| OLD | NEW |
| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 */ | 97 */ |
| 98 static const String DEFINING_BUILT_UNIT_INPUT_NAME = 'definingBuiltUnit'; | 98 static const String DEFINING_BUILT_UNIT_INPUT_NAME = 'definingBuiltUnit'; |
| 99 | 99 |
| 100 /** | 100 /** |
| 101 * The name of the input whose value is a list of built compilation units | 101 * The name of the input whose value is a list of built compilation units |
| 102 * of the parts sourced by a library. | 102 * of the parts sourced by a library. |
| 103 */ | 103 */ |
| 104 static const String PART_BUILT_UNITS_INPUT_NAME = 'partBuiltUnits'; | 104 static const String PART_BUILT_UNITS_INPUT_NAME = 'partBuiltUnits'; |
| 105 | 105 |
| 106 /** | 106 /** |
| 107 * The name of the function used as an entry point. | |
| 108 */ | |
| 109 static const String ENTRY_POINT_NAME = "main"; | |
| 110 | |
| 111 /** | |
| 112 * The task descriptor describing this kind of task. | 107 * The task descriptor describing this kind of task. |
| 113 */ | 108 */ |
| 114 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 109 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 115 'BUILD_LIBRARY_ELEMENT', createTask, buildInputs, <ResultDescriptor>[ | 110 'BUILD_LIBRARY_ELEMENT', createTask, buildInputs, <ResultDescriptor>[ |
| 116 BUILD_LIBRARY_ERRORS, | 111 BUILD_LIBRARY_ERRORS, |
| 117 BUILT_LIBRARY_ELEMENT, | 112 BUILT_LIBRARY_ELEMENT, |
| 118 IS_LAUNCHABLE, | 113 IS_LAUNCHABLE, |
| 119 HAS_HTML_IMPORT | 114 HAS_HTML_IMPORT |
| 120 ]); | 115 ]); |
| 121 | 116 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } | 254 } |
| 260 } | 255 } |
| 261 } | 256 } |
| 262 | 257 |
| 263 /** | 258 /** |
| 264 * Return the top-level [FunctionElement] entry point, or `null` if the given | 259 * Return the top-level [FunctionElement] entry point, or `null` if the given |
| 265 * [element] does not define an entry point. | 260 * [element] does not define an entry point. |
| 266 */ | 261 */ |
| 267 FunctionElement _findEntryPoint(CompilationUnitElementImpl element) { | 262 FunctionElement _findEntryPoint(CompilationUnitElementImpl element) { |
| 268 for (FunctionElement function in element.functions) { | 263 for (FunctionElement function in element.functions) { |
| 269 if (function.name == ENTRY_POINT_NAME) { | 264 if (function.isEntryPoint) { |
| 270 return function; | 265 return function; |
| 271 } | 266 } |
| 272 } | 267 } |
| 273 return null; | 268 return null; |
| 274 } | 269 } |
| 275 | 270 |
| 276 /** | 271 /** |
| 277 * Return the name of the library that the given part is declared to be a | 272 * Return the name of the library that the given part is declared to be a |
| 278 * part of, or `null` if the part does not contain a part-of directive. | 273 * part of, or `null` if the part does not contain a part-of directive. |
| 279 */ | 274 */ |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 } | 547 } |
| 553 | 548 |
| 554 /** | 549 /** |
| 555 * Create a [ScanDartTask] based on the given [target] in the given [context]. | 550 * Create a [ScanDartTask] based on the given [target] in the given [context]. |
| 556 */ | 551 */ |
| 557 static ScanDartTask createTask( | 552 static ScanDartTask createTask( |
| 558 AnalysisContext context, AnalysisTarget target) { | 553 AnalysisContext context, AnalysisTarget target) { |
| 559 return new ScanDartTask(context, target); | 554 return new ScanDartTask(context, target); |
| 560 } | 555 } |
| 561 } | 556 } |
| OLD | NEW |