Make method_call benchmark use inheritance.
This also fixes a bug where constructors weren't being bound correctly, and eliminates some unneeded instructions when compiling ifs. I also tweaked the other method_call languages to match Wren's. Since Wren needs to do a super call to get to the parent _count, the other languages do now too. This is nice too because it means we're benchmarking super calls.
This commit is contained in:
+13
-8
@@ -1805,20 +1805,25 @@ void statement(Compiler* compiler)
|
||||
// Compile the then branch.
|
||||
block(compiler);
|
||||
|
||||
// Jump over the else branch when the if branch is taken.
|
||||
emit(compiler, CODE_JUMP);
|
||||
int elseJump = emit(compiler, 255);
|
||||
|
||||
patchJump(compiler, ifJump);
|
||||
|
||||
// Compile the else branch if there is one.
|
||||
if (match(compiler, TOKEN_ELSE))
|
||||
{
|
||||
// Jump over the else branch when the if branch is taken.
|
||||
emit(compiler, CODE_JUMP);
|
||||
int elseJump = emit(compiler, 255);
|
||||
|
||||
patchJump(compiler, ifJump);
|
||||
|
||||
block(compiler);
|
||||
|
||||
// Patch the jump over the else.
|
||||
patchJump(compiler, elseJump);
|
||||
}
|
||||
else
|
||||
{
|
||||
patchJump(compiler, ifJump);
|
||||
}
|
||||
|
||||
// Patch the jump over the else.
|
||||
patchJump(compiler, elseJump);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user