Commit Graph

38 Commits

Author SHA1 Message Date
강동윤
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
강동윤
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
강동윤
b516c19133
Update dependencies (#135) 2019-02-07 00:05:25 +09:00
강동윤
a26cc61a69 Build on stable rust 2019-01-19 09:25:47 +09:00
강동윤
d7ce4d1100 Bump version 2019-01-17 23:19:08 +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
강동윤
77e3a78353 Make procmacro2_semver_exempt optional 2019-01-15 13:29:57 +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
강동윤
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
강동윤
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
강동윤
22b9e08851 Add CONTRIBUTING.md and ARCHITECTURE.md 2018-12-04 15:11:50 +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
강동윤
84675d32df
Visitor (#69)
* Add Visit<T> and VisitWith<F>

* implement derive(VisitWith<T>)

* Bump versions
2018-11-19 13:02:55 +09:00
강동윤
3786c5f788
Make procmacro2_semver_exempt optional for FromVariant (#68)
- use call_site if cfg(procmacro2_semver_exempt) is false

 - Make `FromVariant` not to emit extern crate swc_common
2018-11-18 21:18:11 +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
강동윤
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
강동윤
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
강동윤
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
강동윤
f9be576e02
Ecmascript codegen (#40)
Comment is not fully supported yet
2018-10-25 13:17:05 +09:00
강동윤
0a5f3f4ab5
rustup to 2018-08-29\ (#39)
- libswc is broken
2018-09-16 20:25:41 +09:00
강동윤
9c2bc94e56 Use cargo override for darling 2018-06-28 15:17:22 +09:00
강동윤
5d5f861b9d Update dependencies
- rustc toolchain to "nightly-2018-05-30"
 - rustfmt to 0.8.6
 - rustc-ap-* to 150
 - syn to 0.14
 - proc-macro2 to 0.4
 - quote to 0.6
2018-06-02 18:01:00 +09:00
강동윤
79f3660f0f
Downgrade rust toolchain to 2018-02-01 (#37) 2018-03-09 16:56:43 +09:00
강동윤
0be4a5ef40 Implement #[fold(ignore)] 2018-03-08 11:00:03 +09:00
강동윤
077e0c551f implement #[span] 2018-03-04 15:17:52 +09:00
강동윤
e1764f907b [WIP] Make ast nodes contain span
* `struct Expr` + `enum ExprKind` -> `enum Expr`

`Expr` / `ExprKind` approach does not work well with recursive
 processing based on the type system because we can't access common
 fields like span while processing child node like `MemberExpr`.

As ast processing is inherently recursive, we should use a
 recursive-friendly approach.

 * `#[derive(FromVariants)]`
It creates lots of `From<T>` to help using ast enums as a real sum type.

 * `#[derive(Spanned)]`

Inspired by https://docs.rs/syn/0.12.13/syn/spanned/trait.Spanned.html

It does not handle attributes yet.

 * Parser is not updated yet.
2018-03-03 19:37:01 +09:00
강동윤
27d9b1e154 Update rustfmt to 0.3.8 2018-03-02 15:07:09 +09:00
강동윤
171abda3c0 Implement #[derive(StringEnum)] 2018-03-02 14:50:50 +09:00
강동윤
c37454ca1f Use Span::def_site() instead of Span::call_site()
* Now rustdoc contains derived implementations.
2018-03-01 14:09:22 +09:00
강동윤
4a30fb3436
Testing framework (#31)
- Make rls happy.
  - Some minor parser error improvements.
  - Add reference files for ecmascript parser errors.
  - Improve error message of import/export used outside of a module
2018-02-27 13:21:57 +09:00
강동윤
fa40c8ddf3 Make rls work
rust-analysis chokes with `Option<Box<Expr>>` style fields.
Rls only shows a warning on the crate with that fields, but ICEs on
dependent crates.
This can be workarounded by using `Option<(Box<Expr>)>`.

Also, using multiple glob imports is bad for rls.
So this commit deglobs them.
2018-02-03 20:00:03 +09:00
강동윤
11b12b8142 Update rustfmt to 0.3.5 and format literals. 2018-01-16 20:11:08 +09:00
강동윤
06731dfcb5 Cleanup and documentations for swc_common.
* Remove CanIUse trait, which will be reimpplemented in future
 using Visitor.

 * Remove some other unused stuffs.

 * Change public path of swc_common::fold::* to swc_common::*.
2018-01-15 10:33:18 +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