Beispiel #1
0
        public override void Init(AstContext context, ParseTreeNode parseNode)
        {
            // callConv + type + typeSpec + _("::") + _(".ctor") + _("(") + sigArgs0 + _(")")
            var typeSpecChildren = AstChildren.Empty()
                                   .Add <CallConvAstNode>()
                                   .Add <TypeAstNode>()
                                   .Add <TypeSpecAstNode>()
                                   .Add("::")
                                   .Add(".ctor")
                                   .Add("(")
                                   .Add <SigArgs0AstNode>()
                                   .Add(")");

            if (typeSpecChildren.PopulateWith(parseNode))
            {
                CustomType = new CilCustomType
                {
                    CallConv = typeSpecChildren.Child1.CallConv,
                    Type     = typeSpecChildren.Child2.Type,
                    TypeSpec = typeSpecChildren.Child3.TypeSpec,
                    SigArgs  = typeSpecChildren.Child7.SigArgs
                };

                return;
            }

            throw new NotImplementedException();
        }
Beispiel #2
0
        public override void Init(AstContext context, ParseTreeNode parseNode)
        {
            // _(".custom") + customType + _("=") + _("(")
            var children = AstChildren.Empty()
                           .Add(".custom")
                           .Add <CustomTypeAstNode>()
                           .Add("=")
                           .Add("(");

            if (children.PopulateWith(parseNode))
            {
                CustomType = children.Child2.CustomType;

                return;
            }

            throw new InitAstNodeException(nameof(CustomHeadAstNode));
        }