/** * generate prologue code for each function body */ protected void doPrologue(WalkContext context) { // perform a lexical write to copy the value stored in the local // associated with each parameter to the lexical name final CAstEntity entity = context.top(); Set<String> exposedNames = entity2ExposedNames.get(entity); if (exposedNames != null) { int i = 0; for (String arg : entity.getArgumentNames()) { if (exposedNames.contains(arg)) { final Scope currentScope = context.currentScope(); Symbol symbol = currentScope.lookup(arg); assert symbol.getDefiningScope() == currentScope; int argVN = symbol.valueNumber(); CAstType type = (entity.getType() instanceof CAstType.Method)? (CAstType)((CAstType.Method)entity.getType()).getArgumentTypes().get(i): topType(); Access A = new Access(arg, context.getEntityName(entity), makeType(type), argVN); context.cfg().addInstruction(new AstLexicalWrite(context.cfg().currentInstruction, A)); } } } }
/** * generate prologue code for each function body */ protected void doPrologue(WalkContext context) { // perform a lexical write to copy the value stored in the local // associated with each parameter to the lexical name final CAstEntity entity = context.top(); Set<String> exposedNames = entity2ExposedNames.get(entity); if (exposedNames != null) { int i = 0; for (String arg : entity.getArgumentNames()) { if (exposedNames.contains(arg)) { final Scope currentScope = context.currentScope(); Symbol symbol = currentScope.lookup(arg); assert symbol.getDefiningScope() == currentScope; int argVN = symbol.valueNumber(); CAstType type = (entity.getType() instanceof CAstType.Method)? (CAstType)((CAstType.Method)entity.getType()).getArgumentTypes().get(i): topType(); Access A = new Access(arg, context.getEntityName(entity), makeType(type), argVN); context.cfg().addInstruction(new AstLexicalWrite(context.cfg().currentInstruction, A)); } } } }