Browse Source

C# AST: when setting a string property to null or an empty string, remove the corresponding identifier token.

newNRvisualizers
Daniel Grunwald 14 years ago
parent
commit
f0bfded6cb
  1. 13
      ICSharpCode.NRefactory.CSharp/Ast/Identifier.cs

13
ICSharpCode.NRefactory.CSharp/Ast/Identifier.cs

@ -113,17 +113,18 @@ namespace ICSharpCode.NRefactory.CSharp @@ -113,17 +113,18 @@ namespace ICSharpCode.NRefactory.CSharp
public static Identifier Create (string name, TextLocation location)
{
if (name == null)
throw new ArgumentNullException("name");
if (name.Length > 0 && name[0] == '@')
if (string.IsNullOrEmpty(name))
return Identifier.Null;
if (name[0] == '@')
return new VerbatimIdentifier(name.Substring (1), location);
return new Identifier (name, location);
else
return new Identifier (name, location);
}
public static Identifier Create (string name, TextLocation location, bool isVerbatim)
{
if (name == null)
throw new ArgumentNullException("name");
if (string.IsNullOrEmpty(name))
return Identifier.Null;
if (isVerbatim)
return new VerbatimIdentifier(name, location);

Loading…
Cancel
Save