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

Unified Diff: dart/lib/compiler/implementation/source_map_builder.dart

Issue 11364025: Remove dependency on dart:json. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: dart/lib/compiler/implementation/source_map_builder.dart
diff --git a/dart/lib/compiler/implementation/source_map_builder.dart b/dart/lib/compiler/implementation/source_map_builder.dart
index a29b0fe3f428380545ab329a073da3dfeb8f2001..06a6ca02c00852f85c8321ed5169aafc729da4da 100644
--- a/dart/lib/compiler/implementation/source_map_builder.dart
+++ b/dart/lib/compiler/implementation/source_map_builder.dart
@@ -2,12 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-#library('source_map_builder');
+library source_map_builder;
-#import('dart:json');
-
-#import('scanner/scannerlib.dart');
-#import('source_file.dart');
+import 'util/util.dart';
+import 'scanner/scannerlib.dart' show Token;
+import 'source_file.dart';
class SourceMapBuilder {
static const int VLQ_BASE_SHIFT = 5;
@@ -53,6 +52,19 @@ class SourceMapBuilder {
entries.add(new SourceMapEntry(sourceLocation, targetOffset));
}
+ void printStringListOn(List<String> strings, StringBuffer buffer) {
+ bool first = true;
+ buffer.add('[');
+ for (String string in strings) {
+ if (!first) buffer.add(',');
+ buffer.add("'");
+ writeJsonEscapedCharsOn(string.charCodes.iterator(), buffer, null);
+ buffer.add("'");
+ first = false;
+ }
+ buffer.add(']');
+ }
+
String build(SourceFile targetFile) {
StringBuffer buffer = new StringBuffer();
buffer.add('{\n');
@@ -61,10 +73,10 @@ class SourceMapBuilder {
entries.forEach((SourceMapEntry entry) => writeEntry(entry, targetFile, buffer));
buffer.add('",\n');
buffer.add(' "sources": ');
- JSON.printOn(sourceUrlList, buffer);
+ printStringListOn(sourceUrlList, buffer);
buffer.add(',\n');
buffer.add(' "names": ');
- JSON.printOn(sourceNameList, buffer);
+ printStringListOn(sourceNameList, buffer);
buffer.add('\n}\n');
return buffer.toString();
}
« no previous file with comments | « dart/lib/compiler/implementation/scanner/scanner_task.dart ('k') | dart/lib/compiler/implementation/util/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698