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

Side by Side Diff: editor/tools/plugins/com.google.dart.engine.services/src/com/google/dart/engine/services/internal/correction/QuickAssistProcessorImpl.java

Issue 14322008: Version 0.4.7.3 . (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 7 years, 8 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 /* 1 /*
2 * Copyright (c) 2013, the Dart project authors. 2 * Copyright (c) 2013, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 23 matching lines...) Expand all
34 import com.google.dart.engine.ast.MethodDeclaration; 34 import com.google.dart.engine.ast.MethodDeclaration;
35 import com.google.dart.engine.ast.ReturnStatement; 35 import com.google.dart.engine.ast.ReturnStatement;
36 import com.google.dart.engine.ast.SimpleIdentifier; 36 import com.google.dart.engine.ast.SimpleIdentifier;
37 import com.google.dart.engine.ast.Statement; 37 import com.google.dart.engine.ast.Statement;
38 import com.google.dart.engine.ast.TopLevelVariableDeclaration; 38 import com.google.dart.engine.ast.TopLevelVariableDeclaration;
39 import com.google.dart.engine.ast.TypeName; 39 import com.google.dart.engine.ast.TypeName;
40 import com.google.dart.engine.ast.VariableDeclaration; 40 import com.google.dart.engine.ast.VariableDeclaration;
41 import com.google.dart.engine.ast.VariableDeclarationList; 41 import com.google.dart.engine.ast.VariableDeclarationList;
42 import com.google.dart.engine.ast.VariableDeclarationStatement; 42 import com.google.dart.engine.ast.VariableDeclarationStatement;
43 import com.google.dart.engine.ast.visitor.NodeLocator; 43 import com.google.dart.engine.ast.visitor.NodeLocator;
44 import com.google.dart.engine.element.Element;
44 import com.google.dart.engine.formatter.edit.Edit; 45 import com.google.dart.engine.formatter.edit.Edit;
45 import com.google.dart.engine.internal.type.BottomTypeImpl; 46 import com.google.dart.engine.internal.type.BottomTypeImpl;
46 import com.google.dart.engine.internal.type.DynamicTypeImpl; 47 import com.google.dart.engine.internal.type.DynamicTypeImpl;
47 import com.google.dart.engine.scanner.Keyword; 48 import com.google.dart.engine.scanner.Keyword;
48 import com.google.dart.engine.scanner.KeywordToken; 49 import com.google.dart.engine.scanner.KeywordToken;
49 import com.google.dart.engine.scanner.TokenType; 50 import com.google.dart.engine.scanner.TokenType;
50 import com.google.dart.engine.services.assist.AssistContext; 51 import com.google.dart.engine.services.assist.AssistContext;
51 import com.google.dart.engine.services.change.SourceChange; 52 import com.google.dart.engine.services.change.SourceChange;
52 import com.google.dart.engine.services.correction.CorrectionImage; 53 import com.google.dart.engine.services.correction.CorrectionImage;
53 import com.google.dart.engine.services.correction.CorrectionProposal; 54 import com.google.dart.engine.services.correction.CorrectionProposal;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 && node.getParent().getParent() instanceof ExpressionStatement) { 365 && node.getParent().getParent() instanceof ExpressionStatement) {
365 } else { 366 } else {
366 return; 367 return;
367 } 368 }
368 AssignmentExpression assignExpression = (AssignmentExpression) node.getParen t(); 369 AssignmentExpression assignExpression = (AssignmentExpression) node.getParen t();
369 // check that binary expression is assignment 370 // check that binary expression is assignment
370 if (assignExpression.getOperator().getType() != TokenType.EQ) { 371 if (assignExpression.getOperator().getType() != TokenType.EQ) {
371 return; 372 return;
372 } 373 }
373 // prepare "declaration" statement 374 // prepare "declaration" statement
374 int declOffset = ((SimpleIdentifier) node).getElement().getNameOffset(); 375 Element element = ((SimpleIdentifier) node).getElement();
376 if (element == null) {
377 return;
378 }
379 int declOffset = element.getNameOffset();
375 ASTNode declNode = new NodeLocator(declOffset).searchWithin(unit); 380 ASTNode declNode = new NodeLocator(declOffset).searchWithin(unit);
376 if (declNode != null && declNode.getParent() instanceof VariableDeclaration 381 if (declNode != null && declNode.getParent() instanceof VariableDeclaration
377 && ((VariableDeclaration) declNode.getParent()).getName() == declNode 382 && ((VariableDeclaration) declNode.getParent()).getName() == declNode
378 && declNode.getParent().getParent() instanceof VariableDeclarationList 383 && declNode.getParent().getParent() instanceof VariableDeclarationList
379 && declNode.getParent().getParent().getParent() instanceof VariableDecla rationStatement) { 384 && declNode.getParent().getParent().getParent() instanceof VariableDecla rationStatement) {
380 } else { 385 } else {
381 return; 386 return;
382 } 387 }
383 VariableDeclaration decl = (VariableDeclaration) declNode.getParent(); 388 VariableDeclaration decl = (VariableDeclaration) declNode.getParent();
384 VariableDeclarationStatement declStatement = (VariableDeclarationStatement) decl.getParent().getParent(); 389 VariableDeclarationStatement declStatement = (VariableDeclarationStatement) decl.getParent().getParent();
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 1235
1231 private void resetProposalElements() { 1236 private void resetProposalElements() {
1232 textEdits.clear(); 1237 textEdits.clear();
1233 proposalRelevance = DEFAULT_RELEVANCE; 1238 proposalRelevance = DEFAULT_RELEVANCE;
1234 linkedPositions.clear(); 1239 linkedPositions.clear();
1235 positionStopEdits.clear(); 1240 positionStopEdits.clear();
1236 linkedPositionProposals.clear(); 1241 linkedPositionProposals.clear();
1237 proposalEndRange = null; 1242 proposalEndRange = null;
1238 } 1243 }
1239 } 1244 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698