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

Side by Side Diff: tests/compiler/dart2js/cps_ir/runner.dart

Issue 1617083002: Base JavaScript code position computation on JavaScript tracer. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 10 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 // Test that the CPS IR code generator compiles programs and produces the 5 // Test that the CPS IR code generator compiles programs and produces the
6 // the expected output. 6 // the expected output.
7 7
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:async_helper/async_helper.dart'; 10 import 'package:async_helper/async_helper.dart';
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 const String TEST_MAIN_FILE = 'test.dart'; 112 const String TEST_MAIN_FILE = 'test.dart';
113 113
114 String _formatTest(Map test) { 114 String _formatTest(Map test) {
115 return test[TEST_MAIN_FILE]; 115 return test[TEST_MAIN_FILE];
116 } 116 }
117 117
118 String _getCodeForMain(CompilerImpl compiler) { 118 String _getCodeForMain(CompilerImpl compiler) {
119 Element mainFunction = compiler.mainFunction; 119 Element mainFunction = compiler.mainFunction;
120 js.Node ast = compiler.enqueuer.codegen.generatedCode[mainFunction]; 120 js.Node ast = compiler.enqueuer.codegen.generatedCode[mainFunction];
121 return js.prettyPrint(ast, compiler).getText(); 121 return js.prettyPrint(ast, compiler);
122 } 122 }
123 123
124 String _getCodeForMethod(CompilerImpl compiler, 124 String _getCodeForMethod(CompilerImpl compiler,
125 String name) { 125 String name) {
126 Element foundElement; 126 Element foundElement;
127 for (Element element in compiler.enqueuer.codegen.generatedCode.keys) { 127 for (Element element in compiler.enqueuer.codegen.generatedCode.keys) {
128 if (element.toString() == name) { 128 if (element.toString() == name) {
129 if (foundElement != null) { 129 if (foundElement != null) {
130 Expect.fail('Multiple compiled elements are called $name'); 130 Expect.fail('Multiple compiled elements are called $name');
131 } 131 }
132 foundElement = element; 132 foundElement = element;
133 } 133 }
134 } 134 }
135 135
136 if (foundElement == null) { 136 if (foundElement == null) {
137 Expect.fail('There is no compiled element called $name'); 137 Expect.fail('There is no compiled element called $name');
138 } 138 }
139 139
140 js.Node ast = compiler.enqueuer.codegen.generatedCode[foundElement]; 140 js.Node ast = compiler.enqueuer.codegen.generatedCode[foundElement];
141 return js.prettyPrint(ast, compiler).getText(); 141 return js.prettyPrint(ast, compiler);
142 } 142 }
OLDNEW
« no previous file with comments | « pkg/js_ast/lib/src/nodes.dart ('k') | tests/compiler/dart2js/js_backend_cps_ir_source_information_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698