-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support unary and binary expressions
- Loading branch information
1 parent
fa79b69
commit f616ec1
Showing
5 changed files
with
40 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { reduce } from '../../../../src/inline-loops.macro'; | ||
|
||
function getStuff(array) { | ||
return array ** reduce(array, (a, v) => a + v * 2); | ||
} |
13 changes: 13 additions & 0 deletions
13
__tests__/__fixtures__/complex/conditional-binary/output.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function getStuff(array) { | ||
return ( | ||
array ** | ||
(() => { | ||
let _a = array[0]; | ||
for (let _key = 1, _length = array.length, _v; _key < _length; ++_key) { | ||
_v = array[_key]; | ||
_a = _a + _v * 2; | ||
} | ||
return _a; | ||
})() | ||
); | ||
} |
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,5 @@ | ||
import { reduce } from '../../../../src/inline-loops.macro'; | ||
|
||
function getStuff(array) { | ||
return array + +reduce(array, (a, v) => a + v * 2); | ||
} |
13 changes: 13 additions & 0 deletions
13
__tests__/__fixtures__/complex/conditional-unary/output.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function getStuff(array) { | ||
return ( | ||
array + | ||
+(() => { | ||
let _a = array[0]; | ||
for (let _key = 1, _length = array.length, _v; _key < _length; ++_key) { | ||
_v = array[_key]; | ||
_a = _a + _v * 2; | ||
} | ||
return _a; | ||
})() | ||
); | ||
} |
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