diff graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JDTCompiler.java @ 7502:6343a09b2ec1

Codegen operation generation is inferred from the node type hierarchy.
author Christian Humer <christian.humer@gmail.com>
date Fri, 18 Jan 2013 13:28:12 +0100
parents a748e4d44694
children 5e3d1a68664e
line wrap: on
line diff
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JDTCompiler.java	Thu Jan 17 17:21:16 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JDTCompiler.java	Fri Jan 18 13:28:12 2013 +0100
@@ -31,7 +31,7 @@
 
     public static boolean isValidElement(Element currentElement) {
         try {
-            Class<?> elementClass = Class.forName("org.eclipse.jdt.internal.compiler.apt.model.ElementImpl");
+            Class< ? > elementClass = Class.forName("org.eclipse.jdt.internal.compiler.apt.model.ElementImpl");
             return elementClass.isAssignableFrom(currentElement.getClass());
         } catch (ClassNotFoundException e) {
             return false;
@@ -48,10 +48,9 @@
             }
 
             /*
-            AbstractMethodDeclaration decl = ((MethodBinding)(((ElementImpl)method)._binding)).sourceMethod();
-            int bodyStart = decl.bodyStart;
-            int bodyEnd = decl.bodyEnd;
-            */
+             * AbstractMethodDeclaration decl = ((MethodBinding)(((ElementImpl)method)._binding)).sourceMethod(); int
+             * bodyStart = decl.bodyStart; int bodyEnd = decl.bodyEnd;
+             */
             Object decl = method(field(method, "_binding"), "sourceMethod");
             int bodyStart = (int) field(decl, "bodyStart");
             int bodyEnd = (int) field(decl, "bodyEnd");
@@ -66,22 +65,19 @@
         }
     }
 
-
     private static char[] getSource(Element element) throws Exception {
         /*
-        Binding binding = ((ElementImpl)element)._binding;
-        char[] source = null;
-        if (binding instanceof MethodBinding) {
-            source = ((MethodBinding) binding).sourceMethod().compilationResult.getCompilationUnit().getContents();
-        } else if (binding instanceof SourceTypeBinding) {
-            source = ((SourceTypeBinding)binding).scope.referenceContext.compilationResult.compilationUnit.getContents();
-        }
-        return source;
-        */
+         * Binding binding = ((ElementImpl)element)._binding; char[] source = null; if (binding instanceof
+         * MethodBinding) { source = ((MethodBinding)
+         * binding).sourceMethod().compilationResult.getCompilationUnit().getContents(); } else if (binding instanceof
+         * SourceTypeBinding) { source =
+         * ((SourceTypeBinding)binding).scope.referenceContext.compilationResult.compilationUnit.getContents(); } return
+         * source;
+         */
 
         Object binding = field(element, "_binding");
-        Class<?> methodBindingClass = Class.forName("org.eclipse.jdt.internal.compiler.lookup.MethodBinding");
-        Class<?> referenceBindingClass = Class.forName("org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding");
+        Class< ? > methodBindingClass = Class.forName("org.eclipse.jdt.internal.compiler.lookup.MethodBinding");
+        Class< ? > referenceBindingClass = Class.forName("org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding");
 
         char[] source = null;
         if (methodBindingClass.isAssignableFrom(binding.getClass())) {
@@ -96,7 +92,6 @@
         return source;
     }
 
-
     @Override
     public String getHeaderComment(ProcessingEnvironment env, Element type) {
         try {