public Constructor(ParsingData parser, ConstructorNode constructorNode)
        {
            AccessLevel = constructorNode.AccessLevel;
            BlockNode   = constructorNode.BlockNode;

            Parameters = ParameterDefineNode.GetParameters(parser, constructorNode.Parameters);
        }
Пример #2
0
        public TypeDefineNode(DeltinScriptParser.Type_defineContext context, BuildAstVisitor visitor) : base(new Location(visitor.file, Range.GetRange(context)))
        {
            if (context.STRUCT() != null)
            {
                TypeKind = TypeKind.Struct;
            }
            else if (context.CLASS() != null)
            {
                TypeKind = TypeKind.Class;
            }
            else
            {
                throw new Exception();
            }

            Name = context.name.Text;

            DefinedVars = new InclassDefineNode[context.inclass_define().Length];
            for (int i = 0; i < DefinedVars.Length; i++)
            {
                DefinedVars[i] = (InclassDefineNode)visitor.VisitInclass_define(context.inclass_define(i));
            }

            Constructors = new ConstructorNode[context.constructor().Length];
            for (int i = 0; i < Constructors.Length; i++)
            {
                Constructors[i] = (ConstructorNode)visitor.VisitConstructor(context.constructor(i));
            }

            Methods = new UserMethodNode[context.user_method().Length];
            for (int i = 0; i < Methods.Length; i++)
            {
                Methods[i] = (UserMethodNode)visitor.VisitUser_method(context.user_method(i));
            }
        }