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 "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"; | 8 import "../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart"; |
9 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; | 9 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; |
10 import "mock_compiler.dart"; | 10 import "mock_compiler.dart"; |
(...skipping 23 matching lines...) Expand all Loading... |
34 buffer.forEachSourceLocation((int offset, var sourcePosition) { | 34 buffer.forEachSourceLocation((int offset, var sourcePosition) { |
35 if (sourcePosition != null && sourcePosition.sourceFile == sourceFile) { | 35 if (sourcePosition != null && sourcePosition.sourceFile == sourceFile) { |
36 locations.add(sourcePosition.token.charOffset); | 36 locations.add(sourcePosition.token.charOffset); |
37 } | 37 } |
38 }); | 38 }); |
39 | 39 |
40 for (int i = 0; i < expectedLocations.length; ++i) { | 40 for (int i = 0; i < expectedLocations.length; ++i) { |
41 int expectedLocation = expectedLocations[i]; | 41 int expectedLocation = expectedLocations[i]; |
42 if (!locations.contains(expectedLocation)) { | 42 if (!locations.contains(expectedLocation)) { |
43 int originalLocation = expectedLocation + i; | 43 int originalLocation = expectedLocation + i; |
44 SourceFile sourceFileWithMarkers = new StringSourceFile('<test script>', | 44 SourceFile sourceFileWithMarkers = |
45 codeWithMarkers); | 45 new StringSourceFile('<test script>', codeWithMarkers); |
46 String message = sourceFileWithMarkers.getLocationMessage( | 46 String message = sourceFileWithMarkers.getLocationMessage( |
47 'Missing location', originalLocation, originalLocation + 1, true, | 47 'Missing location', originalLocation, originalLocation + 1, true, |
48 (s) => s); | 48 (s) => s); |
49 Expect.fail(message); | 49 Expect.fail(message); |
50 } | 50 } |
51 } | 51 } |
52 })); | 52 })); |
53 } | 53 } |
54 | 54 |
55 String FUNCTIONS_TEST = ''' | 55 String FUNCTIONS_TEST = ''' |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 testSourceMapLocations(FUNCTIONS_TEST); | 103 testSourceMapLocations(FUNCTIONS_TEST); |
104 testSourceMapLocations(RETURN_TEST); | 104 testSourceMapLocations(RETURN_TEST); |
105 testSourceMapLocations(NOT_TEST); | 105 testSourceMapLocations(NOT_TEST); |
106 testSourceMapLocations(UNARY_TEST); | 106 testSourceMapLocations(UNARY_TEST); |
107 testSourceMapLocations(BINARY_TEST); | 107 testSourceMapLocations(BINARY_TEST); |
108 testSourceMapLocations(SEND_TEST); | 108 testSourceMapLocations(SEND_TEST); |
109 testSourceMapLocations(SEND_SET_TEST); | 109 testSourceMapLocations(SEND_SET_TEST); |
110 testSourceMapLocations(LOOP_TEST); | 110 testSourceMapLocations(LOOP_TEST); |
111 testSourceMapLocations(INTERCEPTOR_TEST); | 111 testSourceMapLocations(INTERCEPTOR_TEST); |
112 } | 112 } |
OLD | NEW |