nashorn/src/jdk/nashorn/internal/codegen/CompileUnit.java
changeset 16523 af8b30edebce
parent 16233 95d3e01c04c3
child 19456 8cc345d620c8
--- a/nashorn/src/jdk/nashorn/internal/codegen/CompileUnit.java	Tue Mar 12 18:12:42 2013 +0530
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CompileUnit.java	Tue Mar 12 15:30:53 2013 +0100
@@ -37,6 +37,8 @@
 
     private long weight;
 
+    private Class<?> clazz;
+
     CompileUnit(final String className, final ClassEmitter classEmitter) {
         this(className, classEmitter, 0L);
     }
@@ -48,6 +50,24 @@
     }
 
     /**
+     * Return the class that contains the code for this unit, null if not
+     * generated yet
+     *
+     * @return class with compile unit code
+     */
+    public Class<?> getCode() {
+        return clazz;
+    }
+
+    /**
+     * Set class when it exists. Only accessible from compiler
+     * @param clazz class with code for this compile unit
+     */
+    void setCode(final Class<?> clazz) {
+        this.clazz = clazz;
+    }
+
+    /**
      * Add weight to this compile unit
      * @param w weight to add
      */