Added error message for constant declarations.

This commit is contained in:
arookas 2016-03-08 02:16:13 -05:00
parent 26d742dda5
commit 2f6058d49f
2 changed files with 9 additions and 1 deletions

View file

@ -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);
}
}
}

View file

@ -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) { }
}
}