Inheritance: ICSharpCode.NRefactory.Ast.StatementWithEmbeddedStatement
		public virtual object TrackedVisitFixedStatement(FixedStatement fixedStatement, object data) {
			return base.VisitFixedStatement(fixedStatement, data);
		}
		public override object VisitFixedStatement(FixedStatement fixedStatement, object data)
		{
			// uses LocalVariableDeclaration, we just have to put the end location on the stack
			if (fixedStatement.EmbeddedStatement.EndLocation.IsEmpty) {
				return base.VisitFixedStatement(fixedStatement, data);
			} else {
				endLocationStack.Push(fixedStatement.EmbeddedStatement.EndLocation);
				base.VisitFixedStatement(fixedStatement, data);
				endLocationStack.Pop();
				return null;
			}
		}
示例#3
0
		public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data) {
			throw new global::System.NotImplementedException("FixedStatement");
		}
示例#4
0
 public override object VisitFixedStatement(FixedStatement fixedStatement, object data)
 {
     throw new NotSupportedException("CodeDom does not support Fixed Statement");
 }
示例#5
0
	void EmbeddedStatement(
#line  1555 "cs.ATG" 
out Statement statement) {

#line  1557 "cs.ATG" 
		TypeReference type = null;
		Expression expr = null;
		Statement embeddedStatement = null;
		BlockStatement block = null;
		statement = null;
		

#line  1564 "cs.ATG" 
		Location startLocation = la.Location; 
		if (la.kind == 16) {
			Block(
#line  1566 "cs.ATG" 
out block);

#line  1566 "cs.ATG" 
			statement = block; 
		} else if (la.kind == 11) {
			lexer.NextToken();

#line  1569 "cs.ATG" 
			statement = new EmptyStatement(); 
		} else if (
#line  1572 "cs.ATG" 
UnCheckedAndLBrace()) {

#line  1572 "cs.ATG" 
			bool isChecked = true; 
			if (la.kind == 58) {
				lexer.NextToken();
			} else if (la.kind == 118) {
				lexer.NextToken();

#line  1573 "cs.ATG" 
				isChecked = false;
			} else SynErr(198);
			Block(
#line  1574 "cs.ATG" 
out block);

#line  1574 "cs.ATG" 
			statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block); 
		} else if (la.kind == 79) {
			IfStatement(
#line  1577 "cs.ATG" 
out statement);
		} else if (la.kind == 110) {
			lexer.NextToken();

#line  1579 "cs.ATG" 
			List<SwitchSection> switchSections = new List<SwitchSection>(); 
			Expect(20);
			Expr(
#line  1580 "cs.ATG" 
out expr);
			Expect(21);
			Expect(16);
			SwitchSections(
#line  1581 "cs.ATG" 
switchSections);
			Expect(17);

#line  1583 "cs.ATG" 
			statement = new SwitchStatement(expr, switchSections); 
		} else if (la.kind == 125) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1586 "cs.ATG" 
out expr);
			Expect(21);
			EmbeddedStatement(
#line  1587 "cs.ATG" 
out embeddedStatement);

#line  1588 "cs.ATG" 
			statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);
		} else if (la.kind == 65) {
			lexer.NextToken();
			EmbeddedStatement(
#line  1590 "cs.ATG" 
out embeddedStatement);
			Expect(125);
			Expect(20);
			Expr(
#line  1591 "cs.ATG" 
out expr);
			Expect(21);
			Expect(11);

#line  1592 "cs.ATG" 
			statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End); 
		} else if (la.kind == 76) {
			lexer.NextToken();

#line  1594 "cs.ATG" 
			List<Statement> initializer = null; List<Statement> iterator = null; 
			Expect(20);
			if (StartOf(6)) {
				ForInitializer(
#line  1595 "cs.ATG" 
out initializer);
			}
			Expect(11);
			if (StartOf(6)) {
				Expr(
#line  1596 "cs.ATG" 
out expr);
			}
			Expect(11);
			if (StartOf(6)) {
				ForIterator(
#line  1597 "cs.ATG" 
out iterator);
			}
			Expect(21);
			EmbeddedStatement(
#line  1598 "cs.ATG" 
out embeddedStatement);

#line  1599 "cs.ATG" 
			statement = new ForStatement(initializer, expr, iterator, embeddedStatement); 
		} else if (la.kind == 77) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1601 "cs.ATG" 
out type);
			Identifier();

#line  1601 "cs.ATG" 
			string varName = t.val; 
			Expect(81);
			Expr(
#line  1602 "cs.ATG" 
out expr);
			Expect(21);
			EmbeddedStatement(
#line  1603 "cs.ATG" 
out embeddedStatement);

#line  1604 "cs.ATG" 
			statement = new ForeachStatement(type, varName , expr, embeddedStatement); 
		} else if (la.kind == 53) {
			lexer.NextToken();
			Expect(11);

#line  1607 "cs.ATG" 
			statement = new BreakStatement(); 
		} else if (la.kind == 61) {
			lexer.NextToken();
			Expect(11);

#line  1608 "cs.ATG" 
			statement = new ContinueStatement(); 
		} else if (la.kind == 78) {
			GotoStatement(
#line  1609 "cs.ATG" 
out statement);
		} else if (
#line  1611 "cs.ATG" 
IsYieldStatement()) {
			Expect(132);
			if (la.kind == 101) {
				lexer.NextToken();
				Expr(
#line  1612 "cs.ATG" 
out expr);

#line  1612 "cs.ATG" 
				statement = new YieldStatement(new ReturnStatement(expr)); 
			} else if (la.kind == 53) {
				lexer.NextToken();

#line  1613 "cs.ATG" 
				statement = new YieldStatement(new BreakStatement()); 
			} else SynErr(199);
			Expect(11);
		} else if (la.kind == 101) {
			lexer.NextToken();
			if (StartOf(6)) {
				Expr(
#line  1616 "cs.ATG" 
out expr);
			}
			Expect(11);

#line  1616 "cs.ATG" 
			statement = new ReturnStatement(expr); 
		} else if (la.kind == 112) {
			lexer.NextToken();
			if (StartOf(6)) {
				Expr(
#line  1617 "cs.ATG" 
out expr);
			}
			Expect(11);

#line  1617 "cs.ATG" 
			statement = new ThrowStatement(expr); 
		} else if (StartOf(6)) {
			StatementExpr(
#line  1620 "cs.ATG" 
out statement);
			while (!(la.kind == 0 || la.kind == 11)) {SynErr(200); lexer.NextToken(); }
			Expect(11);
		} else if (la.kind == 114) {
			TryStatement(
#line  1623 "cs.ATG" 
out statement);
		} else if (la.kind == 86) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1626 "cs.ATG" 
out expr);
			Expect(21);
			EmbeddedStatement(
#line  1627 "cs.ATG" 
out embeddedStatement);

#line  1627 "cs.ATG" 
			statement = new LockStatement(expr, embeddedStatement); 
		} else if (la.kind == 121) {

#line  1630 "cs.ATG" 
			Statement resourceAcquisitionStmt = null; 
			lexer.NextToken();
			Expect(20);
			ResourceAcquisition(
#line  1632 "cs.ATG" 
out resourceAcquisitionStmt);
			Expect(21);
			EmbeddedStatement(
#line  1633 "cs.ATG" 
out embeddedStatement);

#line  1633 "cs.ATG" 
			statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement); 
		} else if (la.kind == 119) {
			lexer.NextToken();
			Block(
#line  1636 "cs.ATG" 
out block);

#line  1636 "cs.ATG" 
			statement = new UnsafeStatement(block); 
		} else if (la.kind == 74) {

#line  1638 "cs.ATG" 
			Statement pointerDeclarationStmt = null; 
			lexer.NextToken();
			Expect(20);
			ResourceAcquisition(
#line  1640 "cs.ATG" 
out pointerDeclarationStmt);
			Expect(21);
			EmbeddedStatement(
#line  1641 "cs.ATG" 
out embeddedStatement);

#line  1641 "cs.ATG" 
			statement = new FixedStatement(pointerDeclarationStmt, embeddedStatement); 
		} else SynErr(201);

#line  1643 "cs.ATG" 
		if (statement != null) {
		statement.StartLocation = startLocation;
		statement.EndLocation = t.EndLocation;
		}
		
	}
示例#6
0
 public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data)
 {
     Debug.Assert((fixedStatement != null));
     Debug.Assert((fixedStatement.TypeReference != null));
     Debug.Assert((fixedStatement.PointerDeclarators != null));
     Debug.Assert((fixedStatement.EmbeddedStatement != null));
     nodeStack.Push(fixedStatement.TypeReference);
     fixedStatement.TypeReference.AcceptVisitor(this, data);
     fixedStatement.TypeReference = ((TypeReference)(nodeStack.Pop()));
     for (int i = 0; i < fixedStatement.PointerDeclarators.Count; i++) {
         VariableDeclaration o = fixedStatement.PointerDeclarators[i];
         Debug.Assert(o != null);
         nodeStack.Push(o);
         o.AcceptVisitor(this, data);
         o = (VariableDeclaration)nodeStack.Pop();
         if (o == null)
             fixedStatement.PointerDeclarators.RemoveAt(i--);
         else
             fixedStatement.PointerDeclarators[i] = o;
     }
     nodeStack.Push(fixedStatement.EmbeddedStatement);
     fixedStatement.EmbeddedStatement.AcceptVisitor(this, data);
     fixedStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
     return null;
 }
示例#7
0
 public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data) {
     throw CreateException(fixedStatement); ;
 }
 public object VisitFixedStatement(FixedStatement fixedStatement, object data)
 {
     throw new NotImplementedException ();
 }
示例#9
0
 public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data)
 {
     Debug.Assert((fixedStatement != null));
     Debug.Assert((fixedStatement.PointerDeclaration != null));
     Debug.Assert((fixedStatement.EmbeddedStatement != null));
     fixedStatement.PointerDeclaration.AcceptVisitor(this, data);
     return fixedStatement.EmbeddedStatement.AcceptVisitor(this, data);
 }
示例#10
0
		public override object VisitFixedStatement(FixedStatement fixedStatement, object data)
		{
			return base.VisitFixedStatement(fixedStatement, data);
		}
 public virtual bool VisitFixedStatement(FixedStatement fixedStatement, object d)
 {
     if ((fixedStatement == null)) {
         return SetFailure();
     }
     if ((d == null)) {
         return SetFailure();
     }
     if ((fixedStatement.PointerDeclaration == null)) {
         return SetFailure();
     }
     if ((fixedStatement.EmbeddedStatement == null)) {
         return SetFailure();
     }
     if(fixedStatement.GetType() != d.GetType()) {return SetFailure();}
     var data = (FixedStatement)d;
     if (!IsMatch(fixedStatement, data)) {
         return SetFailure();
     }
     fixedStatement.PointerDeclaration.AcceptVisitor(this, data.PointerDeclaration);
     return fixedStatement.EmbeddedStatement.AcceptVisitor(this, data.EmbeddedStatement);
 }
		public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data) {
			Debug.Assert((fixedStatement != null));
			Debug.Assert((fixedStatement.TypeReference != null));
			Debug.Assert((fixedStatement.PointerDeclarators != null));
			Debug.Assert((fixedStatement.EmbeddedStatement != null));
			fixedStatement.TypeReference.AcceptVisitor(this, data);
			foreach (VariableDeclaration o in fixedStatement.PointerDeclarators) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			return fixedStatement.EmbeddedStatement.AcceptVisitor(this, data);
		}
 private bool IsMatch(FixedStatement left, FixedStatement right)
 {
     return false;
 }
		public object VisitFixedStatement(FixedStatement fixedStatement, object data)
		{
			AddError(fixedStatement, "FixedStatement is not supported.");
			return null;
		}
		public sealed override object VisitFixedStatement(FixedStatement fixedStatement, object data) {
			this.BeginVisit(fixedStatement);
			object result = this.TrackedVisitFixedStatement(fixedStatement, data);
			this.EndVisit(fixedStatement);
			return result;
		}
		public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data) {
			Debug.Assert((fixedStatement != null));
			Debug.Assert((fixedStatement.PointerDeclaration != null));
			Debug.Assert((fixedStatement.EmbeddedStatement != null));
			nodeStack.Push(fixedStatement.PointerDeclaration);
			fixedStatement.PointerDeclaration.AcceptVisitor(this, data);
			fixedStatement.PointerDeclaration = ((Statement)(nodeStack.Pop()));
			nodeStack.Push(fixedStatement.EmbeddedStatement);
			fixedStatement.EmbeddedStatement.AcceptVisitor(this, data);
			fixedStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
			return null;
		}
 public override object TrackedVisitFixedStatement(FixedStatement fixedStatement, object data)
 {
     Console.WriteLine("VisitFixedStatement");
     return null;
 }
示例#18
0
文件: Parser.cs 项目: almazik/ILSpy
	void EmbeddedStatement(
#line  1473 "cs.ATG" 
out Statement statement) {

#line  1475 "cs.ATG" 
		TypeReference type = null;
		Expression expr = null;
		Statement embeddedStatement = null;
		statement = null;
		

#line  1481 "cs.ATG" 
		Location startLocation = la.Location; 
		if (la.kind == 16) {
			Block(
#line  1483 "cs.ATG" 
out statement);
		} else if (la.kind == 11) {
			lexer.NextToken();

#line  1486 "cs.ATG" 
			statement = new EmptyStatement(); 
		} else if (
#line  1489 "cs.ATG" 
UnCheckedAndLBrace()) {

#line  1489 "cs.ATG" 
			Statement block; bool isChecked = true; 
			if (la.kind == 58) {
				lexer.NextToken();
			} else if (la.kind == 118) {
				lexer.NextToken();

#line  1490 "cs.ATG" 
				isChecked = false;
			} else SynErr(196);
			Block(
#line  1491 "cs.ATG" 
out block);

#line  1491 "cs.ATG" 
			statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block); 
		} else if (la.kind == 79) {
			IfStatement(
#line  1494 "cs.ATG" 
out statement);
		} else if (la.kind == 110) {
			lexer.NextToken();

#line  1496 "cs.ATG" 
			List<SwitchSection> switchSections = new List<SwitchSection>(); 
			Expect(20);
			Expr(
#line  1497 "cs.ATG" 
out expr);
			Expect(21);
			Expect(16);
			SwitchSections(
#line  1498 "cs.ATG" 
switchSections);
			Expect(17);

#line  1499 "cs.ATG" 
			statement = new SwitchStatement(expr, switchSections); 
		} else if (la.kind == 125) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1502 "cs.ATG" 
out expr);
			Expect(21);
			EmbeddedStatement(
#line  1503 "cs.ATG" 
out embeddedStatement);

#line  1504 "cs.ATG" 
			statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);
		} else if (la.kind == 65) {
			lexer.NextToken();
			EmbeddedStatement(
#line  1506 "cs.ATG" 
out embeddedStatement);
			Expect(125);
			Expect(20);
			Expr(
#line  1507 "cs.ATG" 
out expr);
			Expect(21);
			Expect(11);

#line  1508 "cs.ATG" 
			statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End); 
		} else if (la.kind == 76) {
			lexer.NextToken();

#line  1510 "cs.ATG" 
			List<Statement> initializer = null; List<Statement> iterator = null; 
			Expect(20);
			if (StartOf(6)) {
				ForInitializer(
#line  1511 "cs.ATG" 
out initializer);
			}
			Expect(11);
			if (StartOf(6)) {
				Expr(
#line  1512 "cs.ATG" 
out expr);
			}
			Expect(11);
			if (StartOf(6)) {
				ForIterator(
#line  1513 "cs.ATG" 
out iterator);
			}
			Expect(21);
			EmbeddedStatement(
#line  1514 "cs.ATG" 
out embeddedStatement);

#line  1514 "cs.ATG" 
			statement = new ForStatement(initializer, expr, iterator, embeddedStatement); 
		} else if (la.kind == 77) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1516 "cs.ATG" 
out type);
			Identifier();

#line  1516 "cs.ATG" 
			string varName = t.val; 
			Expect(81);
			Expr(
#line  1517 "cs.ATG" 
out expr);
			Expect(21);
			EmbeddedStatement(
#line  1518 "cs.ATG" 
out embeddedStatement);

#line  1519 "cs.ATG" 
			statement = new ForeachStatement(type, varName , expr, embeddedStatement); 
		} else if (la.kind == 53) {
			lexer.NextToken();
			Expect(11);

#line  1522 "cs.ATG" 
			statement = new BreakStatement(); 
		} else if (la.kind == 61) {
			lexer.NextToken();
			Expect(11);

#line  1523 "cs.ATG" 
			statement = new ContinueStatement(); 
		} else if (la.kind == 78) {
			GotoStatement(
#line  1524 "cs.ATG" 
out statement);
		} else if (
#line  1526 "cs.ATG" 
IsYieldStatement()) {
			Expect(132);
			if (la.kind == 101) {
				lexer.NextToken();
				Expr(
#line  1527 "cs.ATG" 
out expr);

#line  1527 "cs.ATG" 
				statement = new YieldStatement(new ReturnStatement(expr)); 
			} else if (la.kind == 53) {
				lexer.NextToken();

#line  1528 "cs.ATG" 
				statement = new YieldStatement(new BreakStatement()); 
			} else SynErr(197);
			Expect(11);
		} else if (la.kind == 101) {
			lexer.NextToken();
			if (StartOf(6)) {
				Expr(
#line  1531 "cs.ATG" 
out expr);
			}
			Expect(11);

#line  1531 "cs.ATG" 
			statement = new ReturnStatement(expr); 
		} else if (la.kind == 112) {
			lexer.NextToken();
			if (StartOf(6)) {
				Expr(
#line  1532 "cs.ATG" 
out expr);
			}
			Expect(11);

#line  1532 "cs.ATG" 
			statement = new ThrowStatement(expr); 
		} else if (StartOf(6)) {
			StatementExpr(
#line  1535 "cs.ATG" 
out statement);
			while (!(la.kind == 0 || la.kind == 11)) {SynErr(198); lexer.NextToken(); }
			Expect(11);
		} else if (la.kind == 114) {
			TryStatement(
#line  1538 "cs.ATG" 
out statement);
		} else if (la.kind == 86) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1541 "cs.ATG" 
out expr);
			Expect(21);
			EmbeddedStatement(
#line  1542 "cs.ATG" 
out embeddedStatement);

#line  1542 "cs.ATG" 
			statement = new LockStatement(expr, embeddedStatement); 
		} else if (la.kind == 121) {

#line  1545 "cs.ATG" 
			Statement resourceAcquisitionStmt = null; 
			lexer.NextToken();
			Expect(20);
			ResourceAcquisition(
#line  1547 "cs.ATG" 
out resourceAcquisitionStmt);
			Expect(21);
			EmbeddedStatement(
#line  1548 "cs.ATG" 
out embeddedStatement);

#line  1548 "cs.ATG" 
			statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement); 
		} else if (la.kind == 119) {
			lexer.NextToken();
			Block(
#line  1551 "cs.ATG" 
out embeddedStatement);

#line  1551 "cs.ATG" 
			statement = new UnsafeStatement(embeddedStatement); 
		} else if (la.kind == 74) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1554 "cs.ATG" 
out type);

#line  1554 "cs.ATG" 
			if (type == null || type.PointerNestingLevel == 0) Error("can only fix pointer types");
			List<VariableDeclaration> pointerDeclarators = new List<VariableDeclaration>(1);
			
			Identifier();

#line  1557 "cs.ATG" 
			string identifier = t.val; 
			Expect(3);
			Expr(
#line  1558 "cs.ATG" 
out expr);

#line  1558 "cs.ATG" 
			pointerDeclarators.Add(new VariableDeclaration(identifier, expr)); 
			while (la.kind == 14) {
				lexer.NextToken();
				Identifier();

#line  1560 "cs.ATG" 
				identifier = t.val; 
				Expect(3);
				Expr(
#line  1561 "cs.ATG" 
out expr);

#line  1561 "cs.ATG" 
				pointerDeclarators.Add(new VariableDeclaration(identifier, expr)); 
			}
			Expect(21);
			EmbeddedStatement(
#line  1563 "cs.ATG" 
out embeddedStatement);

#line  1563 "cs.ATG" 
			statement = new FixedStatement(type, pointerDeclarators, embeddedStatement); 
		} else SynErr(199);

#line  1565 "cs.ATG" 
		if (statement != null) {
		statement.StartLocation = startLocation;
		statement.EndLocation = t.EndLocation;
		}
		
	}