%token STRUCT
%token SWITCH
%token THIS
-%token THROW
+%token THROW
%token TRUE
%token TRY
%token TYPEOF
%token WHEN
%token INTERPOLATED_STRING
%token INTERPOLATED_STRING_END
+%token THROW_EXPR
/* C# keywords which are not really keywords */
%token GET
$$ = new Await ((Expression) $2, GetLocation ($1));
}
+ | THROW_EXPR prefixed_unary_expression
+ {
+ if (lang_version < LanguageVersion.V_7)
+ FeatureIsNotAvailable (lexer.Location, "throw expression");
+
+ $$ = new ThrowExpression ((Expression) $2, GetLocation ($1));
+ }
| BANG error
{
Error_SyntaxError (yyToken);
;
throw_statement
- : THROW opt_expression SEMICOLON
+ : THROW expression SEMICOLON
{
$$ = new Throw ((Expression) $2, GetLocation ($1));
lbag.AddStatement ($$, GetLocation ($3));
}
+ | THROW SEMICOLON
+ {
+ $$ = new Throw (null, GetLocation ($1));
+ lbag.AddStatement ($$, GetLocation ($2));
+ }
| THROW expression error
{
Error_SyntaxError (yyToken);
case Token.THIS:
return "this";
case Token.THROW:
+ case Token.THROW_EXPR:
return "throw";
case Token.TRUE:
return "true";