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);
}
Arguments.Compile(compiler);
symbol.OpenCallSite(compiler, Arguments.Count);
symbol.OpenRelocation(symbol.CreateCallSite(compiler, Arguments.Count));
if (IsStatement) {
compiler.Binary.WritePOP();
}

View file

@ -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<string> {