Added error message for constant declarations.
This commit is contained in:
parent
26d742dda5
commit
2f6058d49f
2 changed files with 9 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -259,4 +259,12 @@ namespace arookas {
|
|||
public sunInvalidModifierException(sunNode node)
|
||||
: base(node) { }
|
||||
}
|
||||
class sunConstantDeclarationException : sunNodeException<sunVariableDeclaration> {
|
||||
public override string Message {
|
||||
get { return "Constant variables must be assigned a value."; }
|
||||
}
|
||||
|
||||
public sunConstantDeclarationException(sunVariableDeclaration node)
|
||||
: base(node) { }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue