1 |
|
2 | import {TokenType as tt} from "../parser/tokenizer/types";
|
3 |
|
4 | import Transformer from "./Transformer";
|
5 |
|
6 | export default class OptionalCatchBindingTransformer extends Transformer {
|
7 | constructor( tokens, nameManager) {
|
8 | super();this.tokens = tokens;this.nameManager = nameManager;;
|
9 | }
|
10 |
|
11 | process() {
|
12 | if (this.tokens.matches2(tt._catch, tt.braceL)) {
|
13 | this.tokens.copyToken();
|
14 | this.tokens.appendCode(` (${this.nameManager.claimFreeName("e")})`);
|
15 | return true;
|
16 | }
|
17 | return false;
|
18 | }
|
19 | }
|