mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 20:39:31 +08:00
This change makes it easier to run the script from directly `roll_py.deps` without having to fetch the dependencies first. This also makes it easier to track which dependencies our tooling have. Change-Id: I1ce55074ee6a1fffa6f2a2f05a56d0d74b4aca90 Bug: 1255619 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3431346 Reviewed-by: Mathias Bynens <mathias@chromium.org> Commit-Queue: Johan Bay <jobay@chromium.org>
34 lines
946 B
JavaScript
34 lines
946 B
JavaScript
// @ts-check
|
|
|
|
export class Base {
|
|
/**
|
|
* @param {object} initializer
|
|
* @param {Base["source"]} initializer.source
|
|
* @param {Base["tokens"]} initializer.tokens
|
|
*/
|
|
constructor({ source, tokens }) {
|
|
Object.defineProperties(this, {
|
|
source: { value: source },
|
|
tokens: { value: tokens, writable: true },
|
|
parent: { value: null, writable: true },
|
|
this: { value: this }, // useful when escaping from proxy
|
|
});
|
|
}
|
|
|
|
toJSON() {
|
|
const json = { type: undefined, name: undefined, inheritance: undefined };
|
|
let proto = this;
|
|
while (proto !== Object.prototype) {
|
|
const descMap = Object.getOwnPropertyDescriptors(proto);
|
|
for (const [key, value] of Object.entries(descMap)) {
|
|
if (value.enumerable || value.get) {
|
|
// @ts-ignore - allow indexing here
|
|
json[key] = this[key];
|
|
}
|
|
}
|
|
proto = Object.getPrototypeOf(proto);
|
|
}
|
|
return json;
|
|
}
|
|
}
|