-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(babel-plugin-espower): call assertionVisitor with appropriate as…
…ync/generator flags
- Loading branch information
1 parent
b0d700d
commit 2a8389f
Showing
9 changed files
with
128 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/.idea | ||
/node_modules | ||
/npm-debug.log | ||
/test/fixtures/*/actual.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use strict'; | ||
|
||
function myAsync(a) { | ||
return regeneratorRuntime.async(function myAsync$(context$1$0) { | ||
while (1) switch (context$1$0.prev = context$1$0.next) { | ||
case 0: | ||
context$1$0.t0 = assert; | ||
context$1$0.t1 = assert; | ||
context$1$0.t2 = assert; | ||
context$1$0.next = 5; | ||
return regeneratorRuntime.awrap(a); | ||
|
||
case 5: | ||
context$1$0.t3 = context$1$0.sent; | ||
context$1$0.t4 = context$1$0.t2._capt.call(context$1$0.t2, context$1$0.t3, 'arguments/0/left'); | ||
context$1$0.t5 = context$1$0.t4 === 3; | ||
context$1$0.t6 = context$1$0.t1._capt.call(context$1$0.t1, context$1$0.t5, 'arguments/0'); | ||
context$1$0.t7 = { | ||
async: true, | ||
content: 'assert((await a) === 3)', | ||
filepath: 'test/fixtures/AwaitExpression/fixture.js', | ||
line: 4 | ||
}; | ||
context$1$0.t8 = context$1$0.t0._expr.call(context$1$0.t0, context$1$0.t6, context$1$0.t7); | ||
assert(context$1$0.t8); | ||
|
||
case 12: | ||
case 'end': | ||
return context$1$0.stop(); | ||
} | ||
}, null, this); | ||
} | ||
|
||
function notAsync(a) { | ||
assert(assert._expr(assert._capt(assert._capt(await(assert._capt(a, 'arguments/0/left/arguments/0')), 'arguments/0/left') === 3, 'arguments/0'), { | ||
content: 'assert(await(a) === 3)', | ||
filepath: 'test/fixtures/AwaitExpression/fixture.js', | ||
line: 8 | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
async function myAsync(a){ | ||
assert((await (a)) === 3); | ||
} | ||
|
||
function notAsync(a){ | ||
assert((await (a)) === 3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict'; | ||
|
||
var marked0$0 = [gen].map(regeneratorRuntime.mark); | ||
function gen(a) { | ||
return regeneratorRuntime.wrap(function gen$(context$1$0) { | ||
while (1) switch (context$1$0.prev = context$1$0.next) { | ||
case 0: | ||
context$1$0.t0 = assert; | ||
context$1$0.t1 = assert; | ||
context$1$0.t2 = assert; | ||
context$1$0.next = 5; | ||
return a; | ||
|
||
case 5: | ||
context$1$0.t3 = context$1$0.sent; | ||
context$1$0.t4 = context$1$0.t2._capt.call(context$1$0.t2, context$1$0.t3, 'arguments/0/left'); | ||
context$1$0.t5 = context$1$0.t4 === 3; | ||
context$1$0.t6 = context$1$0.t1._capt.call(context$1$0.t1, context$1$0.t5, 'arguments/0'); | ||
context$1$0.t7 = { | ||
content: 'assert((yield a) === 3)', | ||
filepath: 'test/fixtures/YieldExpression/fixture.js', | ||
generator: true, | ||
line: 4 | ||
}; | ||
context$1$0.t8 = context$1$0.t0._expr.call(context$1$0.t0, context$1$0.t6, context$1$0.t7); | ||
assert(context$1$0.t8); | ||
|
||
case 12: | ||
case 'end': | ||
return context$1$0.stop(); | ||
} | ||
}, marked0$0[0], this); | ||
} | ||
|
||
function notGen(a) { | ||
assert(assert._expr(assert._capt(assert._capt(yield(assert._capt(a, 'arguments/0/left/arguments/0')), 'arguments/0/left') === 3, 'arguments/0'), { | ||
content: 'assert(yield(a) === 3)', | ||
filepath: 'test/fixtures/YieldExpression/fixture.js', | ||
line: 8 | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
function *gen(a){ | ||
assert((yield (a)) === 3); | ||
} | ||
|
||
function notGen(a){ | ||
assert((yield (a)) === 3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters