;
operator_declarator
: type OPERATOR overloadable_operator
- open_parens opt_parameter_modifier type IDENTIFIER CLOSE_PARENS
+ open_parens opt_attributes opt_parameter_modifier type IDENTIFIER CLOSE_PARENS
{
// TODO: wrong location
- if ((Parameter.Modifier)$5 != Parameter.Modifier.NONE)
+ if ((Parameter.Modifier)$6 != Parameter.Modifier.NONE)
Error_ParameterModifierNotValid ((Location) $2);
- LocatedToken lt = (LocatedToken) $7;
+ LocatedToken lt = (LocatedToken) $8;
Operator.OpType op = (Operator.OpType) $3;
CheckUnaryOperator (op, lt.Location);
op = Operator.OpType.UnaryNegation;
Parameter [] pars = new Parameter [1];
- Expression type = (Expression) $6;
+ Expression type = (Expression) $7;
- pars [0] = new Parameter (type, lt.Value, Parameter.Modifier.NONE, null, lt.Location);
+ pars [0] = new Parameter (type, lt.Value, Parameter.Modifier.NONE, (Attributes) $5, lt.Location);
current_local_parameters = new Parameters (pars);
}
| type OPERATOR overloadable_operator
open_parens
- opt_parameter_modifier type IDENTIFIER COMMA
- opt_parameter_modifier type IDENTIFIER
+ opt_attributes opt_parameter_modifier type IDENTIFIER COMMA
+ opt_attributes opt_parameter_modifier type IDENTIFIER
CLOSE_PARENS
{
// TODO: wrong location
- if ((Parameter.Modifier)$5 != Parameter.Modifier.NONE || (Parameter.Modifier)$9 != Parameter.Modifier.NONE)
+ if ((Parameter.Modifier)$6 != Parameter.Modifier.NONE || (Parameter.Modifier)$11 != Parameter.Modifier.NONE)
Error_ParameterModifierNotValid ((Location) $2);
- LocatedToken ltParam1 = (LocatedToken) $7;
- LocatedToken ltParam2 = (LocatedToken) $11;
+ LocatedToken ltParam1 = (LocatedToken) $8;
+ LocatedToken ltParam2 = (LocatedToken) $13;
CheckBinaryOperator ((Operator.OpType) $3, (Location) $2);
Parameter [] pars = new Parameter [2];
- Expression typeL = (Expression) $6;
- Expression typeR = (Expression) $10;
+ Expression typeL = (Expression) $7;
+ Expression typeR = (Expression) $12;
- pars [0] = new Parameter (typeL, ltParam1.Value, Parameter.Modifier.NONE, null, ltParam1.Location);
- pars [1] = new Parameter (typeR, ltParam2.Value, Parameter.Modifier.NONE, null, ltParam2.Location);
+ pars [0] = new Parameter (typeL, ltParam1.Value, Parameter.Modifier.NONE, (Attributes) $5, ltParam1.Location);
+ pars [1] = new Parameter (typeR, ltParam2.Value, Parameter.Modifier.NONE, (Attributes) $10, ltParam2.Location);
current_local_parameters = new Parameters (pars);
| conversion_operator_declarator
| type OPERATOR overloadable_operator
open_parens
- opt_parameter_modifier type IDENTIFIER COMMA
- opt_parameter_modifier type IDENTIFIER COMMA
- opt_parameter_modifier type IDENTIFIER
- CLOSE_PARENS
+ opt_attributes opt_parameter_modifier type IDENTIFIER COMMA
+ opt_attributes opt_parameter_modifier type IDENTIFIER COMMA error
{
Report.Error (1534, (Location) $2, "Overloaded binary operator `{0}' takes two parameters",
Operator.GetName ((Operator.OpType) $3));
: FOR open_parens
opt_for_initializer SEMICOLON
{
- Block assign_block = new Block (current_block);
- current_block = assign_block;
+ Location l = lexer.Location;
+ start_block (l);
+ Block assign_block = current_block;
if ($3 is DictionaryEntry){
DictionaryEntry de = (DictionaryEntry) $3;
if (vi == null)
continue;
- Location l = lexer.Location;
Expression expr = decl.expression_or_array_initializer;
LocalVariableReference var;
For f = new For ((Statement) $5, (Expression) $6, (Statement) $8, (Statement) $10, l);
current_block.AddStatement (f);
- while (current_block.Implicit)
- current_block = current_block.Parent;
- $$ = current_block;
- current_block = current_block.Parent;
+
+ $$ = end_block (lexer.Location);
}
;
| FOREACH open_parens type IDENTIFIER IN
expression CLOSE_PARENS
{
- Block foreach_block = new Block (current_block);
- current_block = foreach_block;
+ start_block (lexer.Location);
+ Block foreach_block = current_block;
LocatedToken lt = (LocatedToken) $4;
Location l = lt.Location;
current_block.AddStatement (f);
}
- while (current_block.Implicit)
- current_block = current_block.Parent;
- $$ = current_block;
- current_block = current_block.Parent;
+ $$ = end_block (lexer.Location);
}
;
one.Add (new VariableDeclaration (lt, null));
- current_block = new Block (current_block);
- Block b = declare_local_variables (type, one, lt.Location);
- current_block = b;
+ start_block (lexer.Location);
+ current_block = declare_local_variables (type, one, lt.Location);
}
}
} block {
if (lt != null){
id = lt.Value;
- while (current_block.Implicit)
- current_block = current_block.Parent;
- var_block = current_block;
- current_block = current_block.Parent;
+ var_block = end_block (lexer.Location);
}
}
Location l = (Location) $1;
int top = list.Count;
- Block assign_block = new Block (current_block);
- current_block = assign_block;
+ start_block (lexer.Location);
+ Block assign_block = current_block;
for (int i = 0; i < top; i++){
Pair p = (Pair) list [i];
Fixed f = new Fixed ((Expression) $3, (ArrayList) $4, (Statement) $7, l);
current_block.AddStatement (f);
- while (current_block.Implicit)
- current_block = current_block.Parent;
- $$ = current_block;
- current_block = current_block.Parent;
+
+ $$ = end_block (lexer.Location);
}
;
using_statement
: USING open_parens resource_acquisition CLOSE_PARENS
{
- Block assign_block = new Block (current_block);
- current_block = assign_block;
+ start_block (lexer.Location);
+ Block assign_block = current_block;
if ($3 is DictionaryEntry){
DictionaryEntry de = (DictionaryEntry) $3;
{
Using u = new Using ($5, (Statement) $6, (Location) $1);
current_block.AddStatement (u);
- while (current_block.Implicit)
- current_block = current_block.Parent;
- $$ = current_block;
- current_block = current_block.Parent;
+ $$ = end_block (lexer.Location);
}
;