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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/source_map_builder.dart

Issue 11368138: Add some support for the code-point code-unit distinction. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Implemented feedback from patch set 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 library source_map_builder; 5 library source_map_builder;
6 6
7 import 'util/util.dart'; 7 import 'util/util.dart';
8 import 'scanner/scannerlib.dart' show Token; 8 import 'scanner/scannerlib.dart' show Token;
9 import 'source_file.dart'; 9 import 'source_file.dart';
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 void addMapping(int targetOffset, SourceFileLocation sourceLocation) { 51 void addMapping(int targetOffset, SourceFileLocation sourceLocation) {
52 entries.add(new SourceMapEntry(sourceLocation, targetOffset)); 52 entries.add(new SourceMapEntry(sourceLocation, targetOffset));
53 } 53 }
54 54
55 void printStringListOn(List<String> strings, StringBuffer buffer) { 55 void printStringListOn(List<String> strings, StringBuffer buffer) {
56 bool first = true; 56 bool first = true;
57 buffer.add('['); 57 buffer.add('[');
58 for (String string in strings) { 58 for (String string in strings) {
59 if (!first) buffer.add(','); 59 if (!first) buffer.add(',');
60 buffer.add("'"); 60 buffer.add('"');
61 writeJsonEscapedCharsOn(string.charCodes.iterator(), buffer, null); 61 writeJsonEscapedCharsOn(string, buffer);
62 buffer.add("'"); 62 buffer.add('"');
63 first = false; 63 first = false;
64 } 64 }
65 buffer.add(']'); 65 buffer.add(']');
66 } 66 }
67 67
68 String build(SourceFile targetFile) { 68 String build(SourceFile targetFile) {
69 StringBuffer buffer = new StringBuffer(); 69 StringBuffer buffer = new StringBuffer();
70 buffer.add('{\n'); 70 buffer.add('{\n');
71 buffer.add(' "version": 3,\n'); 71 buffer.add(' "version": 3,\n');
72 buffer.add(' "mappings": "'); 72 buffer.add(' "mappings": "');
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 int getColumn() => sourceFile.getColumn(getLine(), token.charOffset); 180 int getColumn() => sourceFile.getColumn(getLine(), token.charOffset);
181 181
182 String getSourceName() { 182 String getSourceName() {
183 if (token.isIdentifier()) return token.slowToString(); 183 if (token.isIdentifier()) return token.slowToString();
184 return null; 184 return null;
185 } 185 }
186 186
187 bool isValid() => token.charOffset < sourceFile.text.length; 187 bool isValid() => token.charOffset < sourceFile.text.length;
188 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698