From ce525f0a78e59220fd8bebbe1c33b6d97dc777b6 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Wed, 29 Jul 2015 17:45:22 +0300 Subject: [PATCH] Add support for reference equality condition emitter --- .../org/teavm/model/emit/ValueEmitter.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/teavm-core/src/main/java/org/teavm/model/emit/ValueEmitter.java b/teavm-core/src/main/java/org/teavm/model/emit/ValueEmitter.java index b486ea3d6..4f0ed7283 100644 --- a/teavm-core/src/main/java/org/teavm/model/emit/ValueEmitter.java +++ b/teavm-core/src/main/java/org/teavm/model/emit/ValueEmitter.java @@ -580,11 +580,27 @@ public class ValueEmitter { } public ConditionEmitter isEqualTo(ValueEmitter other) { - return new ConditionEmitter(pe, fork(BinaryBranchingCondition.NOT_EQUAL, other)); + return new ConditionEmitter(pe, fork(BinaryBranchingCondition.EQUAL, other)); } public ConditionEmitter isNotEqualTo(ValueEmitter other) { - return new ConditionEmitter(pe, fork(BinaryBranchingCondition.EQUAL, other)); + return new ConditionEmitter(pe, fork(BinaryBranchingCondition.NOT_EQUAL, other)); + } + + public ConditionEmitter isSame(ValueEmitter other) { + return new ConditionEmitter(pe, fork(BinaryBranchingCondition.REFERENCE_EQUAL, other)); + } + + public ConditionEmitter isNotSame(ValueEmitter other) { + return new ConditionEmitter(pe, fork(BinaryBranchingCondition.REFERENCE_NOT_EQUAL, other)); + } + + public ConditionEmitter isNull() { + return isSame(pe.constantNull(getType())); + } + + public ConditionEmitter isNotNull() { + return isNotSame(pe.constantNull(getType())); } public ConditionEmitter isGreaterThan(ValueEmitter other) {