Added compile-count property to callable symbols

This commit is contained in:
arookas 2016-02-01 14:58:40 -05:00
parent 08ca27a4b9
commit e12607790f

View file

@ -102,11 +102,16 @@ namespace arookas {
abstract class sunCallableSymbol : sunSymbol {
sunParameterInfo mParameters;
protected int mCompiles;
public sunParameterInfo Parameters {
get { return mParameters; }
}
public int CompileCount {
get { return mCompiles; }
}
protected sunCallableSymbol(string name, sunParameterInfo parameterInfo)
: base(name) {
mParameters = parameterInfo;
@ -136,6 +141,7 @@ namespace arookas {
public override void Compile(sunCompiler compiler) {
// don't compile builtins
++mCompiles;
}
public override sunRelocation CreateCallSite(sunCompiler compiler, int argCount) {
return new sunBuiltinCallSite(this, compiler, argCount);
@ -178,6 +184,7 @@ namespace arookas {
mBody.Compile(compiler);
compiler.Binary.WriteRET0();
compiler.Context.Scopes.Pop();
++mCompiles;
}
public override sunRelocation CreateCallSite(sunCompiler compiler, int argCount) {
return new sunFunctionCallSite(this, compiler, argCount);