OLD | NEW |
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' | 12 import 'package:compiler/src/js_emitter/full_emitter/emitter.dart' |
13 as full show Emitter; | 13 as full 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.runCompiler(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 return fullEmitter | 26 return fullEmitter |
27 .outputBuffers[compiler.deferredLoadTask.mainOutputUnit]; | 27 .outputBuffers[compiler.deferredLoadTask.mainOutputUnit]; |
28 }); | 28 }); |
29 } | 29 } |
30 | 30 |
31 void testSourceMapLocations(String codeWithMarkers) { | 31 void testSourceMapLocations(String codeWithMarkers) { |
32 List<int> expectedLocations = new List<int>(); | 32 List<int> expectedLocations = new List<int>(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 testSourceMapLocations(FUNCTIONS_TEST); | 112 testSourceMapLocations(FUNCTIONS_TEST); |
113 testSourceMapLocations(RETURN_TEST); | 113 testSourceMapLocations(RETURN_TEST); |
114 testSourceMapLocations(NOT_TEST); | 114 testSourceMapLocations(NOT_TEST); |
115 testSourceMapLocations(UNARY_TEST); | 115 testSourceMapLocations(UNARY_TEST); |
116 testSourceMapLocations(BINARY_TEST); | 116 testSourceMapLocations(BINARY_TEST); |
117 testSourceMapLocations(SEND_TEST); | 117 testSourceMapLocations(SEND_TEST); |
118 testSourceMapLocations(SEND_SET_TEST); | 118 testSourceMapLocations(SEND_SET_TEST); |
119 testSourceMapLocations(LOOP_TEST); | 119 testSourceMapLocations(LOOP_TEST); |
120 testSourceMapLocations(INTERCEPTOR_TEST); | 120 testSourceMapLocations(INTERCEPTOR_TEST); |
121 } | 121 } |
OLD | NEW |