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

Side by Side Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 1383043002: Stop defensively copying AST structures before resolution (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 analyzer.src.task.dart; 5 library analyzer.src.task.dart;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 void internalPerform() { 530 void internalPerform() {
531 // 531 //
532 // Prepare inputs. 532 // Prepare inputs.
533 // 533 //
534 LibrarySpecificUnit librarySpecificUnit = target; 534 LibrarySpecificUnit librarySpecificUnit = target;
535 Source source = getRequiredSource(); 535 Source source = getRequiredSource();
536 CompilationUnit unit = getRequiredInput(PARSED_UNIT_INPUT_NAME); 536 CompilationUnit unit = getRequiredInput(PARSED_UNIT_INPUT_NAME);
537 // 537 //
538 // Build or reuse CompilationUnitElement. 538 // Build or reuse CompilationUnitElement.
539 // 539 //
540 unit = AstCloner.clone(unit); 540 // unit = AstCloner.clone(unit);
541 AnalysisCache analysisCache = 541 AnalysisCache analysisCache =
542 (context as InternalAnalysisContext).analysisCache; 542 (context as InternalAnalysisContext).analysisCache;
543 CompilationUnitElement element = 543 CompilationUnitElement element =
544 analysisCache.getValue(target, COMPILATION_UNIT_ELEMENT); 544 analysisCache.getValue(target, COMPILATION_UNIT_ELEMENT);
545 if (element == null) { 545 if (element == null) {
546 CompilationUnitBuilder builder = new CompilationUnitBuilder(); 546 CompilationUnitBuilder builder = new CompilationUnitBuilder();
547 element = builder.buildCompilationUnit( 547 element = builder.buildCompilationUnit(
548 source, unit, librarySpecificUnit.library); 548 source, unit, librarySpecificUnit.library);
549 } else { 549 } else {
550 new DeclarationResolver().resolve(unit, element); 550 new DeclarationResolver().resolve(unit, element);
(...skipping 15 matching lines...) Expand all
566 } 566 }
567 567
568 /** 568 /**
569 * Return a map from the names of the inputs of this kind of task to the task 569 * Return a map from the names of the inputs of this kind of task to the task
570 * input descriptors describing those inputs for a task with the given 570 * input descriptors describing those inputs for a task with the given
571 * [target]. 571 * [target].
572 */ 572 */
573 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 573 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
574 LibrarySpecificUnit unit = target; 574 LibrarySpecificUnit unit = target;
575 return <String, TaskInput>{ 575 return <String, TaskInput>{
576 PARSED_UNIT_INPUT_NAME: PARSED_UNIT.of(unit.unit) 576 PARSED_UNIT_INPUT_NAME: PARSED_UNIT.of(unit.unit, flushOnAccess: true)
577 }; 577 };
578 } 578 }
579 579
580 /** 580 /**
581 * Create a [BuildCompilationUnitElementTask] based on the given [target] in 581 * Create a [BuildCompilationUnitElementTask] based on the given [target] in
582 * the given [context]. 582 * the given [context].
583 */ 583 */
584 static BuildCompilationUnitElementTask createTask( 584 static BuildCompilationUnitElementTask createTask(
585 AnalysisContext context, AnalysisTarget target) { 585 AnalysisContext context, AnalysisTarget target) {
586 return new BuildCompilationUnitElementTask(context, target); 586 return new BuildCompilationUnitElementTask(context, target);
(...skipping 3517 matching lines...) Expand 10 before | Expand all | Expand 10 after
4104 kind == _SourceClosureKind.IMPORT_EXPORT) { 4104 kind == _SourceClosureKind.IMPORT_EXPORT) {
4105 for (ExportElement exportElement in library.exports) { 4105 for (ExportElement exportElement in library.exports) {
4106 Source exportedSource = exportElement.exportedLibrary.source; 4106 Source exportedSource = exportElement.exportedLibrary.source;
4107 _newSources.add(exportedSource); 4107 _newSources.add(exportedSource);
4108 } 4108 }
4109 } 4109 }
4110 } 4110 }
4111 } 4111 }
4112 4112
4113 @override 4113 @override
4114 bool get flushOnAccess => false;
4115
4116 @override
4114 List<Source> get inputValue { 4117 List<Source> get inputValue {
4115 return _libraries.map((LibraryElement library) => library.source).toList(); 4118 return _libraries.map((LibraryElement library) => library.source).toList();
4116 } 4119 }
4117 4120
4118 @override 4121 @override
4119 void currentValueNotAvailable() { 4122 void currentValueNotAvailable() {
4120 // Nothing needs to be done. moveNext() will simply go on to the next new 4123 // Nothing needs to be done. moveNext() will simply go on to the next new
4121 // source. 4124 // source.
4122 } 4125 }
4123 4126
4124 @override 4127 @override
4125 bool moveNext() { 4128 bool moveNext() {
4126 if (_newSources.isEmpty) { 4129 if (_newSources.isEmpty) {
4127 return false; 4130 return false;
4128 } 4131 }
4129 currentTarget = _newSources.removeLast(); 4132 currentTarget = _newSources.removeLast();
4130 return true; 4133 return true;
4131 } 4134 }
4132 } 4135 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/analysis/notification_implemented_test.dart ('k') | pkg/analyzer/lib/src/task/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698