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

Side by Side Diff: tests/compiler/dart2js/sourcemaps/mapping_test.dart

Issue 2690063002: Refactor CompilerOutput (Closed)
Patch Set: Updated cf. comments Created 3 years, 10 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:async_helper/async_helper.dart'; 9 import 'package:async_helper/async_helper.dart';
10 import 'package:compiler/compiler_new.dart'; 10 import 'package:compiler/compiler_new.dart';
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (useNewSourceInfo) { 131 if (useNewSourceInfo) {
132 options.add(Flags.useNewSourceInfo); 132 options.add(Flags.useNewSourceInfo);
133 } 133 }
134 CompilationResult compilationResult = await runCompiler( 134 CompilationResult compilationResult = await runCompiler(
135 entryPoint: Uri.parse('memory:main.dart'), 135 entryPoint: Uri.parse('memory:main.dart'),
136 memorySourceFiles: {'main.dart': test.code}, 136 memorySourceFiles: {'main.dart': test.code},
137 outputProvider: collector, 137 outputProvider: collector,
138 options: options); 138 options: options);
139 Expect.isTrue(compilationResult.isSuccess, 139 Expect.isTrue(compilationResult.isSuccess,
140 "Unsuccessful compilation of test:\n${test.code}"); 140 "Unsuccessful compilation of test:\n${test.code}");
141 String sourceMapText = collector.getOutput('', 'js.map'); 141 String sourceMapText = collector.getOutput('', OutputType.sourceMap);
142 SingleMapping sourceMap = parse(sourceMapText); 142 SingleMapping sourceMap = parse(sourceMapText);
143 if (writeJs) { 143 if (writeJs) {
144 new File('out.js').writeAsStringSync(collector.getOutput('', 'js')); 144 new File('out.js')
145 .writeAsStringSync(collector.getOutput('', OutputType.js));
145 new File('out.js.map').writeAsStringSync(sourceMapText); 146 new File('out.js.map').writeAsStringSync(sourceMapText);
146 } 147 }
147 148
148 Set<SourceLocation> expectedLocations = test.expectedLocations.toSet(); 149 Set<SourceLocation> expectedLocations = test.expectedLocations.toSet();
149 List<SourceLocation> actualLocations = <SourceLocation>[]; 150 List<SourceLocation> actualLocations = <SourceLocation>[];
150 List<SourceLocation> extraLocations = <SourceLocation>[]; 151 List<SourceLocation> extraLocations = <SourceLocation>[];
151 for (TargetLineEntry targetLineEntry in sourceMap.lines) { 152 for (TargetLineEntry targetLineEntry in sourceMap.lines) {
152 for (TargetEntry targetEntry in targetLineEntry.entries) { 153 for (TargetEntry targetEntry in targetLineEntry.entries) {
153 if (targetEntry.sourceUrlId != null && 154 if (targetEntry.sourceUrlId != null &&
154 sourceMap.urls[targetEntry.sourceUrlId] == 'memory:main.dart') { 155 sourceMap.urls[targetEntry.sourceUrlId] == 'memory:main.dart') {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 bool operator ==(other) { 208 bool operator ==(other) {
208 if (identical(this, other)) return true; 209 if (identical(this, other)) return true;
209 if (other is! SourceLocation) return false; 210 if (other is! SourceLocation) return false;
210 return methodName == other.methodName && 211 return methodName == other.methodName &&
211 lineNo == other.lineNo && 212 lineNo == other.lineNo &&
212 columnNo == other.columnNo; 213 columnNo == other.columnNo;
213 } 214 }
214 215
215 String toString() => '$methodName:$lineNo:$columnNo'; 216 String toString() => '$methodName:$lineNo:$columnNo';
216 } 217 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/source_map_test.dart ('k') | tests/compiler/dart2js/sourcemaps/nomapping_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698