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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 /** @type {!Array.<string>|undefined} */ this.names; 42 /** @type {!Array.<string>|undefined} */ this.names;
43 } 43 }
44 44
45 /** 45 /**
46 * @constructor 46 * @constructor
47 */ 47 */
48 SourceMapV3.Section = function() 48 SourceMapV3.Section = function()
49 { 49 {
50 /** @type {!SourceMapV3} */ this.map; 50 /** @type {!SourceMapV3} */ this.map;
51 /** @type {!SourceMapV3.Offset} */ this.offset; 51 /** @type {!SourceMapV3.Offset} */ this.offset;
52 } 52 };
53 53
54 /** 54 /**
55 * @constructor 55 * @constructor
56 */ 56 */
57 SourceMapV3.Offset = function() 57 SourceMapV3.Offset = function()
58 { 58 {
59 /** @type {number} */ this.line; 59 /** @type {number} */ this.line;
60 /** @type {number} */ this.column; 60 /** @type {number} */ this.column;
61 } 61 };
62 62
63 /** 63 /**
64 * @constructor 64 * @constructor
65 * @param {number} lineNumber 65 * @param {number} lineNumber
66 * @param {number} columnNumber 66 * @param {number} columnNumber
67 * @param {string=} sourceURL 67 * @param {string=} sourceURL
68 * @param {number=} sourceLineNumber 68 * @param {number=} sourceLineNumber
69 * @param {number=} sourceColumnNumber 69 * @param {number=} sourceColumnNumber
70 * @param {string=} name 70 * @param {string=} name
71 */ 71 */
72 WebInspector.SourceMapEntry = function(lineNumber, columnNumber, sourceURL, sour ceLineNumber, sourceColumnNumber, name) 72 WebInspector.SourceMapEntry = function(lineNumber, columnNumber, sourceURL, sour ceLineNumber, sourceColumnNumber, name)
73 { 73 {
74 this.lineNumber = lineNumber; 74 this.lineNumber = lineNumber;
75 this.columnNumber = columnNumber; 75 this.columnNumber = columnNumber;
76 this.sourceURL = sourceURL; 76 this.sourceURL = sourceURL;
77 this.sourceLineNumber = sourceLineNumber; 77 this.sourceLineNumber = sourceLineNumber;
78 this.sourceColumnNumber = sourceColumnNumber; 78 this.sourceColumnNumber = sourceColumnNumber;
79 this.name = name; 79 this.name = name;
80 } 80 };
81 81
82 /** 82 /**
83 * @interface 83 * @interface
84 */ 84 */
85 WebInspector.SourceMap = function() { } 85 WebInspector.SourceMap = function() { };
86 86
87 WebInspector.SourceMap.prototype = { 87 WebInspector.SourceMap.prototype = {
88 /** 88 /**
89 * @return {string} 89 * @return {string}
90 */ 90 */
91 compiledURL: function() { }, 91 compiledURL: function() { },
92 92
93 /** 93 /**
94 * @return {string} 94 * @return {string}
95 */ 95 */
(...skipping 28 matching lines...) Expand all
124 * @return {boolean} 124 * @return {boolean}
125 */ 125 */
126 editable: function() { }, 126 editable: function() { },
127 127
128 /** 128 /**
129 * @param {!Array<!WebInspector.TextRange>} ranges 129 * @param {!Array<!WebInspector.TextRange>} ranges
130 * @param {!Array<string>} texts 130 * @param {!Array<string>} texts
131 * @return {!Promise<?WebInspector.SourceMap.EditResult>} 131 * @return {!Promise<?WebInspector.SourceMap.EditResult>}
132 */ 132 */
133 editCompiled: function(ranges, texts) { }, 133 editCompiled: function(ranges, texts) { },
134 } 134 };
135 135
136 /** 136 /**
137 * @constructor 137 * @constructor
138 * @param {!WebInspector.SourceMap} map 138 * @param {!WebInspector.SourceMap} map
139 * @param {!Array<!WebInspector.SourceEdit>} compiledEdits 139 * @param {!Array<!WebInspector.SourceEdit>} compiledEdits
140 * @param {!Map<string, string>} newSources 140 * @param {!Map<string, string>} newSources
141 */ 141 */
142 WebInspector.SourceMap.EditResult = function(map, compiledEdits, newSources) 142 WebInspector.SourceMap.EditResult = function(map, compiledEdits, newSources)
143 { 143 {
144 this.map = map; 144 this.map = map;
145 this.compiledEdits = compiledEdits; 145 this.compiledEdits = compiledEdits;
146 this.newSources = newSources; 146 this.newSources = newSources;
147 } 147 };
148 148
149 /** 149 /**
150 * @interface 150 * @interface
151 */ 151 */
152 WebInspector.SourceMapFactory = function() { } 152 WebInspector.SourceMapFactory = function() { };
153 153
154 WebInspector.SourceMapFactory.prototype = { 154 WebInspector.SourceMapFactory.prototype = {
155 /** 155 /**
156 * @param {!WebInspector.Target} target 156 * @param {!WebInspector.Target} target
157 * @param {!WebInspector.SourceMap} sourceMap 157 * @param {!WebInspector.SourceMap} sourceMap
158 * @return {!Promise<?WebInspector.SourceMap>} 158 * @return {!Promise<?WebInspector.SourceMap>}
159 */ 159 */
160 editableSourceMap: function(target, sourceMap) { }, 160 editableSourceMap: function(target, sourceMap) { },
161 } 161 };
162 162
163 /** 163 /**
164 * Implements Source Map V3 model. See https://github.com/google/closure-compile r/wiki/Source-Maps 164 * Implements Source Map V3 model. See https://github.com/google/closure-compile r/wiki/Source-Maps
165 * for format description. 165 * for format description.
166 * @constructor 166 * @constructor
167 * @implements {WebInspector.SourceMap} 167 * @implements {WebInspector.SourceMap}
168 * @param {string} compiledURL 168 * @param {string} compiledURL
169 * @param {string} sourceMappingURL 169 * @param {string} sourceMappingURL
170 * @param {!SourceMapV3} payload 170 * @param {!SourceMapV3} payload
171 */ 171 */
172 WebInspector.TextSourceMap = function(compiledURL, sourceMappingURL, payload) 172 WebInspector.TextSourceMap = function(compiledURL, sourceMappingURL, payload)
173 { 173 {
174 if (!WebInspector.TextSourceMap.prototype._base64Map) { 174 if (!WebInspector.TextSourceMap.prototype._base64Map) {
175 const base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx yz0123456789+/"; 175 const base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx yz0123456789+/";
176 WebInspector.TextSourceMap.prototype._base64Map = {}; 176 WebInspector.TextSourceMap.prototype._base64Map = {};
177 for (var i = 0; i < base64Digits.length; ++i) 177 for (var i = 0; i < base64Digits.length; ++i)
178 WebInspector.TextSourceMap.prototype._base64Map[base64Digits.charAt( i)] = i; 178 WebInspector.TextSourceMap.prototype._base64Map[base64Digits.charAt( i)] = i;
179 } 179 }
180 180
181 this._json = payload; 181 this._json = payload;
182 this._compiledURL = compiledURL; 182 this._compiledURL = compiledURL;
183 this._sourceMappingURL = sourceMappingURL; 183 this._sourceMappingURL = sourceMappingURL;
184 /** @type {?Array<!WebInspector.SourceMapEntry>} */ 184 /** @type {?Array<!WebInspector.SourceMapEntry>} */
185 this._mappings = null; 185 this._mappings = null;
186 /** @type {!Map<string, !WebInspector.TextSourceMap.SourceInfo>} */ 186 /** @type {!Map<string, !WebInspector.TextSourceMap.SourceInfo>} */
187 this._sourceInfos = new Map(); 187 this._sourceInfos = new Map();
188 this._eachSection(this._parseSources.bind(this)); 188 this._eachSection(this._parseSources.bind(this));
189 } 189 };
190 190
191 /** 191 /**
192 * @param {string} sourceMapURL 192 * @param {string} sourceMapURL
193 * @param {string} compiledURL 193 * @param {string} compiledURL
194 * @return {!Promise<?WebInspector.TextSourceMap>} 194 * @return {!Promise<?WebInspector.TextSourceMap>}
195 * @this {WebInspector.TextSourceMap} 195 * @this {WebInspector.TextSourceMap}
196 */ 196 */
197 WebInspector.TextSourceMap.load = function(sourceMapURL, compiledURL) 197 WebInspector.TextSourceMap.load = function(sourceMapURL, compiledURL)
198 { 198 {
199 var callback; 199 var callback;
(...skipping 18 matching lines...) Expand all
218 try { 218 try {
219 var payload = /** @type {!SourceMapV3} */ (JSON.parse(content)); 219 var payload = /** @type {!SourceMapV3} */ (JSON.parse(content));
220 var baseURL = sourceMapURL.startsWith("data:") ? compiledURL : sourc eMapURL; 220 var baseURL = sourceMapURL.startsWith("data:") ? compiledURL : sourc eMapURL;
221 callback(new WebInspector.TextSourceMap(compiledURL, baseURL, payloa d)); 221 callback(new WebInspector.TextSourceMap(compiledURL, baseURL, payloa d));
222 } catch (e) { 222 } catch (e) {
223 console.error(e); 223 console.error(e);
224 WebInspector.console.warn("DevTools failed to parse SourceMap: " + s ourceMapURL); 224 WebInspector.console.warn("DevTools failed to parse SourceMap: " + s ourceMapURL);
225 callback(null); 225 callback(null);
226 } 226 }
227 } 227 }
228 } 228 };
229 229
230 WebInspector.TextSourceMap.prototype = { 230 WebInspector.TextSourceMap.prototype = {
231 /** 231 /**
232 * @override 232 * @override
233 * @return {string} 233 * @return {string}
234 */ 234 */
235 compiledURL: function() 235 compiledURL: function()
236 { 236 {
237 return this._compiledURL; 237 return this._compiledURL;
238 }, 238 },
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 var endIndex = mappings.upperBound({lineNumber: textRange.endLine, colum nNumber: textRange.endColumn}, comparator); 539 var endIndex = mappings.upperBound({lineNumber: textRange.endLine, colum nNumber: textRange.endColumn}, comparator);
540 540
541 var startMapping = mappings[startIndex]; 541 var startMapping = mappings[startIndex];
542 var endMapping = mappings[endIndex]; 542 var endMapping = mappings[endIndex];
543 return new WebInspector.TextRange(startMapping.lineNumber, startMapping. columnNumber, endMapping.lineNumber, endMapping.columnNumber); 543 return new WebInspector.TextRange(startMapping.lineNumber, startMapping. columnNumber, endMapping.lineNumber, endMapping.columnNumber);
544 }, 544 },
545 545
546 _VLQ_BASE_SHIFT: 5, 546 _VLQ_BASE_SHIFT: 5,
547 _VLQ_BASE_MASK: (1 << 5) - 1, 547 _VLQ_BASE_MASK: (1 << 5) - 1,
548 _VLQ_CONTINUATION_MASK: 1 << 5 548 _VLQ_CONTINUATION_MASK: 1 << 5
549 } 549 };
550 550
551 /** 551 /**
552 * @constructor 552 * @constructor
553 * @param {string} string 553 * @param {string} string
554 */ 554 */
555 WebInspector.TextSourceMap.StringCharIterator = function(string) 555 WebInspector.TextSourceMap.StringCharIterator = function(string)
556 { 556 {
557 this._string = string; 557 this._string = string;
558 this._position = 0; 558 this._position = 0;
559 } 559 };
560 560
561 WebInspector.TextSourceMap.StringCharIterator.prototype = { 561 WebInspector.TextSourceMap.StringCharIterator.prototype = {
562 /** 562 /**
563 * @return {string} 563 * @return {string}
564 */ 564 */
565 next: function() 565 next: function()
566 { 566 {
567 return this._string.charAt(this._position++); 567 return this._string.charAt(this._position++);
568 }, 568 },
569 569
570 /** 570 /**
571 * @return {string} 571 * @return {string}
572 */ 572 */
573 peek: function() 573 peek: function()
574 { 574 {
575 return this._string.charAt(this._position); 575 return this._string.charAt(this._position);
576 }, 576 },
577 577
578 /** 578 /**
579 * @return {boolean} 579 * @return {boolean}
580 */ 580 */
581 hasNext: function() 581 hasNext: function()
582 { 582 {
583 return this._position < this._string.length; 583 return this._position < this._string.length;
584 } 584 }
585 } 585 };
586 586
587 /** 587 /**
588 * @constructor 588 * @constructor
589 * @param {?string} content 589 * @param {?string} content
590 * @param {?Array<!WebInspector.SourceMapEntry>} reverseMappings 590 * @param {?Array<!WebInspector.SourceMapEntry>} reverseMappings
591 */ 591 */
592 WebInspector.TextSourceMap.SourceInfo = function(content, reverseMappings) { 592 WebInspector.TextSourceMap.SourceInfo = function(content, reverseMappings) {
593 this.content = content; 593 this.content = content;
594 this.reverseMappings = reverseMappings; 594 this.reverseMappings = reverseMappings;
595 } 595 };
596 596
597 WebInspector.TextSourceMap._sourcesListSymbol = Symbol("sourcesList"); 597 WebInspector.TextSourceMap._sourcesListSymbol = Symbol("sourcesList");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698