-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* "fix" #480 * memoize this cuz why not, should? speed it up.
- Loading branch information
Showing
4 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
common/src/main/java/com/gregtechceu/gtceu/core/mixins/rhino/InterpreterMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.gregtechceu.gtceu.core.mixins.rhino; | ||
|
||
import dev.latvian.mods.rhino.*; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Coerce; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(value = Interpreter.class, remap = false) | ||
public class InterpreterMixin { | ||
|
||
/** | ||
* {@code @Coerce}'d because the InterpretedFunction class is package-private. It "works". | ||
* What a bodge for an issue that should never even happen, looking at the code. | ||
* God I hate Rhino. | ||
*/ | ||
@SuppressWarnings("InvalidInjectorMethodSignature") | ||
@Inject(method = "interpret", at = @At(value = "INVOKE", target = "Ldev/latvian/mods/rhino/Kit;codeBug()Ljava/lang/RuntimeException;"), remap = false, cancellable = true) | ||
private static void gtceu$doNotCrashPls(@Coerce NativeFunction ifun, Context cx, Scriptable scope, Scriptable thisObj, Object[] args, CallbackInfoReturnable<Object> cir) { | ||
cir.setReturnValue(ScriptRuntime.doTopCall(cx, scope, ifun, thisObj, args, cx.isStrictMode())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters