Commit Graph

6852 Commits

Author SHA1 Message Date
강동윤
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
강동윤
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
강동윤
7b56b0bc74
Improve codegen (#57)
* travis: make it faster

* better codegen

* Move enable_comments field to config
2018-11-15 21:43:04 +09:00
강동윤
6234fd7a21
parse "constructor"() as constructor (#56) 2018-11-15 21:29:47 +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
강동윤
5cf15cb40f
Fix tests by updating references (#53) 2018-11-14 21:36:37 +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
강동윤
56a6429fad
Documentation (#48)
Use own repository for rustdoc.
2018-11-10 19:00:26 +09:00
강동윤
bbd9ec9eb9
travis: fix doc upload (#47) 2018-11-10 18:15:15 +09:00
강동윤
2a169c451b
Update README.md 2018-11-10 18:02:51 +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
강동윤
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
강동윤
7115fec830 Unpin rustc to fix rls. 2018-06-28 14:18:11 +09:00
강동윤
0e1ee5c560 Remove an obsolete setting. 2018-06-24 19:21:04 +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
강동윤
c9b10168e7
Merge pull request #36 from kdy1/ast-self-contained
Make ast nodes contain span
2018-03-08 11:19:21 +09:00
강동윤
4d5efb4a9b Fix test262-parser-tests 2018-03-08 11:17:41 +09:00
강동윤
442302553d Fix library tests for parser 2018-03-08 11:04:25 +09:00
강동윤
0be4a5ef40 Implement #[fold(ignore)] 2018-03-08 11:00:03 +09:00
강동윤
57944ab70e Update parser to new ast.
Tests are not updated yet.
2018-03-07 17:14:16 +09:00
강동윤
6141206963 Use spanned, interned string instead of raw string. 2018-03-07 16:50:25 +09:00
강동윤
7908aaa6c1 Some more refinements for ast.
* All fields are public.
 * Enabled some lints.
2018-03-07 14:05:09 +09:00
강동윤
f11434ee3c [WIP] Update parser 2018-03-06 22:34:42 +09:00
강동윤
160f5dc367 Add RestPat 2018-03-06 15:44:28 +09:00
강동윤
00bcd8f9af Don't use #[ast_node] for temporary for-head 2018-03-06 15:07:52 +09:00
강동윤
077e0c551f implement #[span] 2018-03-04 15:17:52 +09:00
강동윤
3321ca590d implement Spanned for {Span, BytePos} 2018-03-04 14:41:59 +09:00
강동윤
d5ef2be32a reexport Fold properly 2018-03-04 14:12:17 +09:00
강동윤
ffe6fb9030 Add formatOnSave to settings.json 2018-03-04 14:09:36 +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
bors[bot]
5f4bcdc98c Merge #35
35: #[derive(StringEnum)] r=kdy1 a=kdy1
2018-03-02 06:10:46 +00:00
강동윤
9843be331b Disable coverage temporarily. 2018-03-02 15:10:08 +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
bors[bot]
e128ba64c4 Merge #34
34: Use Span::def_site() instead of Span::call_site() r=kdy1 a=kdy1

  * Now rustdoc contains derived implementations.
2018-03-01 05:18:03 +00:00
강동윤
8370b78ee0 Enable backtrace and disable incr-comp. 2018-03-01 14:16:47 +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
강동윤
10f83f3f02
Fix rls (again) (#33)
* Don't use `#[parser]` in lexer

* Don't use `#[parser]` in parser/util.rs

* Pin rust toolchain to nightly-2018-02-28
2018-02-28 14:35:52 +09:00
강동윤
67daa4c4e4
Fix a test about float parser (#32)
See https://github.com/rust-lang/rust/pull/48235
2018-02-27 15:31:50 +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
bors[bot]
ca663aa33d Merge #30
30: Make rls work r=kdy1 a=kdy1

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 11:01:14 +00: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
bors[bot]
f4bbd69547 Merge #28
28: chores: cleanup for docs; no email from travis r=kdy1 a=kdy1
2018-01-27 06:17:23 +00:00
강동윤
056a11dd06 chores: cleanup for docs; no email from travis 2018-01-27 15:14:53 +09:00
bors[bot]
d4e2c90caf Merge #27
27: Ecma parser errors r=kdy1 a=kdy1

I stored context in lexer because lexer should have access to parser's context.
2018-01-27 04:42:40 +00:00