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 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 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 ..setProperty(ErrorProperty.PARTS_LIBRARY_NAME, partsLibraryName); | 1413 ..setProperty(ErrorProperty.PARTS_LIBRARY_NAME, partsLibraryName); |
1414 } else { | 1414 } else { |
1415 error = new AnalysisError(librarySource, 0, 0, | 1415 error = new AnalysisError(librarySource, 0, 0, |
1416 ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART); | 1416 ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART); |
1417 } | 1417 } |
1418 errors.add(error); | 1418 errors.add(error); |
1419 } | 1419 } |
1420 // | 1420 // |
1421 // Create and populate the library element. | 1421 // Create and populate the library element. |
1422 // | 1422 // |
| 1423 AnalysisContext owningContext = context; |
| 1424 if (context is InternalAnalysisContext) { |
| 1425 InternalAnalysisContext internalContext = context; |
| 1426 owningContext = internalContext.getContextFor(librarySource); |
| 1427 } |
1423 LibraryElementImpl libraryElement = | 1428 LibraryElementImpl libraryElement = |
1424 new LibraryElementImpl.forNode(context, libraryNameNode); | 1429 new LibraryElementImpl.forNode(owningContext, libraryNameNode); |
1425 libraryElement.definingCompilationUnit = definingCompilationUnitElement; | 1430 libraryElement.definingCompilationUnit = definingCompilationUnitElement; |
1426 libraryElement.entryPoint = entryPoint; | 1431 libraryElement.entryPoint = entryPoint; |
1427 libraryElement.parts = sourcedCompilationUnits; | 1432 libraryElement.parts = sourcedCompilationUnits; |
1428 for (Directive directive in directivesToResolve) { | 1433 for (Directive directive in directivesToResolve) { |
1429 directive.element = libraryElement; | 1434 directive.element = libraryElement; |
1430 } | 1435 } |
1431 if (sourcedCompilationUnits.isNotEmpty) { | 1436 if (sourcedCompilationUnits.isNotEmpty) { |
1432 _patchTopLevelAccessors(libraryElement); | 1437 _patchTopLevelAccessors(libraryElement); |
1433 } | 1438 } |
1434 // | 1439 // |
(...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3521 @override | 3526 @override |
3522 bool moveNext() { | 3527 bool moveNext() { |
3523 if (_newSources.isEmpty) { | 3528 if (_newSources.isEmpty) { |
3524 return false; | 3529 return false; |
3525 } | 3530 } |
3526 currentTarget = _newSources.first; | 3531 currentTarget = _newSources.first; |
3527 _newSources.remove(currentTarget); | 3532 _newSources.remove(currentTarget); |
3528 return true; | 3533 return true; |
3529 } | 3534 } |
3530 } | 3535 } |
OLD | NEW |