| OLD | NEW |
| 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'; |
| (...skipping 2706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2717 if (warnings == null) warnings = []; | 2717 if (warnings == null) warnings = []; |
| 2718 if (warnings is! List) warnings = [warnings]; | 2718 if (warnings is! List) warnings = [warnings]; |
| 2719 if (errors == null) errors = []; | 2719 if (errors == null) errors = []; |
| 2720 if (errors is! List) errors = [errors]; | 2720 if (errors is! List) errors = [errors]; |
| 2721 | 2721 |
| 2722 compiler.diagnosticHandler = createHandler(compiler, text); | 2722 compiler.diagnosticHandler = createHandler(compiler, text); |
| 2723 | 2723 |
| 2724 Token tokens = scan(text); | 2724 Token tokens = scan(text); |
| 2725 NodeListener listener = | 2725 NodeListener listener = |
| 2726 new NodeListener(const ScannerOptions(), compiler.reporter, null); | 2726 new NodeListener(const ScannerOptions(), compiler.reporter, null); |
| 2727 Parser parser = new Parser(listener, new MockParserOptions()); | 2727 Parser parser = new Parser(listener); |
| 2728 parser.parseStatement(tokens); | 2728 parser.parseStatement(tokens); |
| 2729 Node node = listener.popNode(); | 2729 Node node = listener.popNode(); |
| 2730 Element compilationUnit = new CompilationUnitElementX( | 2730 Element compilationUnit = new CompilationUnitElementX( |
| 2731 new Script(null, null, null), compiler.mainApp); | 2731 new Script(null, null, null), compiler.mainApp); |
| 2732 Element function = new MockElement(compilationUnit); | 2732 Element function = new MockElement(compilationUnit); |
| 2733 TreeElements elements = compiler.resolveNodeStatement(node, function); | 2733 TreeElements elements = compiler.resolveNodeStatement(node, function); |
| 2734 compiler.enqueuer.resolution.emptyDeferredQueueForTesting(); | 2734 compiler.enqueuer.resolution.emptyDeferredQueueForTesting(); |
| 2735 TypeCheckerVisitor checker = | 2735 TypeCheckerVisitor checker = |
| 2736 new TypeCheckerVisitor(compiler, elements, compiler.types); | 2736 new TypeCheckerVisitor(compiler, elements, compiler.types); |
| 2737 DiagnosticCollector collector = compiler.diagnosticCollector; | 2737 DiagnosticCollector collector = compiler.diagnosticCollector; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2761 {warnings, hints}) { | 2761 {warnings, hints}) { |
| 2762 if (warnings == null) warnings = []; | 2762 if (warnings == null) warnings = []; |
| 2763 if (warnings is! List) warnings = [warnings]; | 2763 if (warnings is! List) warnings = [warnings]; |
| 2764 if (hints == null) hints = []; | 2764 if (hints == null) hints = []; |
| 2765 if (hints is! List) hints = [hints]; | 2765 if (hints is! List) hints = [hints]; |
| 2766 | 2766 |
| 2767 compiler.resolver.resolve(element); | 2767 compiler.resolver.resolve(element); |
| 2768 Token tokens = scan(text); | 2768 Token tokens = scan(text); |
| 2769 NodeListener listener = | 2769 NodeListener listener = |
| 2770 new NodeListener(const ScannerOptions(), compiler.reporter, null); | 2770 new NodeListener(const ScannerOptions(), compiler.reporter, null); |
| 2771 Parser parser = new Parser(listener, new MockParserOptions(), | 2771 Parser parser = new Parser(listener, |
| 2772 asyncAwaitKeywordsEnabled: element.asyncMarker != AsyncMarker.SYNC); | 2772 asyncAwaitKeywordsEnabled: element.asyncMarker != AsyncMarker.SYNC); |
| 2773 parser.parseStatement(tokens); | 2773 parser.parseStatement(tokens); |
| 2774 Node node = listener.popNode(); | 2774 Node node = listener.popNode(); |
| 2775 TreeElements elements = compiler.resolveNodeStatement(node, element); | 2775 TreeElements elements = compiler.resolveNodeStatement(node, element); |
| 2776 TypeCheckerVisitor checker = | 2776 TypeCheckerVisitor checker = |
| 2777 new TypeCheckerVisitor(compiler, elements, compiler.types); | 2777 new TypeCheckerVisitor(compiler, elements, compiler.types); |
| 2778 DiagnosticCollector collector = compiler.diagnosticCollector; | 2778 DiagnosticCollector collector = compiler.diagnosticCollector; |
| 2779 collector.clear(); | 2779 collector.clear(); |
| 2780 checker.analyze(node); | 2780 checker.analyze(node); |
| 2781 generateOutput(compiler, text); | 2781 generateOutput(compiler, text); |
| 2782 compareWarningKinds(text, warnings, collector.warnings); | 2782 compareWarningKinds(text, warnings, collector.warnings); |
| 2783 compareWarningKinds(text, hints, collector.hints); | 2783 compareWarningKinds(text, hints, collector.hints); |
| 2784 } | 2784 } |
| OLD | NEW |