Esempio n. 1
0
 public void AddArgument(VarDeclNode arg)
 {
     Arguments.Add(arg);
 }
Esempio n. 2
0
 public void AddArgument(VarDeclNode arg)
 {
     Arguments.Add(arg);
 }
Esempio n. 3
0
	void ArgDecl(out Node node, ProtoCore.DSASM.AccessModifier access = ProtoCore.DSASM.AccessModifier.kPublic) {
		IdentifierNode tNode = null; 
		VarDeclNode varDeclNode = new VarDeclNode(); 
		varDeclNode.memregion = ProtoCore.DSASM.MemoryRegion.kMemStack;
		varDeclNode.access = access;
		
		if (IsArrayAccess()) {
			arrayIdent(out node);
			tNode = node as IdentifierNode; 
			varDeclNode.NameNode = tNode;
			
		} else if (la.kind == 1) {
			Get();
			tNode = new IdentifierNode() 
			{ 
			   Value = t.val, 
			   Name = t.val, 
			   type = (int)ProtoCore.PrimitiveType.kTypeVar, 
			   datatype = ProtoCore.PrimitiveType.kTypeVar 
			}; 
			varDeclNode.NameNode = tNode;
			
		} else SynErr(71);
		ProtoCore.Type argtype = new ProtoCore.Type(); argtype.Name = "var"; argtype.rank = 0; argtype.UID = 0; 
		if (la.kind == 36) {
			Get();
			Expect(1);
			argtype.Name = t.val; 
			if (la.kind == 11) {
				argtype.IsIndexable = true; 
				Get();
				Expect(12);
				argtype.rank = 1; 
				if (la.kind == 11 || la.kind == 21 || la.kind == 35) {
					if (la.kind == 21) {
						Get();
						Expect(11);
						Expect(12);
						argtype.rank = ProtoCore.DSASM.Constants.nDimensionArrayRank; 
					} else {
						while (la.kind == 11) {
							Get();
							Expect(12);
							argtype.rank++; 
						}
					}
				}
			}
		}
		varDeclNode.ArgumentType = argtype; 
		if (la.kind == 35) {
			Get();
			Node rhsNode; 
			Expression(out rhsNode);
			BinaryExpressionNode bNode = new BinaryExpressionNode();
			bNode.LeftNode = tNode;
			bNode.RightNode = rhsNode;
			bNode.Optr = Operator.assign;
			varDeclNode.NameNode = bNode;		
			
		}
		node = varDeclNode; 
	}