Browse Source

Fixed positioning error.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
f302311c5a
  1. 27
      ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs
  2. 1084
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs
  3. 12
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay

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

@ -909,8 +909,9 @@ namespace ICSharpCode.NRefactory.CSharp @@ -909,8 +909,9 @@ namespace ICSharpCode.NRefactory.CSharp
if (location != null)
newProperty.AddChild (new CSharpTokenNode (Convert (location[0]), 1), MethodDeclaration.Roles.LBrace);
Accessor getAccessor = null;
if (p.Get != null) {
Accessor getAccessor = new Accessor ();
getAccessor = new Accessor ();
AddAttributeSection (getAccessor, p.Get);
var getLocation = LocationsBag.GetMemberLocation (p.Get);
AddModifiers (getAccessor, getLocation);
@ -920,13 +921,13 @@ namespace ICSharpCode.NRefactory.CSharp @@ -920,13 +921,13 @@ namespace ICSharpCode.NRefactory.CSharp
getAccessor.AddChild ((BlockStatement)p.Get.Block.Accept (this), MethodDeclaration.Roles.Body);
} else {
if (getLocation != null && getLocation.Count > 0)
newProperty.AddChild (new CSharpTokenNode (Convert (getLocation[0]), 1), MethodDeclaration.Roles.Semicolon);
getAccessor.AddChild (new CSharpTokenNode (Convert (getLocation[0]), 1), MethodDeclaration.Roles.Semicolon);
}
newProperty.AddChild (getAccessor, PropertyDeclaration.GetterRole);
}
Accessor setAccessor = null;
if (p.Set != null) {
Accessor setAccessor = new Accessor ();
setAccessor = new Accessor ();
AddAttributeSection (setAccessor, p.Set);
var setLocation = LocationsBag.GetMemberLocation (p.Set);
AddModifiers (setAccessor, setLocation);
@ -936,10 +937,24 @@ namespace ICSharpCode.NRefactory.CSharp @@ -936,10 +937,24 @@ namespace ICSharpCode.NRefactory.CSharp
setAccessor.AddChild ((BlockStatement)p.Set.Block.Accept (this), MethodDeclaration.Roles.Body);
} else {
if (setLocation != null && setLocation.Count > 0)
newProperty.AddChild (new CSharpTokenNode (Convert (setLocation[0]), 1), MethodDeclaration.Roles.Semicolon);
setAccessor.AddChild (new CSharpTokenNode (Convert (setLocation[0]), 1), MethodDeclaration.Roles.Semicolon);
}
newProperty.AddChild (setAccessor, PropertyDeclaration.SetterRole);
}
if (getAccessor != null && setAccessor != null) {
if (getAccessor.StartLocation < setAccessor.StartLocation) {
newProperty.AddChild (getAccessor, PropertyDeclaration.GetterRole);
newProperty.AddChild (setAccessor, PropertyDeclaration.SetterRole);
} else {
newProperty.AddChild (setAccessor, PropertyDeclaration.SetterRole);
newProperty.AddChild (getAccessor, PropertyDeclaration.GetterRole);
}
} else {
if (getAccessor != null)
newProperty.AddChild (getAccessor, PropertyDeclaration.GetterRole);
if (setAccessor != null)
newProperty.AddChild (setAccessor, PropertyDeclaration.SetterRole);
}
if (location != null && location.Count > 1) {
newProperty.AddChild (new CSharpTokenNode (Convert (location[1]), 1), MethodDeclaration.Roles.RBrace);
} else {

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

File diff suppressed because it is too large Load Diff

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

@ -1838,7 +1838,6 @@ get_accessor_declaration @@ -1838,7 +1838,6 @@ get_accessor_declaration
}
current_local_parameters = current_property.Get.ParameterInfo;
lbag.AddMember (current_property.Get, GetModifierLocations ());
lexer.PropertyParsing = false;
}
accessor_body
@ -1849,7 +1848,10 @@ get_accessor_declaration @@ -1849,7 +1848,10 @@ get_accessor_declaration
if (current_container.Kind == MemberKind.Interface) {
report.Error (531, current_property.Get.Block.StartLocation,
"`{0}': interface members cannot have a definition", current_property.Get.GetSignatureForError ());
}
}
lbag.AddMember (current_property.Get, GetModifierLocations ());
} else {
lbag.AddMember (current_property.Get, GetModifierLocations (), savedLocation);
}
current_local_parameters = null;
@ -1886,7 +1888,6 @@ set_accessor_declaration @@ -1886,7 +1888,6 @@ set_accessor_declaration
}
current_local_parameters = current_property.Set.ParameterInfo;
lbag.AddMember (current_property.Set, GetModifierLocations ());
lexer.PropertyParsing = false;
}
accessor_body
@ -1898,6 +1899,9 @@ set_accessor_declaration @@ -1898,6 +1899,9 @@ set_accessor_declaration
report.Error (531, current_property.Set.Block.StartLocation,
"`{0}': interface members cannot have a definition", current_property.Set.GetSignatureForError ());
}
lbag.AddMember (current_property.Set, GetModifierLocations ());
} else {
lbag.AddMember (current_property.Set, GetModifierLocations (), savedLocation);
}
current_local_parameters = null;
@ -1913,7 +1917,7 @@ accessor_body @@ -1913,7 +1917,7 @@ accessor_body
: block
| SEMICOLON
{
lbag.AppendToMember (lbag.LastMember, GetLocation ($1));
savedLocation = GetLocation ($1);
$$ = null;
}
| error

Loading…
Cancel
Save