示例#1
0
 public static Symbol DefineClassSymbol(ClassAst ast)
 {
     return new ClassSymbol(ast.Token.TokenValue)
            {
                Src = ast,
                ScopeName = ast.Token.TokenValue
            };
 }
 private void ClassDo(ClassAst classAst)
 {
     // nothing to do here
 }
 public void Visit(ClassAst ast)
 {
     Exec(ast);
 }
 public static MethodDeclr GetConstructorForClass(ClassAst ast)
 {
     return
         ast.Body.ScopedStatements.Where(i => i is MethodDeclr)
                                  .FirstOrDefault(i => (i as MethodDeclr).MethodName.Token.TokenValue == SpecialNames.CONSTRUCTOR_NAME) as MethodDeclr;
 }
        public void Visit(ClassAst ast)
        {
            if (Global == null)
            {
                Global = Current;
            }

            var classSymbol = ScopeUtil.DefineClassSymbol(ast);

            Current.Define(classSymbol);

            SetScopeType(ScopeType.Class);

            SetScopeSource(classSymbol);

            ScopeTree.CreateScope();

            ast.Body.Visit(this);

            classSymbol.Symbols = ast.Body.CurrentScope.Symbols;

            //redefine the class symbol now with actual symbols
            Current.Define(classSymbol);

            ast.Body.CurrentScope.AllowAllForwardReferences = true;

            ScopeTree.PopScope();

            if (ast.Global == null)
            {
                ast.Global = Global;
            }

            SetScopeType(ScopeType.Global);
        }
 public void Visit(ClassAst ast)
 {
     throw new NotImplementedException();
 }