-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
polish: skip creating extra reference for safely re-used node (#10720)
* polish: skip creating extra reference for safely re-used node * reimplement using scope.maybeGenerateMemoised
- Loading branch information
1 parent
d56911b
commit 6c7f829
Showing
9 changed files
with
26 additions
and
11 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
2 changes: 1 addition & 1 deletion
2
...ullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/input.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 |
---|---|---|
@@ -1 +1 @@ | ||
function foo(foo, bar = foo ?? "bar") {} | ||
function foo(foo, qux = foo.bar ?? "qux") {} |
4 changes: 2 additions & 2 deletions
4
...llish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
function foo(foo, bar = (_foo = foo) !== null && _foo !== void 0 ? _foo : "bar") { | ||
var _foo; | ||
function foo(foo, qux = (_foo$bar = foo.bar) !== null && _foo$bar !== void 0 ? _foo$bar : "qux") { | ||
var _foo$bar; | ||
} |
1 change: 1 addition & 0 deletions
1
...scing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/input.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 @@ | ||
function foo(foo, bar = foo ?? "bar") {} |
3 changes: 3 additions & 0 deletions
3
...g-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/options.json
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,3 @@ | ||
{ | ||
"plugins": ["proposal-nullish-coalescing-operator"] | ||
} |
1 change: 1 addition & 0 deletions
1
...cing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/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 @@ | ||
function foo(foo, bar = foo !== null && foo !== void 0 ? foo : "bar") {} |
3 changes: 3 additions & 0 deletions
3
...cing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/input.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,3 @@ | ||
function foo() { | ||
var foo = this ?? {}; | ||
} |
3 changes: 3 additions & 0 deletions
3
...-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/options.json
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,3 @@ | ||
{ | ||
"plugins": ["proposal-nullish-coalescing-operator"] | ||
} |
3 changes: 3 additions & 0 deletions
3
...ing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/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,3 @@ | ||
function foo() { | ||
var foo = this !== null && this !== void 0 ? this : {}; | ||
} |
6c7f829
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am getting the following error when trying to run my react-native ios app.
`
Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(SyntaxError: /Users/williamgoodhew/projects/athalens/Athalens/node_modules/react-native/Libraries/Components/Switch/Switch.js: Support for the experimental syntax 'nullishCoalescingOperator' isn't currently enabled (169:52):
�[0m �[90m 167 | �[39m {�[33m...�[39mprops}�[0m
�[0m �[90m 168 | �[39m {�[33m...�[39mplatformProps}�[0m
�[0m�[31m�[1m>�[22m�[39m�[90m 169 | �[39m accessibilityRole�[33m=�[39m{props�[33m.�[39maccessibilityRole �[33m?�[39m�[33m?�[39m �[32m'button'�[39m}�[0m
�[0m �[90m | �[39m �[31m�[1m^�[22m�[39m�[0m
�[0m �[90m 170 | �[39m onChange�[33m=�[39m{�[36mthis�[39m�[33m.�[39m_handleChange}�[0m
�[0m �[90m 171 | �[39m onResponderTerminationRequest�[33m=�[39m{returnsFalse}�[0m
�[0m �[90m 172 | �[39m onStartShouldSetResponder�[33m=�[39m{returnsTrue}�[0m
Add @babel/plugin-proposal-nullish-coalescing-operator (https://git.io/vb4Se) to the 'plugins' section of your Babel config to enable transformation. (null))
__38-[RCTCxxBridge loadSource:onProgress:]_block_invoke.213
RCTCxxBridge.mm:414
invocation function for block in attemptAsynchronousLoadOfBundleAtURL(NSURL*, void (RCTLoadingProgress*) block_pointer, void (NSError*, RCTSource*) block_pointer)
__80-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]_block_invoke
-[RCTMultipartStreamReader emitChunk:headers:callback:done:]
-[RCTMultipartStreamReader readAllPartsWithCompletionCallback:progressCallback:]
-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]
_CFNetworkHTTPConnectionCacheSetLimit
NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK
-[NSBlockOperation main]
NSOPERATION_IS_INVOKING_MAIN
-[NSOperation start]
NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION
__NSOQSchedule_f
_dispatch_block_async_invoke2
_dispatch_client_callout
_dispatch_continuation_pop
_dispatch_async_redirect_invoke
_dispatch_root_queue_drain
_dispatch_worker_thread2
_pthread_wqthread
start_wqthread
`
my babelrc looks like this.
{ "presets": ["module:metro-react-native-babel-preset"], "plugins": ["@babel/plugin-proposal-nullish-coalescing-operator"] }
I am using:
react-native 0.59.9
react 16.8.3
devdependencies are
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4",
"babel-jest": "23.4.2",
"babel-preset-react-native": "5.0.2",