Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: compiler/java/com/google/dart/compiler/parser/DartParser.java

Issue 10828169: 'Split && condition' quick assist. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 package com.google.dart.compiler.parser; 5 package com.google.dart.compiler.parser;
6 6
7 import com.google.common.annotations.VisibleForTesting; 7 import com.google.common.annotations.VisibleForTesting;
8 import com.google.common.collect.ImmutableSet; 8 import com.google.common.collect.ImmutableSet;
9 import com.google.common.io.CharStreams; 9 import com.google.common.io.CharStreams;
10 import com.google.dart.compiler.DartCompilationError; 10 import com.google.dart.compiler.DartCompilationError;
(...skipping 4159 matching lines...) Expand 10 before | Expand all | Expand 10 after
4170 * | SWITCH '(' expression ')' '{' switchCase* defaultCase? '}' 4170 * | SWITCH '(' expression ')' '{' switchCase* defaultCase? '}'
4171 * ; 4171 * ;
4172 * </pre> 4172 * </pre>
4173 */ 4173 */
4174 private DartIfStatement parseIfStatement() { 4174 private DartIfStatement parseIfStatement() {
4175 beginIfStatement(); 4175 beginIfStatement();
4176 expect(Token.IF); 4176 expect(Token.IF);
4177 expect(Token.LPAREN); 4177 expect(Token.LPAREN);
4178 DartExpression condition = parseExpression(); 4178 DartExpression condition = parseExpression();
4179 expectCloseParen(); 4179 expectCloseParen();
4180 int closeParentOffset = ctx.getTokenLocation().getBegin();
4180 DartStatement yes = parseStatement(); 4181 DartStatement yes = parseStatement();
4181 DartStatement no = null; 4182 DartStatement no = null;
4183 int elseTokenOffset = 0;
4182 if (optional(Token.ELSE)) { 4184 if (optional(Token.ELSE)) {
4185 elseTokenOffset = ctx.getTokenLocation().getBegin();
4183 no = parseStatement(); 4186 no = parseStatement();
4184 } 4187 }
4185 return done(new DartIfStatement(condition, yes, no)); 4188 return done(new DartIfStatement(condition, closeParentOffset, yes, elseToken Offset, no));
4186 } 4189 }
4187 4190
4188 /** 4191 /**
4189 * <pre> 4192 * <pre>
4190 * caseStatements 4193 * caseStatements
4191 * : normalCompletingStatement* abruptCompletingStatement 4194 * : normalCompletingStatement* abruptCompletingStatement
4192 * ; 4195 * ;
4193 * </pre> 4196 * </pre>
4194 */ 4197 */
4195 private List<DartStatement> parseCaseStatements() { 4198 private List<DartStatement> parseCaseStatements() {
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
4741 private void reportError(DartNode node, ErrorCode errorCode, Object... argumen ts) { 4744 private void reportError(DartNode node, ErrorCode errorCode, Object... argumen ts) {
4742 if (node != null) { 4745 if (node != null) {
4743 reportError(new DartCompilationError(node, errorCode, arguments)); 4746 reportError(new DartCompilationError(node, errorCode, arguments));
4744 } 4747 }
4745 } 4748 }
4746 4749
4747 private boolean currentlyParsingToplevel() { 4750 private boolean currentlyParsingToplevel() {
4748 return !(isParsingInterface || isTopLevelAbstract || isParsingClass); 4751 return !(isParsingInterface || isTopLevelAbstract || isParsingClass);
4749 } 4752 }
4750 } 4753 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698