aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax/compiler/ByteCodeMethodCalls.java
diff options
context:
space:
mode:
authorGravatar Francois-Rene Rideau <tunes@google.com>2016-01-28 18:36:22 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-01-29 14:41:09 +0000
commitc0a8c58b9230a1f5d76269eb7dc6b11e18f19686 (patch)
treefe0f0c4161987fc24db93d6caa08cfc8228ec8c3 /src/main/java/com/google/devtools/build/lib/syntax/compiler/ByteCodeMethodCalls.java
parent84450b8c1a6d9a5cb47032d00aac851741fc94ad (diff)
Make Skylark dicts mutable
Represent Skylark dict using a new subclass SkylarkDict<K, V> of Map<K, V>. Back it with a TreeMap to provide a deterministic iteration order. Also make SkylarkList generic in its element type <E>. Have Artifact implement Comparable<Object> so it can be used as TreeMap key. -- MOS_MIGRATED_REVID=113277489
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/syntax/compiler/ByteCodeMethodCalls.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/compiler/ByteCodeMethodCalls.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/compiler/ByteCodeMethodCalls.java b/src/main/java/com/google/devtools/build/lib/syntax/compiler/ByteCodeMethodCalls.java
index 55e9cc1bf6..28bd503ed5 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/compiler/ByteCodeMethodCalls.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/compiler/ByteCodeMethodCalls.java
@@ -15,6 +15,9 @@ package com.google.devtools.build.lib.syntax.compiler;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import com.google.devtools.build.lib.events.Location;
+import com.google.devtools.build.lib.syntax.Environment;
+import com.google.devtools.build.lib.syntax.SkylarkDict;
import net.bytebuddy.implementation.bytecode.StackManipulation;
@@ -71,6 +74,21 @@ public class ByteCodeMethodCalls {
}
/**
+ * Byte code invocations for {@link SkylarkDict}.
+ */
+ public static class BCSkylarkDict {
+ public static final StackManipulation of =
+ ByteCodeUtils.invoke(SkylarkDict.class, "of", Environment.class);
+
+ public static final StackManipulation copyOf =
+ ByteCodeUtils.invoke(SkylarkDict.class, "copyOf", Environment.class, Map.class);
+
+ public static final StackManipulation put =
+ ByteCodeUtils.invoke(SkylarkDict.class, "put",
+ Object.class, Object.class, Location.class, Environment.class);
+ }
+
+ /**
* Byte code invocations for {@link ImmutableList}.
*/
public static class BCImmutableList {