diff options
author | 2015-11-09 17:27:01 +0000 | |
---|---|---|
committer | 2015-11-10 10:23:09 +0000 | |
commit | 30bd7dea2a2a426b6fca5ffd8bd3a6d0ab9b8f36 (patch) | |
tree | 5f95cc27c09af5bfd721942b46288eae0b526cc1 /src/main/java/com/google/devtools/build/lib/syntax/compiler | |
parent | a1c377b0a6e7ecc3ad69c1577aec3706ca2a7512 (diff) |
Compile binary operations to byte code.
--
MOS_MIGRATED_REVID=107391382
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/syntax/compiler')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/syntax/compiler/Jump.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/compiler/Jump.java b/src/main/java/com/google/devtools/build/lib/syntax/compiler/Jump.java index e13b1e6fa8..7ab6379d19 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/compiler/Jump.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/compiler/Jump.java @@ -13,6 +13,7 @@ // limitations under the License. package com.google.devtools.build.lib.syntax.compiler; +import com.google.devtools.build.lib.syntax.Operator; import net.bytebuddy.implementation.Implementation.Context; import net.bytebuddy.implementation.bytecode.StackManipulation; @@ -126,6 +127,21 @@ public class Jump implements StackManipulation { GREATER_EQUAL, GREATER, LESS_EQUAL; + + public static PrimitiveComparison forOperator(Operator operator) { + switch (operator) { + case LESS: + return LESS; + case LESS_EQUALS: + return PrimitiveComparison.LESS_EQUAL; + case GREATER: + return GREATER; + case GREATER_EQUALS: + return GREATER_EQUAL; + default: + throw new Error("unreachable code"); + } + } } /** |