Add support for parsing babylons throwExpressions (#4695)
parent
18aa527adc
commit
56af3d621d
|
@ -31,7 +31,8 @@ function parse(text, parsers, opts) {
|
|||
"optionalChaining",
|
||||
"classPrivateProperties",
|
||||
"pipelineOperator",
|
||||
"nullishCoalescingOperator"
|
||||
"nullishCoalescingOperator",
|
||||
"throwExpressions"
|
||||
]
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`throw_expression.js 1`] = `
|
||||
function save(filename = throw new TypeError("Argument required")) {}
|
||||
|
||||
lint(ast, {
|
||||
with: () => throw new Error("avoid using 'with' statements.")
|
||||
});
|
||||
|
||||
function getEncoder(encoding) {
|
||||
const encoder = encoding === "utf8" ? new UTF8Encoder()
|
||||
: encoding === "utf16le" ? new UTF16Encoder(false)
|
||||
: encoding === "utf16be" ? new UTF16Encoder(true)
|
||||
: throw new Error("Unsupported encoding");
|
||||
}
|
||||
|
||||
class Product {
|
||||
get id() { return this._id; }
|
||||
set id(value) { this._id = value || throw new Error("Invalid value"); }
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
function save(filename = throw new TypeError("Argument required")) {}
|
||||
|
||||
lint(ast, {
|
||||
with: () => throw new Error("avoid using 'with' statements.")
|
||||
});
|
||||
|
||||
function getEncoder(encoding) {
|
||||
const encoder =
|
||||
encoding === "utf8"
|
||||
? new UTF8Encoder()
|
||||
: encoding === "utf16le"
|
||||
? new UTF16Encoder(false)
|
||||
: encoding === "utf16be"
|
||||
? new UTF16Encoder(true)
|
||||
: throw new Error("Unsupported encoding");
|
||||
}
|
||||
|
||||
class Product {
|
||||
get id() {
|
||||
return this._id;
|
||||
}
|
||||
set id(value) {
|
||||
this._id = value || throw new Error("Invalid value");
|
||||
}
|
||||
}
|
||||
|
||||
`;
|
|
@ -0,0 +1 @@
|
|||
run_spec(__dirname, ["babylon"]);
|
|
@ -0,0 +1,17 @@
|
|||
function save(filename = throw new TypeError("Argument required")) {}
|
||||
|
||||
lint(ast, {
|
||||
with: () => throw new Error("avoid using 'with' statements.")
|
||||
});
|
||||
|
||||
function getEncoder(encoding) {
|
||||
const encoder = encoding === "utf8" ? new UTF8Encoder()
|
||||
: encoding === "utf16le" ? new UTF16Encoder(false)
|
||||
: encoding === "utf16be" ? new UTF16Encoder(true)
|
||||
: throw new Error("Unsupported encoding");
|
||||
}
|
||||
|
||||
class Product {
|
||||
get id() { return this._id; }
|
||||
set id(value) { this._id = value || throw new Error("Invalid value"); }
|
||||
}
|
Loading…
Reference in New Issue