| 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 } |
| 110 | 111 |
| 111 int sourceUrlIndex = indexOf(sourceUrlList, sourceUrl, sourceUrlMap); | 112 int sourceUrlIndex = indexOf(sourceUrlList, sourceUrl, sourceUrlMap); |
| 112 encodeVLQ(output, sourceUrlIndex - previousSourceUrlIndex); | 113 encodeVLQ(output, sourceUrlIndex - previousSourceUrlIndex); |
| 113 previousSourceUrlIndex = sourceUrlIndex; | 114 previousSourceUrlIndex = sourceUrlIndex; |
| 114 | 115 |
| 115 encodeVLQ(output, sourceLine - previousSourceLine); | 116 encodeVLQ(output, sourceLine - previousSourceLine); |
| 116 previousSourceLine = sourceLine; | 117 previousSourceLine = sourceLine; |
| 117 encodeVLQ(output, sourceColumn - previousSourceColumn); | 118 encodeVLQ(output, sourceColumn - previousSourceColumn); |
| 118 previousSourceColumn = sourceColumn; | 119 previousSourceColumn = sourceColumn; |
| 119 | 120 |
| 120 if (sourceName === null) | 121 if (sourceName === null) { |
| 121 return; | 122 return; |
| 123 } |
| 122 | 124 |
| 123 int sourceNameIndex = indexOf(sourceNameList, sourceName, sourceNameMap); | 125 int sourceNameIndex = indexOf(sourceNameList, sourceName, sourceNameMap); |
| 124 encodeVLQ(output, sourceNameIndex - previousSourceNameIndex); | 126 encodeVLQ(output, sourceNameIndex - previousSourceNameIndex); |
| 125 previousSourceNameIndex = sourceNameIndex; | 127 previousSourceNameIndex = sourceNameIndex; |
| 126 } | 128 } |
| 127 | 129 |
| 128 int indexOf(List<String> list, String value, Map<String, int> map) { | 130 int indexOf(List<String> list, String value, Map<String, int> map) { |
| 129 return map.putIfAbsent(value, () { | 131 return map.putIfAbsent(value, () { |
| 130 int index = list.length; | 132 int index = list.length; |
| 131 map[value] = index; | 133 map[value] = index; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 144 do { | 146 do { |
| 145 int digit = value & VLQ_BASE_MASK; | 147 int digit = value & VLQ_BASE_MASK; |
| 146 value >>= VLQ_BASE_SHIFT; | 148 value >>= VLQ_BASE_SHIFT; |
| 147 if (value > 0) { | 149 if (value > 0) { |
| 148 digit |= VLQ_CONTINUATION_BIT; | 150 digit |= VLQ_CONTINUATION_BIT; |
| 149 } | 151 } |
| 150 output.add(BASE64_DIGITS[digit]); | 152 output.add(BASE64_DIGITS[digit]); |
| 151 } while (value > 0); | 153 } while (value > 0); |
| 152 } | 154 } |
| 153 } | 155 } |
| OLD | NEW |