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

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

Issue 836313002: Remove dependencies on reportFatalError from tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 5 years, 11 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 | « dart/tests/compiler/dart2js/mock_compiler.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 '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/src/resolution/resolution.dart"; 10 import "package:compiler/src/resolution/resolution.dart";
11 import "compiler_helper.dart"; 11 import "compiler_helper.dart";
12 import "parser_helper.dart"; 12 import "parser_helper.dart";
13 13
14 import 'package:compiler/src/dart_types.dart'; 14 import 'package:compiler/src/dart_types.dart';
15 import 'package:compiler/src/elements/modelx.dart'; 15 import 'package:compiler/src/elements/modelx.dart';
16 import 'link_helper.dart'; 16 import 'link_helper.dart';
17 17
18 import "package:compiler/src/dart2jslib.dart" show
19 CompilerCancelledException;
20
18 Node buildIdentifier(String name) => new Identifier(scan(name)); 21 Node buildIdentifier(String name) => new Identifier(scan(name));
19 22
20 Node buildInitialization(String name) => 23 Node buildInitialization(String name) =>
21 parseBodyCode('$name = 1', 24 parseBodyCode('$name = 1',
22 (parser, tokens) => parser.parseOptionallyInitializedIdentifier(tokens)); 25 (parser, tokens) => parser.parseOptionallyInitializedIdentifier(tokens));
23 26
24 createLocals(List variables) { 27 createLocals(List variables) {
25 var locals = <Node>[]; 28 var locals = <Node>[];
26 for (final variable in variables) { 29 for (final variable in variables) {
27 String name = variable[0]; 30 String name = variable[0];
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 MockCompiler.create((MockCompiler compiler) { 274 MockCompiler.create((MockCompiler compiler) {
272 compiler.parseScript("class Foo { static foo() { return this; } }"); 275 compiler.parseScript("class Foo { static foo() { return this; } }");
273 compiler.resolveStatement("Foo foo;"); 276 compiler.resolveStatement("Foo foo;");
274 ClassElement fooElement = compiler.mainApp.find("Foo"); 277 ClassElement fooElement = compiler.mainApp.find("Foo");
275 FunctionElement funElement = fooElement.lookupLocalMember("foo"); 278 FunctionElement funElement = fooElement.lookupLocalMember("foo");
276 ResolverVisitor visitor = new ResolverVisitor(compiler, funElement, 279 ResolverVisitor visitor = new ResolverVisitor(compiler, funElement,
277 new ResolutionRegistry.internal(compiler, 280 new ResolutionRegistry.internal(compiler,
278 new CollectingTreeElements(funElement))); 281 new CollectingTreeElements(funElement)));
279 FunctionExpression function = 282 FunctionExpression function =
280 (funElement as FunctionElementX).parseNode(compiler); 283 (funElement as FunctionElementX).parseNode(compiler);
281 visitor.visit(function.body); 284 try {
285 visitor.visit(function.body);
286 } on CompilerCancelledException catch (_) {
287 // Ignored.
288
289 // TODO(ahe): Don't ignore CompilerCancelledException, instead, fix
290 // pkg/compiler/lib/src/resolution/members.dart.
291 }
282 Expect.equals(0, compiler.warnings.length); 292 Expect.equals(0, compiler.warnings.length);
283 Expect.equals(1, compiler.errors.length); 293 Expect.equals(1, compiler.errors.length);
284 Expect.equals(MessageKind.NO_INSTANCE_AVAILABLE, 294 Expect.equals(MessageKind.NO_INSTANCE_AVAILABLE,
285 compiler.errors[0].message.kind); 295 compiler.errors[0].message.kind);
286 }), 296 }),
287 ]); 297 ]);
288 } 298 }
289 299
290 Future testLocalsOne() { 300 Future testLocalsOne() {
291 return Future.forEach([ 301 return Future.forEach([
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 }"""; 1152 }""";
1143 asyncTest(() => compileScript(script2).then((compiler) { 1153 asyncTest(() => compileScript(script2).then((compiler) {
1144 expect(compiler, 1154 expect(compiler,
1145 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS], 1155 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS],
1146 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, 1156 [MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR,
1147 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR, 1157 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_CONSTRUCTOR,
1148 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD, 1158 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD,
1149 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD]); 1159 MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD]);
1150 })); 1160 }));
1151 } 1161 }
OLDNEW
« no previous file with comments | « dart/tests/compiler/dart2js/mock_compiler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698