Skip to content

Commit

Permalink
ExpressionTransformer #1917: turns out we need the whole erasure boxi…
Browse files Browse the repository at this point in the history
…ng rules for assignment now

Otherwise we get things like

Type x = (Type)
let(
Object tmpvar = nothing;
y = tmpvar; // here we need to add the (Type) cast as well
)
returning tmpvar;

for Type x, y; x = y = nothing
  • Loading branch information
FroMage committed Nov 19, 2014
1 parent d4a9e1c commit 97300e7
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2409,8 +2409,7 @@ private JCExpression transformAssignAndReturnOperation(Node operator, Tree.Term
// make sure the result is unboxed if necessary, $tmp may be boxed
JCExpression value = make().Ident(varName);
BoxingStrategy boxingStrategy = CodegenUtil.getBoxingStrategy(term);
value = boxUnboxIfNecessary(value, boxResult, term.getTypeModel(), boxingStrategy);
value = applyJavaTypeConversions(value, returnType, valueType, boxingStrategy, boxResult, 0);
value = applyErasureAndBoxing(value, returnType, boxResult, boxingStrategy, valueType);
JCExpression assignment = transformAssignment(operator, term, value);
stats = stats.prepend(at(operator).Exec(assignment));

Expand Down Expand Up @@ -2452,8 +2451,7 @@ else if(term instanceof Tree.QualifiedMemberExpression){
// make sure $tmpV is unboxed if necessary
JCExpression value = make().Ident(varVName);
BoxingStrategy boxingStrategy = CodegenUtil.getBoxingStrategy(term);
value = boxUnboxIfNecessary(value, boxResult, term.getTypeModel(), boxingStrategy);
value = applyJavaTypeConversions(value, returnType, valueType, boxingStrategy, boxResult, 0);
value = applyErasureAndBoxing(value, returnType, boxResult, boxingStrategy, valueType);
JCExpression assignment = transformAssignment(operator, term, isSuper ? transformSuper(qualified) : make().Ident(varEName), value);
stats = stats.prepend(at(operator).Exec(assignment));

Expand Down

0 comments on commit 97300e7

Please sign in to comment.