Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: tests/compiler/dart2js/cpa_inference_test.dart

Issue 15853002: Handle local variable declarations without immediate assignment. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address Karl's comments Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da rt'; 6 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da rt';
7 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; 7 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart';
8 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'; 8 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart';
9 9
10 import "parser_helper.dart"; 10 import "parser_helper.dart";
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 final String source = r""" 186 final String source = r"""
187 main () { 187 main () {
188 var x = "__dynamic_for_test"; 188 var x = "__dynamic_for_test";
189 x; 189 x;
190 } 190 }
191 """; 191 """;
192 AnalysisResult result = analyze(source); 192 AnalysisResult result = analyze(source);
193 result.checkNodeHasUnknownType('x'); 193 result.checkNodeHasUnknownType('x');
194 } 194 }
195 195
196 testVariableDeclaration() {
197 final String source = r"""
198 main() {
199 var v1;
200 var v2;
201 v2 = 1;
202 v1; v2;
203 }
204 """;
205 AnalysisResult result = analyze(source);
206 result.checkNodeHasType('v1', [result.nullType]);
207 result.checkNodeHasType('v2', [result.int]);
208 }
209
196 testLiterals() { 210 testLiterals() {
197 final String source = r""" 211 final String source = r"""
198 main() { 212 main() {
199 var v1 = 42; 213 var v1 = 42;
200 var v2 = 42.0; 214 var v2 = 42.0;
201 var v3 = 'abc'; 215 var v3 = 'abc';
202 var v4 = true; 216 var v4 = true;
203 var v5 = null; 217 var v5 = null;
204 v1; v2; v3; v4; v5; 218 v1; v2; v3; v4; v5;
205 } 219 }
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 xy.rawType, foo)).simplify(result.compiler), 1348 xy.rawType, foo)).simplify(result.compiler),
1335 new TypeMask.nonNullSubclass(bc.rawType)); 1349 new TypeMask.nonNullSubclass(bc.rawType));
1336 1350
1337 Selector bar = new Selector.call(buildSourceString("bar"), null, 0); 1351 Selector bar = new Selector.call(buildSourceString("bar"), null, 0);
1338 1352
1339 Expect.isNull(inferredType(bar)); 1353 Expect.isNull(inferredType(bar));
1340 } 1354 }
1341 1355
1342 void main() { 1356 void main() {
1343 testDynamicBackDoor(); 1357 testDynamicBackDoor();
1358 testVariableDeclaration();
1344 testLiterals(); 1359 testLiterals();
1345 testRedefinition(); 1360 testRedefinition();
1346 testIfThenElse(); 1361 testIfThenElse();
1347 testTernaryIf(); 1362 testTernaryIf();
1348 testWhile(); 1363 testWhile();
1349 testFor1(); 1364 testFor1();
1350 testFor2(); 1365 testFor2();
1351 testFor3(); 1366 testFor3();
1352 testToplevelVariable(); 1367 testToplevelVariable();
1353 testNonRecusiveFunction(); 1368 testNonRecusiveFunction();
(...skipping 30 matching lines...) Expand all
1384 testListWithCapacity(); 1399 testListWithCapacity();
1385 testEmptyList(); 1400 testEmptyList();
1386 testJsCall(); 1401 testJsCall();
1387 testIsCheck(); 1402 testIsCheck();
1388 testSeenClasses(); 1403 testSeenClasses();
1389 testGoodGuys(); 1404 testGoodGuys();
1390 testIntDoubleNum(); 1405 testIntDoubleNum();
1391 testConcreteTypeToTypeMask(); 1406 testConcreteTypeToTypeMask();
1392 testSelectors(); 1407 testSelectors();
1393 } 1408 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698