| 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.dart'; | 7 import 'common.dart'; |
| 8 import 'common/names.dart' show Identifiers; | 8 import 'common/names.dart' show Identifiers; |
| 9 import 'common/resolution.dart' show Resolution; | 9 import 'common/resolution.dart' show Resolution; |
| 10 import 'common/tasks.dart' show CompilerTask; | 10 import 'common/tasks.dart' show CompilerTask; |
| 11 import 'compiler.dart' show Compiler; | 11 import 'compiler.dart' show Compiler; |
| 12 import 'constants/expressions.dart'; | 12 import 'constants/expressions.dart'; |
| 13 import 'constants/values.dart'; | 13 import 'constants/values.dart'; |
| 14 import 'core_types.dart'; | 14 import 'core_types.dart'; |
| 15 import 'dart_types.dart'; | 15 import 'dart_types.dart'; |
| 16 import 'elements/elements.dart' | 16 import 'elements/elements.dart' |
| 17 show | 17 show |
| 18 AbstractFieldElement, | 18 AbstractFieldElement, |
| 19 AstElement, | 19 AstElement, |
| 20 AsyncMarker, | 20 AsyncMarker, |
| 21 ClassElement, | 21 ClassElement, |
| 22 ConstructorElement, | 22 ConstructorElement, |
| 23 Element, | 23 Element, |
| 24 Elements, | 24 Elements, |
| 25 EnumClassElement, | 25 EnumClassElement, |
| 26 EnumConstantElement, |
| 26 ExecutableElement, | 27 ExecutableElement, |
| 27 FieldElement, | 28 FieldElement, |
| 28 FunctionElement, | 29 FunctionElement, |
| 29 GetterElement, | 30 GetterElement, |
| 30 InitializingFormalElement, | 31 InitializingFormalElement, |
| 31 LibraryElement, | 32 LibraryElement, |
| 32 Member, | 33 Member, |
| 33 MemberSignature, | 34 MemberSignature, |
| 34 Name, | 35 Name, |
| 35 ParameterElement, | 36 ParameterElement, |
| (...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1946 | 1947 |
| 1947 analyze(switchCase); | 1948 analyze(switchCase); |
| 1948 } | 1949 } |
| 1949 | 1950 |
| 1950 if (!hasDefaultCase && expressionType.isEnumType) { | 1951 if (!hasDefaultCase && expressionType.isEnumType) { |
| 1951 compiler.enqueuer.resolution.addDeferredAction(executableContext, () { | 1952 compiler.enqueuer.resolution.addDeferredAction(executableContext, () { |
| 1952 Map<ConstantValue, FieldElement> enumValues = | 1953 Map<ConstantValue, FieldElement> enumValues = |
| 1953 <ConstantValue, FieldElement>{}; | 1954 <ConstantValue, FieldElement>{}; |
| 1954 List<FieldElement> unreferencedFields = <FieldElement>[]; | 1955 List<FieldElement> unreferencedFields = <FieldElement>[]; |
| 1955 EnumClassElement enumClass = expressionType.element; | 1956 EnumClassElement enumClass = expressionType.element; |
| 1956 enumClass.enumValues.forEach((FieldElement field) { | 1957 enumClass.enumValues.forEach((EnumConstantElement field) { |
| 1957 ConstantValue constantValue = | 1958 ConstantValue constantValue = |
| 1958 compiler.constants.getConstantValueForVariable(field); | 1959 compiler.constants.getConstantValueForVariable(field); |
| 1959 if (constantValue == null) { | 1960 if (constantValue == null) { |
| 1960 // The field might not have been resolved. | 1961 // The field might not have been resolved. |
| 1961 unreferencedFields.add(field); | 1962 unreferencedFields.add(field); |
| 1962 } else { | 1963 } else { |
| 1963 enumValues[constantValue] = field; | 1964 enumValues[constantValue] = field; |
| 1964 } | 1965 } |
| 1965 }); | 1966 }); |
| 1966 | 1967 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2011 | 2012 |
| 2012 visitTypedef(Typedef node) { | 2013 visitTypedef(Typedef node) { |
| 2013 // Do not typecheck [Typedef] nodes. | 2014 // Do not typecheck [Typedef] nodes. |
| 2014 } | 2015 } |
| 2015 | 2016 |
| 2016 visitNode(Node node) { | 2017 visitNode(Node node) { |
| 2017 reporter.internalError(node, | 2018 reporter.internalError(node, |
| 2018 'Unexpected node ${node.getObjectDescription()} in the type checker.'); | 2019 'Unexpected node ${node.getObjectDescription()} in the type checker.'); |
| 2019 } | 2020 } |
| 2020 } | 2021 } |
| OLD | NEW |