OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.generated.error_verifier; | 5 library analyzer.src.generated.error_verifier; |
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/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 3548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3559 * [ExportElement] retrieved from the node, if the element in the node was | 3559 * [ExportElement] retrieved from the node, if the element in the node was |
3560 * `null`, then this method is not called. | 3560 * `null`, then this method is not called. |
3561 * | 3561 * |
3562 * See [CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY]. | 3562 * See [CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY]. |
3563 */ | 3563 */ |
3564 void _checkForExportInternalLibrary( | 3564 void _checkForExportInternalLibrary( |
3565 ExportDirective directive, ExportElement exportElement) { | 3565 ExportDirective directive, ExportElement exportElement) { |
3566 if (_isInSystemLibrary) { | 3566 if (_isInSystemLibrary) { |
3567 return; | 3567 return; |
3568 } | 3568 } |
| 3569 |
| 3570 LibraryElement exportedLibrary = exportElement.exportedLibrary; |
| 3571 if (exportedLibrary == null) { |
| 3572 return; |
| 3573 } |
| 3574 |
3569 // should be private | 3575 // should be private |
3570 DartSdk sdk = _currentLibrary.context.sourceFactory.dartSdk; | 3576 DartSdk sdk = _currentLibrary.context.sourceFactory.dartSdk; |
3571 String uri = exportElement.uri; | 3577 String uri = exportedLibrary.source.uri.toString(); |
3572 SdkLibrary sdkLibrary = sdk.getSdkLibrary(uri); | 3578 SdkLibrary sdkLibrary = sdk.getSdkLibrary(uri); |
3573 if (sdkLibrary == null) { | 3579 if (sdkLibrary == null) { |
3574 return; | 3580 return; |
3575 } | 3581 } |
3576 if (!sdkLibrary.isInternal) { | 3582 if (!sdkLibrary.isInternal) { |
3577 return; | 3583 return; |
3578 } | 3584 } |
3579 | 3585 |
3580 _errorReporter.reportErrorForNode( | 3586 _errorReporter.reportErrorForNode( |
3581 CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY, | 3587 CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY, |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4172 * [ImportElement] retrieved from the node, if the element in the node was | 4178 * [ImportElement] retrieved from the node, if the element in the node was |
4173 * `null`, then this method is not called | 4179 * `null`, then this method is not called |
4174 * | 4180 * |
4175 * See [CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY]. | 4181 * See [CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY]. |
4176 */ | 4182 */ |
4177 void _checkForImportInternalLibrary( | 4183 void _checkForImportInternalLibrary( |
4178 ImportDirective directive, ImportElement importElement) { | 4184 ImportDirective directive, ImportElement importElement) { |
4179 if (_isInSystemLibrary) { | 4185 if (_isInSystemLibrary) { |
4180 return; | 4186 return; |
4181 } | 4187 } |
| 4188 |
| 4189 LibraryElement importedLibrary = importElement.importedLibrary; |
| 4190 if (importedLibrary == null) { |
| 4191 return; |
| 4192 } |
| 4193 |
4182 // should be private | 4194 // should be private |
4183 DartSdk sdk = _currentLibrary.context.sourceFactory.dartSdk; | 4195 DartSdk sdk = _currentLibrary.context.sourceFactory.dartSdk; |
4184 String uri = importElement.uri; | 4196 String uri = importedLibrary.source.uri.toString(); |
4185 SdkLibrary sdkLibrary = sdk.getSdkLibrary(uri); | 4197 SdkLibrary sdkLibrary = sdk.getSdkLibrary(uri); |
4186 if (sdkLibrary == null || !sdkLibrary.isInternal) { | 4198 if (sdkLibrary == null || !sdkLibrary.isInternal) { |
4187 return; | 4199 return; |
4188 } | 4200 } |
4189 | 4201 |
4190 _errorReporter.reportErrorForNode( | 4202 _errorReporter.reportErrorForNode( |
4191 CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, | 4203 CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, |
4192 directive, | 4204 directive, |
4193 [directive.uri]); | 4205 [directive.uri]); |
4194 } | 4206 } |
(...skipping 2941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7136 class _InvocationCollector extends RecursiveAstVisitor { | 7148 class _InvocationCollector extends RecursiveAstVisitor { |
7137 final List<String> superCalls = <String>[]; | 7149 final List<String> superCalls = <String>[]; |
7138 | 7150 |
7139 @override | 7151 @override |
7140 visitMethodInvocation(MethodInvocation node) { | 7152 visitMethodInvocation(MethodInvocation node) { |
7141 if (node.target is SuperExpression) { | 7153 if (node.target is SuperExpression) { |
7142 superCalls.add(node.methodName.name); | 7154 superCalls.add(node.methodName.name); |
7143 } | 7155 } |
7144 } | 7156 } |
7145 } | 7157 } |
OLD | NEW |