Lines 39-44
Link Here
|
39 |
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; |
39 |
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; |
40 |
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; |
40 |
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; |
41 |
import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; |
41 |
import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; |
|
|
42 |
import org.eclipse.jdt.internal.compiler.problem.AbortMethod; |
42 |
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; |
43 |
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; |
43 |
|
44 |
|
44 |
public class SingleNameReference extends NameReference implements OperatorIds { |
45 |
public class SingleNameReference extends NameReference implements OperatorIds { |
Lines 422-427
Link Here
|
422 |
break; |
423 |
break; |
423 |
case Binding.LOCAL : // reading a local |
424 |
case Binding.LOCAL : // reading a local |
424 |
LocalVariableBinding localBinding = (LocalVariableBinding) this.binding; |
425 |
LocalVariableBinding localBinding = (LocalVariableBinding) this.binding; |
|
|
426 |
if (localBinding.resolvedPosition == -1) { |
427 |
if (valueRequired) { |
428 |
// restart code gen |
429 |
localBinding.useFlag = LocalVariableBinding.USED; |
430 |
throw new AbortMethod(currentScope.referenceCompilationUnit().compilationResult, null); |
431 |
} |
432 |
codeStream.recordPositionsFrom(pc, this.sourceStart); |
433 |
return; |
434 |
} |
425 |
if (!valueRequired && (this.implicitConversion & TypeIds.UNBOXING) == 0) { |
435 |
if (!valueRequired && (this.implicitConversion & TypeIds.UNBOXING) == 0) { |
426 |
// if no valueRequired, optimize out entire gen |
436 |
// if no valueRequired, optimize out entire gen |
427 |
codeStream.recordPositionsFrom(pc, this.sourceStart); |
437 |
codeStream.recordPositionsFrom(pc, this.sourceStart); |
Lines 525-530
Link Here
|
525 |
case Binding.LOCAL : // assigning to a local variable (cannot assign to outer local) |
535 |
case Binding.LOCAL : // assigning to a local variable (cannot assign to outer local) |
526 |
LocalVariableBinding localBinding = (LocalVariableBinding) this.binding; |
536 |
LocalVariableBinding localBinding = (LocalVariableBinding) this.binding; |
527 |
// using incr bytecode if possible |
537 |
// using incr bytecode if possible |
|
|
538 |
if (localBinding.resolvedPosition == -1) { |
539 |
if (valueRequired) { |
540 |
// restart code gen |
541 |
localBinding.useFlag = LocalVariableBinding.USED; |
542 |
throw new AbortMethod(currentScope.referenceCompilationUnit().compilationResult, null); |
543 |
} |
544 |
return; |
545 |
} |
528 |
switch (localBinding.type.id) { |
546 |
switch (localBinding.type.id) { |
529 |
case T_JavaLangString : |
547 |
case T_JavaLangString : |
530 |
codeStream.generateStringConcatenationAppend(currentScope, this, expression); |
548 |
codeStream.generateStringConcatenationAppend(currentScope, this, expression); |
Lines 687-692
Link Here
|
687 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=185682 |
705 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=185682 |
688 |
// check if postIncrement is the only usage of this local |
706 |
// check if postIncrement is the only usage of this local |
689 |
Reference.reportOnlyUselesslyReadLocal(currentScope, localBinding, valueRequired); |
707 |
Reference.reportOnlyUselesslyReadLocal(currentScope, localBinding, valueRequired); |
|
|
708 |
if (localBinding.resolvedPosition == -1) { |
709 |
if (valueRequired) { |
710 |
// restart code gen |
711 |
localBinding.useFlag = LocalVariableBinding.USED; |
712 |
throw new AbortMethod(CodeStream.RESTART_CODE_GEN_FOR_UNUSED_LOCALS_MODE, null); |
713 |
} |
714 |
return; |
715 |
} |
690 |
|
716 |
|
691 |
// using incr bytecode if possible |
717 |
// using incr bytecode if possible |
692 |
if (localBinding.type == TypeBinding.INT) { |
718 |
if (localBinding.type == TypeBinding.INT) { |