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

Side by Side Diff: pkg/analysis_server/lib/src/edit/edit_domain.dart

Issue 898513002: Fix async/await type checking in analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reformat and sort methods Created 5 years, 10 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library edit.domain; 5 library edit.domain;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/collections.dart'; 10 import 'package:analysis_server/src/collections.dart';
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 * parameters. The existing [Refactoring] is reused or created as needed. 391 * parameters. The existing [Refactoring] is reused or created as needed.
392 */ 392 */
393 Future _init(RefactoringKind kind, String file, 393 Future _init(RefactoringKind kind, String file,
394 int offset, int length) async { 394 int offset, int length) async {
395 await server.onAnalysisComplete; 395 await server.onAnalysisComplete;
396 // check if we can continue with the existing Refactoring instance 396 // check if we can continue with the existing Refactoring instance
397 if (this.kind == kind && 397 if (this.kind == kind &&
398 this.file == file && 398 this.file == file &&
399 this.offset == offset && 399 this.offset == offset &&
400 this.length == length) { 400 this.length == length) {
401 return null; 401 return;
402 } 402 }
403 _reset(); 403 _reset();
404 this.kind = kind; 404 this.kind = kind;
405 this.file = file; 405 this.file = file;
406 this.offset = offset; 406 this.offset = offset;
407 this.length = length; 407 this.length = length;
408 // simulate an exception 408 // simulate an exception
409 if (test_simulateRefactoringException_init) { 409 if (test_simulateRefactoringException_init) {
410 throw 'A simulated refactoring exception - init.'; 410 throw 'A simulated refactoring exception - init.';
411 } 411 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 488 }
489 // do create the refactoring 489 // do create the refactoring
490 refactoring = new RenameRefactoring(searchEngine, element); 490 refactoring = new RenameRefactoring(searchEngine, element);
491 feedback = 491 feedback =
492 new RenameFeedback(node.offset, node.length, 'kind', 'oldName'); 492 new RenameFeedback(node.offset, node.length, 'kind', 'oldName');
493 } 493 }
494 } 494 }
495 if (refactoring == null) { 495 if (refactoring == null) {
496 initStatus = 496 initStatus =
497 new RefactoringStatus.fatal('Unable to create a refactoring'); 497 new RefactoringStatus.fatal('Unable to create a refactoring');
498 return null; 498 return;
499 } 499 }
500 // check initial conditions 500 // check initial conditions
501 initStatus = await refactoring.checkInitialConditions(); 501 initStatus = await refactoring.checkInitialConditions();
502 if (refactoring is ExtractLocalRefactoring) { 502 if (refactoring is ExtractLocalRefactoring) {
503 ExtractLocalRefactoring refactoring = this.refactoring; 503 ExtractLocalRefactoring refactoring = this.refactoring;
504 ExtractLocalVariableFeedback feedback = this.feedback; 504 ExtractLocalVariableFeedback feedback = this.feedback;
505 feedback.names = refactoring.names; 505 feedback.names = refactoring.names;
506 feedback.offsets = refactoring.offsets; 506 feedback.offsets = refactoring.offsets;
507 feedback.lengths = refactoring.lengths; 507 feedback.lengths = refactoring.lengths;
508 } 508 }
(...skipping 23 matching lines...) Expand all
532 refactoring.isDeclaration, 532 refactoring.isDeclaration,
533 className: refactoring.className); 533 className: refactoring.className);
534 } 534 }
535 } 535 }
536 if (refactoring is RenameRefactoring) { 536 if (refactoring is RenameRefactoring) {
537 RenameRefactoring refactoring = this.refactoring; 537 RenameRefactoring refactoring = this.refactoring;
538 RenameFeedback feedback = this.feedback; 538 RenameFeedback feedback = this.feedback;
539 feedback.elementKindName = refactoring.elementKindName; 539 feedback.elementKindName = refactoring.elementKindName;
540 feedback.oldName = refactoring.oldName; 540 feedback.oldName = refactoring.oldName;
541 } 541 }
542 return null;
543 } 542 }
544 543
545 void _reset([engine.AnalysisContext context]) { 544 void _reset([engine.AnalysisContext context]) {
546 kind = null; 545 kind = null;
547 offset = null; 546 offset = null;
548 length = null; 547 length = null;
549 refactoring = null; 548 refactoring = null;
550 feedback = null; 549 feedback = null;
551 initStatus = new RefactoringStatus(); 550 initStatus = new RefactoringStatus();
552 optionsStatus = new RefactoringStatus(); 551 optionsStatus = new RefactoringStatus();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 } 605 }
607 if (refactoring is RenameRefactoring) { 606 if (refactoring is RenameRefactoring) {
608 RenameRefactoring renameRefactoring = refactoring; 607 RenameRefactoring renameRefactoring = refactoring;
609 RenameOptions renameOptions = params.options; 608 RenameOptions renameOptions = params.options;
610 renameRefactoring.newName = renameOptions.newName; 609 renameRefactoring.newName = renameOptions.newName;
611 return renameRefactoring.checkNewName(); 610 return renameRefactoring.checkNewName();
612 } 611 }
613 return new RefactoringStatus(); 612 return new RefactoringStatus();
614 } 613 }
615 } 614 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis_server_test.dart » ('j') | pkg/analyzer/lib/src/generated/engine.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698