1 24 25 package org.aspectj.compiler.base.ast; 26 27 import org.aspectj.compiler.base.JavaCompiler; 28 29 import org.aspectj.compiler.base.bcg.FieldBuilder; 30 import org.aspectj.compiler.base.bcg.CodeBuilder; 31 import org.aspectj.compiler.base.bcg.Label; 32 33 37 public class LongLiteralExpr extends NumericLiteralExpr { 38 39 public int getIntValue() { return (int)longValue; } 40 public float getFloatValue() { return (float)longValue; } 41 public double getDoubleValue() { return (double)longValue; } 42 public String getStringValue() { return "" + longValue; } 43 44 public LongLiteralExpr(SourceLocation location, long _longValue) { 45 this(location, location.getCompiler().getTypeManager().longType, _longValue + "L", _longValue); 46 } 47 48 protected void cgValue(CodeBuilder cb) { 51 cb.emitLongConstant(longValue); 52 } 53 public void addConstant(FieldBuilder fb) { 54 fb.setConstantValue(longValue); 55 } 56 public boolean isConstantZero() { return longValue == 0L; } 57 58 protected long longValue; 60 public long getLongValue() { return longValue; } 61 public void setLongValue(long _longValue) { longValue = _longValue; } 62 63 public LongLiteralExpr(SourceLocation location, Type _type, String _value, long _longValue) { 64 super(location, _type, _value); 65 setLongValue(_longValue); 66 } 67 protected LongLiteralExpr(SourceLocation source) { 68 super(source); 69 } 70 71 public ASTObject copyWalk(CopyWalker walker) { 72 LongLiteralExpr ret = new LongLiteralExpr(getSourceLocation()); 73 ret.preCopy(walker, this); 74 ret.type = type; 75 ret.value = value; 76 ret.longValue = longValue; 77 return ret; 78 } 79 80 81 public String getDefaultDisplayName() { 82 return "LongLiteralExpr(type: "+type+", "+"value: "+value+", "+"longValue: "+longValue+")"; 83 } 84 85 } 87 | Popular Tags |