Commit Graph

69 Commits

Author SHA1 Message Date
강동윤
d8541c4f63 Fix a bug 2019-12-23 14:37:25 +09:00
강동윤
24b5c44ba3
Numeric separator & Bigint (#523)
swc_ecma_ast:
 - `BigInt` literal

swc_ecma_parser:
 - numeric separators. (#521)
 - parsing of bigint literal
2019-12-22 17:14:04 +09:00
강동윤
30af06bb70
Ast (#513)
swc_ecmascript:
 - add `ExprStmt`.
 - change type of regex.expression and regex.flags.
2019-12-16 18:08:21 +09:00
강동윤
f9a649ff7a Bump version 2019-12-15 08:15:26 +09:00
강동윤
332061f44d
Parser: respect jsc.target (#507)
swc:
 - make parser respect `jsc.target`.
2019-12-14 18:51:08 +09:00
kdy1
0df908fdb4 ast & parser improvement (#502)
Parser can now parse typescript source code and rxjs.

Closes #468.
2019-12-11 14:28:35 +00:00
kdy1
fa98c470d6 Program instead of Module (#499)
This pr adds an option to parse file as script, not module.


Related: https://github.com/swc-project/swc/issues/491
2019-12-11 06:07:21 +00:00
Zimon Dai
ec086a1dab use 2018 edition syntax (#479) 2019-12-02 17:10:05 +09:00
강동윤
776e014a11
Fix tests (#478) 2019-12-01 18:11:59 +09:00
강동윤
51558c6c36
Final groundwork for plugin (#474)
swc:
 - add serialization tests

ast_node:
 - handle `*` tag properly

swc_ecma_ast:
 - update serialization of ExprOrSpread
2019-11-30 11:12:34 +09:00
강동윤
a7a8a4a2e4
Plugin (#473)
swc_common:
 - apply patch from rust-lang/rust#59693

swc:
 - use &Options instead of Options
 - configures commons::CM
 - exposes `handler`
2019-11-29 23:46:06 +09:00
강동윤
41c6941dc5 fixup! Don't omit empty values while serializing 2019-11-28 17:53:03 +09:00
강동윤
95a59338d3 Don't omit empty values while serializing 2019-11-28 17:49:51 +09:00
강동윤
b46c4ec300
Update dependencies (#464) 2019-11-24 14:17:27 +09:00
강동윤
d074063867
Parser: Error recovery (#449)
Implement some error recovery logic to parser
2019-11-17 18:36:47 +09:00
Jasper De Sutter
716bfe05b2 Cleanup (#448)
- cargo fix
- update all crates to 2018 edition
2019-11-17 13:21:53 +09:00
강동윤
37b80dfd08
Optional chaining for typescript (#444)
Implement typescript 3.7's optional chaining
2019-11-15 14:34:48 +09:00
강동윤
ae3326cd9d
Compiler apis & .swcrc improvement (#434)
- Expose high-level compiler apis (#431)
 - Support multiple entries in .swcrc (#414)
2019-10-25 10:11:24 +09:00
강동윤
4a41140854 Bump versions 2019-10-23 22:20:00 +09:00
강동윤
2e5c81ee8e Fix parsing readonly array and tests
Closes #432
2019-10-23 20:20:17 +09:00
강동윤
c7abda95d4
typescript const assertion (#419)
Fixes #401.
2019-09-18 22:54:12 +09:00
강동윤
ed64a60cb3 Publish ast / codegen /transforms 2019-05-02 15:50:21 +09:00
강동윤
d40600fd46 Make span not optional 2019-04-26 20:33:34 +09:00
강동윤
248a53ce7c
Make deserialization faster (#324)
swc_ecma_ast:
 - make deserialization faster
2019-03-08 11:36:23 +09:00
강동윤
ed100700f1
Make deserialization fast (#314)
swc_ecma_ast:
  - add deserialization benchmark

ast_node:
 - #[ast_node] on enum now implements faster deserialization
2019-03-05 23:16:45 +09:00
강동윤
a46804ab48 swc_ecma_ast:
- Split class member / property into separate types
2019-02-28 19:25:38 +09:00
강동윤
10cb9a4b21
Publish (#278)
- swc_macros_common@0.2.0
 - ast_node@0.4.1
 - string_enum @0.2.0 
 - swc_ecma_ast@0.8.0
 - swc_ecma_parser_macros@0.3.0
 - swc_ecma_codegen_macros@0.3.0
 - swc_ecma_parser@0.9.1
 - swc_ecma_parser@0.6.1
2019-02-27 10:42:22 +09:00
강동윤
a75dbdf2f2 Update references 2019-02-25 19:47:53 +09:00
강동윤
b6a4d1548a FIx 2019-02-25 19:14:23 +09:00
강동윤
27cd169522 More works for ast node serialization 2019-02-25 19:07:20 +09:00
강동윤
dff2cb8f75
Implement deserialize for ast nodes (#274)
string_enum:
 - #[derive(StringEnum)] now derives `Deserialize`

swc_ecma_ast:
 - implement deserialize for ast nodes.
 - change ast to make it serialized / deserialized correctly

swc_ecma_parser:
 - jsx, test262, typescript tests now verify serialization and deserialization of module
2019-02-24 14:12:04 +09:00
강동윤
76ce98b685
Implement serialize for ast nodes (#244)
swc_common:
 - implement Serialize / Deserialize for span

swc_ecma_parser:
 - use json instead of {:#?} while testing
 - update test references
2019-02-20 11:35:41 +09:00
강동윤
2b7240c595
Support export * as Foo from 'foo'; (#228)
swc_ecma_parser:
 - support `export * as Foo from 'foo';` (Fix #226)

swc_ecma_transforms:
 - support `export * as Foo from 'foo';` (Fix #226)
2019-02-18 14:01:56 +09:00
강동윤
2d062432a8
Shebang & small improvement for object rest spread (#184)
swc_ecma_ast:
 - handle shebang

swc_ecma_codegen:
 - handle shebang

swc_ecma_parser:
 - handle shebang

swc_ecma_transforms:
 - fix arrow expression used with object rest spread
2019-02-13 11:08:21 +09:00
강동윤
fc661f24f0
Bugfixes (#182)
swc_ecma_ast:
 - rename ast to be consistent
2019-02-13 08:18:19 +09:00
강동윤
227423d5f6
Export default from & fix codegen of imports (#168)
swc_ecma_ast:
 - Support `export v from 'foo';`

swc_ecma_parser:
 - Support `export v from 'foo';`

swc_ecma_codegen:
 - Fix codegen of side-effect imports
2019-02-12 15:30:11 +09:00
강동윤
a1629d3997
Implement module transforms (#133)
swc_ecma_ast:
 - implement more `From<T>` for `Expr`

swc_ecma_transforms:
 - fnv -> fxhash
 - implement common js imports
 - improve fixer
 - use js_word! instead of &*sym
 - add noop pass
 - handle state correctly
 - ExprFactory::member(), computed_member()
2019-02-05 12:50:19 +09:00
강동윤
ba0c7c908c
Improve swc_ecma_trnasforms (#127)
# swc_ecma_ast
 - Add PrivateName to Expr

# swc_ecma_parser
 - Fix parsing of private name

# swc_ecma_transforms

## Hygiene
 - It correctly tracks `BindingIdentifer` / `IdentifierReference`
 - Preserve `IdentiferReference` if it conflicts with a `BindingIdentifier`

## Block scoping
 - It correctly tracks `BindingIdentifer` / `IdentifierReference`


## Fixer
 - It removes useless parens.
 - It removes useless `IdentiferReference`s in comma expressions.

## Classes properties
 - public prooperty
 - private property

## Class decorators
 - implemented
2019-01-29 23:56:16 +09:00
강동윤
c648232864
Classes improvements (#123)
Now swc passes all tests from `@babel/plugin-transform-classes`
2019-01-24 16:07:09 +09:00
강동윤
eebf14fbef
Allow stable rust (#118)
This pr introduces some cargo features. For `swc_common` and `swc_ecma_ast`, it introduces a feature flag `fold`.
`Fold` and `Visit` traits exist only if the feature is enabled.

For `swc_ecma_parser`, flag called `verify` is added. When disabled, we skip checking of validity of some expressions.

e.g. `{foo = bar}`

Verification is disabled by default it requires nightly compiler
2019-01-17 23:17:16 +09:00
강동윤
d4fefa8615
Reduce binary size (#116)
- remove unused debug impls
2019-01-10 18:23:25 +09:00
강동윤
ea610c6ded
Typescript & parser for decorators
swc_atoms:
 - add some atoms

swc_ecma_ast:
 - ast nodes for typescript
 - `ClassMethod` -> `Method`, `ClassMethodKind` -> `MethodKind`
 - private class method / class property
 - use separate type for tagged template literals
 - add `declare` field to `Decl`s
 - make function body optional

swc_ecma_parser:
 - rename Type to TokenContext
 - support decorators
 Note: error reporting for invalid decorator is not implemented yet
 - merge `Config` into `Syntax`
 - Use DiagnosticBuilder for error type
This is to make backtracking cheaper.

swc_ecma_transforms:
 - add `strip` pass
2019-01-07 19:43:47 +09:00
강동윤
603b83291d
jsx support (#100)
swc_ecma_parser:
 - implement parser for jsx

swc_ecma_transforms:
 - implement react::jsx transform

swc_ecma_codegen:
 - implement code generator for jsx
2018-12-30 11:57:27 +09:00
강동윤
22b40e2b17
implements async to generator (#91)
swc_ecma_parser:
 - fix parsing of arrow expression

swc_ecma_codegen:
 - fix codegen of async function

swc_ecma_transforms:
 - implement es2017::async_to_generator
2018-12-24 10:58:40 +09:00
강동윤
4ff6d4ed4a
Performance & Node binding (#84)
swc_common:
 - update rustc-ap crates to v313

swc_ecma_ast:
 - use bool instead of Option<Span>


swc_ecma_parser:
 - remove LexerInput
 - use uncons_while
 - assert only on debug mode
 - use Visit instead of Fold while verifying
 - replace debug! with trace!
 - disable logging while benchmarking
 - drop slog

swc_ecma_transforms:
 - classes: fold Decl instead of Stmt

swc:
 - add nodejs binding
2018-12-21 16:54:36 +09:00
강동윤
ab7d46c5bc
Es2015 (#80)
swc_common:
 - implement VisitWith for &T and [T]

swc_ecma_ast:
 - fix codegen of `===`

swc_ecma_parser:
 - fix parsing of array pattern


swc_ecma_transforms:
 - implement es2015::destructuring
 - implement es2015::computed_properties
 - implement es2015::duplicate_keys
 - implement es2015::parameters
 - fix `InjectHelper` pass

Note that getters / setters in class are not supported yet

 - Run execution tests via jest
 - ignore es2016::exponentation tests
2018-11-28 12:24:08 +09:00
강동윤
33d296af31
block scoped function and tagged template literal (#77)
swc_ecma_transforms:
 - implement es2015::block_scoped_functions
 - implement tagged template literal without escape handling
 - hygiene: rename to different number
 - scope: handle pattern by folding children


swc_ecma_ast:
 - use Str instead of String for template literal

swc_ecma_parser:
 - fix lexer tests
 - handle template literal correctly
template literals now have cooked field


swc_ecma_codegen:
 - escape newline character and backslash ('\')
2018-11-25 11:31:48 +09:00
강동윤
c816d699ca
Improve ast (#70)
* Update ast (bool -> Option<Span>)

* fixup! Update ast (bool -> Option<Span>)
2018-11-19 15:52:06 +09:00
강동윤
1d0c78de6c
More works (#66)
ecma_transforms:
 - implement es2015::instanceof
 - implement es2015::typeof_symbol
 - implement inline_globals pass

ecma_parser:
 - `PResult<T>` is now `Result<T, ()>` and `Err(())` means that an error is emitted.
 - add docs
2018-11-18 14:00:07 +09:00
강동윤
b3a9d1a264
Cleanup (#64)
- rename packages to be consistent
 - `swc_macros` is removed. Now macros are imported with `extern crate macro_name` instead of `extern crate swc_macros`.
 - manage atoms with words.txt file
2018-11-17 16:38:23 +09:00