diff --git a/ssc/ast/nodes.variables.cs b/ssc/ast/nodes.variables.cs index 3c0596d..88043fd 100644 --- a/ssc/ast/nodes.variables.cs +++ b/ssc/ast/nodes.variables.cs @@ -35,7 +35,7 @@ var symbol = compiler.Context.DeclareVariable(this); symbol.Modifiers = Modifiers; if ((Modifiers & sunSymbolModifiers.Constant) != 0) { - throw new sunInvalidModifierException(this[0]); + throw new sunConstantDeclarationException(this); } } } diff --git a/ssc/exceptions.cs b/ssc/exceptions.cs index 26b004e..27298df 100644 --- a/ssc/exceptions.cs +++ b/ssc/exceptions.cs @@ -259,4 +259,12 @@ namespace arookas { public sunInvalidModifierException(sunNode node) : base(node) { } } + class sunConstantDeclarationException : sunNodeException { + public override string Message { + get { return "Constant variables must be assigned a value."; } + } + + public sunConstantDeclarationException(sunVariableDeclaration node) + : base(node) { } + } }