This repository has been archived by the owner on Oct 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fold boolean and null constants, make
hasContext
and `structContain…
…sKey` VarArgs.
- Loading branch information
Showing
12 changed files
with
112 additions
and
14 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
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
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
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
14 changes: 14 additions & 0 deletions
14
src/main/java/me/melontini/commander/impl/mixin/evalex/EvaluationValueAccessor.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,14 @@ | ||
package me.melontini.commander.impl.mixin.evalex; | ||
|
||
import com.ezylang.evalex.data.EvaluationValue; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(value = EvaluationValue.class, remap = false) | ||
public interface EvaluationValueAccessor { | ||
|
||
@Invoker("<init>") | ||
static EvaluationValue commander$init(Object value, EvaluationValue.DataType dataType) { | ||
throw new IllegalStateException(); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/me/melontini/commander/impl/mixin/evalex/EvaluationValueMixin.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,28 @@ | ||
package me.melontini.commander.impl.mixin.evalex; | ||
|
||
import com.ezylang.evalex.data.EvaluationValue; | ||
import me.melontini.commander.impl.expression.EvalUtils; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
|
||
@Mixin(value = EvaluationValue.class, remap = false) | ||
public class EvaluationValueMixin { | ||
|
||
/** | ||
* @author melontini | ||
* @reason fold boolean constants | ||
*/ | ||
@Overwrite | ||
public static EvaluationValue booleanValue(Boolean value) { | ||
return value ? EvalUtils.TRUE : EvalUtils.FALSE; | ||
} | ||
|
||
/** | ||
* @author melontini | ||
* @reason fold null constant | ||
*/ | ||
@Overwrite | ||
public static EvaluationValue nullValue() { | ||
return EvalUtils.NULL; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/me/melontini/commander/impl/mixin/evalex/ExpressionMixin.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,24 @@ | ||
package me.melontini.commander.impl.mixin.evalex; | ||
|
||
import com.ezylang.evalex.Expression; | ||
import com.ezylang.evalex.config.ExpressionConfiguration; | ||
import com.ezylang.evalex.data.EvaluationValue; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(value = Expression.class, remap = false) | ||
public class ExpressionMixin { | ||
|
||
@Shadow @Final private ExpressionConfiguration configuration; | ||
|
||
/** | ||
* @author melontini | ||
* @reason avoid double object construction | ||
*/ | ||
@Overwrite | ||
public EvaluationValue convertValue(Object value) { | ||
return configuration.getEvaluationValueConverter().convertObject(value, configuration); | ||
} | ||
} |
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