-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,8 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`new transforms new 1`] = ` | ||
"const foo = new Set(); | ||
Object.assign(module.exports, { | ||
foo | ||
});" | ||
`; |
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,8 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`throw transforms throw 1`] = ` | ||
"const foo = bar || throw err(\`spam\`); | ||
Object.assign(module.exports, { | ||
foo | ||
});" | ||
`; |
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,10 @@ | ||
import {newExpression} from '@babel/types'; | ||
import {wrap} from '../types'; | ||
|
||
|
||
export const transform_new = (node, ctx)=> { | ||
const right = ctx.transform(node.right); | ||
|
||
return wrap(node, newExpression(right.callee, right.arguments)); | ||
}; | ||
|
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,12 @@ | ||
import {fink2js} from '../testing'; | ||
|
||
|
||
describe('new', ()=> { | ||
it('transforms new', ()=> { | ||
expect( | ||
fink2js(` | ||
foo = new Set() | ||
`) | ||
).toMatchSnapshot(); | ||
}); | ||
}); |
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,10 @@ | ||
import {unaryExpression} from '@babel/types'; | ||
import {wrap} from '../types'; | ||
|
||
|
||
export const transform_throw = (node, ctx)=> { | ||
const right = ctx.transform(node.right); | ||
|
||
return wrap(node, unaryExpression('throw', right)); | ||
}; | ||
|
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,12 @@ | ||
import {fink2js} from '../testing'; | ||
|
||
|
||
describe('throw', ()=> { | ||
it('transforms throw', ()=> { | ||
expect( | ||
fink2js(` | ||
foo = bar || throw err('spam') | ||
`) | ||
).toMatchSnapshot(); | ||
}); | ||
}); |