| 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 #library('source_map_builder'); | 5 #library('source_map_builder'); |
| 6 | 6 |
| 7 #import('dart:json'); | 7 #import('dart:json'); |
| 8 | 8 |
| 9 #import('source_file.dart'); | 9 #import('source_file.dart'); |
| 10 | 10 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 | 99 |
| 100 if (!firstEntryInLine) { | 100 if (!firstEntryInLine) { |
| 101 output.add(','); | 101 output.add(','); |
| 102 } | 102 } |
| 103 firstEntryInLine = false; | 103 firstEntryInLine = false; |
| 104 | 104 |
| 105 encodeVLQ(output, targetColumn - previousTargetColumn); | 105 encodeVLQ(output, targetColumn - previousTargetColumn); |
| 106 previousTargetColumn = targetColumn; | 106 previousTargetColumn = targetColumn; |
| 107 | 107 |
| 108 if (sourceUrl === null) { | 108 if (sourceUrl === null) |
| 109 return; | 109 return; |
| 110 } | |
| 111 | 110 |
| 112 int sourceUrlIndex = indexOf(sourceUrlList, sourceUrl, sourceUrlMap); | 111 int sourceUrlIndex = indexOf(sourceUrlList, sourceUrl, sourceUrlMap); |
| 113 encodeVLQ(output, sourceUrlIndex - previousSourceUrlIndex); | 112 encodeVLQ(output, sourceUrlIndex - previousSourceUrlIndex); |
| 114 previousSourceUrlIndex = sourceUrlIndex; | 113 previousSourceUrlIndex = sourceUrlIndex; |
| 115 | 114 |
| 116 encodeVLQ(output, sourceLine - previousSourceLine); | 115 encodeVLQ(output, sourceLine - previousSourceLine); |
| 117 previousSourceLine = sourceLine; | 116 previousSourceLine = sourceLine; |
| 118 encodeVLQ(output, sourceColumn - previousSourceColumn); | 117 encodeVLQ(output, sourceColumn - previousSourceColumn); |
| 119 previousSourceColumn = sourceColumn; | 118 previousSourceColumn = sourceColumn; |
| 120 | 119 |
| 121 if (sourceName === null) { | 120 if (sourceName === null) |
| 122 return; | 121 return; |
| 123 } | |
| 124 | 122 |
| 125 int sourceNameIndex = indexOf(sourceNameList, sourceName, sourceNameMap); | 123 int sourceNameIndex = indexOf(sourceNameList, sourceName, sourceNameMap); |
| 126 encodeVLQ(output, sourceNameIndex - previousSourceNameIndex); | 124 encodeVLQ(output, sourceNameIndex - previousSourceNameIndex); |
| 127 previousSourceNameIndex = sourceNameIndex; | 125 previousSourceNameIndex = sourceNameIndex; |
| 128 } | 126 } |
| 129 | 127 |
| 130 int indexOf(List<String> list, String value, Map<String, int> map) { | 128 int indexOf(List<String> list, String value, Map<String, int> map) { |
| 131 return map.putIfAbsent(value, () { | 129 return map.putIfAbsent(value, () { |
| 132 int index = list.length; | 130 int index = list.length; |
| 133 map[value] = index; | 131 map[value] = index; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 146 do { | 144 do { |
| 147 int digit = value & VLQ_BASE_MASK; | 145 int digit = value & VLQ_BASE_MASK; |
| 148 value >>= VLQ_BASE_SHIFT; | 146 value >>= VLQ_BASE_SHIFT; |
| 149 if (value > 0) { | 147 if (value > 0) { |
| 150 digit |= VLQ_CONTINUATION_BIT; | 148 digit |= VLQ_CONTINUATION_BIT; |
| 151 } | 149 } |
| 152 output.add(BASE64_DIGITS[digit]); | 150 output.add(BASE64_DIGITS[digit]); |
| 153 } while (value > 0); | 151 } while (value > 0); |
| 154 } | 152 } |
| 155 } | 153 } |
| OLD | NEW |