| 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/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/visitor.dart'; | 10 import 'package:analyzer/dart/ast/visitor.dart'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 import 'package:analyzer/src/task/driver.dart'; | 32 import 'package:analyzer/src/task/driver.dart'; |
| 33 import 'package:analyzer/src/task/general.dart'; | 33 import 'package:analyzer/src/task/general.dart'; |
| 34 import 'package:analyzer/src/task/html.dart'; | 34 import 'package:analyzer/src/task/html.dart'; |
| 35 import 'package:analyzer/src/task/inputs.dart'; | 35 import 'package:analyzer/src/task/inputs.dart'; |
| 36 import 'package:analyzer/src/task/model.dart'; | 36 import 'package:analyzer/src/task/model.dart'; |
| 37 import 'package:analyzer/src/task/strong/checker.dart'; | 37 import 'package:analyzer/src/task/strong/checker.dart'; |
| 38 import 'package:analyzer/src/task/strong_mode.dart'; | 38 import 'package:analyzer/src/task/strong_mode.dart'; |
| 39 import 'package:analyzer/task/dart.dart'; | 39 import 'package:analyzer/task/dart.dart'; |
| 40 import 'package:analyzer/task/general.dart'; | 40 import 'package:analyzer/task/general.dart'; |
| 41 import 'package:analyzer/task/model.dart'; | 41 import 'package:analyzer/task/model.dart'; |
| 42 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 42 | 43 |
| 43 /** | 44 /** |
| 44 * The [ResultCachingPolicy] for ASTs. | 45 * The [ResultCachingPolicy] for ASTs. |
| 45 */ | 46 */ |
| 46 const ResultCachingPolicy AST_CACHING_POLICY = | 47 const ResultCachingPolicy AST_CACHING_POLICY = |
| 47 const SimpleResultCachingPolicy(8192, 8192); | 48 const SimpleResultCachingPolicy(8192, 8192); |
| 48 | 49 |
| 49 /** | 50 /** |
| 50 * The [ResultCachingPolicy] for [Element]s. | 51 * The [ResultCachingPolicy] for [Element]s. |
| 51 */ | 52 */ |
| (...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 libraryElement.definingCompilationUnit = definingCompilationUnitElement; | 1359 libraryElement.definingCompilationUnit = definingCompilationUnitElement; |
| 1359 libraryElement.entryPoint = entryPoint; | 1360 libraryElement.entryPoint = entryPoint; |
| 1360 libraryElement.parts = sourcedCompilationUnits; | 1361 libraryElement.parts = sourcedCompilationUnits; |
| 1361 for (Directive directive in directivesToResolve) { | 1362 for (Directive directive in directivesToResolve) { |
| 1362 directive.element = libraryElement; | 1363 directive.element = libraryElement; |
| 1363 } | 1364 } |
| 1364 BuildLibraryElementUtils.patchTopLevelAccessors(libraryElement); | 1365 BuildLibraryElementUtils.patchTopLevelAccessors(libraryElement); |
| 1365 // set the library documentation to the docs associated with the first | 1366 // set the library documentation to the docs associated with the first |
| 1366 // directive in the compilation unit. | 1367 // directive in the compilation unit. |
| 1367 if (definingCompilationUnit.directives.isNotEmpty) { | 1368 if (definingCompilationUnit.directives.isNotEmpty) { |
| 1368 _setDoc(libraryElement, definingCompilationUnit.directives.first); | 1369 setElementDocumentationComment( |
| 1370 libraryElement, definingCompilationUnit.directives.first); |
| 1369 } | 1371 } |
| 1370 | 1372 |
| 1371 // | 1373 // |
| 1372 // Record outputs. | 1374 // Record outputs. |
| 1373 // | 1375 // |
| 1374 outputs[BUILD_LIBRARY_ERRORS] = errors; | 1376 outputs[BUILD_LIBRARY_ERRORS] = errors; |
| 1375 outputs[LIBRARY_ELEMENT1] = libraryElement; | 1377 outputs[LIBRARY_ELEMENT1] = libraryElement; |
| 1376 outputs[IS_LAUNCHABLE] = entryPoint != null; | 1378 outputs[IS_LAUNCHABLE] = entryPoint != null; |
| 1377 } | 1379 } |
| 1378 | 1380 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1401 LibraryIdentifier libraryName = directive.libraryName; | 1403 LibraryIdentifier libraryName = directive.libraryName; |
| 1402 if (libraryName != null) { | 1404 if (libraryName != null) { |
| 1403 return libraryName.name; | 1405 return libraryName.name; |
| 1404 } | 1406 } |
| 1405 } | 1407 } |
| 1406 } | 1408 } |
| 1407 return null; | 1409 return null; |
| 1408 } | 1410 } |
| 1409 | 1411 |
| 1410 /** | 1412 /** |
| 1411 * If the given [node] has a documentation comment, remember its content | |
| 1412 * and range into the given [element]. | |
| 1413 */ | |
| 1414 void _setDoc(ElementImpl element, AnnotatedNode node) { | |
| 1415 Comment comment = node.documentationComment; | |
| 1416 if (comment != null && comment.isDocumentation) { | |
| 1417 element.documentationComment = | |
| 1418 comment.tokens.map((Token t) => t.lexeme).join('\n'); | |
| 1419 element.setDocRange(comment.offset, comment.length); | |
| 1420 } | |
| 1421 } | |
| 1422 | |
| 1423 /** | |
| 1424 * Return a map from the names of the inputs of this kind of task to the task | 1413 * Return a map from the names of the inputs of this kind of task to the task |
| 1425 * input descriptors describing those inputs for a task with the given | 1414 * input descriptors describing those inputs for a task with the given |
| 1426 * [libSource]. | 1415 * [libSource]. |
| 1427 */ | 1416 */ |
| 1428 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 1417 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 1429 Source source = target; | 1418 Source source = target; |
| 1430 return <String, TaskInput>{ | 1419 return <String, TaskInput>{ |
| 1431 DEFINING_UNIT_INPUT: | 1420 DEFINING_UNIT_INPUT: |
| 1432 RESOLVED_UNIT1.of(new LibrarySpecificUnit(source, source)), | 1421 RESOLVED_UNIT1.of(new LibrarySpecificUnit(source, source)), |
| 1433 PARTS_UNIT_INPUT: INCLUDED_PARTS.of(source).toList((Source unit) { | 1422 PARTS_UNIT_INPUT: INCLUDED_PARTS.of(source).toList((Source unit) { |
| (...skipping 3867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5301 | 5290 |
| 5302 @override | 5291 @override |
| 5303 bool moveNext() { | 5292 bool moveNext() { |
| 5304 if (_newSources.isEmpty) { | 5293 if (_newSources.isEmpty) { |
| 5305 return false; | 5294 return false; |
| 5306 } | 5295 } |
| 5307 currentTarget = _newSources.removeLast(); | 5296 currentTarget = _newSources.removeLast(); |
| 5308 return true; | 5297 return true; |
| 5309 } | 5298 } |
| 5310 } | 5299 } |
| OLD | NEW |