From 6fe9de3af5cdea2ab57936a4ce17cf8a929cc2df Mon Sep 17 00:00:00 2001 From: arookas Date: Mon, 22 Feb 2016 20:46:08 -0500 Subject: [PATCH] Added check against local builtins --- ssc/ast/nodes.functions.cs | 3 +++ ssc/exceptions.cs | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/ssc/ast/nodes.functions.cs b/ssc/ast/nodes.functions.cs index ad06105..be78dfb 100644 --- a/ssc/ast/nodes.functions.cs +++ b/ssc/ast/nodes.functions.cs @@ -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 + } } } diff --git a/ssc/exceptions.cs b/ssc/exceptions.cs index 3c76c69..26b004e 100644 --- a/ssc/exceptions.cs +++ b/ssc/exceptions.cs @@ -251,4 +251,12 @@ namespace arookas { public sunContinueException(sunContinue node) : base(node) { } } + class sunInvalidModifierException : sunNodeException { + public override string Message { + get { return "Unsupported modifier in modifier list."; } + } + + public sunInvalidModifierException(sunNode node) + : base(node) { } + } }