Permalink
Browse files

Added error expression for the for construct.

  • Loading branch information...
1 parent 817a2da commit fa6ea1222f48576a2bd028929f8eeb9f0a3b44a8 @mkrueger mkrueger committed Nov 8, 2011
@@ -7922,7 +7922,7 @@ void case_797()
void case_798()
#line 5301 "cs-parser.jay"
{
- For f = new For ((Statement) yyVals[-2+yyTop], null, null, null, GetLocation (yyVals[-5+yyTop]));
+ For f = new For ((Statement) yyVals[-2+yyTop], ErrorExpression.Create (0, lexer.Location, "Syntax error"), null, null, GetLocation (yyVals[-5+yyTop]));
current_block.AddStatement (f);
lbag.AddStatement (f, current_block.StartLocation, GetLocation (yyVals[-1+yyTop]));
@@ -5299,7 +5299,7 @@ for_statement_cont
}
| opt_for_initializer SEMICOLON error
{
- For f = new For ((Statement) $1, null, null, null, GetLocation ($-2));
+ For f = new For ((Statement) $1, ErrorExpression.Create (0, lexer.Location, "Syntax error"), null, null, GetLocation ($-2));
current_block.AddStatement (f);
lbag.AddStatement (f, current_block.StartLocation, GetLocation ($2));
@@ -9168,10 +9168,11 @@ private ErrorExpression ()
{
}
- ErrorExpression (int errorCode, Location location, string error) : base (InternalType.ErrorType)
+ ErrorExpression (int errorCode, Location location, string error)
+ : base (InternalType.ErrorType)
{
this.ErrorCode = errorCode;
- this.loc = location;
+ base.loc = location;
this.Error = error;
}
@@ -9201,6 +9202,11 @@ public override void Error_ValueCannotBeConverted (ResolveContext ec, Location l
public override void Error_OperatorCannotBeApplied (ResolveContext rc, Location loc, string oper, TypeSpec t)
{
}
+
+ public override object Accept (StructuralVisitor visitor)
+ {
+ return visitor.Visit (this);
+ }
}
public class UserCast : Expression {
@@ -484,7 +484,7 @@ public class For : Statement {
bool infinite, empty;
public For (Statement init_statement,
- BooleanExpression test,
+ Expression test,
Statement increment,
Statement statement,
Location l)
@@ -183,6 +183,11 @@ public virtual object Visit (EmptyExpression emptyExpression)
{
return null;
}
+
+ public virtual object Visit (ErrorExpression errorExpression)
+ {
+ return null;
+ }
public virtual object Visit (If ifStatement)
{

0 comments on commit fa6ea12

Please sign in to comment.