From 4465839e98282ec03e58da4f81b88e6e8d6ee099 Mon Sep 17 00:00:00 2001 From: mike Date: Wed, 14 Mar 2012 16:46:54 +0100 Subject: [PATCH] Fixed error caused by Root role. Ok now I know why it needs to be there :) --- ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs | 7 ++++++- ICSharpCode.NRefactory.CSharp/Ast/Roles.cs | 4 ---- ICSharpCode.NRefactory/Role.cs | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs index fb12b2be3c..141dc67795 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs @@ -35,6 +35,11 @@ namespace ICSharpCode.NRefactory.CSharp { public abstract class AstNode : AbstractAnnotatable, PatternMatching.INode { + /// + /// Root of an abstract syntax tree. + /// + public static readonly Role Root = new Role ("Root"); + #region Null public static readonly AstNode Null = new NullAstNode (); @@ -124,7 +129,7 @@ namespace ICSharpCode.NRefactory.CSharp AstNode nextSibling; AstNode firstChild; AstNode lastChild; - Role role = Roles.Root; + Role role = Root; public abstract NodeType NodeType { get; diff --git a/ICSharpCode.NRefactory.CSharp/Ast/Roles.cs b/ICSharpCode.NRefactory.CSharp/Ast/Roles.cs index 8f3562ccad..98be008b56 100644 --- a/ICSharpCode.NRefactory.CSharp/Ast/Roles.cs +++ b/ICSharpCode.NRefactory.CSharp/Ast/Roles.cs @@ -30,10 +30,6 @@ namespace ICSharpCode.NRefactory.CSharp { public static class Roles { - /// - /// Root of an abstract syntax tree. - /// - public static readonly Role Root = new Role ("Root"); // some pre defined constants for common roles public static readonly Role Identifier = new Role ("Identifier", CSharp.Identifier.Null); diff --git a/ICSharpCode.NRefactory/Role.cs b/ICSharpCode.NRefactory/Role.cs index 9f81457685..cde1462e7a 100644 --- a/ICSharpCode.NRefactory/Role.cs +++ b/ICSharpCode.NRefactory/Role.cs @@ -70,6 +70,8 @@ namespace ICSharpCode.NRefactory { if (name == null) throw new ArgumentNullException("name"); + if (nullObject == null) + throw new ArgumentNullException ("nullObject"); this.nullObject = nullObject; this.name = name; }