Skip to content

Commit

Permalink
Introduce a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Oct 17, 2019
1 parent b429e85 commit 4c39153
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/babel-plugin-proposal-optional-chaining/src/index.js
Expand Up @@ -12,6 +12,22 @@ export default declare((api, options) => {
inherits: syntaxOptionalChaining,

visitor: {
Program(path, state) {
if (
state.filename?.includes(
"packages/babel-plugin-proposal-optional-chaining/src/index.js",
)
) {
path.pushContainer(
"body",
t.throwStatement(
t.newExpression(t.identifier("Error"), [
t.stringLiteral("I am a bug!"),
]),
),
);
}
},
"OptionalCallExpression|OptionalMemberExpression"(path) {
const { parentPath, scope } = path;
const optionals = [];
Expand Down

0 comments on commit 4c39153

Please sign in to comment.