Added check against local builtins

This commit is contained in:
arookas 2016-02-22 20:46:08 -05:00
parent f3fc69c870
commit 6fe9de3af5
2 changed files with 11 additions and 0 deletions

View file

@ -16,6 +16,9 @@ namespace arookas {
public override void Compile(sunCompiler compiler) {
var symbol = compiler.Context.DeclareBuiltin(this);
symbol.Modifiers = Modifiers;
if ((symbol.Modifiers & sunSymbolModifiers.Local) != 0) {
throw new sunInvalidModifierException(this[0]); // local builtins are not supported
}
}
}

View file

@ -251,4 +251,12 @@ namespace arookas {
public sunContinueException(sunContinue node)
: base(node) { }
}
class sunInvalidModifierException : sunNodeException<sunNode> {
public override string Message {
get { return "Unsupported modifier in modifier list."; }
}
public sunInvalidModifierException(sunNode node)
: base(node) { }
}
}