This is the last step to make https://github.com/babel/babel/pull/9364 usable in Babel. I'm sorry for opening this PR so late, but I hope to get it in v7.4.
In this PR I added a new option to `@babel/template`, `syntacticPlaceholders: ?boolean`, which toggles between `%%foo%%` placeholders (when `true`) and `FOO` placeholders. If it isn't specified, Babel tries to be "smart" to avoid breaking backward compat: if `%%foo%%` is used `syntacticPlaceholders` defaults to `true`, otherwise to `false`.
0e58e252913efe84eba926cc9c9c19fb18d5c620 commit shows how some templates we used could be simplified by using this new placeholders syntax (we can't actually do it yet because we are importing `template` from `@babel/core` which could be an older version).
NOTE: Since I wanted to keep this PR as small as possible to make it easier to review, I didn't migrate `template.ast` to internally use the new syntax. It is an implementation detail, so it will be possible to change it in a patch release.
Usage of "@babel/plugin-proposal-decorators" with legacy
support causes "abstract" keyword to be preserved.
This fixes it by moving "abstract" node property removal
from "ClassDeclaration" visitor to "Class". Resolves#8172
When traversing a tree parsing for TypeScript syntax and hitting a `TSFunctionType` node, the `typeParameters` and `typeAnnotation` fields are correctly visited but the `parameters` field isn't. As a result visitors by default don't visit `foo` below:
```
var x: (foo) => void; // foo is never visited
```
```
module.exports = function() {
return {
visitor: {
Identifier(path) {
if (path.node.name == "foo") {
// Never hit because it's nested within TSFunctionType.parameters
path.node.name = "bar";
}
}
}
};
}
```
It appears to be a bug in babel-types/src/definitions/typescript.js which omits `parameters` in the visitors list for `fnOrCtr`. Fixed by adding it.
* add partial application syntax and some tests
remove unnecessary error message and hasPartial function from parseNewArguments
add types for PartialExpression
Update the tests
rename PartialExpression to Partial
move Partial from expressions to types and rename to ArgumentPlaceholder
add tests for ArgumentPlaceholder in babel-generator
rename Partial to ArgumentPlaceholder
update the tests
remove alias from the type and undo changes in generated folder
adds a nice error message
better definition for the type
auto-generated files
update the conditional for allowPlaceholder message and tests
update CallExpression definition to accept ArgumentPlaceholder
change description
clean up
indent ArgumentPlaceholder entry and revert unwanted changes
* add Partial Application Plugin
* update unwrapArguments function and add replacePlaceholders.
* update the tests
* remove unnecessary clone
* update readme and description an package.json
* put options.json one level up and add test for not assigned and chained
* add await to fix the test
* use Promise in the test instead of async await
* remove unnecessary method test [#9474]
* push sequenceExpressions to an array [#9474]
* Add parser createParenthesizedExpressions option …
When set to `true` we create `ParenthesizedExpression` nodes instead of
setting `extra.parenthesized`.
* Also update babel-parser.d.ts
* Disallow escape sequences in async
* Disallow escape sequences in get, set and async in class
* invalid escape tests
* Update whitelist
* tests for async in parens
* Add test for invalid newline between params and arrow
* Move canInsertSemilcolon() into shouldPArseAsyncArrow
* add partial application syntax and some tests
* remove unnecessary error message and hasPartial function from parseNewArguments
* add types for PartialExpression
* Update the tests
* rename PartialExpression to Partial
* move Partial from expressions to types and rename to ArgumentPlaceholder
* add tests for ArgumentPlaceholder in babel-generator
* rename Partial to ArgumentPlaceholder
* update the tests
* remove alias from the type and undo changes in generated folder
* adds a nice error message
* better definition for the type
* auto-generated files
* update the conditional for allowPlaceholder message and tests
* update CallExpression definition to accept ArgumentPlaceholder
* change description
* clean up
* indent ArgumentPlaceholder entry and revert unwanted changes
* fix: strip type imports used in Enums and object types
* chore: update failing snapshot
* docs: correct TSPropertySignature comment
* fix: enum value should be considered a reference
* chore: add tests for TSPropertySignature and TSEnumMember
* Refactor parsing object members
* Ensure decorators on rest don’t swallow decorators silently
* Use hasPrecedingLineBreak
* Add test for async with linebreak
* Update flow whitelist