| 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:uri'); | 5 #import('dart:uri'); |
| 6 | 6 |
| 7 #import("../../../lib/compiler/implementation/leg.dart"); | 7 #import("../../../lib/compiler/implementation/leg.dart"); |
| 8 #import('../../../lib/compiler/implementation/source_file.dart'); | 8 #import('../../../lib/compiler/implementation/source_file.dart'); |
| 9 #import("mock_compiler.dart"); | 9 #import("mock_compiler.dart"); |
| 10 #import('parser_helper.dart'); | 10 #import('parser_helper.dart'); |
| 11 | 11 |
| 12 List compileAll(SourceFile sourceFile) { | 12 List compileAll(SourceFile sourceFile) { |
| 13 MockCompiler compiler = new MockCompiler(); | 13 MockCompiler compiler = new MockCompiler(); |
| 14 Uri uri = new Uri(sourceFile.filename); | 14 Uri uri = new Uri.fromComponents(sourceFile.filename); |
| 15 compiler.sourceFiles[uri.toString()] = sourceFile; | 15 compiler.sourceFiles[uri.toString()] = sourceFile; |
| 16 compiler.runCompiler(uri); | 16 compiler.runCompiler(uri); |
| 17 return compiler.backend.emitter.sourceMapBuilder.entries; | 17 return compiler.backend.emitter.sourceMapBuilder.entries; |
| 18 } | 18 } |
| 19 | 19 |
| 20 void testSourceMapLocations(String codeWithMarkers) { | 20 void testSourceMapLocations(String codeWithMarkers) { |
| 21 List<int> expectedLocations = new List<int>(); | 21 List<int> expectedLocations = new List<int>(); |
| 22 for (int i = 0; i < codeWithMarkers.length; ++i) { | 22 for (int i = 0; i < codeWithMarkers.length; ++i) { |
| 23 if (codeWithMarkers[i] == '@') { | 23 if (codeWithMarkers[i] == '@') { |
| 24 expectedLocations.add(i - expectedLocations.length); | 24 expectedLocations.add(i - expectedLocations.length); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // so that the new code is not optimized, otherwise just remove the marker | 89 // so that the new code is not optimized, otherwise just remove the marker |
| 90 // from problematic location. | 90 // from problematic location. |
| 91 testSourceMapLocations(FUNCTIONS_TEST); | 91 testSourceMapLocations(FUNCTIONS_TEST); |
| 92 testSourceMapLocations(RETURN_TEST); | 92 testSourceMapLocations(RETURN_TEST); |
| 93 testSourceMapLocations(NOT_TEST); | 93 testSourceMapLocations(NOT_TEST); |
| 94 testSourceMapLocations(UNARY_TEST); | 94 testSourceMapLocations(UNARY_TEST); |
| 95 testSourceMapLocations(BINARY_TEST); | 95 testSourceMapLocations(BINARY_TEST); |
| 96 testSourceMapLocations(SEND_TEST); | 96 testSourceMapLocations(SEND_TEST); |
| 97 testSourceMapLocations(LOOP_TEST); | 97 testSourceMapLocations(LOOP_TEST); |
| 98 } | 98 } |
| OLD | NEW |