304305306307308309310311312313314
} } @Override public void endVisit(JFieldRef x, Context ctx) { JLiteral literal = tryGetConstant(x); if (literal == null && !ignoringExpressionOutput.contains(x)) { return; } /* * At this point, either we have a constant replacement, or our value is
366367368369370371372373374375376
} } @Override public void endVisit(JLocalRef x, Context ctx) { JLiteral literal = tryGetConstant(x); if (literal != null) { assert (!x.hasSideEffects()); ctx.replaceMe(literal); } }
444445446447448449450451452453454
} } @Override public void endVisit(JParameterRef x, Context ctx) { JLiteral literal = tryGetConstant(x); if (literal != null) { assert (!x.hasSideEffects()); ctx.replaceMe(literal); } }
15381539154015411542154315441545154615471548
} } private JLiteral tryGetConstant(JVariableRef x) { if (!lvalues.contains(x)) { JLiteral lit = x.getTarget().getConstInitializer(); if (lit != null) { /* * Upcast the initializer so that the semantics of any arithmetic on * this value is not changed. */