@Override public boolean hasBody() { ScopedBlockNode sbn = getScopedNode(); return sbn.getChildCount() > 0 || sbn.getContainerType() != IContainerNode.ContainerType.SYNTHESIZED; }
@Override public boolean hasBody() { ScopedBlockNode sbn = getScopedNode(); return sbn.getChildCount() > 0 || sbn.getContainerType() != IContainerNode.ContainerType.SYNTHESIZED; }
@Override public IScopedNode getScopeNode() { IASNode ancestor = getAncestorOfType(FunctionNode.class); if (ancestor != null && ancestor instanceof FunctionNode) { FunctionNode function = (FunctionNode)ancestor; if (function.getScopedNode() != null) return function.getScopedNode(); } // We should never get here, but just in case... if (getParent() != null) return getParent().getContainingScope(); return null; }
@Override public IScopedNode getScopeNode() { IASNode ancestor = getAncestorOfType(FunctionNode.class); if (ancestor != null && ancestor instanceof FunctionNode) { FunctionNode function = (FunctionNode)ancestor; if (function.getScopedNode() != null) return function.getScopedNode(); } // We should never get here, but just in case... if (getParent() != null) return getParent().getContainingScope(); return null; }
public void prologue_anonymousFunction(IASNode iNode) { // TODO: The current scope may not // need an activation if the anonymous // function doesn't access any of the // current scope's locals. currentScope = currentScope.pushFrame(); currentScope.declareAnonymousFunction(); currentScope.setInitialControlFlowRegionNode(((FunctionObjectNode)iNode).getFunctionNode().getScopedNode()); }
public void prologue_anonymousFunction(IASNode iNode) { // TODO: The current scope may not // need an activation if the anonymous // function doesn't access any of the // current scope's locals. currentScope = currentScope.pushFrame(); currentScope.declareAnonymousFunction(); currentScope.setInitialControlFlowRegionNode(((FunctionObjectNode)iNode).getFunctionNode().getScopedNode()); }
public void prologue_functionObject(IASNode iNode) { final FunctionNode innerFunctionNode = ((FunctionObjectNode)iNode).getFunctionNode(); currentScope = currentScope.pushFrame(); currentScope.declareFunctionObject(innerFunctionNode.getName()); currentScope.setInitialControlFlowRegionNode(innerFunctionNode.getScopedNode()); prologue_function(iNode); }
public void prologue_functionObject(IASNode iNode) { final FunctionNode innerFunctionNode = ((FunctionObjectNode)iNode).getFunctionNode(); currentScope = currentScope.pushFrame(); currentScope.declareFunctionObject(innerFunctionNode.getName()); currentScope.setInitialControlFlowRegionNode(innerFunctionNode.getScopedNode()); prologue_function(iNode); }
@Override public void emitFunctionObject(IFunctionObjectNode node) { FunctionNode fnode = node.getFunctionNode(); write(ASEmitterTokens.FUNCTION); emitParameters(fnode.getParametersContainerNode()); emitType(fnode.getTypeNode()); emitFunctionScope(fnode.getScopedNode()); }
@Override public void emitFunctionObject(IFunctionObjectNode node) { startMapping(node); FunctionNode fnode = node.getFunctionNode(); write(ASEmitterTokens.FUNCTION); String name = fnode.getName(); //may have a name, or may be anonymous if(name.length() > 0) { write(ASEmitterTokens.SPACE); write(name); } endMapping(node); emitParameters(fnode.getParametersContainerNode()); emitFunctionScope(fnode.getScopedNode()); }
@Override public void emitLocalNamedFunction(IFunctionNode node) { FunctionNode fnode = (FunctionNode) node; write(ASEmitterTokens.FUNCTION); write(ASEmitterTokens.SPACE); write(fnode.getName()); emitParameters(fnode.getParametersContainerNode()); emitType(fnode.getTypeNode()); emitFunctionScope(fnode.getScopedNode()); }
protected InlineFunctionLexicalScope(LexicalScope enclosingFrame, IASScope containingScope, boolean storeClassBinding, FunctionNode functionNode) { super(enclosingFrame, true); this.containingScope = containingScope; this.inlinedFunctionCallSiteLabel = new Label(); // set the problems and methodBodySemanticChecker, so we don't create // any problems when trying to inline a function this.problems = new ArrayList<ICompilerProblem>(); this.methodBodySemanticChecker = new MethodBodySemanticChecker(this); // these members should be initialized from the containing scope, as they'll be merged back // if the inline is successful this.containingClassBinding = storeClassBinding ? allocateTemp() : null; IScopedNode body = functionNode.getScopedNode(); FunctionDefinition functionDefinition = (FunctionDefinition)functionNode.getDefinition(); setInitialControlFlowRegionNode(body); setLocalASScope(functionDefinition.getContainedScope()); resetDebugInfo(); // Set the current file name - the function body will always start with an OP_debugfile // so we never need emit another one unless the method body spans multiple files setDebugFile(SemanticUtils.getFileName(functionNode)); }
protected InlineFunctionLexicalScope(LexicalScope enclosingFrame, IASScope containingScope, boolean storeClassBinding, FunctionNode functionNode) { super(enclosingFrame, true); this.containingScope = containingScope; this.inlinedFunctionCallSiteLabel = new Label(); // set the problems and methodBodySemanticChecker, so we don't create // any problems when trying to inline a function this.problems = new ArrayList<ICompilerProblem>(); this.methodBodySemanticChecker = new MethodBodySemanticChecker(this); // these members should be initialized from the containing scope, as they'll be merged back // if the inline is successful this.containingClassBinding = storeClassBinding ? allocateTemp() : null; IScopedNode body = functionNode.getScopedNode(); FunctionDefinition functionDefinition = (FunctionDefinition)functionNode.getDefinition(); setInitialControlFlowRegionNode(body); setLocalASScope(functionDefinition.getContainedScope()); resetDebugInfo(); // Set the current file name - the function body will always start with an OP_debugfile // so we never need emit another one unless the method body spans multiple files setDebugFile(SemanticUtils.getFileName(functionNode)); }
@Override public void emitLocalNamedFunction(IFunctionNode node) { startMapping(node); FunctionNode fnode = (FunctionNode)node; write(ASEmitterTokens.FUNCTION); write(ASEmitterTokens.SPACE); write(fnode.getName()); endMapping(node); emitParameters(fnode.getParametersContainerNode()); emitFunctionScope(fnode.getScopedNode()); }
final BlockNode b = f.getScopedNode(); b.setContainerType(IContainerNode.ContainerType.BRACES); skipFunctionBody(f, openT);
final BlockNode b = f.getScopedNode(); b.setContainerType(IContainerNode.ContainerType.BRACES); skipFunctionBody(f, openT);
BlockNode blockNode = f.getScopedNode(); enableSemicolonInsertion();
BlockNode blockNode = f.getScopedNode(); enableSemicolonInsertion();
currentScope.setInitialControlFlowRegionNode(((FunctionObjectNode)iNode).getFunctionNode().getScopedNode()); currentScope.setNeedsActivation();
FunctionNode constructorNode = new FunctionNode(null, constructorNameNode); constructorNode.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_)); ScopedBlockNode constructorContents = constructorNode.getScopedNode();