Index: third_party/WebKit/Source/devtools/front_end/common/CharacterIdMap.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/common/CharacterIdMap.js b/third_party/WebKit/Source/devtools/front_end/common/CharacterIdMap.js |
index b6b96b58f96dfd4d5dbbf3fc52ce388a79cb8c1a..5f9a9f646df25e7a88295eb1bad024a09f7943e8 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/common/CharacterIdMap.js |
+++ b/third_party/WebKit/Source/devtools/front_end/common/CharacterIdMap.js |
@@ -1,44 +1,40 @@ |
// Copyright 2016 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
- |
/** |
- * @constructor |
* @template T |
+ * @unrestricted |
*/ |
-WebInspector.CharacterIdMap = function() |
-{ |
+WebInspector.CharacterIdMap = class { |
+ constructor() { |
/** @type {!Map<T, string>} */ |
this._elementToCharacter = new Map(); |
/** @type {!Map<string, T>} */ |
this._characterToElement = new Map(); |
this._charCode = 33; |
-}; |
+ } |
-WebInspector.CharacterIdMap.prototype = { |
- /** |
- * @param {T} object |
- * @return {string} |
- */ |
- toChar: function(object) |
- { |
- var character = this._elementToCharacter.get(object); |
- if (!character) { |
- if (this._charCode >= 0xFFFF) |
- throw new Error("CharacterIdMap ran out of capacity!"); |
- character = String.fromCharCode(this._charCode++); |
- this._elementToCharacter.set(object, character); |
- this._characterToElement.set(character, object); |
- } |
- return character; |
- }, |
- |
- /** |
- * @param {string} character |
- * @return {?T} |
- */ |
- fromChar: function(character) |
- { |
- return this._characterToElement.get(character) || null; |
+ /** |
+ * @param {T} object |
+ * @return {string} |
+ */ |
+ toChar(object) { |
+ var character = this._elementToCharacter.get(object); |
+ if (!character) { |
+ if (this._charCode >= 0xFFFF) |
+ throw new Error('CharacterIdMap ran out of capacity!'); |
+ character = String.fromCharCode(this._charCode++); |
+ this._elementToCharacter.set(object, character); |
+ this._characterToElement.set(character, object); |
} |
+ return character; |
+ } |
+ |
+ /** |
+ * @param {string} character |
+ * @return {?T} |
+ */ |
+ fromChar(character) { |
+ return this._characterToElement.get(character) || null; |
+ } |
}; |