|
|
|
@ -951,10 +951,10 @@ struct_declaration |
|
|
|
opt_partial |
|
|
|
opt_partial |
|
|
|
STRUCT |
|
|
|
STRUCT |
|
|
|
{ |
|
|
|
{ |
|
|
|
lexer.ConstraintsParsing = true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
type_declaration_name |
|
|
|
type_declaration_name |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
lexer.ConstraintsParsing = true; |
|
|
|
push_current_container (new Struct (current_container, (MemberName) $6, (Modifiers) $2, (Attributes) $1), $3); |
|
|
|
push_current_container (new Struct (current_container, (MemberName) $6, (Modifiers) $2, (Attributes) $1), $3); |
|
|
|
lbag.AddMember (current_container, GetModifierLocations (), GetLocation ($4)); |
|
|
|
lbag.AddMember (current_container, GetModifierLocations (), GetLocation ($4)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1539,7 +1539,7 @@ fixed_parameter |
|
|
|
: opt_attributes |
|
|
|
: opt_attributes |
|
|
|
opt_parameter_modifier |
|
|
|
opt_parameter_modifier |
|
|
|
parameter_type |
|
|
|
parameter_type |
|
|
|
IDENTIFIER |
|
|
|
identifier_inside_body |
|
|
|
{ |
|
|
|
{ |
|
|
|
var lt = (Tokenizer.LocatedToken) $4; |
|
|
|
var lt = (Tokenizer.LocatedToken) $4; |
|
|
|
$$ = new Parameter ((FullNamedExpression) $3, lt.Value, (Parameter.Modifier) $2, (Attributes) $1, lt.Location); |
|
|
|
$$ = new Parameter ((FullNamedExpression) $3, lt.Value, (Parameter.Modifier) $2, (Attributes) $1, lt.Location); |
|
|
|
@ -1548,7 +1548,7 @@ fixed_parameter |
|
|
|
| opt_attributes |
|
|
|
| opt_attributes |
|
|
|
opt_parameter_modifier |
|
|
|
opt_parameter_modifier |
|
|
|
parameter_type |
|
|
|
parameter_type |
|
|
|
IDENTIFIER OPEN_BRACKET CLOSE_BRACKET |
|
|
|
identifier_inside_body OPEN_BRACKET CLOSE_BRACKET |
|
|
|
{ |
|
|
|
{ |
|
|
|
var lt = (Tokenizer.LocatedToken) $4; |
|
|
|
var lt = (Tokenizer.LocatedToken) $4; |
|
|
|
report.Error (1552, lt.Location, "Array type specifier, [], must appear before parameter name"); |
|
|
|
report.Error (1552, lt.Location, "Array type specifier, [], must appear before parameter name"); |
|
|
|
@ -1574,7 +1574,7 @@ fixed_parameter |
|
|
|
| opt_attributes |
|
|
|
| opt_attributes |
|
|
|
opt_parameter_modifier |
|
|
|
opt_parameter_modifier |
|
|
|
parameter_type |
|
|
|
parameter_type |
|
|
|
IDENTIFIER |
|
|
|
identifier_inside_body |
|
|
|
ASSIGN |
|
|
|
ASSIGN |
|
|
|
{ |
|
|
|
{ |
|
|
|
++lexer.parsing_block; |
|
|
|
++lexer.parsing_block; |
|
|
|
@ -1952,10 +1952,10 @@ interface_declaration |
|
|
|
opt_partial |
|
|
|
opt_partial |
|
|
|
INTERFACE |
|
|
|
INTERFACE |
|
|
|
{ |
|
|
|
{ |
|
|
|
lexer.ConstraintsParsing = true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
type_declaration_name |
|
|
|
type_declaration_name |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
lexer.ConstraintsParsing = true; |
|
|
|
push_current_container (new Interface (current_container, (MemberName) $6, (Modifiers) $2, (Attributes) $1), $3); |
|
|
|
push_current_container (new Interface (current_container, (MemberName) $6, (Modifiers) $2, (Attributes) $1), $3); |
|
|
|
lbag.AddMember (current_container, GetModifierLocations (), GetLocation ($4)); |
|
|
|
lbag.AddMember (current_container, GetModifierLocations (), GetLocation ($4)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -3219,28 +3219,28 @@ parenthesized_expression |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
member_access |
|
|
|
member_access |
|
|
|
: primary_expression DOT IDENTIFIER opt_type_argument_list |
|
|
|
: primary_expression DOT identifier_inside_body opt_type_argument_list |
|
|
|
{ |
|
|
|
{ |
|
|
|
var lt = (Tokenizer.LocatedToken) $3; |
|
|
|
var lt = (Tokenizer.LocatedToken) $3; |
|
|
|
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location) { |
|
|
|
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location) { |
|
|
|
DotLocation = GetLocation ($2) |
|
|
|
DotLocation = GetLocation ($2) |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
| builtin_types DOT IDENTIFIER opt_type_argument_list |
|
|
|
| builtin_types DOT identifier_inside_body opt_type_argument_list |
|
|
|
{ |
|
|
|
{ |
|
|
|
var lt = (Tokenizer.LocatedToken) $3; |
|
|
|
var lt = (Tokenizer.LocatedToken) $3; |
|
|
|
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location) { |
|
|
|
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location) { |
|
|
|
DotLocation = GetLocation ($2) |
|
|
|
DotLocation = GetLocation ($2) |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
| BASE DOT IDENTIFIER opt_type_argument_list |
|
|
|
| BASE DOT identifier_inside_body opt_type_argument_list |
|
|
|
{ |
|
|
|
{ |
|
|
|
var lt = (Tokenizer.LocatedToken) $3; |
|
|
|
var lt = (Tokenizer.LocatedToken) $3; |
|
|
|
$$ = new MemberAccess (new BaseThis (GetLocation ($1)), lt.Value, (TypeArguments) $4, lt.Location) { |
|
|
|
$$ = new MemberAccess (new BaseThis (GetLocation ($1)), lt.Value, (TypeArguments) $4, lt.Location) { |
|
|
|
DotLocation = GetLocation ($2) |
|
|
|
DotLocation = GetLocation ($2) |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
| qualified_alias_member IDENTIFIER opt_type_argument_list |
|
|
|
| qualified_alias_member identifier_inside_body opt_type_argument_list |
|
|
|
{ |
|
|
|
{ |
|
|
|
var lt1 = (Tokenizer.LocatedToken) $1; |
|
|
|
var lt1 = (Tokenizer.LocatedToken) $1; |
|
|
|
var lt2 = (Tokenizer.LocatedToken) $2; |
|
|
|
var lt2 = (Tokenizer.LocatedToken) $2; |
|
|
|
@ -3284,7 +3284,7 @@ invocation_expression |
|
|
|
|
|
|
|
|
|
|
|
$$ = new Invocation ((Expression) $1, null); |
|
|
|
$$ = new Invocation ((Expression) $1, null); |
|
|
|
lbag.AddLocation ($$, GetLocation ($2)); |
|
|
|
lbag.AddLocation ($$, GetLocation ($2)); |
|
|
|
} |
|
|
|
} |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
opt_object_or_collection_initializer |
|
|
|
opt_object_or_collection_initializer |
|
|
|
@ -3344,6 +3344,12 @@ member_initializer |
|
|
|
$$ = new ElementInitializer (lt.Value, (Expression)$3, lt.Location); |
|
|
|
$$ = new ElementInitializer (lt.Value, (Expression)$3, lt.Location); |
|
|
|
lbag.AddLocation ($$, GetLocation ($2)); |
|
|
|
lbag.AddLocation ($$, GetLocation ($2)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
| AWAIT ASSIGN initializer_value |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var lt = (Tokenizer.LocatedToken) Error_AwaitAsIdentifier ($1); |
|
|
|
|
|
|
|
$$ = new ElementInitializer (lt.Value, (Expression)$3, lt.Location); |
|
|
|
|
|
|
|
lbag.AddLocation ($$, GetLocation ($2)); |
|
|
|
|
|
|
|
} |
|
|
|
| GENERATE_COMPLETION |
|
|
|
| GENERATE_COMPLETION |
|
|
|
{ |
|
|
|
{ |
|
|
|
$$ = new CompletionElementInitializer (null, GetLocation ($1)); |
|
|
|
$$ = new CompletionElementInitializer (null, GetLocation ($1)); |
|
|
|
@ -3680,13 +3686,13 @@ anonymous_type_parameters |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
anonymous_type_parameter |
|
|
|
anonymous_type_parameter |
|
|
|
: IDENTIFIER ASSIGN variable_initializer |
|
|
|
: identifier_inside_body ASSIGN variable_initializer |
|
|
|
{ |
|
|
|
{ |
|
|
|
var lt = (Tokenizer.LocatedToken)$1; |
|
|
|
var lt = (Tokenizer.LocatedToken)$1; |
|
|
|
$$ = new AnonymousTypeParameter ((Expression)$3, lt.Value, lt.Location); |
|
|
|
$$ = new AnonymousTypeParameter ((Expression)$3, lt.Value, lt.Location); |
|
|
|
lbag.AddLocation ($$, GetLocation ($2)); |
|
|
|
lbag.AddLocation ($$, GetLocation ($2)); |
|
|
|
} |
|
|
|
} |
|
|
|
| IDENTIFIER |
|
|
|
| identifier_inside_body |
|
|
|
{ |
|
|
|
{ |
|
|
|
var lt = (Tokenizer.LocatedToken)$1; |
|
|
|
var lt = (Tokenizer.LocatedToken)$1; |
|
|
|
$$ = new AnonymousTypeParameter (new SimpleName (lt.Value, lt.Location), |
|
|
|
$$ = new AnonymousTypeParameter (new SimpleName (lt.Value, lt.Location), |
|
|
|
@ -4537,6 +4543,11 @@ lambda_parameter |
|
|
|
var lt = (Tokenizer.LocatedToken) $1; |
|
|
|
var lt = (Tokenizer.LocatedToken) $1; |
|
|
|
$$ = new ImplicitLambdaParameter (lt.Value, lt.Location); |
|
|
|
$$ = new ImplicitLambdaParameter (lt.Value, lt.Location); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
| AWAIT |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var lt = (Tokenizer.LocatedToken) Error_AwaitAsIdentifier ($1); |
|
|
|
|
|
|
|
$$ = new ImplicitLambdaParameter (lt.Value, lt.Location); |
|
|
|
|
|
|
|
} |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
opt_lambda_parameter_list |
|
|
|
opt_lambda_parameter_list |
|
|
|
@ -4593,6 +4604,17 @@ lambda_expression |
|
|
|
$$ = end_anonymous ((ParametersBlock) $4); |
|
|
|
$$ = end_anonymous ((ParametersBlock) $4); |
|
|
|
lbag.AddLocation ($$, GetLocation ($2)); |
|
|
|
lbag.AddLocation ($$, GetLocation ($2)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
| AWAIT ARROW |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var lt = (Tokenizer.LocatedToken) Error_AwaitAsIdentifier ($1); |
|
|
|
|
|
|
|
Parameter p = new ImplicitLambdaParameter (lt.Value, lt.Location); |
|
|
|
|
|
|
|
start_anonymous (true, new ParametersCompiled (p), false, lt.Location); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
lambda_expression_body |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$$ = end_anonymous ((ParametersBlock) $4); |
|
|
|
|
|
|
|
lbag.AddLocation ($$, GetLocation ($2)); |
|
|
|
|
|
|
|
} |
|
|
|
| ASYNC identifier_inside_body ARROW |
|
|
|
| ASYNC identifier_inside_body ARROW |
|
|
|
{ |
|
|
|
{ |
|
|
|
var lt = (Tokenizer.LocatedToken) $2; |
|
|
|
var lt = (Tokenizer.LocatedToken) $2; |
|
|
|
@ -4687,10 +4709,11 @@ class_declaration |
|
|
|
opt_partial |
|
|
|
opt_partial |
|
|
|
CLASS |
|
|
|
CLASS |
|
|
|
{ |
|
|
|
{ |
|
|
|
lexer.ConstraintsParsing = true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
type_declaration_name |
|
|
|
type_declaration_name |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
lexer.ConstraintsParsing = true; |
|
|
|
|
|
|
|
|
|
|
|
Class c = new Class (current_container, (MemberName) $6, (Modifiers) $2, (Attributes) $1); |
|
|
|
Class c = new Class (current_container, (MemberName) $6, (Modifiers) $2, (Attributes) $1); |
|
|
|
if (((c.ModFlags & Modifiers.STATIC) != 0) && lang_version == LanguageVersion.ISO_1) { |
|
|
|
if (((c.ModFlags & Modifiers.STATIC) != 0) && lang_version == LanguageVersion.ISO_1) { |
|
|
|
FeatureIsNotAvailable (c.Location, "static classes"); |
|
|
|
FeatureIsNotAvailable (c.Location, "static classes"); |
|
|
|
@ -5303,10 +5326,7 @@ identifier_inside_body |
|
|
|
: IDENTIFIER |
|
|
|
: IDENTIFIER |
|
|
|
| AWAIT |
|
|
|
| AWAIT |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (async_block) { |
|
|
|
$$ = Error_AwaitAsIdentifier ($1); |
|
|
|
report.Error (4003, GetLocation ($1), "`await' cannot be used as an identifier within an async method or lambda expression"); |
|
|
|
|
|
|
|
$$ = new Tokenizer.LocatedToken ("await", GetLocation ($1)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
@ -7059,6 +7079,16 @@ void Error_MissingInitializer (Location loc) |
|
|
|
report.Error (210, loc, "You must provide an initializer in a fixed or using statement declaration"); |
|
|
|
report.Error (210, loc, "You must provide an initializer in a fixed or using statement declaration"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
object Error_AwaitAsIdentifier (object token) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (async_block) { |
|
|
|
|
|
|
|
report.Error (4003, GetLocation (token), "`await' cannot be used as an identifier within an async method or lambda expression"); |
|
|
|
|
|
|
|
return new Tokenizer.LocatedToken ("await", GetLocation (token)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return token; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void push_current_container (TypeDefinition tc, object partial_token) |
|
|
|
void push_current_container (TypeDefinition tc, object partial_token) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (module.Evaluator != null){ |
|
|
|
if (module.Evaluator != null){ |
|
|
|
|