105 */
106 public void setUsed() {
107 this.isUsed = true;
108 }
109
110 /**
111 * Return the class that contains the code for this unit, null if not
112 * generated yet
113 *
114 * @return class with compile unit code
115 */
116 public Class<?> getCode() {
117 return clazz;
118 }
119
120 /**
121 * Set class when it exists. Only accessible from compiler
122 * @param clazz class with code for this compile unit
123 */
124 void setCode(final Class<?> clazz) {
125 Objects.requireNonNull(clazz);
126 this.clazz = clazz;
127 // Revisit this - refactor to avoid null-ed out non-final fields
128 // null out emitter
129 this.classEmitter = null;
130 }
131
132 void addFunctionInitializer(final RecompilableScriptFunctionData data, final FunctionNode functionNode) {
133 functions.put(functionNode, data);
134 }
135
136 /**
137 * Returns true if this compile unit is responsible for initializing the specified function data with specified
138 * function node.
139 * @param data the function data to check
140 * @param functionNode the function node to check
141 * @return true if this unit is responsible for initializing the function data with the function node, otherwise
142 * false
143 */
144 public boolean isInitializing(final RecompilableScriptFunctionData data, final FunctionNode functionNode) {
145 return functions.get(functionNode) == data;
146 }
|
105 */
106 public void setUsed() {
107 this.isUsed = true;
108 }
109
110 /**
111 * Return the class that contains the code for this unit, null if not
112 * generated yet
113 *
114 * @return class with compile unit code
115 */
116 public Class<?> getCode() {
117 return clazz;
118 }
119
120 /**
121 * Set class when it exists. Only accessible from compiler
122 * @param clazz class with code for this compile unit
123 */
124 void setCode(final Class<?> clazz) {
125 this.clazz = Objects.requireNonNull(clazz);
126 // Revisit this - refactor to avoid null-ed out non-final fields
127 // null out emitter
128 this.classEmitter = null;
129 }
130
131 void addFunctionInitializer(final RecompilableScriptFunctionData data, final FunctionNode functionNode) {
132 functions.put(functionNode, data);
133 }
134
135 /**
136 * Returns true if this compile unit is responsible for initializing the specified function data with specified
137 * function node.
138 * @param data the function data to check
139 * @param functionNode the function node to check
140 * @return true if this unit is responsible for initializing the function data with the function node, otherwise
141 * false
142 */
143 public boolean isInitializing(final RecompilableScriptFunctionData data, final FunctionNode functionNode) {
144 return functions.get(functionNode) == data;
145 }
|