Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public override void ExitFuncDeclaration(AdvplParser.FuncDeclarationContext ctx)
 {
     currentScope = currentScope.getEnclosingScope(); // pop scope
 }