From 53a50fb62c9b70769338fc1fa626dbdc8dc778a4 Mon Sep 17 00:00:00 2001 From: arookas Date: Mon, 1 Feb 2016 12:45:12 -0500 Subject: [PATCH] Added CreateCallSite Similar to what I had before. Gonna be utility for sunFunctionCall. --- ssc/ast/nodes.functions.cs | 2 +- ssc/symbol.cs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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 {