OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart2js.typechecker; | 5 library dart2js.typechecker; |
6 | 6 |
7 import 'common/tasks.dart' show | 7 import 'common/tasks.dart' show |
8 CompilerTask; | 8 CompilerTask; |
9 import 'compiler.dart' show | 9 import 'compiler.dart' show |
10 Compiler, | 10 Compiler; |
11 isPrivateName; | |
12 import 'constants/expressions.dart'; | 11 import 'constants/expressions.dart'; |
13 import 'constants/values.dart'; | 12 import 'constants/values.dart'; |
14 import 'core_types.dart'; | 13 import 'core_types.dart'; |
15 import 'dart_types.dart'; | 14 import 'dart_types.dart'; |
16 import 'diagnostics/invariant.dart' show | 15 import 'diagnostics/invariant.dart' show |
17 invariant; | 16 invariant; |
18 import 'diagnostics/messages.dart'; | 17 import 'diagnostics/messages.dart'; |
19 import 'diagnostics/spannable.dart' show | 18 import 'diagnostics/spannable.dart' show |
20 Spannable; | 19 Spannable; |
21 import 'elements/elements.dart' show | 20 import 'elements/elements.dart' show |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 checkCondition(node.condition); | 713 checkCondition(node.condition); |
715 analyzeInPromotedContext(condition, thenPart); | 714 analyzeInPromotedContext(condition, thenPart); |
716 if (node.elsePart != null) { | 715 if (node.elsePart != null) { |
717 analyze(node.elsePart); | 716 analyze(node.elsePart); |
718 } | 717 } |
719 return const StatementType(); | 718 return const StatementType(); |
720 } | 719 } |
721 | 720 |
722 void checkPrivateAccess(Node node, Element element, String name) { | 721 void checkPrivateAccess(Node node, Element element, String name) { |
723 if (name != null && | 722 if (name != null && |
724 isPrivateName(name) && | 723 Name.isPrivateName(name) && |
725 element.library != currentLibrary) { | 724 element.library != currentLibrary) { |
726 reportTypeWarning( | 725 reportTypeWarning( |
727 node, | 726 node, |
728 MessageKind.PRIVATE_ACCESS, | 727 MessageKind.PRIVATE_ACCESS, |
729 {'name': name, | 728 {'name': name, |
730 'libraryName': element.library.getLibraryOrScriptName()}); | 729 'libraryName': element.library.getLibraryOrScriptName()}); |
731 } | 730 } |
732 | 731 |
733 } | 732 } |
734 | 733 |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1927 | 1926 |
1928 visitTypedef(Typedef node) { | 1927 visitTypedef(Typedef node) { |
1929 // Do not typecheck [Typedef] nodes. | 1928 // Do not typecheck [Typedef] nodes. |
1930 } | 1929 } |
1931 | 1930 |
1932 visitNode(Node node) { | 1931 visitNode(Node node) { |
1933 compiler.internalError(node, | 1932 compiler.internalError(node, |
1934 'Unexpected node ${node.getObjectDescription()} in the type checker.'); | 1933 'Unexpected node ${node.getObjectDescription()} in the type checker.'); |
1935 } | 1934 } |
1936 } | 1935 } |
OLD | NEW |