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

Unified Diff: third_party/WebKit/Source/devtools/front_end/common/CharacterIdMap.js

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done 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 side-by-side diff with in-line comments
Download patch
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;
+ }
};

Powered by Google App Engine
This is Rietveld 408576698