public override bool Visit(AstClassBody node)
 {
     return true;
 }
Exemple #2
0
 public AstClass(AstIdExpression name, AstClassBody body)
 {
     Name = name;
     Body = body;
 }
        public override bool Visit(AstClassBody node)
        {
            foreach (AstClassField classField in node.ClassFields)
            {
                classField.Accept(this);
            }
            foreach (AstClassMethod classMethod in node.ClassMethods)
            {
                classMethod.Accept(this);
                table.UseParentScope();
            }

            return false;
        }
        // #CLASS_BODY BLOCK_START #CLASS_DECLARATIONS BLOCK_END
        private void ConstructClassBody()
        {
            var fieldsList = new List<AstClassField>();
            var methodsList = new List<AstClassMethod>();

            AstNode curr = nodes.Peek() as AstNode;
            while (curr is AstClassField || curr is AstClassMethod)
            {
                if (curr is AstClassField)
                {
                    fieldsList.Insert(0, curr as AstClassField);
                }
                else
                {
                    methodsList.Insert(0, curr as AstClassMethod);
                }
                nodes.Pop();
                curr = nodes.Peek() as AstNode;
            }

            var classBody = new AstClassBody(fieldsList, methodsList);
            PushNode(classBody);
        }
 public abstract bool Visit(AstClassBody node);