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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/common/CharacterIdMap.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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @template T 7 * @template T
8 */ 8 */
9 WebInspector.CharacterIdMap = function() 9 WebInspector.CharacterIdMap = function()
10 { 10 {
11 /** @type {!Map<T, string>} */ 11 /** @type {!Map<T, string>} */
12 this._elementToCharacter = new Map(); 12 this._elementToCharacter = new Map();
13 /** @type {!Map<string, T>} */ 13 /** @type {!Map<string, T>} */
14 this._characterToElement = new Map(); 14 this._characterToElement = new Map();
15 this._charCode = 33; 15 this._charCode = 33;
16 } 16 };
17 17
18 WebInspector.CharacterIdMap.prototype = { 18 WebInspector.CharacterIdMap.prototype = {
19 /** 19 /**
20 * @param {T} object 20 * @param {T} object
21 * @return {string} 21 * @return {string}
22 */ 22 */
23 toChar: function(object) 23 toChar: function(object)
24 { 24 {
25 var character = this._elementToCharacter.get(object); 25 var character = this._elementToCharacter.get(object);
26 if (!character) { 26 if (!character) {
27 if (this._charCode >= 0xFFFF) 27 if (this._charCode >= 0xFFFF)
28 throw new Error("CharacterIdMap ran out of capacity!"); 28 throw new Error("CharacterIdMap ran out of capacity!");
29 character = String.fromCharCode(this._charCode++); 29 character = String.fromCharCode(this._charCode++);
30 this._elementToCharacter.set(object, character); 30 this._elementToCharacter.set(object, character);
31 this._characterToElement.set(character, object); 31 this._characterToElement.set(character, object);
32 } 32 }
33 return character; 33 return character;
34 }, 34 },
35 35
36 /** 36 /**
37 * @param {string} character 37 * @param {string} character
38 * @return {?T} 38 * @return {?T}
39 */ 39 */
40 fromChar: function(character) 40 fromChar: function(character)
41 { 41 {
42 return this._characterToElement.get(character) || null; 42 return this._characterToElement.get(character) || null;
43 } 43 }
44 } 44 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698