Browse Source

Fixed location bug.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
b1fa379e6b
  1. 9
      ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs
  2. 1138
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs
  3. 13
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay

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

@ -91,10 +91,10 @@ namespace ICSharpCode.NRefactory.CSharp @@ -91,10 +91,10 @@ namespace ICSharpCode.NRefactory.CSharp
{
AstType result;
if (memberName.Left != null) {
result = new MemberType () { MemberName = memberName.Name };
result = new MemberType () { MemberNameToken = Identifier.Create (memberName.Name, Convert (memberName.Location)) };
result.AddChild (ConvertToType (memberName.Left), MemberType.TargetRole);
} else {
result = new SimpleType () { Identifier = memberName.Name };
result = new SimpleType () { IdentifierToken = Identifier.Create (memberName.Name, Convert (memberName.Location)) };
}
if (memberName.TypeArguments != null && !memberName.TypeArguments.IsEmpty) {
foreach (var arg in memberName.TypeArguments.Args) {
@ -210,7 +210,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -210,7 +210,6 @@ namespace ICSharpCode.NRefactory.CSharp
result.AddChild ((Expression)arg.Expr.Accept (this), Attribute.Roles.Argument);
}
}
Console.WriteLine ("---");
if (attr.NamedArguments != null) {
foreach (NamedArgument na in attr.NamedArguments) {
var newArg = new NamedExpression ();
@ -2207,7 +2206,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -2207,7 +2206,6 @@ namespace ICSharpCode.NRefactory.CSharp
}
var p = (Parameter)parameters.FixedParameters [i];
var location = LocationsBag.GetLocations (p);
ParameterDeclaration parameterDeclarationExpression = new ParameterDeclaration ();
AddAttributeSection (parameterDeclarationExpression, p);
switch (p.ModFlags) {
@ -2229,8 +2227,9 @@ namespace ICSharpCode.NRefactory.CSharp @@ -2229,8 +2227,9 @@ namespace ICSharpCode.NRefactory.CSharp
default:
if (p.HasExtensionMethodModifier) {
parameterDeclarationExpression.ParameterModifier = ParameterModifier.This;
if (location != null)
if (location != null) {
parameterDeclarationExpression.AddChild (new CSharpTokenNode (Convert (location [0]), "this".Length), ParameterDeclaration.Roles.Keyword);
}
}
break;
}

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

File diff suppressed because it is too large Load Diff

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

@ -1626,7 +1626,6 @@ parameter_modifiers @@ -1626,7 +1626,6 @@ parameter_modifiers
: parameter_modifier
{
$$ = $1;
parameterModifierLocation = GetLocation ($1);
}
| parameter_modifiers parameter_modifier
{
@ -1656,14 +1655,14 @@ parameter_modifier @@ -1656,14 +1655,14 @@ parameter_modifier
{
if ((valid_param_mod & ParameterModifierType.Ref) == 0)
Error_ParameterModifierNotValid ("ref", GetLocation ($1));
parameterModifierLocation = GetLocation ($1);
$$ = Parameter.Modifier.REF;
}
| OUT
{
if ((valid_param_mod & ParameterModifierType.Out) == 0)
Error_ParameterModifierNotValid ("out", GetLocation ($1));
parameterModifierLocation = GetLocation ($1);
$$ = Parameter.Modifier.OUT;
}
| THIS
@ -1673,7 +1672,7 @@ parameter_modifier @@ -1673,7 +1672,7 @@ parameter_modifier
if (lang_version <= LanguageVersion.ISO_2)
FeatureIsNotAvailable (GetLocation ($1), "extension methods");
parameterModifierLocation = GetLocation ($1);
$$ = Parameter.Modifier.This;
}
;
@ -4344,7 +4343,7 @@ class_declaration @@ -4344,7 +4343,7 @@ class_declaration
FeatureIsNotAvailable (c.Location, "static classes");
}
lbag.AddMember (current_class, GetModifierLocations (), GetLocation ($4));
lbag.AddMember (current_class, GetModifierLocations ());
push_current_class (c, $3);
}
opt_class_base
@ -4368,9 +4367,9 @@ class_declaration @@ -4368,9 +4367,9 @@ class_declaration
opt_semicolon
{
if ($15 != null) {
lbag.AppendToMember (current_class, GetLocation ($11), GetLocation ($13), GetLocation ($15));
lbag.AppendToMember (current_class, GetLocation ($4), GetLocation ($11), GetLocation ($13), GetLocation ($15));
} else {
lbag.AppendToMember (current_class, GetLocation ($11), GetLocation ($13));
lbag.AppendToMember (current_class, GetLocation ($4), GetLocation ($11), GetLocation ($13));
}
$$ = pop_current_class ();
}

Loading…
Cancel
Save