public override void EnterFuncDeclaration(AdvplParser.FuncDeclarationContext ctx) { String name = ctx.identifier().GetText(); int typeTokenType = -1; if (ctx.modifiersFunction() != null) { typeTokenType = ctx.modifiersFunction().start.Type; } Symbol.Type type = CheckSymbols.getType(typeTokenType); FunctionSymbol function = new FunctionSymbol(name, type, currentScope); function.startFuncionPos = ctx.start.StartIndex; function.endFuncionPos = ctx.stop.StopIndex; m_functionsAndMethodsInSource.Add(function); currentScope.define(function); saveScope(ctx, function); currentScope = function; allScopes.Add(currentScope); treesByScopes.Add(currentScope, ctx); }
public override void ExitFuncDeclaration(AdvplParser.FuncDeclarationContext ctx) { currentScope = currentScope.getEnclosingScope(); // pop scope }