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

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

Issue 1864433004: Repeats and fixes the changes landed & reverted as CL 1789553003. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updates to external dependents Created 4 years, 8 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:async_helper/async_helper.dart'; 7 import 'package:async_helper/async_helper.dart';
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 9
10 import 'package:compiler/src/dart_types.dart'; 10 import 'package:compiler/src/dart_types.dart';
11 import 'package:compiler/src/diagnostics/messages.dart'; 11 import 'package:compiler/src/diagnostics/messages.dart';
12 import 'package:compiler/src/elements/elements.dart'; 12 import 'package:compiler/src/elements/elements.dart';
13 import 'package:compiler/src/elements/modelx.dart' show 13 import 'package:compiler/src/elements/modelx.dart' show
14 ClassElementX, 14 ClassElementX,
15 CompilationUnitElementX, 15 CompilationUnitElementX,
16 ElementX, 16 ElementX,
17 FunctionElementX; 17 FunctionElementX;
18 import 'package:compiler/src/io/source_file.dart'; 18 import 'package:compiler/src/io/source_file.dart';
19 import 'package:compiler/src/resolution/tree_elements.dart' show 19 import 'package:compiler/src/resolution/tree_elements.dart' show
20 TreeElements, 20 TreeElements,
21 TreeElementMapping; 21 TreeElementMapping;
22 import 'package:compiler/src/parser/element_listener.dart'; 22 import 'package:compiler/src/parser/element_listener.dart';
23 import 'package:compiler/src/tree/tree.dart'; 23 import 'package:compiler/src/tree/tree.dart';
24 import 'package:compiler/src/typechecker.dart'; 24 import 'package:compiler/src/typechecker.dart';
25 import 'package:compiler/src/script.dart'; 25 import 'package:compiler/src/script.dart';
26 import 'package:compiler/src/util/util.dart'; 26 import 'package:compiler/src/util/util.dart';
27 27
28 import 'mock_compiler.dart'; 28 import 'mock_compiler.dart';
29 import 'options_helper.dart';
29 import 'parser_helper.dart'; 30 import 'parser_helper.dart';
30 31
31 final MessageKind NOT_ASSIGNABLE = MessageKind.NOT_ASSIGNABLE; 32 final MessageKind NOT_ASSIGNABLE = MessageKind.NOT_ASSIGNABLE;
32 final MessageKind UNDEFINED_GETTER = MessageKind.UNDEFINED_GETTER; 33 final MessageKind UNDEFINED_GETTER = MessageKind.UNDEFINED_GETTER;
33 34
34 main() { 35 main() {
35 List tests = [testSimpleTypes, 36 List tests = [testSimpleTypes,
36 testReturn, 37 testReturn,
37 testFor, 38 testFor,
38 testSyncForIn, 39 testSyncForIn,
(...skipping 2509 matching lines...) Expand 10 before | Expand all | Expand 10 after
2548 if (warnings == null) warnings = []; 2549 if (warnings == null) warnings = [];
2549 if (warnings is !List) warnings = [warnings]; 2550 if (warnings is !List) warnings = [warnings];
2550 if (errors == null) errors = []; 2551 if (errors == null) errors = [];
2551 if (errors is !List) errors = [errors]; 2552 if (errors is !List) errors = [errors];
2552 2553
2553 compiler.diagnosticHandler = createHandler(compiler, text); 2554 compiler.diagnosticHandler = createHandler(compiler, text);
2554 2555
2555 Token tokens = scan(text); 2556 Token tokens = scan(text);
2556 NodeListener listener = new NodeListener( 2557 NodeListener listener = new NodeListener(
2557 const ScannerOptions(), compiler.reporter, null); 2558 const ScannerOptions(), compiler.reporter, null);
2558 Parser parser = new Parser(listener); 2559 Parser parser = new Parser(listener, new MockParserOptions());
2559 parser.parseStatement(tokens); 2560 parser.parseStatement(tokens);
2560 Node node = listener.popNode(); 2561 Node node = listener.popNode();
2561 Element compilationUnit = 2562 Element compilationUnit =
2562 new CompilationUnitElementX(new Script(null, null, null), compiler.mainApp); 2563 new CompilationUnitElementX(new Script(null, null, null), compiler.mainApp);
2563 Element function = new MockElement(compilationUnit); 2564 Element function = new MockElement(compilationUnit);
2564 TreeElements elements = compiler.resolveNodeStatement(node, function); 2565 TreeElements elements = compiler.resolveNodeStatement(node, function);
2565 compiler.enqueuer.resolution.emptyDeferredTaskQueue(); 2566 compiler.enqueuer.resolution.emptyDeferredTaskQueue();
2566 TypeCheckerVisitor checker = new TypeCheckerVisitor( 2567 TypeCheckerVisitor checker = new TypeCheckerVisitor(
2567 compiler, elements, compiler.types); 2568 compiler, elements, compiler.types);
2568 DiagnosticCollector collector = compiler.diagnosticCollector; 2569 DiagnosticCollector collector = compiler.diagnosticCollector;
(...skipping 25 matching lines...) Expand all
2594 {warnings, hints}) { 2595 {warnings, hints}) {
2595 if (warnings == null) warnings = []; 2596 if (warnings == null) warnings = [];
2596 if (warnings is !List) warnings = [warnings]; 2597 if (warnings is !List) warnings = [warnings];
2597 if (hints == null) hints = []; 2598 if (hints == null) hints = [];
2598 if (hints is !List) hints = [hints]; 2599 if (hints is !List) hints = [hints];
2599 2600
2600 compiler.resolver.resolve(element); 2601 compiler.resolver.resolve(element);
2601 Token tokens = scan(text); 2602 Token tokens = scan(text);
2602 NodeListener listener = new NodeListener( 2603 NodeListener listener = new NodeListener(
2603 const ScannerOptions(), compiler.reporter, null); 2604 const ScannerOptions(), compiler.reporter, null);
2604 Parser parser = new Parser(listener, 2605 Parser parser = new Parser(listener, new MockParserOptions(),
2605 asyncAwaitKeywordsEnabled: element.asyncMarker != AsyncMarker.SYNC); 2606 asyncAwaitKeywordsEnabled: element.asyncMarker != AsyncMarker.SYNC);
2606 parser.parseStatement(tokens); 2607 parser.parseStatement(tokens);
2607 Node node = listener.popNode(); 2608 Node node = listener.popNode();
2608 TreeElements elements = compiler.resolveNodeStatement(node, element); 2609 TreeElements elements = compiler.resolveNodeStatement(node, element);
2609 TypeCheckerVisitor checker = new TypeCheckerVisitor( 2610 TypeCheckerVisitor checker = new TypeCheckerVisitor(
2610 compiler, elements, compiler.types); 2611 compiler, elements, compiler.types);
2611 DiagnosticCollector collector = compiler.diagnosticCollector; 2612 DiagnosticCollector collector = compiler.diagnosticCollector;
2612 collector.clear(); 2613 collector.clear();
2613 checker.analyze(node); 2614 checker.analyze(node);
2614 generateOutput(compiler, text); 2615 generateOutput(compiler, text);
2615 compareWarningKinds(text, warnings, collector.warnings); 2616 compareWarningKinds(text, warnings, collector.warnings);
2616 compareWarningKinds(text, hints, collector.hints); 2617 compareWarningKinds(text, hints, collector.hints);
2617 } 2618 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/partial_parser_test.dart ('k') | tests/compiler/dart2js/unparser2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698