Commit Graph

672 Commits

Author SHA1 Message Date
강동윤
14f5212d3d
Wasm (#691) 2020-05-07 18:17:57 +09:00
강동윤
37bfb79b02
Fix dead code elimination pass (#762) 2020-05-05 20:10:30 +09:00
강동윤
8615d69ac3
Fix bugs (#758)
swc_ecma_transforms:
 - Module passes resolver pass now shares 'global' context (Closes #724)
 - TypeScript enums are treated as concrete (Closes #757)
2020-04-30 23:48:52 +09:00
강동윤
cdf1772bf1
Fix declare (#747) 2020-04-10 22:26:29 +09:00
강동윤
648e87c28d
Fix exponential operator (#746) 2020-04-05 20:45:55 +09:00
강동윤
09279432c4
Do not depend on hashbrown (#744) 2020-04-03 10:33:35 +09:00
강동윤
706ae00523
Fix deeply nested optional chaining (#735)
- Handle deeply nested optional chaining expression correctly (Closes #732)
2020-03-28 11:59:45 +09:00
Muslim Guseinov
6a6013b14c
Fix enum default value transform (#730) 2020-03-26 10:53:35 +09:00
강동윤
da97acca20 Bump 2020-03-10 00:35:53 +09:00
강동윤
e448a8910c
Fix bugs (#710)
- The parser now supports parsing optional patterns in .d.ts files (Closes #709)
 - The source map is handled properly (Closes #705, Closes #707)
2020-03-09 21:18:41 +09:00
강동윤
e5a818aabd
Fix resolver and block_scoping (#700) 2020-03-04 16:07:17 +09:00
강동윤
6e028696a5
Faster sourcemap generation for large files (#697)
We buffer operations related to source map and make it fast using an assumption that the byte positions always increment while emitting a file.
2020-03-02 20:49:08 +09:00
강동윤
8f280c535c
Performance (#696)
- Parser performance is improved by ~15%
 - Codegen performance is improved by ~90% (when comment and source map is enabled)
2020-03-01 20:05:03 +09:00
강동윤
99b5018ba6
Fix ts enum with initializer (#694) 2020-02-29 14:54:10 +09:00
David Sherret
0e8c5a6c93
Fix assignment pattern start when there is a type annotation (#693)
- Update dashmap to 3.5.1

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-02-29 10:29:34 +09:00
강동윤
363b8353cf
resolver: handle hoisting correctly (#689) 2020-02-25 21:29:52 +09:00
강동윤
1cf86b059d
Fix bugs (#687)
- stript type-only export default
- allow `continue` in a for loop
2020-02-22 14:49:04 +09:00
강동윤
cb43a69e02
implement { Hash, Eq } for ast nodes (#684)
As NaN is`IIdent` not `Number`, we can use implement Hash and Eq for ast nodes.
2020-02-21 12:47:06 +09:00
강동윤
e3ca8e5d13
Fix bugs (#683)
- Fix block_scoping (Fix #682)
 - Handle new.target in susbscript position (Fix #675)
2020-02-20 13:06:28 +09:00
강동윤
f79223e98c
resolver: Handle method property correctly (#679) 2020-02-19 19:49:58 +09:00
강동윤
53d09d448e
Handle await-for loop just like babel (#676) 2020-02-18 12:27:13 +09:00
강동윤
e709da9d55
Fix SourceMap (#672)
Previously, `SourceMap` (taken from rustc) has a bug which reuses start position when new_source_file is invoked concurrently.
2020-02-17 15:56:41 +09:00
강동윤
1fc09caa2f
type-only import, exports (#662) 2020-02-13 22:56:13 +09:00
강동윤
f344caa4fa
Reduce binary size (#663)
This pr add two helper macros to prevent folding type unnecessarily.
This reduces the binary size by 3MB on linux.
2020-02-13 21:55:54 +09:00
강동윤
f26ef0cfb7
Fix optimizer (#661) 2020-02-13 15:03:38 +09:00
강동윤
348052b017
Improve optimizer (#660)
Although it's quite naive at the moment, I added two optimization passes.

 - dead code elimination (Closes #607)
 - inlining
2020-02-13 11:45:14 +09:00
kdy1
82e73b1121 Fix bugs (#659)
- Strip out const assertions (Closes #656)
 - Fix exclude of the file matcher (Closes #658) 
 - Automatic typescript detection (Closes #655)
2020-02-12 15:07:45 +00:00
Hyeon Kim
226336b38b
Fix version of regenerator-runtime (#644)
7.7.7 is version of @babel/runtime, not regenerator-runtime. Looks like
the intended version was "0.11.0" as you can see in the yarn.lock:

    regenerator-runtime@^0.11.0:
      version "0.11.1"
      resolved "https://registry.yarnpkg.com/regenerator-runtime/-/re...
      integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT9...

Reference:
  https://github.com/swc-project/swc/commit/05be89c19
2020-02-10 03:23:10 +09:00
kdy1
f8c358c9ac Strip type-only imports (#641)
Fixes #640
2020-02-09 11:35:33 +00:00
강동윤
26eb4e3206
Collect all comments (#633)
- Comments are now appended
 - pin dashmap's version
2020-02-07 14:32:43 +09:00
강동윤
05be89c198
Smaller runtime (#631)
Replace babel-runtime with regenerator-runtime
2020-02-07 11:19:23 +09:00
alubbe
45604fa6e7 Remove dependency renaming to enable WASM (#625)
This PR supercedes https://github.com/swc-project/swc/pull/621 and tries to remove dependency renaming to enable WASM, as discussed in https://github.com/swc-project/swc/issues/106
2020-02-05 11:20:25 +00:00
강동윤
8afa3413ea
Remove dependency on lazy_static and chashmap (#617)
- `lazy_static` is replaced by `once_cell`
 - `chashmap` is replaced by `dashmap`
2020-01-30 23:29:12 +09:00
kdy1
01659585e4 Fix parsing of jsx attribute values (#616)
Closes #614.
Closes #615.
2020-01-29 06:24:35 +00:00
kdy1
480015d407 block_scoping: handle variable infection (#610)
Handle variable infection in the block scoping pass. 

i.e. In the code below, v is 'infected' by i.
```js
var functions = [];
for (let i = 0; i < 10; i++) {
   let v = i;
   functions.push(function() {
       return v;
   });
}
functions[0]() // should print 0
```

Closes #609.
2020-01-24 12:29:57 +00:00
kdy1
0ebda3c33e hygiene / block scoping improvement (#608)
`hygiene` pass had a bug related to globally defined variables like `Object` or `undefined`. This pr make hygiene to utilize use-bind conflict to resolve global objects correctly.
Closes #605.

block_scoping pass had a bug with closure in for statement with let or const. This pr fixes it by extracting a loop body as a variable.
Closes #604.
2020-01-24 05:54:52 +00:00
kdy1
9be9ea2c43 hygiene: fix handling of special identifiers (#603)
The identifiers are `arguments`, `undefined`, `NaN`.

Closes #602.
2020-01-23 14:23:24 +00:00
kdy1
20e37eae5d regenerator: allow nested finally block (#601)
Previously, 

```js
function *foo() {
    try {
    } finally {
        try {
        } finally {
             throw new Error('foo');
        }
    }
}

```

make swc panic

Closes #600.
2020-01-23 01:04:08 +00:00
강동윤
8ecbe14207
hygiene: handle use-use conflict (#599)
Note that as we don't care about emitting a clean code, the renamed output may not match it of bind-bind conflict or bind-use conflict.
2020-01-22 10:43:59 +09:00
erikdesjardins
08ce8d0293 fix as_bool treating bitor like bitand (#596) 2020-01-20 08:22:52 +09:00
강동윤
8e476d8a83
Make parser work identically in release mode (#577)
swc_ecma_parser:
 - parser behaves identically on debug mode and release mode

swc:
 - run all tests on travis ci
 - use nvm on travis ci

swc_ecma_transforms:
 - make async_to_generator understand hoisting
2020-01-17 18:44:51 +09:00
kdy1
96e1dbe213 Improve hygiene and use JSXAttrValue (#592)
swc_ecmacript:
 - use JSXAttrValue (Fixes #584)

swc_ecma_transforms:
 - make hygiene pass check for exported vars (Fixes #591)
2020-01-17 05:45:33 +00:00
David Sherret
0d67d5d855 Fix JSX opening, closing, spread child, and expression container spans (#582)
swc_ecma_parser:
 - fix opening and closing jsx spans.
 - fix JSX expression.
 - fix JSX spread child.
2020-01-14 12:37:29 +09:00
강동윤
b7f8282eb1
resolver: handle methods correctly (#579)
swc_ecma_transform:
 - handle a class method in child scope (#578)
2020-01-11 13:29:31 +09:00
강동윤
5503cde085
Extract utils from swc_ecma_transforms (#575)
swc_ecma_transforms:
 - extract utils
2020-01-08 10:55:22 +09:00
erikdesjardins
3e0f4a5bd7 dce: preserve nested if statement (#565)
swc_ecma_transforms:
  - preserve nested if statements

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-01-05 09:51:40 +09:00
David Sherret
c43bc471dd Fix span for patterns with a type annotation (#558)
swc_ecma_parser:
* fix span for patterns with a type annotation.

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-01-03 14:37:48 +09:00
David Sherret
5acf557e35 GetterProp - Add type_ann (#557)
swc_ecma_ast:
 - add type_ann to GetterProp

swc_ecmascript_parser:
 - parse type annotation after a getter property
2020-01-03 13:08:27 +09:00
강동윤
806a6d97da
Regenerator (#554)
swc_ecma_transforms:
 - implement regenerator pass
 - add regenerator pass to es2015 preset

swc_ecma_preset_env:
 - add regenerator
2020-01-02 20:53:06 +09:00
David Sherret
288008091a Typo (#550) 2020-01-02 10:13:47 +09:00
강동윤
916858ae81
Bugfixes (#549)
swc_ecma_ast:
 - fix TsExprWithTypeArgs (closes #548)

swc_ecma_codegen:
 - allow using default import with namespace import (closes #546)

swc_ecma_parser:
 - parse import.meta (closes #545)
2020-01-01 06:57:34 +09:00
강동윤
aa2a394f7d
Fix #542 (#543)
swc_ecma_transforms:
 - preserve space after a jsx element
2019-12-30 00:05:43 +09:00
강동윤
702800e0d9
Attach comments to correct node (#541) 2019-12-28 22:02:58 +09:00
강동윤
3cf1caa4b1 Bump version 2019-12-28 14:05:12 +09:00
강동윤
6fa85b646f
preset-env (#537)
swc_ecma_preset_env:
 - can inject polyfills automatically
 - can apply transforms automatically

swc:
 - added env config to .swcrc
2019-12-28 11:25:54 +09:00
강동윤
31a5bed497
Legacy decorator for class and class members (#531) 2019-12-25 19:30:16 +09:00
강동윤
ac3f69acd0
Split tests to reduce compile time (#530) 2019-12-24 22:53:48 +09:00
강동윤
e2764e997b Transform for nullish coalescing operator.
Fixes #526.
2019-12-24 18:01:27 +09:00
강동윤
b1e4122b02
Nullish coalescing / optional chaining / comments (#529)
swc_ecma_ast:
 - rename `TsOptChain` to `OptChainExpr` (Fixes #525)
 - add `BinOp::NullishCoalescing`

swc_ecma_parser:
 - parse `??` (Fixes #526)

swc_ecma_transforms:
 - remap comments from fixer (Fixes #528)
2019-12-24 17:01:32 +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
강동윤
6186af04a9
Fix handling of jsx texts (#519)
swc_ecma_transforms:
 - Fix handling of jsx texts (#517)
2019-12-21 16:59: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
강동윤
332061f44d
Parser: respect jsc.target (#507)
swc:
 - make parser respect `jsc.target`.
2019-12-14 18:51:08 +09:00
kdy1
3ec395ba75 Improve performance & update rustfmt (#504) 2019-12-13 06:21:25 +00:00
강동윤
6fc91f2017 Remove #[inline(never)] 2019-12-13 08:47:46 +09:00
강동윤
126b6bc761 Add a test for #503 2019-12-13 08:35:32 +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
강동윤
1a48efa4e4
ES3 (#498)
* Add a test for #496
 - Better error message for TS1056
 - Allow using dynamic import with es3 target
2019-12-11 13:35:15 +09:00
강동윤
30869dc340 Fix template_literal in a script 2019-12-10 11:57:22 +09:00
강동윤
ae6de87abb
Add more tests (#489) 2019-12-09 21:02:51 +09:00
강동윤
69e768e6bd
Fix codegen of typescript enum (#488)
swc_ecma_trnsnofrms
 - Handle export enum
2019-12-04 10:08:17 +09:00
강동윤
b4e93f2b53
Handle catch clause properly (#484)
swc_ecma_transforms
 - Fix #483
2019-12-03 11:50:33 +09:00
강동윤
b3a2ee8e9b
Fix bugs (#482)
swc_ecma_parser:
 - fix lexing of numbers like 9.09

swc_ecma_transforms:
 - jsx_text_to_str
 - use fxhash instead of ahash for exports
2019-12-02 20:19:15 +09:00
Zimon Dai
ec086a1dab use 2018 edition syntax (#479) 2019-12-02 17:10:05 +09:00
강동윤
153cf36168
Jsonify large pure object literals (#477)
swc_ecma_transforms:
 - add `jsonify` transform
2019-12-01 17:32:44 +09:00
강동윤
3f2477196c Fix typescript enum 2019-12-01 11:27:28 +09:00
강동윤
8c7005d7ab
More testing (#469)
swc:
 - Move tests from node-swc to swc
 - Add integration tests (webpack, rxjs, angular-core)
 - Support `exclude`
 
swc_ecma_transforms:
 - More span validation
 - classes:
    - Strip `TsIndexSignature`

swc_ecma_parser:
 - Fix span of member expression
 - Fix span of binary expression
 - Fix span of unary expression
2019-11-26 10:08:48 +09:00
강동윤
fc9880e4f4 Bump parser's version 2019-11-24 14:42:08 +09:00
강동윤
b46c4ec300
Update dependencies (#464) 2019-11-24 14:17:27 +09:00
강동윤
7d4168f415
Parser performance (#463)
- Update string_cache from 0.7 to 0.8
 - Update unicode_xid from 0.1 to 0.2

swc_ecma_parser:
 - Add benchmarks for lexer
2019-11-23 23:03:19 +09:00
강동윤
fa941b3ea3
resolver: Handle arrow expression correctly (#462)
swc_ecma_transforms:
 - resolver: Handle arrow expression correctly (#462)
2019-11-23 19:14:52 +09:00
강동윤
107c35fb41
Fix renaming bug related to import (#457)
- Fix renaming bug related to import (#456)
- Add tests for common_js / umd / amd
2019-11-20 21:32:42 +09:00
강동윤
210686011d
Resolver: Handle hoisting (#455)
swc_ecma_transforms:
 - resolver: Handle variable hoisting
 - resolver: Handle function hoisting
2019-11-19 19:10:15 +09:00
강동윤
d50ab99ef0
Fix #451 (#452)
swc_ecma_parser:
 - Fix parser of eval and arguments

swc_ecma_transforms:
 - Improve fixer (#451)
2019-11-18 18:19:25 +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
강동윤
bc4a2976e5
Validate spans (#447)
- Add span validator to swc_ecma_transforms
2019-11-16 23:49:32 +09:00
강동윤
350f609afd
Allow accessing same constant from static property and constructor (#445)
Fix #443.
2019-11-15 18:36:43 +09:00
강동윤
37b80dfd08
Optional chaining for typescript (#444)
Implement typescript 3.7's optional chaining
2019-11-15 14:34:48 +09:00
강동윤
d64d125996
Bugfixes (#440)
* Allow running swc on babel's output (#438)
* Print comments correctly (#439)
2019-11-10 18:21:28 +09:00
강동윤
076957661d Fix a test 2019-11-10 15:23:40 +09:00
강동윤
264dcf0d7b Fix #439 2019-11-10 13:21:44 +09:00
강동윤
167008de6f
Expose tokenizer (#437)
swc_common:
 - Added input::Input

swc_ecma_parser:
 - Made lexer public
 - Make input type of parser generic
 - Added example of using lexer
2019-11-06 13:14:44 +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
강동윤
2e5c81ee8e Fix parsing readonly array and tests
Closes #432
2019-10-23 20:20:17 +09:00
강동윤
01b1cc1a5e Update rustfmt 2019-10-19 12:21:56 +09:00
dependabot[bot]
2ca5aa5766 Bump js-yaml from 3.12.0 to 3.13.1 in /ecmascript/transforms (#426)
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.12.0 to 3.13.1.
- [Release notes](https://github.com/nodeca/js-yaml/releases)
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.12.0...3.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2019-10-05 14:14:38 +09:00
dependabot[bot]
451f5938c9 Bump mixin-deep from 1.3.1 to 1.3.2 in /ecmascript/transforms (#428)
Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
- [Commits](https://github.com/jonschlinkert/mixin-deep/compare/1.3.1...1.3.2)

Signed-off-by: dependabot[bot] <support@github.com>
2019-10-05 14:14:26 +09:00
dependabot[bot]
2c9f2e1f68 Bump handlebars from 4.0.12 to 4.4.0 in /ecmascript/transforms (#429)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.0.12 to 4.4.0.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/v4.4.0/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.0.12...v4.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2019-10-05 14:14:13 +09:00
dependabot[bot]
09e911bec8 Bump lodash from 4.17.11 to 4.17.15 in /ecmascript/transforms (#427)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.15.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.15)

Signed-off-by: dependabot[bot] <support@github.com>
2019-10-05 14:13:59 +09:00
강동윤
9f1fca55ff Update rustc toolchain to nightly-2019-09-30 2019-10-02 13:53:56 +09:00
강동윤
3a637d4229
fix this in async generator (#425)
swc_ecma_transforms:
 - Don't delete test file when an execution test fails
 - fix #400
2019-10-01 23:42:05 +09:00
강동윤
d7d22c2d5e
Optional try catch binding (#422)
swc_ecma_parser:
 - Add test for optional try catch binding
 
swc_ecma_transforms:
 - Implement optional catch binding (#411)
2019-09-22 19:31:32 +09:00
강동윤
febe34e280 Publish swc_ecma_transforms 2019-09-22 17:55:35 +09:00
강동윤
4f8220329f publish 2019-09-20 13:41:11 +09:00
강동윤
eefdaaaa2f
Fold expressions in module item (#420)
* Fix #413
2019-09-20 13:20:37 +09:00
강동윤
bf70946546 Fix #417
process.env['X'] is now supported
2019-09-18 16:15:13 +09:00
강동윤
5a47c7a15c Fix 1 - (1 - 1) (#418) 2019-09-18 16:05:36 +09:00
강동윤
7715c2626b
Issues (#404, #406, #407) (#408)
swc_ecma_transforms:
 - fix mis-referencing caused by destructuring (#404)
 - fix invalid code generated by comment on arrow functions (#406)
 - fix string concatation of template literal (#407)
 - hygiene: fix rewriting of object pattern
 - fix test module to prevent SIGILL
 - fix module import order (using IndexMap)
2019-09-18 14:40:22 +09:00
강동윤
a1c2538338 hashbrown & comment revamp 2019-06-25 09:41:58 +09:00
강동윤
54cf8fbb96
Fix (#398)
swc_ecma_transforms:
 - Fix resolver (#396)
 - Add tests for #395
2019-06-16 10:22:15 +09:00
강동윤
0e1991f62d
Fix bugs (#394)
- Add a test case for #392
 - Add tests for #389
 - Fix #388
 - Fix #387 
 - Add tests for #392

swc_ecma_parser:
 - Make non-last rest paramters in object pattern error
 - `...` must be followed by an identifier
2019-06-03 21:54:09 +09:00
Erik Desjardins
07bf194e61 Simplify: left.rhs * right is only safe when operators are the same 2019-05-16 14:10:06 -04:00
강동윤
b5bbbc0cd6 publish atoms 2019-05-02 16:06:42 +09:00
강동윤
0b4f06027d Version 2019-05-02 16:02:45 +09:00
강동윤
ed64a60cb3 Publish ast / codegen /transforms 2019-05-02 15:50:21 +09:00
강동윤
786117c16c Fix #382 2019-04-30 22:32:06 +09:00
강동윤
0d52148dcd
Bugfixes (#375)
swc_ecma_transforms:
 - fix hygiene for decorators (#367)
 - add test for react with common js module (#351)

swc_ecma_parser:
  - add test for string escape problem (#350)
2019-04-28 14:58:52 +09:00
강동윤
b44da9dbe4
Fix #369, #370 (#373)
swc_common:
 - don't emit `loc` for dummy spans

swc_ecma_transforms:
 - prevent hygiene from changing key in object pattern (#369)
 - fix module tests (iteration order of FxHashSet is changed)

swc_ecma_parser:
 - fix parsing of arrow function (#370)
2019-04-27 16:28:34 +09:00
강동윤
0ffd075588 Strip bodyless functions.
Closes #357.
2019-04-11 21:20:50 +09:00
강동윤
9e333a153c Fix #366 2019-04-11 21:11:21 +09:00
강동윤
ca220342e0 Fix #365 2019-04-11 21:04:06 +09:00
강동윤
56be56acea Fix lints 2019-04-11 21:01:29 +09:00
강동윤
fe451d5809 Fix #360 and update rustc 2019-04-05 12:19:18 +09:00
Michael Stewart
6f97012821 fix test imports for latest nightly (#355) 2019-03-23 13:18:55 +09:00
강동윤
5114dc9e95
Extract resolver pass (#344) 2019-03-14 15:54:33 +09:00
강동윤
13bf89d08c
Fix bugs (#339)
swc_ecma_parser:
 - fix parsing of type query (#338)
 - fix parsing of `in` in a let / const declaration (#337)

swc_ecma_transforms:
 - string literal is computed (#336)
 - modules: handle imports in lhs of assignment correctly (#335)
2019-03-11 20:33:15 +09:00
강동윤
2025f20e8c
Handle imported stuffs in shorthand property. (#333)
swc_ecma_transforms:
 - handle imported stuffs in shorthand property (#332)
2019-03-10 22:17:08 +09:00
강동윤
a40518f667
v1.0.36 (#330)
swc_ecma_parser
 - decorator_before_export is true for typescript. (#325)
 - fix parsing of dynamic imports. (#328)
 - fix parsing of conditional expression. (#327)
2019-03-09 09:07:15 +09:00
강동윤
248a53ce7c
Make deserialization faster (#324)
swc_ecma_ast:
 - make deserialization faster
2019-03-08 11:36:23 +09:00
강동윤
dd5f17463e
hygiene now handles class name correctly (#323) 2019-03-07 22:42:16 +09:00
강동윤
a311f42acf
Bugs (#321)
swc_ecma_parser:
 - add a test to ensure that \r\n is lexed correctly (#316)

swc_ecma_transforms:
 - destructuring pass now handle variable exports correctly (#317)
 - es2017::async_to_generator now handles module items. Fix #319.
 - prevent hygiene pass from de-exporting class and funcrion (#315)
2019-03-07 15:48:45 +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
강동윤
b4a391b3a7
es2015::destructuring pass (#312)
swc_ecma_transforms:
 - es2015::destructuring pass now uses computed member if necessary. (#311)
2019-03-05 17:44:47 +09:00
강동윤
5f16412273
Fix class properties pass (#310)
swc_ecma_transforms:
  - Class properties pass handle nested scope correctly (#308)
2019-03-03 17:01:23 +09:00
강동윤
b5d3b9a7c7
Initialize var to undefined in loops (#306)
swc_ecma_transforms:
 - block_scoping: initialize var to undefined if it's declared in a loop (#305)
2019-03-02 16:19:19 +09:00
강동윤
5dc4ba181d
Improve fixer (#304)
swc_ecma_transforms:
 - fixer: handle member exprssion correctly
 - fixer: handle binary expression correctly
 - fixer: handle conditional expression correctly
 - fixer: handle unary expression correctly
2019-03-01 22:50:43 +09:00
강동윤
1a0f1108a1
Bugs (#303)
swc_ecma_transforms:
 - report error if jsx namespace is used (#301)
2019-03-01 18:18:57 +09:00
강동윤
99e34ddbbd
Fix #295 (#298)
swc_ecma_transforms:
 - hygiene::operator now handles export correctly (#295)
 - make function hoisting respect directives
2019-03-01 14:02:33 +09:00
강동윤
21f3f792d1
Fixes (#294)
swc_ecma_transforms:
  - block_scoped_fn: don't fold self-modifing functions. (#288).
  - fixer: fix assignment in conditional expression (#293)
  - make resolver work with self modifying function (#292)
2019-02-28 23:07:31 +09:00
강동윤
a46804ab48 swc_ecma_ast:
- Split class member / property into separate types
2019-02-28 19:25:38 +09:00
강동윤
8c1b773eec
Bug fixes (#289)
swc_ecma_transforms:
 - fix assignment expression in callee position (#286)
 - don't name funtion if function's body reference function name (#288)
2019-02-28 16:30:56 +09:00
강동윤
cdf4a09e65
Fixes (#283)
swc_ecma_transforms:
 - Remove State / Clone
 - Fix hygiene bug of labels (#281)
 - Fix sequence expression in unary expression (#282)
2019-02-27 22:40:19 +09:00
강동윤
892b4f01cd FIx #280 2019-02-27 18:56:12 +09:00
강동윤
ae91b724b7 Fix helpers 2019-02-27 18:46:34 +09:00
강동윤
74dc5582f1 Don't inject @swc/helpers if nothing is used 2019-02-27 18:31:30 +09:00
강동윤
1b28766c26
Improve comment api (#277)
swc_ecma_parser:
 - parser now take comments by reference
2019-02-26 13:56:58 +09:00
강동윤
3e2750ba5e Make const_module pass parse expressions itself 2019-02-25 12:42:23 +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
강동윤
78f4b25480
Bug Fixes (#273)
swc_ecma_transforms:
 - fix spread pass (#270)
 - add babel's fixture tests for spreads
 - change order of passes (#271)
 - handle updates of private class fields (#272)
2019-02-23 21:56:12 +09:00
강동윤
a785ecc960
Add const_modules pass (#268)
swc_ecma_transforms:
 - use fxhash for inline_globals pass
 - handle member expression in inlne_globals pass
 - add const_modules pass
2019-02-22 15:42:27 +09:00
강동윤
c1de0a5c86
Improve codegen of binary expression which contains unary expression. (#267)
swc_ecma_codegen:
 - improve codegen of binary expression which contains unary expression (#266)
2019-02-22 12:04:41 +09:00
강동윤
8f932c374e Fix visibillity 2019-02-21 22:29:06 +09:00
강동윤
07e2cffb43
Fixes (#265)
swc_ecma_parsr:
 - fix parsing of invalid utf8 characters (#261)
 - fix parsing of function body (#257)
 - fix parsing of  () => (x = true) (#259)

swc_ecma_transforms:
 - fix default arguments in arrow expression (#254)
 - fix assignment pattern in array pattern (#260)
 - make amd / umd configurable. (#262)
2019-02-21 22:21:48 +09:00
강동윤
e9b06c5de2
Improve fixer (#263)
swc_ecma_transforms:
 - fixer does not breaks cast to boolean (#252)
 - fixer does not break conditional expression with comma expressions (#255)
2019-02-21 14:49:13 +09:00
강동윤
162dee5518
Fix bugs (#251)
swc_ecma_transforms:
 - don't convert typeof to _typeof if not necessary (#250)
 - fix imports of `@swc/helpers` (#248).
2019-02-20 20:02:22 +09:00
강동윤
601f0feb14 Hoist functions in block scoped function pass.
Fix #245.
2019-02-20 12:10:28 +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
강동윤
7d5316463d
Fixes (#241)
swc_ecma_transforms:
 - handle constructor from object_rest_spread pass (#239)
 - typescript::strip pass now removes signature-only constructor

swc_ecma_parser:
 - fix parsing of do while statement (#242)

swc_ecma_codegen:
 - fix codegen of do while statement (#242)
2019-02-19 15:20:02 +09:00
강동윤
4fddea0bbd swc_ecma_transforms:
- remove this parameter from typescript::strip pass (fixes #236)
2019-02-19 14:30:26 +09:00
강동윤
4dc10d849e
Fixes (#237)
swc_ecma_transforms:
 - handle pattern correctly in coomon_js pass (#235)
 - fix object rest in arrow expression (#233)
2019-02-19 12:52:03 +09:00
강동윤
4917bbaf44 Fix test 2019-02-18 22:34:32 +09:00
강동윤
3252988e6a Update fixer.
Fixes #231.
2019-02-18 22:31:50 +09:00
강동윤
59f6a6ffb6 Handle react fragment in top level.
Fixes #229.
2019-02-18 18:08:40 +09:00
강동윤
1368a4a281 Fix #227 2019-02-18 15:05:58 +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
강동윤
523307a5da FIx #225 2019-02-18 12:19:40 +09:00
강동윤
d8f9101b30 Fix #227 2019-02-18 11:15:04 +09:00
강동윤
3fc360d870 Make sourcemap optional 2019-02-17 23:25:35 +09:00
강동윤
a00d281704 Make Optional pass 2019-02-17 17:52:48 +09:00
강동윤
e419d7d378
Cache react config (#224)
swc_ecma_transforms:
 - global codemap / parser session for config parsing
 - cache parsing result of react pass
 - InjectHelpers pass does not require source map
2019-02-17 17:11:21 +09:00
강동윤
bbfcca8f2b
External helpers (#223)
swc_ecma_transforms
 - support extenal helpers (#155)
2019-02-17 13:48:18 +09:00
강동윤
33ab0db712
Fix travis (#222)
swc_common:
 - ignore copied doctests

swc_ecma_transforms:
 - fox some tests
2019-02-16 18:58:29 +09:00
강동윤
046788cf78 Add option to disable module analyzer 2019-02-16 14:27:24 +09:00
강동윤
1a1889f437
Fix bugs (#221)
swc_ecmascript_parser:
 - fix parsing of `export default from 'src';`

swc_ecmascript:
 - add a pass which allows injecting helpers before the module pass
2019-02-16 14:18:22 +09:00
강동윤
9108ba7bb7 Don't inline process.env.x if x is not registered as global.
Fix #215.
2019-02-15 14:06:16 +09:00
강동윤
ad49de35b3
Handle foo && yield bar (#218)
Fix #216.
2019-02-15 13:58:10 +09:00
강동윤
1d865b9979
Strip type-only imports (#217)
swc_ecma_transforms:
 - strip type-only imports (#179)
2019-02-15 12:14:28 +09:00
강동윤
34fff56462 Add a test for #211.
Closes #211.
2019-02-14 21:17:01 +09:00
강동윤
9bd7a9c484
Perfect fixer (#212)
swc_ecma_transforms:
 - test fixer using test262
 - make fixer perfect
2019-02-14 21:12:05 +09:00
강동윤
b76c4f26e6 Fix #210. 2019-02-14 17:46:22 +09:00
강동윤
e20998d69b FIx #209 2019-02-14 16:06:54 +09:00
강동윤
631eff9e8c
Bugfixes (#208)
swc_ecma_codegen:
 - fix codegen of shebang (#177)
 - add test for #197.

swc_ecma_transforms:
 - fix object rest spread pass (#162)
2019-02-14 13:24:01 +09:00
강동윤
b27829825e
Fix Bugs (#205)
swc_ecma_codegen:
 - escape characters (#204)

swc_ecma_parser:
 - fix parsing of `<!--`

swc_ecma_transforms:
 - promote VarCollector to crate-level utility
 - fix es3::member_expr_lits (#206)
 - fix es2015::duplicate_keys pass (#203)
 - improve fixer (paren for assignment) (#201)
 - improve fixer (arrow expression) (#207)
 - make typescript pass strip out type-only exports (#196)
2019-02-14 11:03:06 +09:00
강동윤
c1a3cc53c1
React jsx / improve fixer (#202)
swc_ecma_parser:
 - fix parsing of jsx

swc_ecma_transforms:
 - fix fixer (#199)
2019-02-13 19:12:00 +09:00
강동윤
c647cf1bc0
Fix bugs (#193)
swc_ecma_parser:
 - fix lexer
 - better error reporting for jsx reference test

swc_ecma_codegen:
 - Update references
2019-02-13 16:03:38 +09:00
강동윤
a13e6a09b5
Fix #185 (#187)
swc_ecma_transforms:
 - handle imports correctly (in rhs of assignment)
2019-02-13 12:32:12 +09:00
강동윤
74858c3b66
Fix #167 (#186) 2019-02-13 11:56:45 +09:00
강동윤
bf128d295f Add test for #182.
Closes #182.
2019-02-13 11:33:28 +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
강동윤
f797019b79
Use strict (#183)
swc_ecma_parser:
- fix parsing of use strict without semicolon.

swc_ecma_transforms:
 - emit helpers after use strict.
2019-02-13 08:44:54 +09:00
강동윤
fc661f24f0
Bugfixes (#182)
swc_ecma_ast:
 - rename ast to be consistent
2019-02-13 08:18:19 +09:00
강동윤
cc36bbe3ad Add tests for #169. 2019-02-12 22:18:14 +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
강동윤
45e78e40d4
Amd & Correct named exports (#165) 2019-02-12 11:41:08 +09:00
강동윤
a0c6b4458e
Revert "Amd & Fix for exports (#164)" (#166)
This reverts commit 8c5c7b55b7.
2019-02-12 11:40:36 +09:00
강동윤
8c5c7b55b7
Amd & Fix for exports (#164)
swc_ecma_transforms:
 - correctly tracks exported names.
 - Implement amd

Fix #162
2019-02-12 11:23:19 +09:00
Nate Mara
42f94a3f24 Remove HERE eprintln (#161) 2019-02-12 06:24:12 +09:00
강동윤
d98219cd42 Reduce vtable size of Pass. 2019-02-11 19:11:14 +09:00
강동윤
7fe2245a3d
Cleanup (#152)
- replace Lrc with std::sync::Arc
swc_common:
 - make swc_common::sync private
 - improve MoveMap

swc_ecma_codegen:
 - fix codegen of import.

swc_ecma_transforms:
 - properly detect valid identifier.

swc_ecma_parser:
 - Fix parsing of cond expr inside paren.
2019-02-11 11:39:20 +09:00
강동윤
ab4f619257
Fix tests (#142) 2019-02-10 20:49:29 +09:00
강동윤
3b8d36dc58 Parse dynamic imports 2019-02-10 12:07:40 +09:00
강동윤
654f55b658 Closes #137, Closes #138 2019-02-09 12:19:20 +09:00
강동윤
7482836d5e Support typescript constructor parameter property 2019-02-08 18:13:32 +09:00
강동윤
43d633b44d
Handle comments and improve codegen (#136)
swc_ecma_codegen:
 - Improve codegen
 - Handle comments

swc_ecma_parser:
 - Handle comments
2019-02-08 13:00:58 +09:00
강동윤
cc83b863ec Threading support 2019-02-06 12:09:42 +09:00
강동윤
17ed32a73c Fix common_js::lazy 2019-02-05 15:47:17 +09:00
강동윤
c5e18e06d1 Use objekt::Clone 2019-02-05 15:24:30 +09:00
강동윤
ea013a1e12 Export module configs 2019-02-05 14:33:29 +09:00
강동윤
4c6c4bc595
Make Helper scoped thread local (#134)
This allows injecting helpers per file without any multi threading issue.
2019-02-05 14:15:38 +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
강동윤
33fe3a9515 Remove dbg! 2019-02-02 23:17:06 +09:00
강동윤
ca6f4eb096 Remove unnecessary logging 2019-01-31 19:49:02 +09:00
강동윤
d8d117b494 implement Clone for HelperResetter 2019-01-31 19:44:34 +09:00
강동윤
976943ba97
Add HelperResetter pass (#132) 2019-01-31 19:39:26 +09:00
강동윤
f914c8579e
Revert "Fix Arc<Helpers> (#130)" (#131)
This reverts commit 6865370205.
2019-01-31 18:22:35 +09:00
강동윤
6865370205
Fix Arc<Helpers> (#130)
Don't clone Arc<Helpers>
2019-01-31 15:14:49 +09:00
강동윤
e681ae37e4 mute resolver 2019-01-30 13:09:21 +09:00
강동윤
e63be11d0e Fix order of the classes pass 2019-01-30 13:05:45 +09:00
강동윤
c87fac213a Add a test about inheriting native class 2019-01-30 11:30:09 +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
강동윤
90135ede1e fix a bug 2019-01-24 16:41:19 +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
강동윤
bb28d81ed4 Strip typescript declarations 2019-01-15 20:51:13 +09:00
강동윤
a126afaf42 Better error messages for unimplemented!s 2019-01-15 20:18:41 +09:00
강동윤
b9eb110549 Cache compiled helpers 2019-01-15 11:53:43 +09:00
강동윤
e85bcce9cf implement Clone for passes 2019-01-15 11:15:18 +09:00
강동윤
66eab1bc85 enable flag for the simplifier pass 2019-01-15 10:59:40 +09:00
강동윤
1710bb6e8a Allow using Pass as a trait object 2019-01-14 17:54:42 +09:00
강동윤
2a49e1e896 implement clone for transform passes 2019-01-14 17:36:15 +09:00
강동윤
fefc4c88c7 camelCase for react options 2019-01-14 13:45:19 +09:00
강동윤
7aee29d91d Fix tests 2019-01-10 18:33:32 +09:00
강동윤
d4fefa8615
Reduce binary size (#116)
- remove unused debug impls
2019-01-10 18:23:25 +09:00
강동윤
fc3a9d6180
.swcrc file for configuration (#115)
libswc:
 - use config file
2019-01-08 16:34:35 +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
강동윤
2e22397f42
Fix hygiene bug (#109) 2018-12-31 23:10:50 +09:00
강동윤
b437488082
implement es3::reserved_word (#103) 2018-12-30 12:56:04 +09:00
강동윤
72c9ac0b5a remove unused fields 2018-12-30 12:14:51 +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
강동윤
b6a0d2303b Comment out printlns 2018-12-27 19:20:30 +09:00
강동윤
4d4e4ce979
Implement object rest / spread (#98)
swc_ecma_parser:
 - improve parser's tests
It now shows the code failed to parse
 - allow rest pattern in catch clause
 - fix parsing of named export (semicolon)

swc_ecma_transforms:
 - implement array spread
 - add helper methods (objectWithoutProperties)
 - add some fast paths
 - make es2015::parameters handle catch clauses
 - don't show helpers when execution failed
 - export fixer
2018-12-26 17:09:48 +09:00
강동윤
fbf70a3803 improve performance 2018-12-24 12:49:00 +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
강동윤
6a0a2cf34e
Class getter / setter (#86)
Implement class getter / setter.
2018-12-22 12:15:04 +09:00
강동윤
145d6f39eb
For-of loop (#85)
Implements `es2015::for_of`
2018-12-21 21:39:42 +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
강동윤
222bdc191f
Performance (#82)
`Map<T>` adds a method named `map` which is actually `Box<T>` -> `Box<T>` without reallocation.

swc_ecma_transforms:
 - chain_at!(Type, passes)
This macro deeply joins path at 'Type' level.
2018-12-01 22:24:26 +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
강동윤
7c58b89571
Scope analysis via ident hygiene (#74)
testing:
 - preserve context of the span in `::testing::DropSpan`

swc_ecma_codegen:
 - disable get_text_of_node to avoid deoptimization

swc_ecma_transforms:
 - allow using this inside arrow expression
 - implement es2015::block_scoping with hygiene ident
2018-11-23 19:22:07 +09:00
강동윤
d3e14b6533
Parser & transformers (#71)
swc_ecma_transforms:
 - implement es2015::arrow (without this support)
 - implement basical scope analysis
 - implement es2015::function_name
 - new.target is supported
 - implement untagged template literals

swc_ecma_parser
 - make test to use load_file()
 - fix eof handling
 - bump version
2018-11-21 18:59:17 +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
강동윤
cd51cb1731
Make procmacro2_semver_exempt optional (#67)
* Reduce compile time of tests.

* Make procmacro2_semver_exempt optional

* Bump versions
2018-11-18 19:57:35 +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
강동윤
8e0e9ca4c7 Make it thread safe 2018-11-17 17:02:34 +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
강동윤
fb08c18f7e
Support es2019 (#63)
ast:
 - Update ast to match es2019 spec

parser:
 - implement es2019 parser
 - ignore an old test

codegen:
 - fix

testing:
 - better output while testing (when failed)

transforms:
 - fix
2018-11-17 12:30:49 +09:00
강동윤
63ee25f0c5
Cleanup (#62)
- do not reexport swc crates

 - Add benchmark for parser

 135ns/op on my macbook pro
 
 - remove unused script
 
 - Update README.md
    - Make features section complete
2018-11-17 10:02:40 +09:00
강동윤
f8ea0bdfea fix
It's not rust code..
2018-11-16 20:26:04 +09:00
강동윤
309a9de0fd
Fix tests & upgrade deps (#60)
common:
 - upgrade rustc-ap crates to 297
 - swc_common does not reexport sourcemap anymore
 - update rustfmt to 0.99.6

simplifier:
 - make some tests success when source code is equavalent
 - implement fixer to fix ast broken by simplifier
- implement bit shift operators
- fix str.length
- ignore some tests


compat:
 - fix `**=`
 - fix es3::prop_lits
2018-11-16 20:09:17 +09:00
강동윤
7b56b0bc74
Improve codegen (#57)
* travis: make it faster

* better codegen

* Move enable_comments field to config
2018-11-15 21:43:04 +09:00
강동윤
fae7bfc2c7
Chores (#54)
- improve readme
 - fix lints
 - Enable lto
 - better codegen (newline after stmts)
 - add some docs

 - implement `**=` transformer

 - use `quote_ident!`
 - use `.as_arg()` instead of constructing ExprOrSpread
 - use `as_callee()`
 - inject helpers

 - fix imports

 - split libswc

 - don't mark! useless span
2018-11-15 13:29:44 +09:00
강동윤
9a5de4beb6
More transcompilers (#49)
transforms:
 - implement String.length simplifier
 - implement more arithmetic operations
 - new Date() is side-effect free
 - implement left.rhs * right
 - optimize `SeqExpr` while creation
 
 - implement es3 - member expression literals pass
 - implement es2015 - classes pass

codegen: 
 - handle infinity correctly
 - disable comments for testing (it's buggy)

ast:
 - add methods about reserved words
2018-11-14 19:40:46 +09:00
강동윤
9d7af34aab
Initial release (#45)
common:
 - rename `Folder` to `Fold`
 - folder.then()
 - impl Fold for Box<F>
 - impl Fold<T> for &mut F where F: Fold<T>

transforms:
 - make Simplifier private
 - organize compat

codegen:
 - use `Mark` to avoid deoptimization

swc:
 - upgrade rayon and use global thread pool instead
2018-11-10 17:44:35 +09:00
강동윤
eb2a2a7f15
Fix tests and lints (#44)
- Temporarilly ignored comment codegen tests.
 - Split Simplify into SimplifyExpr and SimplifyStmt
 - fix lints
2018-11-05 13:12:52 +09:00
강동윤
e12dcf0452
Compiler baseline
- Fix binary
 - Add base for transformers

This will be last large squash.
2018-11-03 16:56:43 +09:00
강동윤
fd5b4d0dc0 Revert "Merge remote-tracking branch 'refs/remotes/origin/simplifier'"
This reverts commit 43fcbcbef2, reversing
changes made to 15fde7b5ff.
2018-01-14 14:00:01 +09:00
강동윤
b778f0c398 Rebase 2018-01-14 13:37:32 +09:00
강동윤
5a1c844549 [WIP] simplifier 2018-01-14 13:33:09 +09:00
강동윤
015ccb07f4 [WIP] Working for simplfier 2018-01-14 13:30:50 +09:00
강동윤
58bc3b4ade [WIP] Working for simplfier 2018-01-13 19:13:32 +09:00