From 957c48eede87cd56f673089d0d7d9526511e5462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Thu, 1 Sep 2011 10:15:58 +0200 Subject: [PATCH] Fixed query expression tests. --- .../CSharp/Parser/CSharpParser.cs | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs b/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs index f2a485e344..be34e2745f 100644 --- a/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs +++ b/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs @@ -2892,7 +2892,6 @@ namespace ICSharpCode.NRefactory.CSharp var result = new QueryJoinClause (); var location = LocationsBag.GetLocations (join); result.AddChild (new CSharpTokenNode (Convert (join.Location), "join".Length), QueryJoinClause.JoinKeywordRole); - result.AddChild (Identifier.Create (join.JoinVariable.Name, Convert (join.JoinVariable.Location)), QueryJoinClause.JoinIdentifierRole); if (location != null) @@ -2902,11 +2901,17 @@ namespace ICSharpCode.NRefactory.CSharp if (location != null) result.AddChild (new CSharpTokenNode (Convert (location[1]), "on".Length), QueryJoinClause.OnKeywordRole); - // TODO: on expression + + var outer = join.OuterSelector.Statements.FirstOrDefault () as ContextualReturn; + if (outer != null) + result.AddChild ((Expression)outer.Expr.Accept (this), QueryJoinClause.OnExpressionRole); if (location != null) result.AddChild (new CSharpTokenNode (Convert (location[2]), "equals".Length), QueryJoinClause.EqualsKeywordRole); - // TODO: equals expression + + var inner = join.InnerSelector.Statements.FirstOrDefault () as ContextualReturn; + if (inner != null) + result.AddChild ((Expression)inner.Expr.Accept (this), QueryJoinClause.EqualsExpressionRole); return result; } @@ -2923,16 +2928,19 @@ namespace ICSharpCode.NRefactory.CSharp if (location != null) result.AddChild (new CSharpTokenNode (Convert (location[0]), "in".Length), QueryJoinClause.InKeywordRole); - result.AddChild ((Expression)join.Expr.Accept (this), QueryJoinClause.InExpressionRole); + var outer = join.OuterSelector.Statements.FirstOrDefault () as ContextualReturn; + if (outer != null) + result.AddChild ((Expression)outer.Expr.Accept (this), QueryJoinClause.OnExpressionRole); if (location != null) result.AddChild (new CSharpTokenNode (Convert (location[1]), "on".Length), QueryJoinClause.OnKeywordRole); - - // TODO: on expression + result.AddChild ((Expression)join.Expr.Accept (this), QueryJoinClause.InExpressionRole); if (location != null) result.AddChild (new CSharpTokenNode (Convert (location[2]), "equals".Length), QueryJoinClause.EqualsKeywordRole); - // TODO: equals expression + var inner = join.InnerSelector.Statements.FirstOrDefault () as ContextualReturn; + if (inner != null) + result.AddChild ((Expression)inner.Expr.Accept (this), QueryJoinClause.EqualsExpressionRole); if (location != null) result.AddChild (new CSharpTokenNode (Convert (location[3]), "into".Length), QueryJoinClause.IntoKeywordRole);