| 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'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 for (int i = 0; i < codeWithMarkers.length; ++i) { | 32 for (int i = 0; i < codeWithMarkers.length; ++i) { |
| 33 if (codeWithMarkers[i] == '@') { | 33 if (codeWithMarkers[i] == '@') { |
| 34 expectedLocations.add(i - expectedLocations.length); | 34 expectedLocations.add(i - expectedLocations.length); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 String code = codeWithMarkers.replaceAll('@', ''); | 37 String code = codeWithMarkers.replaceAll('@', ''); |
| 38 | 38 |
| 39 SourceFile sourceFile = new StringSourceFile.fromName('<test script>', code); | 39 SourceFile sourceFile = new StringSourceFile.fromName('<test script>', code); |
| 40 asyncTest(() => compileAll(sourceFile).then((CodeOutput output) { | 40 asyncTest(() => compileAll(sourceFile).then((CodeOutput output) { |
| 41 Set<int> locations = new Set<int>(); | 41 Set<int> locations = new Set<int>(); |
| 42 output | 42 SourceLocations sourceLocations = output.sourceLocations.single; |
| 43 sourceLocations |
| 43 .forEachSourceLocation((int offset, SourceLocation sourcePosition) { | 44 .forEachSourceLocation((int offset, SourceLocation sourcePosition) { |
| 44 if (sourcePosition != null && | 45 if (sourcePosition != null && |
| 45 sourcePosition.sourceUri == sourceFile.uri) { | 46 sourcePosition.sourceUri == sourceFile.uri) { |
| 46 locations.add(sourcePosition.offset); | 47 locations.add(sourcePosition.offset); |
| 47 } | 48 } |
| 48 }); | 49 }); |
| 49 | 50 |
| 50 for (int i = 0; i < expectedLocations.length; ++i) { | 51 for (int i = 0; i < expectedLocations.length; ++i) { |
| 51 int expectedLocation = expectedLocations[i]; | 52 int expectedLocation = expectedLocations[i]; |
| 52 if (!locations.contains(expectedLocation)) { | 53 if (!locations.contains(expectedLocation)) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 testSourceMapLocations(FUNCTIONS_TEST); | 114 testSourceMapLocations(FUNCTIONS_TEST); |
| 114 testSourceMapLocations(RETURN_TEST); | 115 testSourceMapLocations(RETURN_TEST); |
| 115 testSourceMapLocations(NOT_TEST); | 116 testSourceMapLocations(NOT_TEST); |
| 116 testSourceMapLocations(UNARY_TEST); | 117 testSourceMapLocations(UNARY_TEST); |
| 117 testSourceMapLocations(BINARY_TEST); | 118 testSourceMapLocations(BINARY_TEST); |
| 118 testSourceMapLocations(SEND_TEST); | 119 testSourceMapLocations(SEND_TEST); |
| 119 testSourceMapLocations(SEND_SET_TEST); | 120 testSourceMapLocations(SEND_SET_TEST); |
| 120 testSourceMapLocations(LOOP_TEST); | 121 testSourceMapLocations(LOOP_TEST); |
| 121 testSourceMapLocations(INTERCEPTOR_TEST); | 122 testSourceMapLocations(INTERCEPTOR_TEST); |
| 122 } | 123 } |
| OLD | NEW |