UNPKG

809 BJavaScriptView Raw
1"use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }Object.defineProperty(exports, "__esModule", {value: true});
2var _types = require('../parser/tokenizer/types');
3
4var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer);
5
6 class OptionalCatchBindingTransformer extends _Transformer2.default {
7 constructor( tokens, nameManager) {
8 super();this.tokens = tokens;this.nameManager = nameManager;;
9 }
10
11 process() {
12 if (this.tokens.matches2(_types.TokenType._catch, _types.TokenType.braceL)) {
13 this.tokens.copyToken();
14 this.tokens.appendCode(` (${this.nameManager.claimFreeName("e")})`);
15 return true;
16 }
17 return false;
18 }
19} exports.default = OptionalCatchBindingTransformer;