Delegate current_delegate;
- GenericMethod current_generic_method;
AnonymousMethodExpression current_anonymous_method;
/// <summary>
//
public Undo undo;
- Stack<Block> linq_clause_blocks;
+ Stack<Linq.QueryBlock> linq_clause_blocks;
// A counter to create new class names in interactive mode
static int class_count;
Report.Error (531, method.Location, "`{0}': interface members cannot have a definition", method.GetSignatureForError ());
}
- current_generic_method = null;
current_local_parameters = null;
if (RootContext.Documentation != null)
MemberName name = (MemberName) $4;
current_local_parameters = (ParametersCompiled) $7;
- if ($10 != null && name.TypeArguments == null)
- Report.Error (80, lexer.Location,
- "Constraints are not allowed on non-generic declarations");
-
- Method method;
-
GenericMethod generic = null;
if (name.TypeArguments != null) {
generic = new GenericMethod (current_namespace, current_class, name,
(FullNamedExpression) $3, current_local_parameters);
generic.SetParameterInfo ((List<Constraints>) $10);
+ } else if ($10 != null) {
+ Report.Error (80, GetLocation ($10),
+ "Constraints are not allowed on non-generic declarations");
}
- method = new Method (current_class, generic, (FullNamedExpression) $3, (Modifiers) $2,
+ Method method = new Method (current_class, generic, (FullNamedExpression) $3, (Modifiers) $2,
name, current_local_parameters, (Attributes) $1);
-
- current_generic_method = generic;
+
+ if ($10 != null && ((method.ModFlags & Modifiers.OVERRIDE) != 0 || method.IsExplicitImpl)) {
+ Report.Error (460, method.Location,
+ "`{0}': Cannot specify constraints for overrides and explicit interface implementation methods",
+ method.GetSignatureForError ());
+ }
if (RootContext.Documentation != null)
method.DocComment = Lexer.consume_doc_comment ();
method = new Method (current_class, generic, TypeManager.system_void_expr,
modifiers, name, current_local_parameters, (Attributes) $1);
- current_generic_method = generic;
-
if (RootContext.Documentation != null)
method.DocComment = Lexer.consume_doc_comment ();
base_type_name
: type
{
- if ($1 is ComposedCast)
+ if ($1 is ComposedCast) {
Report.Error (1521, GetLocation ($1), "Invalid base type `{0}'", ((ComposedCast)$1).GetSignatureForError ());
+ }
$$ = $1;
}
| error
| CHAR { $$ = TypeManager.system_char_expr; }
;
-predefined_type
- : builtin_types
- | VOID
- {
- $$ = TypeManager.system_void_expr;
- }
- ;
-
//
// Expressions, section 7.5
//
| IDENTIFIER opt_type_argument_list
{
var lt = (Tokenizer.LocatedToken) $1;
- $$ = new SimpleName (MemberName.MakeName (lt.Value, (TypeArguments)$2), (TypeArguments)$2, lt.Location);
+ $$ = new SimpleName (lt.Value, (TypeArguments)$2, lt.Location);
}
| IDENTIFIER GENERATE_COMPLETION {
var lt = (Tokenizer.LocatedToken) $1;
var lt = (Tokenizer.LocatedToken) $3;
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, lt.Location);
}
- | predefined_type DOT IDENTIFIER opt_type_argument_list
+ | builtin_types DOT IDENTIFIER opt_type_argument_list
{
var lt = (Tokenizer.LocatedToken) $3;
// TODO: Location is wrong as some predefined types doesn't hold a location
var lt = (Tokenizer.LocatedToken) $3;
$$ = new CompletionMemberAccess ((Expression) $1, lt.Value, lt.Location);
}
- | predefined_type DOT GENERATE_COMPLETION
+ | builtin_types DOT GENERATE_COMPLETION
{
// TODO: Location is wrong as some predefined types doesn't hold a location
$$ = new CompletionMemberAccess ((Expression) $1, null, lexer.Location);
}
- | predefined_type DOT IDENTIFIER GENERATE_COMPLETION {
+ | builtin_types DOT IDENTIFIER GENERATE_COMPLETION {
var lt = (Tokenizer.LocatedToken) $3;
$$ = new CompletionMemberAccess ((Expression) $1, lt.Value, lt.Location);
}
a.Add ((Expression) $3);
$$ = a;
}
+ | member_initializer_list error {
+ Error_SyntaxError (yyToken);
+ $$ = $1;
+ }
;
member_initializer
}
| OPEN_BRACE expression_list CLOSE_BRACE
{
- $$ = new CollectionElementInitializer ((List<Expression>)$2, GetLocation ($1));
+ if ($2 == null)
+ $$ = null;
+ else
+ $$ = new CollectionElementInitializer ((List<Expression>)$2, GetLocation ($1));
}
| OPEN_BRACE CLOSE_BRACE
{
| argument_list COMMA
{
Report.Error (839, GetLocation ($2), "An argument is missing");
- $$ = null;
+ $$ = $1;
}
| COMMA argument_or_named_argument
{
Report.Error (839, GetLocation ($1), "An argument is missing");
- $$ = null;
+ $$ = $1;
}
;
list.Add ((Expression) $3);
$$ = list;
}
+ | expression_list error {
+ Error_SyntaxError (yyToken);
+ $$ = $1;
+ }
;
expression_list_arguments
this_access
: THIS
{
- $$ = new This (current_block, GetLocation ($1));
+ $$ = new This (GetLocation ($1));
}
;
: rank_specifier
| rank_specifier rank_specifiers
{
- $$ = (string) $2 + (string) $1;
+ $$ = (string) $1 + (string) $2;
}
;
{
var lt = (Tokenizer.LocatedToken) $1;
- $$ = new SimpleName (MemberName.MakeName (lt.Value, (int)$2), lt.Location);
+ $$ = new SimpleName (lt.Value, (int) $2, lt.Location);
}
| qualified_alias_member IDENTIFIER generic_dimension
{
var lt1 = (Tokenizer.LocatedToken) $1;
var lt2 = (Tokenizer.LocatedToken) $2;
- $$ = new QualifiedAliasMember (lt1.Value, MemberName.MakeName (lt2.Value, (int) $3), lt1.Location);
+ $$ = new QualifiedAliasMember (lt1.Value, lt2.Value, (int) $3, lt1.Location);
}
| unbound_type_name DOT IDENTIFIER
{
{
var lt = (Tokenizer.LocatedToken) $3;
- $$ = new MemberAccess ((Expression) $1, MemberName.MakeName (lt.Value, (int) $4), lt.Location);
+ $$ = new MemberAccess ((Expression) $1, lt.Value, (int) $4, lt.Location);
}
| namespace_or_type_name DOT IDENTIFIER generic_dimension
{
var lt = (Tokenizer.LocatedToken) $3;
MemberName name = (MemberName) $1;
- $$ = new MemberAccess (name.GetTypeExpression (), MemberName.MakeName (lt.Value, (int) $4), lt.Location);
+ $$ = new MemberAccess (name.GetTypeExpression (), lt.Value, (int) $4, lt.Location);
}
;
{
$$ = new Cast ((FullNamedExpression) $2, (Expression) $4, GetLocation ($1));
}
- | OPEN_PARENS predefined_type CLOSE_PARENS prefixed_unary_expression
+ | OPEN_PARENS builtin_types CLOSE_PARENS prefixed_unary_expression
{
$$ = new Cast ((FullNamedExpression) $2, (Expression) $4, GetLocation ($1));
}
type_parameter_constraint
: type
{
+ if ($1 is ComposedCast)
+ Report.Error (706, GetLocation ($1), "Invalid constraint type `{0}'", ((ComposedCast)$1).GetSignatureForError ());
+
$$ = $1;
}
| NEW OPEN_PARENS CLOSE_PARENS
empty_statement
: SEMICOLON
{
- $$ = EmptyStatement.Value;
+ $$ = new EmptyStatement (GetLocation ($1));
}
;
| error
{
Error_SyntaxError (yyToken);
- $$ = EmptyStatement.Value;
+ $$ = new EmptyStatement (GetLocation ($1));
}
;
: IF open_parens_any boolean_expression CLOSE_PARENS
embedded_statement
{
- Location l = GetLocation ($1);
-
- $$ = new If ((BooleanExpression) $3, (Statement) $5, l);
-
- // FIXME: location for warning should be loc property of $5.
- if ($5 == EmptyStatement.Value)
- Report.Warning (642, 3, l, "Possible mistaken empty statement");
-
+ if ($5 is EmptyStatement)
+ Report.Warning (642, 3, GetLocation ($5), "Possible mistaken empty statement");
+
+ $$ = new If ((BooleanExpression) $3, (Statement) $5, GetLocation ($1));
}
| IF open_parens_any boolean_expression CLOSE_PARENS
embedded_statement ELSE embedded_statement
{
- Location l = GetLocation ($1);
-
- $$ = new If ((BooleanExpression) $3, (Statement) $5, (Statement) $7, l);
+ $$ = new If ((BooleanExpression) $3, (Statement) $5, (Statement) $7, GetLocation ($1));
- // FIXME: location for warning should be loc property of $5 and $7.
- if ($5 == EmptyStatement.Value)
- Report.Warning (642, 3, l, "Possible mistaken empty statement");
- if ($7 == EmptyStatement.Value)
- Report.Warning (642, 3, l, "Possible mistaken empty statement");
+ if ($5 is EmptyStatement)
+ Report.Warning (642, 3, GetLocation ($5), "Possible mistaken empty statement");
+ if ($7 is EmptyStatement)
+ Report.Warning (642, 3, GetLocation ($7), "Possible mistaken empty statement");
}
;
;
opt_for_initializer
- : /* empty */ { $$ = EmptyStatement.Value; }
+ : /* empty */ { $$ = new EmptyStatement (lexer.Location); }
| for_initializer
;
;
opt_for_iterator
- : /* empty */ { $$ = EmptyStatement.Value; }
+ : /* empty */ { $$ = new EmptyStatement (lexer.Location); }
| for_iterator
;
first_from_clause
: FROM_FIRST IDENTIFIER IN expression
{
- $$ = new Linq.QueryExpression (current_block, new Linq.QueryStartClause ((Expression)$4));
- var lt = (Tokenizer.LocatedToken) $2;
- current_block = new Linq.QueryBlock (compiler, current_block, new SimpleMemberName (lt.Value, lt.Location), GetLocation ($1));
+ current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
+
+ var lt = (Tokenizer.LocatedToken) $2;
+ $$ = new Linq.QueryExpression (new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$4, new SimpleMemberName (lt.Value, lt.Location), GetLocation ($1)));
}
| FROM_FIRST type IDENTIFIER IN expression
{
+ current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
+
var lt = (Tokenizer.LocatedToken) $3;
- $$ = new Linq.QueryExpression (current_block, new Linq.Cast ((FullNamedExpression)$2, (Expression)$5));
- current_block = new Linq.QueryBlock (compiler, current_block, new SimpleMemberName (lt.Value, lt.Location), GetLocation ($1));
+ $$ = new Linq.QueryExpression (
+ new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$5, new SimpleMemberName (lt.Value, lt.Location), GetLocation ($1)) {
+ IdentifierType = (FullNamedExpression)$2
+ }
+ );
}
;
nested_from_clause
: FROM IDENTIFIER IN expression
{
- $$ = new Linq.QueryExpression (current_block, new Linq.QueryStartClause ((Expression)$4));
- var lt = (Tokenizer.LocatedToken) $2;
- current_block = new Linq.QueryBlock (compiler, current_block, new SimpleMemberName (lt.Value, lt.Location), GetLocation ($1));
+ current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
+
+ var lt = (Tokenizer.LocatedToken) $2;
+ $$ = new Linq.QueryExpression (new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$4, new SimpleMemberName (lt.Value, lt.Location), GetLocation ($1)));
}
| FROM type IDENTIFIER IN expression
{
- $$ = new Linq.QueryExpression (current_block, new Linq.Cast ((FullNamedExpression)$2, (Expression)$5));
+ current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
+
var lt = (Tokenizer.LocatedToken) $3;
- current_block = new Linq.QueryBlock (compiler, current_block, new SimpleMemberName (lt.Value, lt.Location), GetLocation ($1));
+ $$ = new Linq.QueryExpression (
+ new Linq.QueryStartClause ((Linq.QueryBlock)current_block, (Expression)$5, new SimpleMemberName (lt.Value, lt.Location), GetLocation ($1)) {
+ IdentifierType = (FullNamedExpression)$2
+ }
+ );
}
;
from_clause
: FROM IDENTIFIER IN
{
- current_block = new Linq.QueryBlock (compiler, current_block, GetLocation ($1));
+ current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
}
expression
{
var lt = (Tokenizer.LocatedToken) $2;
var sn = new SimpleMemberName (lt.Value, lt.Location);
- $$ = new Linq.SelectMany (current_block.Toplevel, sn, (Expression)$5);
+ $$ = new Linq.SelectMany ((Linq.QueryBlock)current_block, sn, (Expression)$5, GetLocation ($1));
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
- ((Linq.QueryBlock)current_block).AddTransparentParameter (compiler, sn);
+ ((Linq.QueryBlock)current_block).AddRangeVariable (sn);
}
| FROM type IDENTIFIER IN
{
- current_block = new Linq.QueryBlock (compiler, current_block, GetLocation ($1));
+ current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
}
expression
{
var lt = (Tokenizer.LocatedToken) $3;
var sn = new SimpleMemberName (lt.Value, lt.Location);
- FullNamedExpression type = (FullNamedExpression)$2;
-
- $$ = new Linq.SelectMany (current_block.Toplevel, sn, new Linq.Cast (type, (FullNamedExpression)$6));
+ $$ = new Linq.SelectMany ((Linq.QueryBlock)current_block, sn, (Expression)$6, GetLocation ($1)) {
+ IdentifierType = (FullNamedExpression)$2
+ };
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
- ((Linq.QueryBlock)current_block).AddTransparentParameter (compiler, sn);
+ ((Linq.QueryBlock)current_block).AddRangeVariable (sn);
}
;
}
expression
{
- $$ = new Linq.Select (current_block.Toplevel, (Expression)$3, GetLocation ($1));
+ $$ = new Linq.Select ((Linq.QueryBlock)current_block, (Expression)$3, GetLocation ($1));
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
| GROUP
{
if (linq_clause_blocks == null)
- linq_clause_blocks = new Stack<Block> ();
+ linq_clause_blocks = new Stack<Linq.QueryBlock> ();
current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
- linq_clause_blocks.Push (current_block);
+ linq_clause_blocks.Push ((Linq.QueryBlock)current_block);
}
expression
{
}
BY expression
{
- $$ = new Linq.GroupBy (current_block.Toplevel, (Expression)$3, (ToplevelBlock) linq_clause_blocks.Pop (), (Expression)$6, GetLocation ($1));
+ $$ = new Linq.GroupBy ((Linq.QueryBlock)current_block, (Expression)$3, linq_clause_blocks.Pop (), (Expression)$6, GetLocation ($1));
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
let_clause
: LET IDENTIFIER ASSIGN
{
- current_block = new Linq.QueryBlock (compiler, current_block, GetLocation ($1));
+ current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
}
expression
{
var lt = (Tokenizer.LocatedToken) $2;
var sn = new SimpleMemberName (lt.Value, lt.Location);
- $$ = new Linq.Let (current_block.Toplevel, current_container, sn, (Expression)$5);
+ $$ = new Linq.Let ((Linq.QueryBlock) current_block, sn, (Expression)$5, GetLocation ($1));
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
- ((Linq.QueryBlock)current_block).AddTransparentParameter (compiler, sn);
+ ((Linq.QueryBlock)current_block).AddRangeVariable (sn);
}
;
}
boolean_expression
{
- $$ = new Linq.Where (current_block.Toplevel, (BooleanExpression)$3, GetLocation ($1));
+ $$ = new Linq.Where ((Linq.QueryBlock)current_block, (BooleanExpression)$3, GetLocation ($1));
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
: JOIN IDENTIFIER IN
{
if (linq_clause_blocks == null)
- linq_clause_blocks = new Stack<Block> ();
+ linq_clause_blocks = new Stack<Linq.QueryBlock> ();
current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
- linq_clause_blocks.Push (current_block);
+ linq_clause_blocks.Push ((Linq.QueryBlock) current_block);
}
expression ON
{
current_block = current_block.Parent;
current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
- linq_clause_blocks.Push (current_block);
+ linq_clause_blocks.Push ((Linq.QueryBlock) current_block);
}
expression EQUALS
{
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
- var lt = (Tokenizer.LocatedToken) $2;
- current_block = new Linq.QueryBlock (compiler, current_block, new SimpleMemberName (lt.Value, lt.Location), lexer.Location);
+ current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
}
expression opt_join_into
{
var sn = new SimpleMemberName (lt.Value, lt.Location);
SimpleMemberName sn2 = null;
- ToplevelBlock outer_selector = (ToplevelBlock) linq_clause_blocks.Pop ();
- ToplevelBlock block = (ToplevelBlock) linq_clause_blocks.Pop ();
+ var outer_selector = linq_clause_blocks.Pop ();
+ var block = linq_clause_blocks.Pop ();
if ($12 == null) {
- $$ = new Linq.Join (block, sn, (Expression)$5, outer_selector, current_block.Toplevel, GetLocation ($1));
+ $$ = new Linq.Join (block, sn, (Expression)$5, outer_selector, (Linq.QueryBlock) current_block, GetLocation ($1));
} else {
var lt2 = (Tokenizer.LocatedToken) $12;
sn2 = new SimpleMemberName (lt2.Value, lt2.Location);
- $$ = new Linq.GroupJoin (block, sn, (Expression)$5, outer_selector, current_block.Toplevel,
+ $$ = new Linq.GroupJoin (block, sn, (Expression)$5, outer_selector, (Linq.QueryBlock) current_block,
sn2, GetLocation ($1));
}
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
- if (sn2 == null)
- ((Linq.QueryBlock)current_block).AddTransparentParameter (compiler, sn);
- else
- ((Linq.QueryBlock)current_block).AddTransparentParameter (compiler, sn2);
+ ((Linq.QueryBlock)current_block).AddRangeVariable (sn2 ?? sn);
}
| JOIN type IDENTIFIER IN
{
if (linq_clause_blocks == null)
- linq_clause_blocks = new Stack<Block> ();
+ linq_clause_blocks = new Stack<Linq.QueryBlock> ();
current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
- linq_clause_blocks.Push (current_block);
+ linq_clause_blocks.Push ((Linq.QueryBlock) current_block);
}
expression ON
{
current_block = current_block.Parent;
current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
- linq_clause_blocks.Push (current_block);
+ linq_clause_blocks.Push ((Linq.QueryBlock) current_block);
}
expression EQUALS
{
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
- var lt = (Tokenizer.LocatedToken) $3;
- current_block = new Linq.QueryBlock (compiler, current_block, new SimpleMemberName (lt.Value, lt.Location), lexer.Location);
+ current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
}
expression opt_join_into
{
var lt = (Tokenizer.LocatedToken) $3;
var sn = new SimpleMemberName (lt.Value, lt.Location);
SimpleMemberName sn2 = null;
- ToplevelBlock outer_selector = (ToplevelBlock) linq_clause_blocks.Pop ();
- ToplevelBlock block = (ToplevelBlock) linq_clause_blocks.Pop ();
+ var outer_selector = linq_clause_blocks.Pop ();
+ var block = linq_clause_blocks.Pop ();
- Linq.Cast cast = new Linq.Cast ((FullNamedExpression)$2, (Expression)$6);
if ($13 == null) {
- $$ = new Linq.Join (block, sn, cast, outer_selector, current_block.Toplevel, GetLocation ($1));
+ $$ = new Linq.Join (block, sn, (Expression)$6, outer_selector, (Linq.QueryBlock) current_block, GetLocation ($1)) {
+ IdentifierType = (FullNamedExpression)$2
+ };
} else {
var lt2 = (Tokenizer.LocatedToken) $13;
sn2 = new SimpleMemberName (lt2.Value, lt2.Location);
- $$ = new Linq.GroupJoin (block, sn, cast, outer_selector, current_block.Toplevel,
- sn2, GetLocation ($1));
+ $$ = new Linq.GroupJoin (block, sn, (Expression)$6, outer_selector, (Linq.QueryBlock) current_block, sn2, GetLocation ($1)) {
+ IdentifierType = (FullNamedExpression)$2
+ };
}
current_block.AddStatement (new ContextualReturn ((Expression) $12));
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
- if (sn2 == null)
- ((Linq.QueryBlock)current_block).AddTransparentParameter (compiler, sn);
- else
- ((Linq.QueryBlock)current_block).AddTransparentParameter (compiler, sn2);
+ ((Linq.QueryBlock)current_block).AddRangeVariable (sn2 ?? sn);
}
;
current_block.SetEndLocation (lexer.Location);
current_block = current_block.Parent;
- current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
+ current_block = new Linq.QueryBlock (compiler, (Linq.QueryBlock) current_block, lexer.Location);
}
then_by
{
- ((Linq.AQueryClause)$1).Tail.Next = (Linq.AQueryClause)$3;
+ ((Linq.AQueryClause)$1).Tail.Next = (Linq.AQueryClause)$4;
$$ = $1;
}
;
order_by
: expression
{
- $$ = new Linq.OrderByAscending (current_block.Toplevel, (Expression)$1);
+ $$ = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)$1);
}
| expression ASCENDING
{
- $$ = new Linq.OrderByAscending (current_block.Toplevel, (Expression)$1);
+ $$ = new Linq.OrderByAscending ((Linq.QueryBlock) current_block, (Expression)$1);
}
| expression DESCENDING
{
- $$ = new Linq.OrderByDescending (current_block.Toplevel, (Expression)$1);
+ $$ = new Linq.OrderByDescending ((Linq.QueryBlock) current_block, (Expression)$1);
}
;
then_by
: expression
{
- $$ = new Linq.ThenByAscending (current_block.Toplevel, (Expression)$1);
+ $$ = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)$1);
}
| expression ASCENDING
{
- $$ = new Linq.ThenByAscending (current_block.Toplevel, (Expression)$1);
+ $$ = new Linq.ThenByAscending ((Linq.QueryBlock) current_block, (Expression)$1);
}
| expression DESCENDING
{
- $$ = new Linq.ThenByDescending (current_block.Toplevel, (Expression)$1);
+ $$ = new Linq.ThenByDescending ((Linq.QueryBlock) current_block, (Expression)$1);
}
;
current_block.SetEndLocation (GetLocation ($1));
current_block = current_block.Parent;
-
- var lt = (Tokenizer.LocatedToken) $2;
+
+ current_block = new Linq.QueryBlock (compiler, current_block, lexer.Location);
- current_block = new Linq.QueryBlock (compiler, current_block, new SimpleMemberName (lt.Value, lt.Location), GetLocation ($1));
+ if (linq_clause_blocks == null)
+ linq_clause_blocks = new Stack<Linq.QueryBlock> ();
+
+ linq_clause_blocks.Push ((Linq.QueryBlock) current_block);
}
query_body
{
- $$ = new Linq.QueryExpression (current_block, (Linq.AQueryClause)$4);
+ var current_block = linq_clause_blocks.Pop ();
+ var lt = (Tokenizer.LocatedToken) $2;
+ $$ = new Linq.QueryStartClause ((Linq.QueryBlock)current_block, null, new SimpleMemberName (lt.Value, lt.Location), GetLocation ($1)) {
+ next = (Linq.AQueryClause)$4
+ };
}
;
if (obj is MemberName)
return ((MemberName) obj).Location;
+// if (obj is Expression)
+// return ((Expression) obj).Location;
+
return lexer.Location;
}
void start_block (Location loc)
{
if (current_block == null || parsing_anonymous_method) {
- current_block = new ToplevelBlock (compiler, current_block, current_local_parameters, current_generic_method, loc);
+ current_block = new ToplevelBlock (compiler, current_block, current_local_parameters, loc);
parsing_anonymous_method = false;
} else {
current_block = new ExplicitBlock (current_block, loc, Location.Null);