diff --git a/ssc/ast/nodes.functions.cs b/ssc/ast/nodes.functions.cs index d0994e0..e0817e6 100644 --- a/ssc/ast/nodes.functions.cs +++ b/ssc/ast/nodes.functions.cs @@ -52,7 +52,7 @@ namespace arookas { throw new sunArgumentCountException(this, symbol); } Arguments.Compile(compiler); - symbol.OpenCallSite(compiler, Arguments.Count); + symbol.OpenRelocation(symbol.CreateCallSite(compiler, Arguments.Count)); if (IsStatement) { compiler.Binary.WritePOP(); } diff --git a/ssc/symbol.cs b/ssc/symbol.cs index a3e57b1..e5bdc43 100644 --- a/ssc/symbol.cs +++ b/ssc/symbol.cs @@ -111,6 +111,8 @@ namespace arookas { : base(name) { mParameters = parameterInfo; } + + public abstract sunRelocation CreateCallSite(sunCompiler compiler, int argCount); } class sunBuiltinSymbol : sunCallableSymbol { @@ -135,6 +137,9 @@ namespace arookas { public override void Compile(sunCompiler compiler) { // don't compile builtins } + public override sunRelocation CreateCallSite(sunCompiler compiler, int argCount) { + return new sunBuiltinCallSite(this, compiler, argCount); + } } class sunFunctionSymbol : sunCallableSymbol { @@ -174,6 +179,9 @@ namespace arookas { compiler.Binary.WriteRET0(); compiler.Context.Scopes.Pop(); } + public override sunRelocation CreateCallSite(sunCompiler compiler, int argCount) { + return new sunFunctionCallSite(this, compiler, argCount); + } } class sunParameterInfo : IEnumerable {