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

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

Issue 1205993002: fix resolution of URIs (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'package:analyzer/src/context/cache.dart'; 10 import 'package:analyzer/src/context/cache.dart';
(...skipping 2596 matching lines...) Expand 10 before | Expand all | Expand 10 after
2607 ParseDartTask(InternalAnalysisContext context, AnalysisTarget target) 2607 ParseDartTask(InternalAnalysisContext context, AnalysisTarget target)
2608 : super(context, target); 2608 : super(context, target);
2609 2609
2610 @override 2610 @override
2611 TaskDescriptor get descriptor => DESCRIPTOR; 2611 TaskDescriptor get descriptor => DESCRIPTOR;
2612 2612
2613 @override 2613 @override
2614 void internalPerform() { 2614 void internalPerform() {
2615 Source source = getRequiredSource(); 2615 Source source = getRequiredSource();
2616 LineInfo lineInfo = getRequiredInput(LINE_INFO_INPUT_NAME); 2616 LineInfo lineInfo = getRequiredInput(LINE_INFO_INPUT_NAME);
2617 int modificationTime = getRequiredInput(MODIFICATION_TIME_INPUT_NAME);
2617 Token tokenStream = getRequiredInput(TOKEN_STREAM_INPUT_NAME); 2618 Token tokenStream = getRequiredInput(TOKEN_STREAM_INPUT_NAME);
2618 2619
2619 RecordingErrorListener errorListener = new RecordingErrorListener(); 2620 RecordingErrorListener errorListener = new RecordingErrorListener();
2620 Parser parser = new Parser(source, errorListener); 2621 Parser parser = new Parser(source, errorListener);
2621 AnalysisOptions options = context.analysisOptions; 2622 AnalysisOptions options = context.analysisOptions;
2622 parser.parseFunctionBodies = options.analyzeFunctionBodiesPredicate(source); 2623 parser.parseFunctionBodies = options.analyzeFunctionBodiesPredicate(source);
2623 CompilationUnit unit = parser.parseCompilationUnit(tokenStream); 2624 CompilationUnit unit = parser.parseCompilationUnit(tokenStream);
2624 unit.lineInfo = lineInfo; 2625 unit.lineInfo = lineInfo;
2625 2626
2626 bool hasNonPartOfDirective = false; 2627 bool hasNonPartOfDirective = false;
(...skipping 28 matching lines...) Expand all
2655 // Always include "dart:core" source. 2656 // Always include "dart:core" source.
2656 // 2657 //
2657 HashSet<Source> importedSourceSet = 2658 HashSet<Source> importedSourceSet =
2658 new HashSet.from(explicitlyImportedSourceSet); 2659 new HashSet.from(explicitlyImportedSourceSet);
2659 Source coreLibrarySource = context.sourceFactory.forUri(DartSdk.DART_CORE); 2660 Source coreLibrarySource = context.sourceFactory.forUri(DartSdk.DART_CORE);
2660 importedSourceSet.add(coreLibrarySource); 2661 importedSourceSet.add(coreLibrarySource);
2661 // 2662 //
2662 // Compute kind. 2663 // Compute kind.
2663 // 2664 //
2664 SourceKind sourceKind = SourceKind.LIBRARY; 2665 SourceKind sourceKind = SourceKind.LIBRARY;
2665 if (hasPartOfDirective && !hasNonPartOfDirective) { 2666 if (modificationTime == -1) {
2667 sourceKind = SourceKind.UNKNOWN;
2668 } else if (hasPartOfDirective && !hasNonPartOfDirective) {
2666 sourceKind = SourceKind.PART; 2669 sourceKind = SourceKind.PART;
2667 } 2670 }
2668 // 2671 //
2669 // Record outputs. 2672 // Record outputs.
2670 // 2673 //
2671 List<Source> explicitlyImportedSources = 2674 List<Source> explicitlyImportedSources =
2672 explicitlyImportedSourceSet.toList(); 2675 explicitlyImportedSourceSet.toList();
2673 List<Source> exportedSources = exportedSourceSet.toList(); 2676 List<Source> exportedSources = exportedSourceSet.toList();
2674 List<Source> importedSources = importedSourceSet.toList(); 2677 List<Source> importedSources = importedSourceSet.toList();
2675 List<Source> includedSources = includedSourceSet.toList(); 2678 List<Source> includedSources = includedSourceSet.toList();
(...skipping 11 matching lines...) Expand all
2687 } 2690 }
2688 2691
2689 /** 2692 /**
2690 * Return a map from the names of the inputs of this kind of task to the task 2693 * Return a map from the names of the inputs of this kind of task to the task
2691 * input descriptors describing those inputs for a task with the given 2694 * input descriptors describing those inputs for a task with the given
2692 * [source]. 2695 * [source].
2693 */ 2696 */
2694 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 2697 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
2695 return <String, TaskInput>{ 2698 return <String, TaskInput>{
2696 LINE_INFO_INPUT_NAME: LINE_INFO.of(target), 2699 LINE_INFO_INPUT_NAME: LINE_INFO.of(target),
2700 MODIFICATION_TIME_INPUT_NAME: MODIFICATION_TIME.of(target),
2697 TOKEN_STREAM_INPUT_NAME: TOKEN_STREAM.of(target) 2701 TOKEN_STREAM_INPUT_NAME: TOKEN_STREAM.of(target)
2698 }; 2702 };
2699 } 2703 }
2700 2704
2701 /** 2705 /**
2702 * Create a [ParseDartTask] based on the given [target] in the given 2706 * Create a [ParseDartTask] based on the given [target] in the given
2703 * [context]. 2707 * [context].
2704 */ 2708 */
2705 static ParseDartTask createTask( 2709 static ParseDartTask createTask(
2706 AnalysisContext context, AnalysisTarget target) { 2710 AnalysisContext context, AnalysisTarget target) {
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
3481 3485
3482 @override 3486 @override
3483 bool moveNext() { 3487 bool moveNext() {
3484 if (_newSources.isEmpty) { 3488 if (_newSources.isEmpty) {
3485 return false; 3489 return false;
3486 } 3490 }
3487 currentTarget = _newSources.removeLast(); 3491 currentTarget = _newSources.removeLast();
3488 return true; 3492 return true;
3489 } 3493 }
3490 } 3494 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698