Inheritance: ICSharpCode.NRefactory.Ast.Statement
		public sealed override object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
			this.BeginVisit(unsafeStatement);
			object result = this.TrackedVisitUnsafeStatement(unsafeStatement, data);
			this.EndVisit(unsafeStatement);
			return result;
		}
 public override object TrackedVisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
 {
     return null;
 }
		public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
			throw new global::System.NotImplementedException("UnsafeStatement");
		}
		public virtual object TrackedVisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
			return base.VisitUnsafeStatement(unsafeStatement, data);
		}
 public override object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
 {
     base.VisitUnsafeStatement(unsafeStatement, data);
     ReplaceCurrentNode(unsafeStatement.Block);
     return null;
 }
Example #6
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;
		}
		
	}
		public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
			Debug.Assert((unsafeStatement != null));
			Debug.Assert((unsafeStatement.Block != null));
			nodeStack.Push(unsafeStatement.Block);
			unsafeStatement.Block.AcceptVisitor(this, data);
			unsafeStatement.Block = ((Statement)(nodeStack.Pop()));
			return null;
		}
Example #8
0
 public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
     throw CreateException(unsafeStatement);
 }
 public object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
 {
     throw new NotImplementedException ();
 }
Example #10
0
 public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
 {
     Debug.Assert((unsafeStatement != null));
     Debug.Assert((unsafeStatement.Block != null));
     return unsafeStatement.Block.AcceptVisitor(this, data);
 }
 public virtual bool VisitUnsafeStatement(UnsafeStatement unsafeStatement, object d)
 {
     if ((unsafeStatement == null)) {
         return SetFailure();
     }
     if ((d == null)) {
         return SetFailure();
     }
     if ((unsafeStatement.Block == null)) {
         return SetFailure();
     }
     if(unsafeStatement.GetType() != d.GetType()) {return SetFailure();}
     var data = (UnsafeStatement)d;
     if (!IsMatch(unsafeStatement, data)) {
         return SetFailure();
     }
     return unsafeStatement.Block.AcceptVisitor(this, data.Block);
 }
Example #12
0
		public override object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
		{
			return base.VisitUnsafeStatement(unsafeStatement, data);
		}
 private bool IsMatch(UnsafeStatement left, UnsafeStatement data)
 {
     return false;
 }
		public object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
		{
			AddError(unsafeStatement, "UnsafeStatement is not supported.");
			return null;
		}
Example #15
0
	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;
		}
		
	}