-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🚀 Transform Function Declarations #23358
Closed
kristoferbaxter
wants to merge
11
commits into
ampproject:master
from
kristoferbaxter:transform-function-declarations
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cfc797f
Move from media 'not-blocking' to 'print'
kristoferbaxter 7c9902e
latest master
kristoferbaxter 3e82249
Introduce a Babel Plugin that converts function definitions to arrow …
kristoferbaxter 337410c
Left over conflict
kristoferbaxter 1c74b49
Fix console usage
kristoferbaxter fd4e961
Comment on isNotSingleReturnStatment
kristoferbaxter 84d0ad4
findParent instead of find since we dont need to test the current pat…
kristoferbaxter 4336304
path.stop after detection of the bail out condition
kristoferbaxter d8dfd96
use the cloned node to construct the variable declaration
kristoferbaxter 7d7ce7c
destructure for better clarity
kristoferbaxter 1655a0c
Refactor messaging to be more actionable
kristoferbaxter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
154 changes: 154 additions & 0 deletions
154
build-system/babel-plugins/babel-plugin-transform-function-declarations/index.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,154 @@ | ||
/** | ||
* Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
const BAIL_OUT_CONDITIONS = { | ||
// If this isn't a FunctionDeclaration, bail out on modification. | ||
isNotFunction: (t, path) => !t.isFunctionDeclaration(path.node), | ||
|
||
// If this FunctionDeclaration is a Generator, bail out on modification. | ||
isGenerator: (t, path) => path.node.generator, | ||
|
||
// If this FunctionDeclaration doesn't have a single return statement, bail out on modification | ||
isNotSingleReturnStatment: (t, path) => { | ||
if (!path.get('body').isBlockStatement()) { | ||
return false; | ||
} | ||
const body = path.get('body.body.0'); | ||
return !body || !body.isReturnStatement(); | ||
}, | ||
|
||
// Since we don't know if exported members are 'new'd, bail out on modification. | ||
isExported: (t, path) => | ||
path.findParent( | ||
path => | ||
path.isExportNamedDeclaration() || path.isExportDefaultDeclaration() | ||
), | ||
|
||
// If the function contains usage of `arguments`, bail out on modification. | ||
containsArgumentsUsage: (t, path) => { | ||
let containsArgumentsUsage = false; | ||
path.traverse({ | ||
Identifier(path) { | ||
if (t.isIdentifier(path.node, {name: 'arguments'})) { | ||
containsArgumentsUsage = true; | ||
kristoferbaxter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
path.stop(); | ||
} | ||
}, | ||
}); | ||
return containsArgumentsUsage; | ||
}, | ||
|
||
// If the function contains a ThisExpression, converting from a FunctionDeclaration to a | ||
// VariableDeclaration => VariableDeclarator => ArrowFunctionExpression isn't necessarily valid. | ||
// Bail out on modification. | ||
containsThisExpression: (t, path) => { | ||
let containsThis = false; | ||
path.traverse({ | ||
ThisExpression() { | ||
containsThis = true; | ||
kristoferbaxter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
path.stop(); | ||
}, | ||
}); | ||
return containsThis; | ||
}, | ||
|
||
// If the FunctionDeclaration identifier is newed in the scope of this program, bail out on modification. | ||
isNewedInProgramScope: (t, path) => { | ||
const {name} = path.get('id').node; | ||
let isNewed = false; | ||
path | ||
.findParent(path => path.isProgram()) | ||
.traverse({ | ||
NewExpression(path) { | ||
if (t.isIdentifier(path.node.callee, {name})) { | ||
isNewed = true; | ||
path.stop(); | ||
} | ||
}, | ||
}); | ||
return isNewed; | ||
}, | ||
}; | ||
|
||
function createVariableDeclaration(t, path) { | ||
const {params, body, async, id} = t.cloneNode(path.node); | ||
const arrowFunction = t.arrowFunctionExpression( | ||
params, | ||
body.body[0].argument, | ||
async | ||
); | ||
const declarations = t.variableDeclarator( | ||
t.identifier(id.name), | ||
arrowFunction | ||
); | ||
|
||
// Making an existing FunctionDeclaration a const VariableDeclaration is safe. | ||
// The name was already reserved for the FunctionDeclaration. | ||
return t.variableDeclaration('const', [declarations]); | ||
} | ||
|
||
// Attempt to convert simple single ReturnStatement FunctionDeclarations to ArrowFunctionExpressions. | ||
// See BAIL_OUT_CONDITIONS for reasons why FunctionDeclarations would not be modified. | ||
module.exports = function({types: t}) { | ||
const DEBUG = false; | ||
const REPORT = true; | ||
|
||
return { | ||
name: 'safe-arrows', | ||
pre() { | ||
this.bailoutCount = Object.assign({}, BAIL_OUT_CONDITIONS); | ||
Object.keys(this.bailoutCount).forEach( | ||
key => (this.bailoutCount[key] = []) | ||
); | ||
this.successCount = []; | ||
}, | ||
visitor: { | ||
FunctionDeclaration(path) { | ||
const name = (path.get('id') && path.get('id').node.name) || ''; | ||
for (const [id, method] of Object.entries(BAIL_OUT_CONDITIONS)) { | ||
if (method(t, path)) { | ||
this.bailoutCount[id].push(name); | ||
if (DEBUG) { | ||
console /*OK*/ | ||
.log( | ||
`Bail on ${ | ||
name !== '' ? `function ${name}:` : 'item:' | ||
} Reason ${id}.` | ||
); | ||
} | ||
return; | ||
} | ||
} | ||
this.successCount.push(name); | ||
if (DEBUG) { | ||
console /*OK*/ | ||
.log(`Success for function ${path.get('id').node.name}.`); | ||
} | ||
path.replaceWith(createVariableDeclaration(t, path)); | ||
}, | ||
}, | ||
post() { | ||
if (REPORT) { | ||
console.log(`Success Count: ${this.successCount.length}`); | ||
console.log('Bail Out Reason Counts'); | ||
Object.keys(this.bailoutCount).forEach(name => | ||
console.log(`${name}: ${this.bailoutCount[name].length}`) | ||
); | ||
console.log('\n'); | ||
} | ||
}, | ||
}; | ||
}; |
18 changes: 18 additions & 0 deletions
18
...rm-function-declarations/test/fixtures/transform-assertions/arguments-identifier/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,18 @@ | ||
/** | ||
* Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
function argumentsUsage() { | ||
return arguments[0] + arguments[1]; | ||
} |
3 changes: 3 additions & 0 deletions
3
...unction-declarations/test/fixtures/transform-assertions/arguments-identifier/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": ["../../../../../babel-plugin-transform-function-declarations"] | ||
} |
18 changes: 18 additions & 0 deletions
18
...m-function-declarations/test/fixtures/transform-assertions/arguments-identifier/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,18 @@ | ||
/** | ||
* Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
function argumentsUsage() { | ||
return arguments[0] + arguments[1]; | ||
} |
18 changes: 18 additions & 0 deletions
18
...ransform-function-declarations/test/fixtures/transform-assertions/async-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,18 @@ | ||
/** | ||
* Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
async function test(a, b) { | ||
return a + b; | ||
} |
3 changes: 3 additions & 0 deletions
3
...form-function-declarations/test/fixtures/transform-assertions/async-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": ["../../../../../babel-plugin-transform-function-declarations"] | ||
} |
16 changes: 16 additions & 0 deletions
16
...ansform-function-declarations/test/fixtures/transform-assertions/async-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,16 @@ | ||
/** | ||
* Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
const test = async (a, b) => a + b; |
22 changes: 22 additions & 0 deletions
22
...s/test/fixtures/transform-assertions/class-function-declaration-in-public-method/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,22 @@ | ||
/** | ||
* Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
class Foo { | ||
foo() { | ||
function testInFooClass() { | ||
return ''; | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...st/fixtures/transform-assertions/class-function-declaration-in-public-method/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": ["../../../../../babel-plugin-transform-function-declarations"] | ||
} |
21 changes: 21 additions & 0 deletions
21
.../test/fixtures/transform-assertions/class-function-declaration-in-public-method/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,21 @@ | ||
/** | ||
* Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
class Foo { | ||
foo() { | ||
const testInFooClass = () => ''; | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
...function-declarations/test/fixtures/transform-assertions/existing-arrow-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,16 @@ | ||
/** | ||
* Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
const thing = (a, b) => a + b; |
3 changes: 3 additions & 0 deletions
3
...tion-declarations/test/fixtures/transform-assertions/existing-arrow-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": ["../../../../../babel-plugin-transform-function-declarations"] | ||
} |
16 changes: 16 additions & 0 deletions
16
...unction-declarations/test/fixtures/transform-assertions/existing-arrow-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,16 @@ | ||
/** | ||
* Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
const thing = (a, b) => a + b; |
16 changes: 16 additions & 0 deletions
16
...on-declarations/test/fixtures/transform-assertions/existing-async-arrow-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,16 @@ | ||
/** | ||
* Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
const thing = async (a, b) => a + b; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: newlines in test files. |
3 changes: 3 additions & 0 deletions
3
...eclarations/test/fixtures/transform-assertions/existing-async-arrow-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": ["../../../../../babel-plugin-transform-function-declarations"] | ||
} |
16 changes: 16 additions & 0 deletions
16
...n-declarations/test/fixtures/transform-assertions/existing-async-arrow-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,16 @@ | ||
/** | ||
* Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
const thing = async (a, b) => a + b; |
18 changes: 18 additions & 0 deletions
18
...declarations/test/fixtures/transform-assertions/export-default-named-declaration/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,18 @@ | ||
/** | ||
* Copyright 2019 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
export default function exportedFunctionDefault(a, b) { | ||
return a + b; | ||
} |
4 changes: 4 additions & 0 deletions
4
...arations/test/fixtures/transform-assertions/export-default-named-declaration/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,4 @@ | ||
{ | ||
"plugins": ["../../../../../babel-plugin-transform-function-declarations"], | ||
"sourceType": "module" | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why are you ignoring function expressions?
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.
Scope, starting with a very small surface. Happy to extend though if this is too restrictive.