| 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 engine.resolver; | 5 library engine.resolver; |
| 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 'java_core.dart'; | 10 import 'java_core.dart'; |
| (...skipping 10748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10759 if (_inheritanceManager != null) { | 10759 if (_inheritanceManager != null) { |
| 10760 _inheritanceManager.libraryElement = libraryElement; | 10760 _inheritanceManager.libraryElement = libraryElement; |
| 10761 } | 10761 } |
| 10762 } | 10762 } |
| 10763 | 10763 |
| 10764 @override | 10764 @override |
| 10765 String toString() => librarySource.shortName; | 10765 String toString() => librarySource.shortName; |
| 10766 } | 10766 } |
| 10767 | 10767 |
| 10768 /** | 10768 /** |
| 10769 * The enumeration `ResolverErrorCode` defines the error codes used for errors d
etected by the | 10769 * The enumeration `ResolverErrorCode` defines the error codes used for errors |
| 10770 * resolver. The convention for this class is for the name of the error code to
indicate the problem | 10770 * detected by the resolver. The convention for this class is for the name of |
| 10771 * that caused the error to be generated and for the error message to explain wh
at is wrong and, | 10771 * the error code to indicate the problem that caused the error to be generated |
| 10772 * when appropriate, how the problem can be corrected. | 10772 * and for the error message to explain what is wrong and, when appropriate, how |
| 10773 * the problem can be corrected. |
| 10773 */ | 10774 */ |
| 10774 class ResolverErrorCode extends Enum<ResolverErrorCode> implements ErrorCode { | 10775 class ResolverErrorCode extends ErrorCode { |
| 10775 static const ResolverErrorCode BREAK_LABEL_ON_SWITCH_MEMBER = const ResolverEr
rorCode.con1('BREAK_LABEL_ON_SWITCH_MEMBER', 0, ErrorType.COMPILE_TIME_ERROR, "B
reak label resolves to case or default statement"); | 10776 static const ResolverErrorCode BREAK_LABEL_ON_SWITCH_MEMBER |
| 10777 = const ResolverErrorCode( |
| 10778 'BREAK_LABEL_ON_SWITCH_MEMBER', |
| 10779 "Break label resolves to case or default statement"); |
| 10776 | 10780 |
| 10777 static const ResolverErrorCode CONTINUE_LABEL_ON_SWITCH = const ResolverErrorC
ode.con1('CONTINUE_LABEL_ON_SWITCH', 1, ErrorType.COMPILE_TIME_ERROR, "A continu
e label resolves to switch, must be loop or switch member"); | 10781 static const ResolverErrorCode CONTINUE_LABEL_ON_SWITCH |
| 10782 = const ResolverErrorCode( |
| 10783 'CONTINUE_LABEL_ON_SWITCH', |
| 10784 "A continue label resolves to switch, must be loop or switch member"); |
| 10778 | 10785 |
| 10779 static const ResolverErrorCode MISSING_LIBRARY_DIRECTIVE_WITH_PART = const Res
olverErrorCode.con1('MISSING_LIBRARY_DIRECTIVE_WITH_PART', 2, ErrorType.COMPILE_
TIME_ERROR, "Libraries that have parts must have a library directive"); | 10786 static const ResolverErrorCode MISSING_LIBRARY_DIRECTIVE_WITH_PART |
| 10780 | 10787 = const ResolverErrorCode( |
| 10781 static const List<ResolverErrorCode> values = const [ | 10788 'MISSING_LIBRARY_DIRECTIVE_WITH_PART', |
| 10782 BREAK_LABEL_ON_SWITCH_MEMBER, | 10789 "Libraries that have parts must have a library directive"); |
| 10783 CONTINUE_LABEL_ON_SWITCH, | |
| 10784 MISSING_LIBRARY_DIRECTIVE_WITH_PART]; | |
| 10785 | 10790 |
| 10786 /** | 10791 /** |
| 10787 * The type of this error. | 10792 * Initialize a newly created error code to have the given [name]. The message |
| 10793 * associated with the error will be created from the given [message] |
| 10794 * template. The correction associated with the error will be created from the |
| 10795 * given [correction] template. |
| 10788 */ | 10796 */ |
| 10789 final ErrorType type; | 10797 const ResolverErrorCode(String name, String message, [String correction]) |
| 10790 | 10798 : super(name, message, correction); |
| 10791 /** | |
| 10792 * The template used to create the message to be displayed for this error. | |
| 10793 */ | |
| 10794 final String message; | |
| 10795 | |
| 10796 /** | |
| 10797 * The template used to create the correction to be displayed for this error,
or `null` if | |
| 10798 * there is no correction information for this error. | |
| 10799 */ | |
| 10800 final String correction; | |
| 10801 | |
| 10802 /** | |
| 10803 * Initialize a newly created error code to have the given type and message. | |
| 10804 * | |
| 10805 * @param type the type of this error | |
| 10806 * @param message the message template used to create the message to be displa
yed for the error | |
| 10807 */ | |
| 10808 const ResolverErrorCode.con1(String name, int ordinal, ErrorType type, String
message) : this.con2(name, ordinal, type, message, null); | |
| 10809 | |
| 10810 /** | |
| 10811 * Initialize a newly created error code to have the given type, message and c
orrection. | |
| 10812 * | |
| 10813 * @param type the type of this error | |
| 10814 * @param message the template used to create the message to be displayed for
the error | |
| 10815 * @param correction the template used to create the correction to be displaye
d for the error | |
| 10816 */ | |
| 10817 const ResolverErrorCode.con2(String name, int ordinal, this.type, this.message
, this.correction) : super(name, ordinal); | |
| 10818 | 10799 |
| 10819 @override | 10800 @override |
| 10820 ErrorSeverity get errorSeverity => type.severity; | 10801 ErrorSeverity get errorSeverity => type.severity; |
| 10821 | 10802 |
| 10822 @override | 10803 @override |
| 10823 String get uniqueName => "$runtimeType.$name"; | 10804 ErrorType get type => ErrorType.COMPILE_TIME_ERROR; |
| 10824 } | 10805 } |
| 10825 | 10806 |
| 10826 /** | 10807 /** |
| 10827 * Instances of the class `ResolverVisitor` are used to resolve the nodes within
a single | 10808 * Instances of the class `ResolverVisitor` are used to resolve the nodes within
a single |
| 10828 * compilation unit. | 10809 * compilation unit. |
| 10829 */ | 10810 */ |
| 10830 class ResolverVisitor extends ScopedVisitor { | 10811 class ResolverVisitor extends ScopedVisitor { |
| 10831 /** | 10812 /** |
| 10832 * The manager for the inheritance mappings. | 10813 * The manager for the inheritance mappings. |
| 10833 */ | 10814 */ |
| (...skipping 4722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15556 /** | 15537 /** |
| 15557 * Return the tag that has the given identifier, or {@code null} if there is n
o such tag (the | 15538 * Return the tag that has the given identifier, or {@code null} if there is n
o such tag (the |
| 15558 * identifier is not defined). | 15539 * identifier is not defined). |
| 15559 * | 15540 * |
| 15560 * @return the tag that has the given identifier | 15541 * @return the tag that has the given identifier |
| 15561 */ | 15542 */ |
| 15562 String getTagWithId(String identifier) { | 15543 String getTagWithId(String identifier) { |
| 15563 return idToTagMap[identifier]; | 15544 return idToTagMap[identifier]; |
| 15564 } | 15545 } |
| 15565 } | 15546 } |
| OLD | NEW |