Added CreateCallSite
Similar to what I had before. Gonna be utility for sunFunctionCall.
This commit is contained in:
parent
d384899888
commit
53a50fb62c
2 changed files with 9 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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> {
|
||||
|
|
Loading…
Reference in a new issue