Browse Source

Fixed some tests broken by the mcs update.

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

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

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

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

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

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

File diff suppressed because it is too large Load Diff

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

@ -774,8 +774,15 @@ attribute
if (tne.HasTypeArguments) { if (tne.HasTypeArguments) {
report.Error (404, tne.Location, "Attributes cannot be generic"); 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)); $$ = 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
method.DocComment = Lexer.consume_doc_comment (); method.DocComment = Lexer.consume_doc_comment ();
StoreModifierLocation (Modifiers.PARTIAL, GetLocation ($3)); StoreModifierLocation (Modifiers.PARTIAL, GetLocation ($3));
lbag.AddMember (method, mod_locations, GetLocation ($7), GetLocation ($10)); lbag.AddMember (method, GetModifierLocations (), GetLocation ($7), GetLocation ($10));
$$ = method; $$ = method;
} }
| opt_attributes | opt_attributes
@ -2209,7 +2216,7 @@ constructor_declarator
} }
} }
lbag.AddMember (c, mod_locations, GetLocation ($5), GetLocation ($7)); lbag.AddMember (c, GetModifierLocations (), GetLocation ($5), GetLocation ($7));
$$ = c; $$ = c;
// //
@ -2229,9 +2236,9 @@ constructor_declarator
"`{0}': static constructor cannot have an explicit `this' or `base' constructor call", "`{0}': static constructor cannot have an explicit `this' or `base' constructor call",
c.GetSignatureForError ()); c.GetSignatureForError ());
} }
lbag.AddMember (c, GetModifierLocations (), GetLocation ($5), GetLocation ($7));
} }
lbag.AddMember (c, GetModifierLocations (), GetLocation ($5), GetLocation ($7));
$$ = $8; $$ = $8;
} }
; ;
@ -6786,6 +6793,7 @@ void start_anonymous (bool isLambda, ParametersCompiled parameters, bool isAsync
current_anonymous_method = new AnonymousMethodExpression (loc); current_anonymous_method = new AnonymousMethodExpression (loc);
} }
current_anonymous_method.IsAsync = isAsync;
async_block = isAsync; async_block = isAsync;
// Force the next block to be created as a ToplevelBlock // Force the next block to be created as a ToplevelBlock

Loading…
Cancel
Save