From f0bfded6cb7c7efc9046527e589a45c346c1222a Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 17 Sep 2011 16:18:38 +0200 Subject: [PATCH] C# AST: when setting a string property to null or an empty string, remove the corresponding identifier token. --- ICSharpCode.NRefactory.CSharp/Ast/Identifier.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Ast/Identifier.cs b/ICSharpCode.NRefactory.CSharp/Ast/Identifier.cs index 0938d9f0c3..3c692706d1 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/Identifier.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Identifier.cs @@ -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);