Browse Source

Fixed some tests broken by the mcs update.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
5d81799cab
  1. 41
      ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs
  2. 5
      ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs
  3. 1338
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs
  4. 16
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay

41
ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs

@ -835,13 +835,8 @@ namespace ICSharpCode.NRefactory.CSharp @@ -835,13 +835,8 @@ namespace ICSharpCode.NRefactory.CSharp
var location = LocationsBag.GetMemberLocation (indexer);
AddModifiers (newIndexer, location);
newIndexer.AddChild (ConvertToType (indexer.TypeName), IndexerDeclaration.Roles.Type);
AddExplicitInterface (newIndexer, indexer.MemberName);
var name = indexer.MemberName;
if (name.Left != null) {
newIndexer.AddChild (ConvertToType (name.Left), IndexerDeclaration.PrivateImplementationTypeRole);
var privateImplTypeLoc = LocationsBag.GetLocations (name.Left);
if (privateImplTypeLoc != null)
newIndexer.AddChild (new CSharpTokenNode (Convert (privateImplTypeLoc[0]), 1), MethodDeclaration.Roles.Dot);
}
newIndexer.AddChild (Identifier.Create ("this", Convert (name.Location)), IndexerDeclaration.Roles.Identifier);
if (location != null)
@ -901,12 +896,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -901,12 +896,7 @@ namespace ICSharpCode.NRefactory.CSharp
var location = LocationsBag.GetMemberLocation (m);
AddModifiers (newMethod, location);
newMethod.AddChild (ConvertToType (m.TypeName), AstNode.Roles.Type);
if (m.MethodName.Left != null) {
newMethod.AddChild (ConvertToType (m.MethodName.Left), MethodDeclaration.PrivateImplementationTypeRole);
var privateImplTypeLoc = LocationsBag.GetLocations (m.MethodName.Left);
if (privateImplTypeLoc != null)
newMethod.AddChild (new CSharpTokenNode (Convert (privateImplTypeLoc[0]), 1), MethodDeclaration.Roles.Dot);
}
AddExplicitInterface (newMethod, m.MethodName);
newMethod.AddChild (Identifier.Create (m.MethodName.Name, Convert (m.Location)), AstNode.Roles.Identifier);
AddTypeParameters (newMethod, m.MemberName);
@ -1002,13 +992,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1002,13 +992,7 @@ namespace ICSharpCode.NRefactory.CSharp
var location = LocationsBag.GetMemberLocation (p);
AddModifiers (newProperty, location);
newProperty.AddChild (ConvertToType (p.TypeName), AstNode.Roles.Type);
if (p.MemberName.Left != null) {
newProperty.AddChild (ConvertToType (p.MemberName.Left), PropertyDeclaration.PrivateImplementationTypeRole);
var privateImplTypeLoc = LocationsBag.GetLocations (p.MemberName.Left);
if (privateImplTypeLoc != null)
newProperty.AddChild (new CSharpTokenNode (Convert (privateImplTypeLoc[0]), 1), MethodDeclaration.Roles.Dot);
}
AddExplicitInterface (newProperty, p.MemberName);
newProperty.AddChild (Identifier.Create (p.MemberName.Name, Convert (p.Location)), PropertyDeclaration.Roles.Identifier);
if (location != null)
@ -1172,6 +1156,17 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1172,6 +1156,17 @@ namespace ICSharpCode.NRefactory.CSharp
typeStack.Peek ().AddChild (newEvent, TypeDeclaration.MemberRole);
}
void AddExplicitInterface (AstNode parent, MemberName memberName)
{
if (memberName == null || memberName.ExplicitInterface == null)
return;
parent.AddChild (ConvertToType (memberName.ExplicitInterface), MemberDeclaration.PrivateImplementationTypeRole);
var privateImplTypeLoc = LocationsBag.GetLocations (memberName.ExplicitInterface);
if (privateImplTypeLoc != null)
parent.AddChild (new CSharpTokenNode (Convert (privateImplTypeLoc[0]), 1), MethodDeclaration.Roles.Dot);
}
public override void Visit (EventProperty ep)
{
CustomEventDeclaration newEvent = new CustomEventDeclaration ();
@ -1182,12 +1177,8 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1182,12 +1177,8 @@ namespace ICSharpCode.NRefactory.CSharp
if (location != null)
newEvent.AddChild (new CSharpTokenNode (Convert (location[0]), "event".Length), CustomEventDeclaration.Roles.Keyword);
newEvent.AddChild (ConvertToType (ep.TypeName), CustomEventDeclaration.Roles.Type);
if (ep.MemberName.Left != null) {
newEvent.AddChild (ConvertToType (ep.MemberName.Left), CustomEventDeclaration.PrivateImplementationTypeRole);
var privateImplTypeLoc = LocationsBag.GetLocations (ep.MemberName.Left);
if (privateImplTypeLoc != null)
newEvent.AddChild (new CSharpTokenNode (Convert (privateImplTypeLoc[0]), 1), MethodDeclaration.Roles.Dot);
}
AddExplicitInterface (newEvent, ep.MemberName);
newEvent.AddChild (Identifier.Create (ep.MemberName.Name, Convert (ep.Location)), CustomEventDeclaration.Roles.Identifier);

5
ICSharpCode.NRefactory.CSharp/Parser/mcs/anonymous.cs

@ -16,6 +16,7 @@ using System.Collections.Generic; @@ -16,6 +16,7 @@ using System.Collections.Generic;
#if STATIC
using IKVM.Reflection;
using IKVM.Reflection.Emit;
using System.Diagnostics;
#else
using System.Reflection;
using System.Reflection.Emit;
@ -913,10 +914,10 @@ namespace Mono.CSharp { @@ -913,10 +914,10 @@ namespace Mono.CSharp {
return Block.Parameters;
}
}
public bool IsAsync {
get;
private set;
internal set;
}
#endregion

1338
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs

File diff suppressed because it is too large Load Diff

16
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay

@ -774,8 +774,15 @@ attribute @@ -774,8 +774,15 @@ attribute
if (tne.HasTypeArguments) {
report.Error (404, tne.Location, "Attributes cannot be generic");
}
Arguments [] arguments = (Arguments []) $3;
$$ = new Attribute (current_attr_target, tne, (Arguments[]) $3, GetLocation ($1), lexer.IsEscapedIdentifier (tne));
if (arguments != null) {
attributeArgumentCommas.Insert (0, savedAttrParenOpenLocation);
attributeArgumentCommas.Add (savedAttrParenCloseLocation);
lbag.AddLocation ($$, attributeArgumentCommas);
attributeArgumentCommas.Clear ();
}
}
;
@ -1345,7 +1352,7 @@ method_header @@ -1345,7 +1352,7 @@ method_header
method.DocComment = Lexer.consume_doc_comment ();
StoreModifierLocation (Modifiers.PARTIAL, GetLocation ($3));
lbag.AddMember (method, mod_locations, GetLocation ($7), GetLocation ($10));
lbag.AddMember (method, GetModifierLocations (), GetLocation ($7), GetLocation ($10));
$$ = method;
}
| opt_attributes
@ -2209,7 +2216,7 @@ constructor_declarator @@ -2209,7 +2216,7 @@ constructor_declarator
}
}
lbag.AddMember (c, mod_locations, GetLocation ($5), GetLocation ($7));
lbag.AddMember (c, GetModifierLocations (), GetLocation ($5), GetLocation ($7));
$$ = c;
//
@ -2229,9 +2236,9 @@ constructor_declarator @@ -2229,9 +2236,9 @@ constructor_declarator
"`{0}': static constructor cannot have an explicit `this' or `base' constructor call",
c.GetSignatureForError ());
}
lbag.AddMember (c, GetModifierLocations (), GetLocation ($5), GetLocation ($7));
}
lbag.AddMember (c, GetModifierLocations (), GetLocation ($5), GetLocation ($7));
$$ = $8;
}
;
@ -6786,7 +6793,8 @@ void start_anonymous (bool isLambda, ParametersCompiled parameters, bool isAsync @@ -6786,7 +6793,8 @@ void start_anonymous (bool isLambda, ParametersCompiled parameters, bool isAsync
current_anonymous_method = new AnonymousMethodExpression (loc);
}
current_anonymous_method.IsAsync = isAsync;
async_block = isAsync;
// Force the next block to be created as a ToplevelBlock
parsing_anonymous_method = true;

Loading…
Cancel
Save