| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 analyzer.test.generated.static_type_analyzer_test; | 5 library analyzer.test.generated.static_type_analyzer_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 resultType); | 1093 resultType); |
| 1094 _listener.assertNoErrors(); | 1094 _listener.assertNoErrors(); |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 void test_visitListLiteral_unresolved() { | 1097 void test_visitListLiteral_unresolved() { |
| 1098 _analyzer = _createAnalyzer(strongMode: true); | 1098 _analyzer = _createAnalyzer(strongMode: true); |
| 1099 // [a] // where 'a' is not resolved | 1099 // [a] // where 'a' is not resolved |
| 1100 Identifier identifier = AstFactory.identifier3('a'); | 1100 Identifier identifier = AstFactory.identifier3('a'); |
| 1101 Expression node = AstFactory.listLiteral([identifier]); | 1101 Expression node = AstFactory.listLiteral([identifier]); |
| 1102 DartType resultType = _analyze(node); | 1102 DartType resultType = _analyze(node); |
| 1103 expect(resultType, isNull); | 1103 _assertType2( |
| 1104 _typeProvider.listType |
| 1105 .instantiate(<DartType>[_typeProvider.dynamicType]), |
| 1106 resultType); |
| 1104 _listener.assertNoErrors(); | 1107 _listener.assertNoErrors(); |
| 1105 } | 1108 } |
| 1106 | 1109 |
| 1107 void test_visitListLiteral_unresolved_multiple() { | 1110 void test_visitListLiteral_unresolved_multiple() { |
| 1108 _analyzer = _createAnalyzer(strongMode: true); | 1111 _analyzer = _createAnalyzer(strongMode: true); |
| 1109 // [0, a, 1] // where 'a' is not resolved | 1112 // [0, a, 1] // where 'a' is not resolved |
| 1110 Identifier identifier = AstFactory.identifier3('a'); | 1113 Identifier identifier = AstFactory.identifier3('a'); |
| 1111 Expression node = AstFactory | 1114 Expression node = AstFactory |
| 1112 .listLiteral([_resolvedInteger(0), identifier, _resolvedInteger(1)]); | 1115 .listLiteral([_resolvedInteger(0), identifier, _resolvedInteger(1)]); |
| 1113 DartType resultType = _analyze(node); | 1116 DartType resultType = _analyze(node); |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 void _setType(FormalParameter parameter, DartType type) { | 1676 void _setType(FormalParameter parameter, DartType type) { |
| 1674 SimpleIdentifier identifier = parameter.identifier; | 1677 SimpleIdentifier identifier = parameter.identifier; |
| 1675 Element element = identifier.staticElement; | 1678 Element element = identifier.staticElement; |
| 1676 if (element is! ParameterElement) { | 1679 if (element is! ParameterElement) { |
| 1677 element = new ParameterElementImpl.forNode(identifier); | 1680 element = new ParameterElementImpl.forNode(identifier); |
| 1678 identifier.staticElement = element; | 1681 identifier.staticElement = element; |
| 1679 } | 1682 } |
| 1680 (element as ParameterElementImpl).type = type; | 1683 (element as ParameterElementImpl).type = type; |
| 1681 } | 1684 } |
| 1682 } | 1685 } |
| OLD | NEW |