Пример #1
0
 public FunctionNode(LeafParser.Function_declContext ctx)
 {
     Line        = ctx.Start.Line;
     _returnType = TypeNode.Create(ctx.type());
     Parameters  = ctx.parameter_def().ArraySelect(p
                                                   => new ParameterNode(p.Id().GetText(), TypeNode.Create(p.type())));
 }
Пример #2
0
		CreateNestedTypeDefCommand(TypeNode ownerType, TypeDefOptions options) {
			this.ownerType = ownerType;

			var modNode = ownerType.GetModuleNode();
			Debug.Assert(modNode != null);
			if (modNode == null)
				throw new InvalidOperationException();
			nestedType = ownerType.Create(options.CreateTypeDef(modNode.Document.ModuleDef));
		}
Пример #3
0
 public DeclarationNode(LeafParser.Var_def_tContext ctx)
 {
     Line    = ctx.Start.Line;
     _name   = ctx.Id().GetText();
     Mutable = ctx.Var() != null;
     Type    = TypeNode.Create(ctx.type(0));
     if (ctx.type(1) != null)
     {
         Allocator = TypeNode.Create(ctx.type(1));
     }
 }
Пример #4
0
        static TypeNode GetOrCreateNestedTypeTreeNode(TypeNode typeNode, TypeDef nestedType)
        {
            Debug.Assert(nestedType != null && nestedType.DeclaringType == typeNode.TypeDef);
            typeNode.TreeNode.EnsureChildrenLoaded();
            var childTypeNode = typeNode.TreeNode.DataChildren.OfType <TypeNode>().FirstOrDefault(a => a.TypeDef == nestedType);

            if (childTypeNode != null)
            {
                return(childTypeNode);
            }
            childTypeNode = typeNode.Create(nestedType);
            typeNode.TreeNode.AddChild(childTypeNode.TreeNode);
            return(childTypeNode);
        }
Пример #5
0
 public DeclarationNode(LeafParser.Var_def_vContext ctx)
 {
     Line      = ctx.Start.Line;
     _name     = ctx.Id().GetText();
     Mutable   = ctx.Var() != null;
     Reference = ctx.Ref() != null;
     Value     = ValueNode.Create(ctx.value());
     if (ctx.type(0) != null)
     {
         Type = TypeNode.Create(ctx.type(0));
     }
     if (ctx.type(1) != null)
     {
         Allocator = TypeNode.Create(ctx.type(1));
     }
 }
Пример #6
0
 public CastNode(LeafParser.ValueContext v, LeafParser.TypeContext t)
 {
     Line  = v.Start.Line;
     Value = Create(v);
     Type  = TypeNode.Create(t);
 }
Пример #7
0
 CreateFieldDefCommand(TypeNode ownerNode, FieldDefOptions options)
 {
     this.ownerNode = ownerNode;
     this.fieldNode = ownerNode.Create(options.CreateFieldDef(ownerNode.TypeDef.Module));
 }
Пример #8
0
 CreateEventDefCommand(TypeNode ownerNode, EventDefOptions options)
 {
     this.ownerNode = ownerNode;
     eventNode      = ownerNode.Create(options.CreateEventDef(ownerNode.TypeDef.Module));
 }
Пример #9
0
		CreateEventDefCommand(TypeNode ownerNode, EventDefOptions options) {
			this.ownerNode = ownerNode;
			eventNode = ownerNode.Create(options.CreateEventDef(ownerNode.TypeDef.Module));
		}
Пример #10
0
 CreatePropertyDefCommand(TypeNode ownerNode, PropertyDefOptions options)
 {
     this.ownerNode = ownerNode;
     this.propNode  = ownerNode.Create(options.CreatePropertyDef(ownerNode.TypeDef.Module));
 }
Пример #11
0
		CreateMethodDefCommand(TypeNode ownerNode, MethodDefOptions options) {
			this.ownerNode = ownerNode;
			methodNode = ownerNode.Create(options.CreateMethodDef(ownerNode.TypeDef.Module));
		}
Пример #12
0
 CreateMethodDefCommand(TypeNode ownerNode, MethodDefOptions options)
 {
     this.ownerNode = ownerNode;
     methodNode     = ownerNode.Create(options.CreateMethodDef(ownerNode.TypeDef.Module));
 }
Пример #13
0
		CreateFieldDefCommand(TypeNode ownerNode, FieldDefOptions options) {
			this.ownerNode = ownerNode;
			fieldNode = ownerNode.Create(options.CreateFieldDef(ownerNode.TypeDef.Module));
		}
Пример #14
0
		static TypeNode GetOrCreateNestedTypeTreeNode(TypeNode typeNode, TypeDef nestedType) {
			Debug.Assert(nestedType != null && nestedType.DeclaringType == typeNode.TypeDef);
			typeNode.TreeNode.EnsureChildrenLoaded();
			var childTypeNode = typeNode.TreeNode.DataChildren.OfType<TypeNode>().FirstOrDefault(a => a.TypeDef == nestedType);
			if (childTypeNode != null)
				return childTypeNode;
			childTypeNode = typeNode.Create(nestedType);
			typeNode.TreeNode.AddChild(childTypeNode.TreeNode);
			return childTypeNode;
		}