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

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

Issue 368833002: Cleanup warnings in unit tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix outdated type annotations. Created 6 years, 5 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 | « tests/compiler/dart2js/patch_test.dart ('k') | tests/compiler/dart2js/type_checker_test.dart » ('j') | 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 'dart:async'; 6 import 'dart:async';
7 import "package:async_helper/async_helper.dart"; 7 import "package:async_helper/async_helper.dart";
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import "package:compiler/implementation/resolution/resolution.dart"; 10 import "package:compiler/implementation/resolution/resolution.dart";
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 new Message(MessageKind.DUPLICATE_DEFINITION, {'name': 'foo'}, false), 307 new Message(MessageKind.DUPLICATE_DEFINITION, {'name': 'foo'}, false),
308 compiler.errors[0].message); 308 compiler.errors[0].message);
309 })], (f) => f()); 309 })], (f) => f());
310 } 310 }
311 311
312 312
313 Future testLocalsTwo() { 313 Future testLocalsTwo() {
314 return MockCompiler.create((MockCompiler compiler) { 314 return MockCompiler.create((MockCompiler compiler) {
315 ResolverVisitor visitor = compiler.resolverVisitor(); 315 ResolverVisitor visitor = compiler.resolverVisitor();
316 Node tree = parseStatement("if (true) { var a = 1; var b = 2; }"); 316 Node tree = parseStatement("if (true) { var a = 1; var b = 2; }");
317 Element element = visitor.visit(tree); 317 ResolutionResult element = visitor.visit(tree);
318 Expect.equals(null, element); 318 Expect.equals(null, element);
319 MethodScope scope = visitor.scope; 319 MethodScope scope = visitor.scope;
320 Expect.equals(0, scope.elements.length); 320 Expect.equals(0, scope.elements.length);
321 Expect.equals(2, map(visitor).length); 321 Expect.equals(2, map(visitor).length);
322 322
323 List<Element> elements = new List<Element>.from(map(visitor).values); 323 List<Element> elements = new List<Element>.from(map(visitor).values);
324 Expect.notEquals(elements[0], elements[1]); 324 Expect.notEquals(elements[0], elements[1]);
325 }); 325 });
326 } 326 }
327 327
328 Future testLocalsThree() { 328 Future testLocalsThree() {
329 return MockCompiler.create((MockCompiler compiler) { 329 return MockCompiler.create((MockCompiler compiler) {
330 ResolverVisitor visitor = compiler.resolverVisitor(); 330 ResolverVisitor visitor = compiler.resolverVisitor();
331 Node tree = parseStatement("{ var a = 1; if (true) { a; } }"); 331 Node tree = parseStatement("{ var a = 1; if (true) { a; } }");
332 Element element = visitor.visit(tree); 332 ResolutionResult element = visitor.visit(tree);
333 Expect.equals(null, element); 333 Expect.equals(null, element);
334 MethodScope scope = visitor.scope; 334 MethodScope scope = visitor.scope;
335 Expect.equals(0, scope.elements.length); 335 Expect.equals(0, scope.elements.length);
336 Expect.equals(3, map(visitor).length); 336 Expect.equals(3, map(visitor).length);
337 List<Element> elements = map(visitor).values.toList(); 337 List<Element> elements = map(visitor).values.toList();
338 Expect.equals(elements[0], elements[1]); 338 Expect.equals(elements[0], elements[1]);
339 }); 339 });
340 } 340 }
341 341
342 Future testLocalsFour() { 342 Future testLocalsFour() {
343 return MockCompiler.create((MockCompiler compiler) { 343 return MockCompiler.create((MockCompiler compiler) {
344 ResolverVisitor visitor = compiler.resolverVisitor(); 344 ResolverVisitor visitor = compiler.resolverVisitor();
345 Node tree = parseStatement("{ var a = 1; if (true) { var a = 1; } }"); 345 Node tree = parseStatement("{ var a = 1; if (true) { var a = 1; } }");
346 Element element = visitor.visit(tree); 346 ResolutionResult element = visitor.visit(tree);
347 Expect.equals(null, element); 347 Expect.equals(null, element);
348 MethodScope scope = visitor.scope; 348 MethodScope scope = visitor.scope;
349 Expect.equals(0, scope.elements.length); 349 Expect.equals(0, scope.elements.length);
350 Expect.equals(2, map(visitor).length); 350 Expect.equals(2, map(visitor).length);
351 List<Element> elements = map(visitor).values.toList(); 351 List<Element> elements = map(visitor).values.toList();
352 Expect.notEquals(elements[0], elements[1]); 352 Expect.notEquals(elements[0], elements[1]);
353 }); 353 });
354 } 354 }
355 355
356 Future testLocalsFive() { 356 Future testLocalsFive() {
357 return MockCompiler.create((MockCompiler compiler) { 357 return MockCompiler.create((MockCompiler compiler) {
358 ResolverVisitor visitor = compiler.resolverVisitor(); 358 ResolverVisitor visitor = compiler.resolverVisitor();
359 If tree = 359 If tree =
360 parseStatement("if (true) { var a = 1; a; } else { var a = 2; a;}"); 360 parseStatement("if (true) { var a = 1; a; } else { var a = 2; a;}");
361 Element element = visitor.visit(tree); 361 ResolutionResult element = visitor.visit(tree);
362 Expect.equals(null, element); 362 Expect.equals(null, element);
363 MethodScope scope = visitor.scope; 363 MethodScope scope = visitor.scope;
364 Expect.equals(0, scope.elements.length); 364 Expect.equals(0, scope.elements.length);
365 Expect.equals(6, map(visitor).length); 365 Expect.equals(6, map(visitor).length);
366 366
367 Block thenPart = tree.thenPart; 367 Block thenPart = tree.thenPart;
368 List statements1 = thenPart.statements.nodes.toList(); 368 List statements1 = thenPart.statements.nodes.toList();
369 Node def1 = statements1[0].definitions.nodes.head; 369 Node def1 = statements1[0].definitions.nodes.head;
370 Node id1 = statements1[1].expression; 370 Node id1 = statements1[1].expression;
371 Expect.equals(visitor.registry.mapping[def1], 371 Expect.equals(visitor.registry.mapping[def1],
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 }"""; 1069 }""";
1070 asyncTest(() => compileScript(script2).then((compiler) { 1070 asyncTest(() => compileScript(script2).then((compiler) {
1071 expect(compiler, 1071 expect(compiler,
1072 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS], 1072 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS],
1073 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, 1073 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR,
1074 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, 1074 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR,
1075 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD, 1075 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD,
1076 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD]); 1076 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD]);
1077 })); 1077 }));
1078 } 1078 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/patch_test.dart ('k') | tests/compiler/dart2js/type_checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698