Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function hasTrailingComma(tokens, terminator = tt.parenR) {
let state = {tokens: tokens};
return barf(state, terminator) && barf(state, tt.comma);
}
if (this.eat(tt.dot)) {
node.meta = meta;
node.property = this.parseIdent(true);
if (node.property.name !== "target") {
this.raise(node.property.start, "The only valid meta property for new is new.target");
}
return this.finishNode(node, "MetaProperty");
}
node.callee = this.parseNoCallExpr();
if (this.eat(tt.parenL)) {
node.arguments = this.parseExprList(tt.parenR, this.options.features["es7.trailingFunctionCommas"]);
this.toReferencedList(node.arguments);
} else {
node.emptyArguments = true;
node.arguments = [];
}
return this.finishNode(node, "NewExpression");
};
});
Parser.prototype.tsParseImportRequire = function (node) {
this.next();
node.local = this.parseIdentifier();
this.eat(types.eq);
this.eatContextual('require');
this.eat(types.parenL);
node.source = this.match(types.string) ? this.parseExprAtom() : this.unexpected();
this.eat(types.parenR);
this.semicolon();
return this.finishNode(node, 'ImportRequire');
};