public virtual object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
			throw new global::System.NotImplementedException("LocalVariableDeclaration");
		}
Пример #2
0
		public virtual object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
			Debug.Assert((localVariableDeclaration != null));
			Debug.Assert((localVariableDeclaration.TypeReference != null));
			Debug.Assert((localVariableDeclaration.Variables != null));
			localVariableDeclaration.TypeReference.AcceptVisitor(this, data);
			foreach (VariableDeclaration o in localVariableDeclaration.Variables) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			return null;
		}
Пример #3
0
	void UsingStatement(out Statement statement) {
		Expression expr = null; Statement block; statement = null;
		Expect(226);
		if (Peek(1).kind == Tokens.As) {
			LocalVariableDeclaration resourceAquisition = 
			new LocalVariableDeclaration(Modifiers.None);
			VariableDeclarator(resourceAquisition.Variables);
			while (la.kind == 22) {
				Get();
				VariableDeclarator(resourceAquisition.Variables);
			}
			EndOfStmt();
			Block(out block);
			statement = new UsingStatement(resourceAquisition, block);
		} else if (StartOf(24)) {
			Expr(out expr);
			EndOfStmt();
			Block(out block);
			statement = new UsingStatement(new ExpressionStatement(expr), block);
		} else SynErr(313);
		Expect(113);
		Expect(226);
	}
Пример #4
0
		public virtual object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
			Debug.Assert((localVariableDeclaration != null));
			Debug.Assert((localVariableDeclaration.TypeReference != null));
			Debug.Assert((localVariableDeclaration.Variables != null));
			nodeStack.Push(localVariableDeclaration.TypeReference);
			localVariableDeclaration.TypeReference.AcceptVisitor(this, data);
			localVariableDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
			for (int i = 0; i < localVariableDeclaration.Variables.Count; i++) {
				VariableDeclaration o = localVariableDeclaration.Variables[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (VariableDeclaration)nodeStack.Pop();
				if (o == null)
					localVariableDeclaration.Variables.RemoveAt(i--);
				else
					localVariableDeclaration.Variables[i] = o;
			}
			return null;
		}
Пример #5
0
	void LocalDeclarationStatement(out Statement statement) {
		ModifierList m = new ModifierList();
		LocalVariableDeclaration localVariableDeclaration;
		bool dimfound = false;

		while (la.kind == 88 || la.kind == 105 || la.kind == 204) {
			if (la.kind == 88) {
				Get();
				m.Add(Modifiers.Const, t.Location);
			} else if (la.kind == 204) {
				Get();
				m.Add(Modifiers.Static, t.Location);
			} else {
				Get();
				dimfound = true;
			}
		}
		if(dimfound && (m.Modifier & Modifiers.Const) != 0) {
				Error("Dim is not allowed on constants.");
			}
			
			if(m.isNone && dimfound == false) {
				Error("Const, Dim or Static expected");
			}
			
			localVariableDeclaration = new LocalVariableDeclaration(m.Modifier);
			localVariableDeclaration.StartLocation = t.Location;

		VariableDeclarator(localVariableDeclaration.Variables);
		while (la.kind == 22) {
			Get();
			VariableDeclarator(localVariableDeclaration.Variables);
		}
		statement = localVariableDeclaration;

	}
Пример #6
0
		public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
		{
			for (int i = 0; i < localVariableDeclaration.Variables.Count; ++i) {
				VariableDeclaration varDecl = (VariableDeclaration)localVariableDeclaration.Variables[i];
				
				AddVariable(localVariableDeclaration.GetTypeForVariable(i),
				            varDecl.Name,
				            localVariableDeclaration.StartLocation,
				            CurrentEndLocation,
				            (localVariableDeclaration.Modifier & Modifiers.Const) == Modifiers.Const,
				            false, varDecl.Initializer, null, false);
			}
			return base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
		}
Пример #7
0
		public sealed override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
			this.BeginVisit(localVariableDeclaration);
			object result = this.TrackedVisitLocalVariableDeclaration(localVariableDeclaration, data);
			this.EndVisit(localVariableDeclaration);
			return result;
		}
Пример #8
0
		public virtual object TrackedVisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
			return base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
		}
Пример #9
0
		public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
		{
			CodeVariableDeclarationStatement declStmt = null;
			
			for (int i = 0; i < localVariableDeclaration.Variables.Count; ++i) {
				CodeTypeReference type = ConvType(localVariableDeclaration.GetTypeForVariable(i) ?? new TypeReference("System.Object", true));
				VariableDeclaration var = (VariableDeclaration)localVariableDeclaration.Variables[i];
				if (!var.Initializer.IsNull) {
					declStmt = new CodeVariableDeclarationStatement(type,
					                                                var.Name,
					                                                (CodeExpression)((INode)var.Initializer).AcceptVisitor(this, data));
				} else {
					declStmt = new CodeVariableDeclarationStatement(type,
					                                                var.Name);
				}
				variables.Add(declStmt);
				AddStmt(declStmt);
			}
			
			return declStmt;
		}