Ejemplo n.º 1
0
		public override object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data)
		{
			if (tryCatchStatement == null) {
				return data;
			}
			if (tryCatchStatement.StatementBlock != null) {
				tryCatchStatement.StatementBlock.AcceptVisitor(this, data);
			}
			if (tryCatchStatement.CatchClauses != null) {
				foreach (CatchClause catchClause in tryCatchStatement.CatchClauses) {
					if (catchClause != null) {
						if (catchClause.TypeReference != null && catchClause.VariableName != null) {
							AddVariable(catchClause.TypeReference,
							            catchClause.VariableName,
							            catchClause.StartLocation,
							            catchClause.StatementBlock.EndLocation,
							            false, false, null, null, false, catchClause.StartLocation);
						}
						catchClause.StatementBlock.AcceptVisitor(this, data);
					}
				}
			}
			if (tryCatchStatement.FinallyBlock != null) {
				return tryCatchStatement.FinallyBlock.AcceptVisitor(this, data);
			}
			return data;
		}
Ejemplo n.º 2
0
		public virtual object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
			Debug.Assert((tryCatchStatement != null));
			Debug.Assert((tryCatchStatement.StatementBlock != null));
			Debug.Assert((tryCatchStatement.CatchClauses != null));
			Debug.Assert((tryCatchStatement.FinallyBlock != null));
			tryCatchStatement.StatementBlock.AcceptVisitor(this, data);
			foreach (CatchClause o in tryCatchStatement.CatchClauses) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			return tryCatchStatement.FinallyBlock.AcceptVisitor(this, data);
		}
		public sealed override object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
			this.BeginVisit(tryCatchStatement);
			object result = this.TrackedVisitTryCatchStatement(tryCatchStatement, data);
			this.EndVisit(tryCatchStatement);
			return result;
		}
Ejemplo n.º 4
0
	void TryStatement(
#line  1721 "Frames/cs.ATG" 
out Statement tryStatement) {

#line  1723 "Frames/cs.ATG" 
		Statement blockStmt = null, finallyStmt = null;
		CatchClause catchClause = null;
		List<CatchClause> catchClauses = new List<CatchClause>();
		
		Expect(114);
		Block(
#line  1728 "Frames/cs.ATG" 
out blockStmt);
		while (la.kind == 56) {
			CatchClause(
#line  1730 "Frames/cs.ATG" 
out catchClause);

#line  1731 "Frames/cs.ATG" 
			if (catchClause != null) catchClauses.Add(catchClause); 
		}
		if (la.kind == 73) {
			lexer.NextToken();
			Block(
#line  1733 "Frames/cs.ATG" 
out finallyStmt);
		}

#line  1735 "Frames/cs.ATG" 
		tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt);
		if (catchClauses != null) {
			foreach (CatchClause cc in catchClauses) cc.Parent = tryStatement;
		}
		
	}
		public virtual object TrackedVisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
			return base.VisitTryCatchStatement(tryCatchStatement, data);
		}
Ejemplo n.º 6
0
	void TryStatement(
#line  3245 "VBNET.ATG" 
out Statement tryStatement) {

#line  3247 "VBNET.ATG" 
		Statement blockStmt = null, finallyStmt = null;List<CatchClause> catchClauses = null;
		
		Expect(203);
		EndOfStmt();
		Block(
#line  3250 "VBNET.ATG" 
out blockStmt);
		if (la.kind == 62 || la.kind == 100 || la.kind == 110) {
			CatchClauses(
#line  3251 "VBNET.ATG" 
out catchClauses);
		}
		if (la.kind == 110) {
			lexer.NextToken();
			EndOfStmt();
			Block(
#line  3252 "VBNET.ATG" 
out finallyStmt);
		}
		Expect(100);
		Expect(203);

#line  3255 "VBNET.ATG" 
		tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt);
		
	}
		public virtual object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
			Debug.Assert((tryCatchStatement != null));
			Debug.Assert((tryCatchStatement.StatementBlock != null));
			Debug.Assert((tryCatchStatement.CatchClauses != null));
			Debug.Assert((tryCatchStatement.FinallyBlock != null));
			nodeStack.Push(tryCatchStatement.StatementBlock);
			tryCatchStatement.StatementBlock.AcceptVisitor(this, data);
			tryCatchStatement.StatementBlock = ((Statement)(nodeStack.Pop()));
			for (int i = 0; i < tryCatchStatement.CatchClauses.Count; i++) {
				CatchClause o = tryCatchStatement.CatchClauses[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (CatchClause)nodeStack.Pop();
				if (o == null)
					tryCatchStatement.CatchClauses.RemoveAt(i--);
				else
					tryCatchStatement.CatchClauses[i] = o;
			}
			nodeStack.Push(tryCatchStatement.FinallyBlock);
			tryCatchStatement.FinallyBlock.AcceptVisitor(this, data);
			tryCatchStatement.FinallyBlock = ((Statement)(nodeStack.Pop()));
			return null;
		}
		public virtual object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
			throw new global::System.NotImplementedException("TryCatchStatement");
		}
Ejemplo n.º 9
0
		public override object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data)
		{
			// add a try-catch-finally
			CodeTryCatchFinallyStatement tryStmt = new CodeTryCatchFinallyStatement();
			
			codeStack.Push(tryStmt.TryStatements);
			
			tryCatchStatement.StatementBlock.AcceptChildren(this, data);
			codeStack.Pop();
			
			if (!tryCatchStatement.FinallyBlock.IsNull) {
				codeStack.Push(tryStmt.FinallyStatements);
				
				tryCatchStatement.FinallyBlock.AcceptChildren(this,data);
				codeStack.Pop();
			}
			
			foreach (CatchClause clause in tryCatchStatement.CatchClauses)
			{
				CodeCatchClause catchClause = new CodeCatchClause(clause.VariableName);
				catchClause.CatchExceptionType = ConvType(clause.TypeReference);
				tryStmt.CatchClauses.Add(catchClause);
				
				codeStack.Push(catchClause.Statements);
				
				clause.StatementBlock.AcceptChildren(this, data);
				codeStack.Pop();
			}
			
			// Add Statement to Current Statement Collection
			AddStmt(tryStmt);
			
			return tryStmt;
		}