astro-ghostcms/.pnpm-store/v3/files/24/d56698672b14462a2dcd34323bd...

20 lines
511 B
Plaintext
Raw Normal View History

2024-02-14 14:10:47 +00:00
import {TokenType as tt} from "../parser/tokenizer/types";
import Transformer from "./Transformer";
export default class OptionalCatchBindingTransformer extends Transformer {
constructor( tokens, nameManager) {
super();this.tokens = tokens;this.nameManager = nameManager;;
}
process() {
if (this.tokens.matches2(tt._catch, tt.braceL)) {
this.tokens.copyToken();
this.tokens.appendCode(` (${this.nameManager.claimFreeName("e")})`);
return true;
}
return false;
}
}