diff options
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java')
-rw-r--r-- | org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java index 2a8217732..8bd10b461 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2020 IBM Corporation and others. + * Copyright (c) 2000, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -227,14 +227,14 @@ public StringBuffer printStatement(int indent, StringBuffer output) { @Override public void resolve(BlockScope scope) { - if (this.condition.containsPatternVariable()) { + if (containsPatternVariable()) { this.condition.collectPatternVariablesToScope(null, scope); LocalVariableBinding[] patternVariablesInFalseScope = this.condition.getPatternVariablesWhenFalse(); TypeBinding type = this.condition.resolveTypeExpecting(scope, TypeBinding.BOOLEAN); this.condition.computeConversion(scope, type, type); if (this.action != null) { this.action.resolve(scope); - this.action.promotePatternVariablesIfApplicable(patternVariablesInFalseScope, + this.action.promotePatternVariablesIfApplicable(patternVariablesInFalseScope, () -> !this.action.breaksOut(null)); } } else { @@ -246,6 +246,10 @@ public void resolve(BlockScope scope) { } @Override +public boolean containsPatternVariable() { + return this.condition.containsPatternVariable(); +} +@Override public void traverse(ASTVisitor visitor, BlockScope scope) { if (visitor.visit(this, scope)) { if (this.action != null) { |