1 package org.simantics.scl.compiler.constants;
3 import org.cojen.classfile.TypeDesc;
4 import org.objectweb.asm.Label;
5 import org.simantics.scl.compiler.internal.codegen.continuations.Cont;
6 import org.simantics.scl.compiler.internal.codegen.references.IVal;
7 import org.simantics.scl.compiler.internal.codegen.utils.Constants;
8 import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;
9 import org.simantics.scl.compiler.internal.codegen.utils.TransientClassBuilder;
10 import org.simantics.scl.compiler.types.Types;
12 public class StringConstant extends Constant {
15 public StringConstant(String value) {
21 public void push(MethodBuilder mb) {
22 mb.loadConstant(value);
26 public String toString() {
27 return "\"" + value + "\"";
30 public String getValue() {
35 public int hashCode() {
36 return value.hashCode();
40 public boolean equals(Object obj) {
45 if (getClass() != obj.getClass())
47 StringConstant other = (StringConstant) obj;
48 return value.equals(other.value);
52 public void deconstruct(MethodBuilder mb, IVal parameter, Cont success,
54 mb.loadConstant(value);
55 mb.push(parameter, Types.STRING);
56 mb.invokeVirtual(TypeDesc.STRING, "equals", TypeDesc.BOOLEAN, Constants.OBJECTS[1]);
57 mb.ifZeroComparisonBranch(failure, "==");
61 public int constructorTag() {
66 public Object realizeValue(TransientClassBuilder classBuilder) {