Browse Source

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

pull/205/merge
Daniel Grunwald 14 years ago
parent
commit
f450aca351
  1. 13
      NRefactory/ICSharpCode.NRefactory.CSharp/Ast/Identifier.cs

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

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

Loading…
Cancel
Save