コード例 #1
0
        public Void VisitFunctionStmt(Stmt.Function stmt)
        {
            Declare(stmt.name);
            Define(stmt.name);

            ResolveFunction(stmt, FunctionType.FUNCTION);
            return(null);
        }
コード例 #2
0
ファイル: Interpreter.cs プロジェクト: figo711/elizScript
        public Void VisitFunctionStmt(Stmt.Function stmt)
        {
            ElizFunction function = new ElizFunction(stmt, environment, false);

            environment.Define(stmt.name.Lexeme, function);

            return(null);
        }
コード例 #3
0
        void ResolveFunction(Stmt.Function function, FunctionType type)
        {
            FunctionType enclosingFunction = currentFunction;

            currentFunction = type;

            BeginScope();

            foreach (Token param in function.@params)
            {
                Declare(param);
                Define(param);
            }

            Resolve(function.body);
            EndScope();

            currentFunction = enclosingFunction;
        }