Skip to content

Commit

Permalink
Partial Application Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Behrang Yarahmadi committed Feb 20, 2019
1 parent 487d64e commit 9196d67
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 24 deletions.
9 changes: 0 additions & 9 deletions packages/babel-parser/src/parser/expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,6 @@ export default class ExpressionParser extends LValParser {
}
return this.finishNode(node, "Super");

case tt.question:
node = this.startNode();
this.raise(node.start, "Partial Application syntax is not allowed");
case tt._import:
if (this.lookahead().type === tt.dot) {
return this.parseImportMetaProperty();
Expand Down Expand Up @@ -1350,12 +1347,6 @@ export default class ExpressionParser extends LValParser {
parseNewArguments(node: N.NewExpression): void {
if (this.eat(tt.parenL)) {
const args = this.parseExprList(tt.parenR);
if (this.hasPartial(args)) {
this.raise(
this.state.start,
"Partial Application syntax is not allowed with 'new' keyword",
);
}
this.toReferencedList(args);
// $FlowFixMe (parseExprList should be all non-null in this case)
node.arguments = args;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
"arguments": [
{
"type": "Partial",
"type": "ArgumentPlaceholder",
"start": 4,
"end": 5,
"loc": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
},
"arguments": [
{
"type": "Partial",
"type": "ArgumentPlaceholder",
"start": 66,
"end": 67,
"loc": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
"arguments": [
{
"type": "Partial",
"type": "ArgumentPlaceholder",
"start": 4,
"end": 5,
"loc": {
Expand Down Expand Up @@ -108,7 +108,7 @@
"name": "x"
},
{
"type": "Partial",
"type": "ArgumentPlaceholder",
"start": 8,
"end": 9,
"loc": {
Expand Down Expand Up @@ -205,7 +205,7 @@
},
"arguments": [
{
"type": "Partial",
"type": "ArgumentPlaceholder",
"start": 20,
"end": 21,
"loc": {
Expand Down Expand Up @@ -237,7 +237,7 @@
"name": "x"
},
{
"type": "Partial",
"type": "ArgumentPlaceholder",
"start": 26,
"end": 27,
"loc": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"name": "x"
},
{
"type": "Partial",
"type": "ArgumentPlaceholder",
"start": 6,
"end": 7,
"loc": {
Expand Down Expand Up @@ -207,7 +207,7 @@
"name": "x"
},
{
"type": "Partial",
"type": "ArgumentPlaceholder",
"start": 20,
"end": 21,
"loc": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
"arguments": [
{
"type": "Partial",
"type": "ArgumentPlaceholder",
"start": 4,
"end": 5,
"loc": {
Expand Down Expand Up @@ -190,7 +190,7 @@
},
"arguments": [
{
"type": "Partial",
"type": "ArgumentPlaceholder",
"start": 18,
"end": 19,
"loc": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class foo{
constructor(x){
super(XXX, 1, ?, ?);
super(x, 1, ?, ?);
this.x = x;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"plugins": ["partialApplication"],
"throws": "Partial Application syntax is not allowed (3:18)"
"throws": "Unexpected argument placeholder (3:16)"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"plugins": ["partialApplication"],
"throws": "Partial Application syntax is not allowed (1:11)"
"throws": "Unexpected argument placeholder (1:11)"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"plugins": ["partialApplication"],
"throws": "Partial Application syntax is not allowed (1:0)"
"throws": "Unexpected token (1:0)"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@babel/plugin-syntax-partial-application",
"version": "7.2.0",
"description": "Allow parsing of optional properties",
"description": "Allow parsing of partial application syntax",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-partial-application",
"license": "MIT",
"publishConfig": {
Expand Down

0 comments on commit 9196d67

Please sign in to comment.