| 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 |
| (...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 analyze(node.first); | 1583 analyze(node.first); |
| 1584 analyze(node.second); | 1584 analyze(node.second); |
| 1585 return stringType; | 1585 return stringType; |
| 1586 } | 1586 } |
| 1587 | 1587 |
| 1588 DartType visitLiteralNull(LiteralNull node) { | 1588 DartType visitLiteralNull(LiteralNull node) { |
| 1589 return const DynamicType(); | 1589 return const DynamicType(); |
| 1590 } | 1590 } |
| 1591 | 1591 |
| 1592 DartType visitLiteralSymbol(LiteralSymbol node) { | 1592 DartType visitLiteralSymbol(LiteralSymbol node) { |
| 1593 return compiler.symbolClass.rawType; | 1593 return coreTypes.symbolType; |
| 1594 } | 1594 } |
| 1595 | 1595 |
| 1596 DartType computeConstructorType(ConstructorElement constructor, | 1596 DartType computeConstructorType(ConstructorElement constructor, |
| 1597 DartType type) { | 1597 DartType type) { |
| 1598 if (Elements.isUnresolved(constructor)) return const DynamicType(); | 1598 if (Elements.isUnresolved(constructor)) return const DynamicType(); |
| 1599 DartType constructorType = constructor.computeType(resolution); | 1599 DartType constructorType = constructor.computeType(resolution); |
| 1600 if (identical(type.kind, TypeKind.INTERFACE)) { | 1600 if (identical(type.kind, TypeKind.INTERFACE)) { |
| 1601 if (constructor.isSynthesized) { | 1601 if (constructor.isSynthesized) { |
| 1602 // TODO(johnniwinther): Remove this when synthesized constructors handle | 1602 // TODO(johnniwinther): Remove this when synthesized constructors handle |
| 1603 // type variables correctly. | 1603 // type variables correctly. |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 return | 1822 return |
| 1823 analyzeWithDefault(declaredIdentifier.type, const DynamicType()); | 1823 analyzeWithDefault(declaredIdentifier.type, const DynamicType()); |
| 1824 } else { | 1824 } else { |
| 1825 return analyze(node.declaredIdentifier); | 1825 return analyze(node.declaredIdentifier); |
| 1826 } | 1826 } |
| 1827 } | 1827 } |
| 1828 | 1828 |
| 1829 visitAsyncForIn(AsyncForIn node) { | 1829 visitAsyncForIn(AsyncForIn node) { |
| 1830 DartType elementType = computeForInElementType(node); | 1830 DartType elementType = computeForInElementType(node); |
| 1831 DartType expressionType = analyze(node.expression); | 1831 DartType expressionType = analyze(node.expression); |
| 1832 // TODO(johnniwinther): Move this to _CompilerCoreTypes. | |
| 1833 compiler.streamClass.ensureResolved(resolution); | |
| 1834 DartType streamOfDynamic = coreTypes.streamType(); | 1832 DartType streamOfDynamic = coreTypes.streamType(); |
| 1835 if (!types.isAssignable(expressionType, streamOfDynamic)) { | 1833 if (!types.isAssignable(expressionType, streamOfDynamic)) { |
| 1836 reportMessage(node.expression, | 1834 reportMessage(node.expression, |
| 1837 MessageKind.NOT_ASSIGNABLE, | 1835 MessageKind.NOT_ASSIGNABLE, |
| 1838 {'fromType': expressionType, 'toType': streamOfDynamic}, | 1836 {'fromType': expressionType, 'toType': streamOfDynamic}, |
| 1839 isHint: true); | 1837 isHint: true); |
| 1840 } else { | 1838 } else { |
| 1841 InterfaceType interfaceType = | 1839 InterfaceType interfaceType = |
| 1842 Types.computeInterfaceType(resolution, expressionType); | 1840 Types.computeInterfaceType(resolution, expressionType); |
| 1843 if (interfaceType != null) { | 1841 if (interfaceType != null) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1999 | 1997 |
| 2000 visitTypedef(Typedef node) { | 1998 visitTypedef(Typedef node) { |
| 2001 // Do not typecheck [Typedef] nodes. | 1999 // Do not typecheck [Typedef] nodes. |
| 2002 } | 2000 } |
| 2003 | 2001 |
| 2004 visitNode(Node node) { | 2002 visitNode(Node node) { |
| 2005 reporter.internalError(node, | 2003 reporter.internalError(node, |
| 2006 'Unexpected node ${node.getObjectDescription()} in the type checker.'); | 2004 'Unexpected node ${node.getObjectDescription()} in the type checker.'); |
| 2007 } | 2005 } |
| 2008 } | 2006 } |
| OLD | NEW |