1 46 package org.codehaus.groovy.ast.expr; 47 48 import org.codehaus.groovy.ast.GroovyCodeVisitor; 49 import org.codehaus.groovy.classgen.AsmClassGenerator2; 50 51 52 58 public class MapEntryExpression extends Expression { 59 private Expression keyExpression; 60 private Expression valueExpression; 61 62 public MapEntryExpression(Expression keyExpression, Expression valueExpression) { 63 this.keyExpression = keyExpression; 64 this.valueExpression = valueExpression; 65 } 66 67 public void visit(GroovyCodeVisitor visitor) { 68 visitor.visitMapEntryExpression(this); 69 } 70 71 public Expression transformExpression(ExpressionTransformer transformer) { 72 return new MapEntryExpression(transformer.transform(keyExpression), transformer.transform(valueExpression)); 73 } 74 75 protected void resolveType(AsmClassGenerator2 resolver) { 76 this.keyExpression.resolve(resolver); 77 this.valueExpression.resolve(resolver); 78 } 79 80 public String toString() { 81 return super.toString() + "(key: " + keyExpression + ", value: " + valueExpression + ")"; 82 } 83 84 public Expression getKeyExpression() { 85 return keyExpression; 86 } 87 88 public Expression getValueExpression() { 89 return valueExpression; 90 } 91 92 } 93 | Popular Tags |