mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 12:33:47 +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>
54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
// @ts-check
|
|
|
|
import { Base } from "./base.js";
|
|
import { unescape } from "./helpers.js";
|
|
|
|
export class Includes extends Base {
|
|
/**
|
|
* @param {import("../tokeniser").Tokeniser} tokeniser
|
|
*/
|
|
static parse(tokeniser) {
|
|
const target = tokeniser.consumeKind("identifier");
|
|
if (!target) {
|
|
return;
|
|
}
|
|
const tokens = { target };
|
|
tokens.includes = tokeniser.consume("includes");
|
|
if (!tokens.includes) {
|
|
tokeniser.unconsume(target.index);
|
|
return;
|
|
}
|
|
tokens.mixin =
|
|
tokeniser.consumeKind("identifier") ||
|
|
tokeniser.error("Incomplete includes statement");
|
|
tokens.termination =
|
|
tokeniser.consume(";") ||
|
|
tokeniser.error("No terminating ; for includes statement");
|
|
return new Includes({ source: tokeniser.source, tokens });
|
|
}
|
|
|
|
get type() {
|
|
return "includes";
|
|
}
|
|
get target() {
|
|
return unescape(this.tokens.target.value);
|
|
}
|
|
get includes() {
|
|
return unescape(this.tokens.mixin.value);
|
|
}
|
|
|
|
/** @param {import("../writer.js").Writer} w */
|
|
write(w) {
|
|
return w.ts.definition(
|
|
w.ts.wrap([
|
|
this.extAttrs.write(w),
|
|
w.reference_token(this.tokens.target, this),
|
|
w.token(this.tokens.includes),
|
|
w.reference_token(this.tokens.mixin, this),
|
|
w.token(this.tokens.termination),
|
|
]),
|
|
{ data: this }
|
|
);
|
|
}
|
|
}
|