Commit Graph

20 Commits

Author SHA1 Message Date
강동윤
b5bbbc0cd6 publish atoms 2019-05-02 16:06:42 +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
강동윤
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
Leviathan Jeanis
ba75072509
Replace hard split on \n with ::lines() + ::trim() to fix \r\n 2018-12-30 10:04:13 -06: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
강동윤
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
강동윤
4f1dc24e40
Update deps (#59)
* constructor codegen

* Update string_cache to 0.7

* make swc_common not depend on sourcemap

* Remove unused dependencies

* update either to 1.5.0

* update rustc-ap crates to 297

* remove unused dependency (fnv)
2018-11-16 11:56:04 +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
강동윤
e12dcf0452
Compiler baseline
- Fix binary
 - Add base for transformers

This will be last large squash.
2018-11-03 16:56:43 +09:00
강동윤
0a5f3f4ab5
rustup to 2018-08-29\ (#39)
- libswc is broken
2018-09-16 20:25:41 +09:00
강동윤
5602c376e5 Implement error reporting for ecmascript parser
Passes all test262-identity tests and all fail tests.
2018-01-26 21:53:30 +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
강동윤
8d62017d88 add atoms for transformers 2018-01-14 13:30:50 +09:00
강동윤
e949c40517
ECMAScript parser (#1)
- Parser and lexer for lastest ecma spec https://tc39.github.io/ecma262

  - Lexer is currently very inefficient

 - Use https://github.com/tc39/test262-parser-tests/ for testing.

 - Implement proc-macro based ast folder and assert_eq_ignore_span! based on it.

 - Some utilities for proc macro at /macros/common
2018-01-12 16:53:06 +09:00
강동윤
0f9532dd5d initial commit 2017-12-22 22:07:03 +09:00