diff options
author | Jay Arthanareeswaran | 2019-07-18 05:49:00 +0000 |
---|---|---|
committer | Jay Arthanareeswaran | 2019-07-28 17:16:27 +0000 |
commit | ce369a4ecc8167f57467670086928858fe4bcf57 (patch) | |
tree | 602d083c459dfc88a82e05181d31a4ce48fc4c5f /org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java | |
parent | 1660166cbf7402140ac33c2b86e0e96c704f2ef4 (diff) | |
download | eclipse.jdt.core-Y20190730-0055.tar.gz eclipse.jdt.core-Y20190730-0055.tar.xz eclipse.jdt.core-Y20190730-0055.zip |
Bug 542560 - [13][completion] Code completion Support for SwitchY20190805-0900Y20190801-0900Y20190730-0135Y20190730-0055Y20190729-0900
Expressions
Change-Id: I82f86c5c029927d976e86cf8c3614f0a97921084
Signed-off-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
Diffstat (limited to 'org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java')
-rw-r--r-- | org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java index 99804638db..fa1531dedb 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java @@ -8,6 +8,10 @@ * * SPDX-License-Identifier: EPL-2.0 * + * This is an implementation of an early-draft specification developed under the Java + * Community Process (JCP) and is made available for testing and evaluation purposes + * only. The code is not compatible with any specification of the JCP. + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -104,6 +108,7 @@ public abstract class AssistParser extends Parser { protected static final int K_ENUM_CONSTANT_DELIMITER = ASSIST_PARSER + 6; // whether we are inside a field initializer protected static final int K_LAMBDA_EXPRESSION_DELIMITER = ASSIST_PARSER + 7; // whether we are inside a lambda expression protected static final int K_MODULE_INFO_DELIMITER = ASSIST_PARSER + 8; // whether we are inside a module info declaration + protected static final int K_SWITCH_EXPRESSION_DELIMITTER = ASSIST_PARSER + 9; // whether we are inside a switch expression // selector constants protected static final int THIS_CONSTRUCTOR = -1; @@ -1281,11 +1286,8 @@ private void adjustBracket(int token) { break; } } -private boolean lastArrowAssociatedWithCase = false; @Override protected void consumeToken(int token) { - if (TokenNameARROW == token) - this.lastArrowAssociatedWithCase = this.caseFlagSet; // remember the arrow association before reset. super.consumeToken(token); if(this.isFirst) { @@ -1318,9 +1320,10 @@ protected void consumeToken(int token) { } break; case TokenNameLBRACE: - if (this.previousToken == TokenNameARROW && !this.lastArrowAssociatedWithCase) { + if (this.previousToken == TokenNameARROW) { popElement(K_LAMBDA_EXPRESSION_DELIMITER); - pushOnElementStack(K_LAMBDA_EXPRESSION_DELIMITER, BLOCK_BODY, this.previousObjectInfo); + if (topKnownElementKind(ASSIST_PARSER, 1) != K_SWITCH_EXPRESSION_DELIMITTER) + pushOnElementStack(K_LAMBDA_EXPRESSION_DELIMITER, BLOCK_BODY, this.previousObjectInfo); } break; } |