Added CreateCallSite

Similar to what I had before. Gonna be utility for sunFunctionCall.
This commit is contained in:
arookas 2016-02-01 12:45:12 -05:00
parent d384899888
commit 53a50fb62c
2 changed files with 9 additions and 1 deletions

View file

@ -52,7 +52,7 @@ namespace arookas {
throw new sunArgumentCountException(this, symbol); throw new sunArgumentCountException(this, symbol);
} }
Arguments.Compile(compiler); Arguments.Compile(compiler);
symbol.OpenCallSite(compiler, Arguments.Count); symbol.OpenRelocation(symbol.CreateCallSite(compiler, Arguments.Count));
if (IsStatement) { if (IsStatement) {
compiler.Binary.WritePOP(); compiler.Binary.WritePOP();
} }

View file

@ -111,6 +111,8 @@ namespace arookas {
: base(name) { : base(name) {
mParameters = parameterInfo; mParameters = parameterInfo;
} }
public abstract sunRelocation CreateCallSite(sunCompiler compiler, int argCount);
} }
class sunBuiltinSymbol : sunCallableSymbol { class sunBuiltinSymbol : sunCallableSymbol {
@ -135,6 +137,9 @@ namespace arookas {
public override void Compile(sunCompiler compiler) { public override void Compile(sunCompiler compiler) {
// don't compile builtins // don't compile builtins
} }
public override sunRelocation CreateCallSite(sunCompiler compiler, int argCount) {
return new sunBuiltinCallSite(this, compiler, argCount);
}
} }
class sunFunctionSymbol : sunCallableSymbol { class sunFunctionSymbol : sunCallableSymbol {
@ -174,6 +179,9 @@ namespace arookas {
compiler.Binary.WriteRET0(); compiler.Binary.WriteRET0();
compiler.Context.Scopes.Pop(); compiler.Context.Scopes.Pop();
} }
public override sunRelocation CreateCallSite(sunCompiler compiler, int argCount) {
return new sunFunctionCallSite(this, compiler, argCount);
}
} }
class sunParameterInfo : IEnumerable<string> { class sunParameterInfo : IEnumerable<string> {