-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swc_ecma_parser: - Allow `in` in class properties (#944) - Make `delete` with optional chaining valid (#947) swc_ecma_transforms: - Add a `typescript_class_properties` pass (#930)
- Loading branch information
Showing
13 changed files
with
519 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "swc_ecma_parser" | ||
version = "0.33.1" | ||
version = "0.33.2" | ||
authors = ["강동윤 <[email protected]>"] | ||
license = "Apache-2.0/MIT" | ||
repository = "https://github.com/swc-project/swc.git" | ||
|
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
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
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
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 @@ | ||
class CTest { | ||
myFunc = () => "key" in {}; | ||
} |
109 changes: 109 additions & 0 deletions
109
ecmascript/parser/tests/typescript/issue-944/input.ts.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,109 @@ | ||
{ | ||
"type": "Module", | ||
"span": { | ||
"start": 0, | ||
"end": 47, | ||
"ctxt": 0 | ||
}, | ||
"body": [ | ||
{ | ||
"type": "ClassDeclaration", | ||
"identifier": { | ||
"type": "Identifier", | ||
"span": { | ||
"start": 6, | ||
"end": 11, | ||
"ctxt": 0 | ||
}, | ||
"value": "CTest", | ||
"typeAnnotation": null, | ||
"optional": false | ||
}, | ||
"declare": false, | ||
"span": { | ||
"start": 0, | ||
"end": 47, | ||
"ctxt": 0 | ||
}, | ||
"decorators": [], | ||
"body": [ | ||
{ | ||
"type": "ClassProperty", | ||
"span": { | ||
"start": 18, | ||
"end": 45, | ||
"ctxt": 0 | ||
}, | ||
"key": { | ||
"type": "Identifier", | ||
"span": { | ||
"start": 18, | ||
"end": 24, | ||
"ctxt": 0 | ||
}, | ||
"value": "myFunc", | ||
"typeAnnotation": null, | ||
"optional": false | ||
}, | ||
"value": { | ||
"type": "ArrowFunctionExpression", | ||
"span": { | ||
"start": 27, | ||
"end": 44, | ||
"ctxt": 0 | ||
}, | ||
"params": [], | ||
"body": { | ||
"type": "BinaryExpression", | ||
"span": { | ||
"start": 33, | ||
"end": 44, | ||
"ctxt": 0 | ||
}, | ||
"operator": "in", | ||
"left": { | ||
"type": "StringLiteral", | ||
"span": { | ||
"start": 33, | ||
"end": 38, | ||
"ctxt": 0 | ||
}, | ||
"value": "key", | ||
"hasEscape": false | ||
}, | ||
"right": { | ||
"type": "ObjectExpression", | ||
"span": { | ||
"start": 42, | ||
"end": 44, | ||
"ctxt": 0 | ||
}, | ||
"properties": [] | ||
} | ||
}, | ||
"async": false, | ||
"generator": false, | ||
"typeParameters": null, | ||
"returnType": null | ||
}, | ||
"typeAnnotation": null, | ||
"isStatic": false, | ||
"decorators": [], | ||
"computed": false, | ||
"accessibility": null, | ||
"isAbstract": false, | ||
"isOptional": false, | ||
"readonly": false, | ||
"declare": false, | ||
"definite": false | ||
} | ||
], | ||
"superClass": null, | ||
"isAbstract": false, | ||
"typeParams": null, | ||
"superTypeParams": null, | ||
"implements": [] | ||
} | ||
], | ||
"interpreter": null | ||
} |
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 @@ | ||
delete obj?.myProp; |
72 changes: 72 additions & 0 deletions
72
ecmascript/parser/tests/typescript/issue-947/input.ts.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,72 @@ | ||
{ | ||
"type": "Module", | ||
"span": { | ||
"start": 0, | ||
"end": 19, | ||
"ctxt": 0 | ||
}, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"span": { | ||
"start": 0, | ||
"end": 19, | ||
"ctxt": 0 | ||
}, | ||
"expression": { | ||
"type": "UnaryExpression", | ||
"span": { | ||
"start": 0, | ||
"end": 18, | ||
"ctxt": 0 | ||
}, | ||
"operator": "delete", | ||
"argument": { | ||
"type": "OptionalChainingExpression", | ||
"span": { | ||
"start": 7, | ||
"end": 18, | ||
"ctxt": 0 | ||
}, | ||
"questionDotToken": { | ||
"start": 10, | ||
"end": 11, | ||
"ctxt": 0 | ||
}, | ||
"expr": { | ||
"type": "MemberExpression", | ||
"span": { | ||
"start": 7, | ||
"end": 18, | ||
"ctxt": 0 | ||
}, | ||
"object": { | ||
"type": "Identifier", | ||
"span": { | ||
"start": 7, | ||
"end": 10, | ||
"ctxt": 0 | ||
}, | ||
"value": "obj", | ||
"typeAnnotation": null, | ||
"optional": false | ||
}, | ||
"property": { | ||
"type": "Identifier", | ||
"span": { | ||
"start": 12, | ||
"end": 18, | ||
"ctxt": 0 | ||
}, | ||
"value": "myProp", | ||
"typeAnnotation": null, | ||
"optional": false | ||
}, | ||
"computed": false | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"interpreter": null | ||
} |
73 changes: 73 additions & 0 deletions
73
ecmascript/parser/tests/typescript/v4/issue-941/input.ts.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,73 @@ | ||
{ | ||
"type": "Module", | ||
"span": { | ||
"start": 0, | ||
"end": 30, | ||
"ctxt": 0 | ||
}, | ||
"body": [ | ||
{ | ||
"type": "TryStatement", | ||
"span": { | ||
"start": 0, | ||
"end": 30, | ||
"ctxt": 0 | ||
}, | ||
"block": { | ||
"type": "BlockStatement", | ||
"span": { | ||
"start": 4, | ||
"end": 7, | ||
"ctxt": 0 | ||
}, | ||
"stmts": [] | ||
}, | ||
"handler": { | ||
"type": "CatchClause", | ||
"span": { | ||
"start": 8, | ||
"end": 30, | ||
"ctxt": 0 | ||
}, | ||
"param": { | ||
"type": "Identifier", | ||
"span": { | ||
"start": 15, | ||
"end": 16, | ||
"ctxt": 0 | ||
}, | ||
"value": "e", | ||
"typeAnnotation": { | ||
"type": "TsTypeAnnotation", | ||
"span": { | ||
"start": 16, | ||
"end": 25, | ||
"ctxt": 0 | ||
}, | ||
"typeAnnotation": { | ||
"type": "TsKeywordType", | ||
"span": { | ||
"start": 18, | ||
"end": 25, | ||
"ctxt": 0 | ||
}, | ||
"kind": "unknown" | ||
} | ||
}, | ||
"optional": false | ||
}, | ||
"body": { | ||
"type": "BlockStatement", | ||
"span": { | ||
"start": 27, | ||
"end": 30, | ||
"ctxt": 0 | ||
}, | ||
"stmts": [] | ||
} | ||
}, | ||
"finalizer": null | ||
} | ||
], | ||
"interpreter": null | ||
} |
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
Oops, something went wrong.