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

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

Issue 2939063002: Strong mode cleaning of many dart2js tests. (Closed)
Patch Set: Use ClassElement. Created 3 years, 6 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) 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 'dart:async'; 5 import 'dart:async';
6 import 'package:expect/expect.dart'; 6 import 'package:expect/expect.dart';
7 import 'package:async_helper/async_helper.dart'; 7 import 'package:async_helper/async_helper.dart';
8 import 'package:compiler/src/io/code_output.dart'; 8 import 'package:compiler/src/io/code_output.dart';
9 import 'package:compiler/src/io/source_file.dart'; 9 import 'package:compiler/src/io/source_file.dart';
10 import 'package:compiler/src/io/source_information.dart'; 10 import 'package:compiler/src/io/source_information.dart';
11 import 'package:compiler/src/js_backend/js_backend.dart'; 11 import 'package:compiler/src/js_backend/js_backend.dart';
12 import 'package:compiler/src/js_emitter/full_emitter/emitter.dart' as full 12 import 'package:compiler/src/js_emitter/full_emitter/emitter.dart' as full
13 show Emitter; 13 show Emitter;
14 14
15 import 'mock_compiler.dart'; 15 import 'mock_compiler.dart';
16 16
17 Future<CodeBuffer> compileAll(SourceFile sourceFile) { 17 Future<CodeBuffer> compileAll(SourceFile sourceFile) {
18 MockCompiler compiler = new MockCompiler.internal(); 18 MockCompiler compiler = new MockCompiler.internal();
19 Uri uri = new Uri(path: sourceFile.filename); 19 Uri uri = new Uri(path: sourceFile.filename);
20 compiler.sourceFiles[uri.toString()] = sourceFile; 20 compiler.sourceFiles[uri.toString()] = sourceFile;
21 JavaScriptBackend backend = compiler.backend; 21 JavaScriptBackend backend = compiler.backend;
22 return compiler.run(uri).then((_) { 22 return compiler.run(uri).then((_) {
23 // TODO(floitsch): the outputBuffers are only accessible in the full 23 // TODO(floitsch): the outputBuffers are only accessible in the full
24 // emitter. 24 // emitter.
25 full.Emitter fullEmitter = backend.emitter.emitter; 25 full.Emitter fullEmitter = backend.emitter.emitter;
26 // CodeOutput isn't assignable to CodeBuffer.
27 // ignore: RETURN_OF_INVALID_TYPE
26 return fullEmitter.outputBuffers[compiler.deferredLoadTask.mainOutputUnit]; 28 return fullEmitter.outputBuffers[compiler.deferredLoadTask.mainOutputUnit];
27 }); 29 });
28 } 30 }
29 31
30 void testSourceMapLocations(String codeWithMarkers) { 32 void testSourceMapLocations(String codeWithMarkers) {
31 List<int> expectedLocations = new List<int>(); 33 List<int> expectedLocations = new List<int>();
32 for (int i = 0; i < codeWithMarkers.length; ++i) { 34 for (int i = 0; i < codeWithMarkers.length; ++i) {
33 if (codeWithMarkers[i] == '@') { 35 if (codeWithMarkers[i] == '@') {
34 expectedLocations.add(i - expectedLocations.length); 36 expectedLocations.add(i - expectedLocations.length);
35 } 37 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 testSourceMapLocations(FUNCTIONS_TEST); 116 testSourceMapLocations(FUNCTIONS_TEST);
115 testSourceMapLocations(RETURN_TEST); 117 testSourceMapLocations(RETURN_TEST);
116 testSourceMapLocations(NOT_TEST); 118 testSourceMapLocations(NOT_TEST);
117 testSourceMapLocations(UNARY_TEST); 119 testSourceMapLocations(UNARY_TEST);
118 testSourceMapLocations(BINARY_TEST); 120 testSourceMapLocations(BINARY_TEST);
119 testSourceMapLocations(SEND_TEST); 121 testSourceMapLocations(SEND_TEST);
120 testSourceMapLocations(SEND_SET_TEST); 122 testSourceMapLocations(SEND_SET_TEST);
121 testSourceMapLocations(LOOP_TEST); 123 testSourceMapLocations(LOOP_TEST);
122 testSourceMapLocations(INTERCEPTOR_TEST); 124 testSourceMapLocations(INTERCEPTOR_TEST);
123 } 125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698