Skip to content

Commit

Permalink
fix(core): wrong this in function call expr in optional chains
Browse files Browse the repository at this point in the history
  • Loading branch information
LongYinan committed Sep 6, 2020
1 parent 1ca71c6 commit 5d9966f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ export function transform(source: string, path: string, options?: Options) {
return bindings.transform(source, path, transformOption(path, options))
}

export const SWC_VERSION = '1.2.22'
export const SWC_VERSION = '57112fc'
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import test from 'ava'

test('optional chain function call', (t) => {
const obj = {
a: {
b: {
c: function () {
return this.foo
},
foo: 2,
},
foo: 1,
},
}

t.is(obj?.a?.b?.c(), 2)
})

0 comments on commit 5d9966f

Please sign in to comment.