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

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

Issue 998053002: Task: Build Public Namespace. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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) 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/generated/ast.dart'; 9 import 'package:analyzer/src/generated/ast.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 * Create a [BuildLibraryElementTask] based on the given [target] in the 333 * Create a [BuildLibraryElementTask] based on the given [target] in the
334 * given [context]. 334 * given [context].
335 */ 335 */
336 static BuildLibraryElementTask createTask( 336 static BuildLibraryElementTask createTask(
337 AnalysisContext context, AnalysisTarget target) { 337 AnalysisContext context, AnalysisTarget target) {
338 return new BuildLibraryElementTask(context, target); 338 return new BuildLibraryElementTask(context, target);
339 } 339 }
340 } 340 }
341 341
342 /** 342 /**
343 * A task that builds [PUBLIC_NAMESPACE] for a library.
344 */
345 class BuildPublicNamespaceTask extends SourceBasedAnalysisTask {
346 /**
347 * The name of the [BUILT_LIBRARY_ELEMENT] input.
348 */
349 static const String BUILT_LIBRARY_ELEMENT_INPUT_NAME = "builtLibraryElement";
350
351 /**
352 * The task descriptor describing this kind of task.
353 */
354 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
355 'BUILD_PUBLIC_NAMESPACE', createTask, buildInputs, <ResultDescriptor>[
356 PUBLIC_NAMESPACE
357 ]);
358
359 BuildPublicNamespaceTask(
360 InternalAnalysisContext context, AnalysisTarget target)
361 : super(context, target);
362
363 @override
364 TaskDescriptor get descriptor => DESCRIPTOR;
365
366 @override
367 void internalPerform() {
368 LibraryElement library = getRequiredInput(BUILT_LIBRARY_ELEMENT_INPUT_NAME);
369
370 NamespaceBuilder builder = new NamespaceBuilder();
371 Namespace namespace = builder.createPublicNamespaceForLibrary(library);
372
373 outputs[PUBLIC_NAMESPACE] = namespace;
374 }
375
376 /**
377 * Return a map from the names of the inputs of this kind of task to the task
378 * input descriptors describing those inputs for a task with the
379 * given [target].
380 */
381 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
382 return <String, TaskInput>{
383 BUILT_LIBRARY_ELEMENT_INPUT_NAME: BUILT_LIBRARY_ELEMENT.inputFor(target)
384 };
385 }
386
387 /**
388 * Create a [BuildPublicNamespaceTask] based on the given [target] in
389 * the given [context].
390 */
391 static BuildPublicNamespaceTask createTask(
392 AnalysisContext context, AnalysisTarget target) {
393 return new BuildPublicNamespaceTask(context, target);
394 }
395 }
396
397 /**
343 * A task that parses the content of a Dart file, producing an AST structure. 398 * A task that parses the content of a Dart file, producing an AST structure.
344 */ 399 */
345 class ParseDartTask extends SourceBasedAnalysisTask { 400 class ParseDartTask extends SourceBasedAnalysisTask {
346 /** 401 /**
347 * The name of the input whose value is the line information produced for the 402 * The name of the input whose value is the line information produced for the
348 * file. 403 * file.
349 */ 404 */
350 static const String LINE_INFO_INPUT_NAME = "lineInfo"; 405 static const String LINE_INFO_INPUT_NAME = "lineInfo";
351 406
352 /** 407 /**
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } 602 }
548 603
549 /** 604 /**
550 * Create a [ScanDartTask] based on the given [target] in the given [context]. 605 * Create a [ScanDartTask] based on the given [target] in the given [context].
551 */ 606 */
552 static ScanDartTask createTask( 607 static ScanDartTask createTask(
553 AnalysisContext context, AnalysisTarget target) { 608 AnalysisContext context, AnalysisTarget target) {
554 return new ScanDartTask(context, target); 609 return new ScanDartTask(context, target);
555 } 610 }
556 } 611 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/task/dart.dart » ('j') | pkg/analyzer/test/src/task/dart_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698