public Value evaluate(Context cx, VariableDefinitionNode node) { if (node.attrs != null) node.attrs.evaluate(cx, this); if (node.list != null) node.list.evaluate(cx, this); VariableDefinitionNode vdn = node; if (debugging) addPositionMetadata(cx, vdn); if (node.metaData != null) { for (Node it : vdn.list.items) { VariableBindingNode binding = it instanceof VariableBindingNode ? (VariableBindingNode) it : null; if (binding != null) { ReferenceValue ref = binding.ref; Slot slot = null; if (ref != null) slot = ref.getSlot(cx); if (slot != null && slot.getMetadata() == null) { for (Node meta_node : vdn.metaData.items) { if (meta_node instanceof MetaDataNode) addMetadataToSlot(cx, slot, (MetaDataNode) meta_node); } } } } } return null; };
private void addMetadataToSlot(Context cx, Slot slot, MetaDataNode metadata) { if (metadata != null) { if (!(metadata instanceof DocCommentNode)) { // Don't add comments as metadata slot.addMetadata(metadata); int i = isVersionMetadata(cx, metadata); if (i != -1) slot.setVersion((byte) i); } } }
public Value evaluate(Context cx, ClassDefinitionNode node) { if (doing_class) return null; doing_class = true; // inner classes are included multiple times in node->staticinits. Don't double // evaluate them. cx.pushStaticClassScopes(node); if (node.statements != null) node.statements.evaluate(cx, this); // now do the nested classes doing_class = false; { for (ClassDefinitionNode it : node.clsdefs) { it.evaluate(cx, this); } } cx.pushScope(node.iframe); { for (Node init : node.instanceinits) { if (cx.statics.es4_nullability && !init.isDefinition()) node.iframe.setInitOnly(true); init.evaluate(cx, this); if (cx.statics.es4_nullability && !init.isDefinition()) node.iframe.setInitOnly(false); } } cx.popScope(); // iframe cx.popStaticClassScopes(node); ClassDefinitionNode cdn = node; ReferenceValue ref = cdn.ref; Slot classSlot = null; if (ref != null) classSlot = ref.getSlot(cx); if (debugging) { addPositionMetadata(cx, cdn); } if (classSlot != null && classSlot.getMetadata() == null && cdn.metaData != null) for (Node meta_node : cdn.metaData.items) { if (meta_node instanceof MetaDataNode) { addMetadataToSlot(cx, classSlot, (MetaDataNode) meta_node); int i = isVersionMetadata(cx, (MetaDataNode) meta_node); if (i > -1) cdn.version = i; } } return null; }
public Value evaluate(Context cx, FunctionDefinitionNode node) { FunctionDefinitionNode fdn = node; int kind = fdn.fexpr.kind; ReferenceValue ref = fdn.fexpr.ref; Slot func_slot = null; if (ref != null) func_slot = ref.getSlot(cx, kind); if (debugging) addPositionMetadata(cx, fdn); if (func_slot != null && func_slot.getMetadata() == null && fdn.metaData != null) { for (Node meta_node : fdn.metaData.items) { if (meta_node instanceof MetaDataNode) { addMetadataToSlot(cx, func_slot, (MetaDataNode) meta_node); int i = isVersionMetadata(cx, (MetaDataNode) meta_node); if (i > -1) fdn.version = i; } } } return null; };