mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-10 05:35:05 +08:00
Typecheck javascript_metadata/JavaScriptMetadata.js with TypeScript
R=aerotwist@chromium.org Bug: 1011811 Change-Id: I7cb62ed2bdd49fac361168c5e103ea99f07c9828 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2550079 Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
67d6b84d9a
commit
cc8c82e4bc
@@ -2,9 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @ts-nocheck
|
||||
// TODO(crbug.com/1011811): Enable TypeScript compiler checks
|
||||
|
||||
import * as Common from '../common/common.js'; // eslint-disable-line no-unused-vars
|
||||
|
||||
import {NativeFunctions} from './NativeFunctions.js';
|
||||
@@ -25,15 +22,19 @@ export class JavaScriptMetadataImpl {
|
||||
if (!nativeFunction.receiver) {
|
||||
this._uniqueFunctions.set(nativeFunction.name, nativeFunction.signatures);
|
||||
} else if (nativeFunction.static) {
|
||||
if (!this._staticMethods.has(nativeFunction.receiver)) {
|
||||
this._staticMethods.set(nativeFunction.receiver, new Map());
|
||||
let staticMethod = this._staticMethods.get(nativeFunction.receiver);
|
||||
if (!staticMethod) {
|
||||
staticMethod = new Map();
|
||||
this._staticMethods.set(nativeFunction.receiver, staticMethod);
|
||||
}
|
||||
this._staticMethods.get(nativeFunction.receiver).set(nativeFunction.name, nativeFunction.signatures);
|
||||
staticMethod.set(nativeFunction.name, nativeFunction.signatures);
|
||||
} else {
|
||||
if (!this._instanceMethods.has(nativeFunction.receiver)) {
|
||||
this._instanceMethods.set(nativeFunction.receiver, new Map());
|
||||
let instanceMethod = this._instanceMethods.get(nativeFunction.receiver);
|
||||
if (!instanceMethod) {
|
||||
instanceMethod = new Map();
|
||||
this._instanceMethods.set(nativeFunction.receiver, instanceMethod);
|
||||
}
|
||||
this._instanceMethods.get(nativeFunction.receiver).set(nativeFunction.name, nativeFunction.signatures);
|
||||
instanceMethod.set(nativeFunction.name, nativeFunction.signatures);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,10 +55,11 @@ export class JavaScriptMetadataImpl {
|
||||
* @return {?Array<!Array<string>>}
|
||||
*/
|
||||
signaturesForInstanceMethod(name, receiverClassName) {
|
||||
if (!this._instanceMethods.has(receiverClassName)) {
|
||||
const instanceMethod = this._instanceMethods.get(receiverClassName);
|
||||
if (!instanceMethod) {
|
||||
return null;
|
||||
}
|
||||
return this._instanceMethods.get(receiverClassName).get(name) || null;
|
||||
return instanceMethod.get(name) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,9 +69,10 @@ export class JavaScriptMetadataImpl {
|
||||
* @return {?Array<!Array<string>>}
|
||||
*/
|
||||
signaturesForStaticMethod(name, receiverConstructorName) {
|
||||
if (!this._staticMethods.has(receiverConstructorName)) {
|
||||
const staticMethod = this._staticMethods.get(receiverConstructorName);
|
||||
if (!staticMethod) {
|
||||
return null;
|
||||
}
|
||||
return this._staticMethods.get(receiverConstructorName).get(name) || null;
|
||||
return staticMethod.get(name) || null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user