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