001 package railo.transformer.bytecode.expression.var; 002 003 import org.objectweb.asm.Type; 004 005 import railo.transformer.bytecode.BytecodeContext; 006 import railo.transformer.bytecode.BytecodeException; 007 import railo.transformer.bytecode.cast.Cast; 008 import railo.transformer.bytecode.expression.Expression; 009 import railo.transformer.bytecode.expression.ExpressionBase; 010 import railo.transformer.bytecode.util.ExpressionUtil; 011 012 013 public class Argument extends ExpressionBase { 014 015 private Expression raw; 016 private String type; 017 018 public Argument(Expression value, String type) { 019 super(value.getLine()); 020 this.raw=value;//Cast.toExpression(value,type); 021 this.type=type; 022 } 023 024 /** 025 * @return the value 026 */ 027 public Expression getValue() { 028 return Cast.toExpression(raw,type); 029 } 030 031 /** 032 * return the uncasted value 033 * @return 034 */ 035 public Expression getRawValue() { 036 return raw; 037 } 038 039 public void setValue(Expression value,String type) { 040 this.raw = value; 041 this.type=type; 042 043 } 044 045 /** 046 * 047 * @see railo.transformer.bytecode.expression.ExpressionBase#_writeOut(org.objectweb.asm.commons.GeneratorAdapter, int) 048 */ 049 public Type _writeOut(BytecodeContext bc, int mode) throws BytecodeException { 050 return getValue().writeOut(bc, mode); 051 } 052 053 public Type writeOutValue(BytecodeContext bc, int mode) throws BytecodeException { 054 ExpressionUtil.visitLine(bc, getLine()); 055 return getValue().writeOut(bc, mode); 056 } 057 058 /** 059 * @return the type 060 */ 061 public String getStringType() { 062 return type; 063 } 064 }