Browse Source

Fixed position of unbound type arguments.

pull/32/merge
Mike Krüger 13 years ago
parent
commit
a3edf1ac62
  1. 764
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.cs
  2. 18
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-parser.jay
  3. 14
      ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs

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

File diff suppressed because it is too large Load Diff

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

@ -3804,15 +3804,17 @@ unbound_type_name @@ -3804,15 +3804,17 @@ unbound_type_name
: identifier_inside_body generic_dimension
{
var lt = (Tokenizer.LocatedToken) $1;
$$ = new SimpleName (lt.Value, (int) $2, lt.Location);
var sn = new SimpleName (lt.Value, (int) $2, lt.Location);
$$ = sn;
lbag.AddLocation (sn.TypeArguments, Lexer.GetGenericDimensionLocations ());
}
| qualified_alias_member identifier_inside_body generic_dimension
{
var lt1 = (Tokenizer.LocatedToken) $1;
var lt2 = (Tokenizer.LocatedToken) $2;
$$ = new QualifiedAliasMember (lt1.Value, lt2.Value, (int) $3, lt1.Location);
var qam = new QualifiedAliasMember (lt1.Value, lt2.Value, (int) $3, lt1.Location);
$$ = qam;
lbag.AddLocation (qam.TypeArguments, Lexer.GetGenericDimensionLocations ());
lbag.AddLocation ($$, GetLocation ($2));
}
| unbound_type_name DOT identifier_inside_body
@ -3827,9 +3829,11 @@ unbound_type_name @@ -3827,9 +3829,11 @@ unbound_type_name
{
var lt = (Tokenizer.LocatedToken) $3;
$$ = new MemberAccess ((Expression) $1, lt.Value, (int) $4, lt.Location) {
var ma = new MemberAccess ((Expression) $1, lt.Value, (int) $4, lt.Location) {
DotLocation = GetLocation ($2)
};
$$ = ma;
lbag.AddLocation (ma.TypeArguments, Lexer.GetGenericDimensionLocations ());
}
| namespace_or_type_expr DOT identifier_inside_body generic_dimension
{
@ -3838,9 +3842,11 @@ unbound_type_name @@ -3838,9 +3842,11 @@ unbound_type_name
Error_TypeExpected (GetLocation ($4));
var lt = (Tokenizer.LocatedToken) $3;
$$ = new MemberAccess (tne, lt.Value, (int) $4, lt.Location) {
var ma = new MemberAccess (tne, lt.Value, (int) $4, lt.Location) {
DotLocation = GetLocation ($2)
};
$$ = ma;
lbag.AddLocation (ma.TypeArguments, Lexer.GetGenericDimensionLocations ());
}
;

14
ICSharpCode.NRefactory.CSharp/Parser/mcs/cs-tokenizer.cs

@ -1182,16 +1182,26 @@ namespace Mono.CSharp @@ -1182,16 +1182,26 @@ namespace Mono.CSharp
return false;
}
List<Location> genericLocs = new List<Location> ();
public List<Location> GetGenericDimensionLocations ()
{
return genericLocs;
}
bool parse_generic_dimension (out int dimension)
{
dimension = 1;
again:
int the_token = token ();
if (the_token == Token.OP_GENERICS_GT)
if (the_token == Token.OP_GENERICS_GT) {
genericLocs.Add (Location);
return true;
}
else if (the_token == Token.COMMA) {
dimension++;
genericLocs.Add (Location);
goto again;
}
@ -3674,6 +3684,8 @@ namespace Mono.CSharp @@ -3674,6 +3684,8 @@ namespace Mono.CSharp
{
int d;
if (handle_typeof) {
genericLocs.Clear ();
genericLocs.Add (Location);
PushPosition ();
if (parse_generic_dimension (out d)) {
val = d;

Loading…
Cancel
Save