Commit Graph

7427 Commits

Author SHA1 Message Date
강동윤
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
강동윤
338759110f Fix parsing of large integers 2019-01-16 11:53:41 +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
강동윤
77e3a78353 Make procmacro2_semver_exempt optional 2019-01-15 13:29:57 +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
강동윤
c361ef560d Re-depend on rustc-ap-rustc_data_structures 2019-01-14 22:02:11 +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
강동윤
1fabc3fa3e debug_assert! instead of assert!
This reduces binary size
2019-01-10 18:54:40 +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
강동윤
9361e96d5b Move config from libswc to node-swc 2019-01-09 18:40:14 +09:00
강동윤
0f0dc1451a Make procmacro2_semver_exempt optional 2019-01-09 09:46:38 +09:00
강동윤
eb22cfb1bd default for syntax configs 2019-01-08 18:27:38 +09:00
강동윤
5dbf5ebf02 #[serde(default)] for all config structs 2019-01-08 17:59:50 +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
bors[bot]
d99d774a2b Merge #105
105: Fix old proc_macros2 dep breaking compile and fix line endings in atoms r=kdy1 a=isavegas

When trying to compile swc, I came across an issue with [proc_macro2::Span::join(&self, other: Span) -> Option\<Span\>](https://docs.rs/proc-macro2/0.4.24/proc_macro2/struct.Span.html#method.join) not existing. Easily fixed by updating the dependency from `0.4.4` to `0.4.24`.

Another major issue I came across when compiling the crate involved the `js_word!` macro throwing an error due to not accepting any parameters. After digging around, I noticed that the `js_word.rs` file that is generated by `atoms`' `build.rs` contained trailing `\r`s. As it turns out, the call to `::split(&'static str)` was allowing carriage returns to propagate to the aforementioned `js_word.rs` file. Replaced with a call to `::lines()` and a `map` to trim the words, just in case.

Co-authored-by: Leviathan Jeanis <isavegas2006@gmail.com>
2018-12-30 23:57:29 +00:00
Leviathan Jeanis
ba75072509
Replace hard split on \n with ::lines() + ::trim() to fix \r\n 2018-12-30 10:04:13 -06:00
Leviathan Jeanis
75e83860be
Update proc_macro2 to fix missing join() 2018-12-30 09:48:56 -06:00
강동윤
f89a227d5e implement more traits for Syntax 2018-12-30 13:06:13 +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
bors[bot]
cb59cd63c6 Merge #101
101: Benchmark comparison r=kdy1 a=mmathys

Add speedup factor to benchmark description

Co-authored-by: Max Mathys <threadox@gmail.com>
2018-12-28 23:18:56 +00:00
Max Mathys
f1852fc085
Add benchmark 2018-12-28 17:12:41 +01: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
bors[bot]
2ba47d697d Merge #96
96: Fix link to reference files r=kdy1 a=rcoh

The current link is broken

Co-authored-by: Russell Cohen <russell.r.cohen@gmail.com>
2018-12-26 01:59:59 +00:00
Russell Cohen
3f8e81c37f
Fix link to reference files 2018-12-25 14:18:54 -08: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
강동윤
a5362ebdb8 inline benchmark files and remove submodule 2018-12-22 18:35:44 +09:00
강동윤
2867a43df5 Move node-swc into separate repository 2018-12-22 17:55:09 +09:00
강동윤
5bea4a6138
Add index.d.ts and export inline globals pass (#90) 2018-12-22 17:41:01 +09:00
Viktor Kuroljov
946a32adf8 readme: Fix npm install command (#89) 2018-12-22 17:19:16 +09:00
강동윤
fb77e996bd
v1.0.0-alpha (#88)
Currently using this library requires nightly rustc toolchian
2018-12-22 14:08:18 +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
강동윤
f0e4598f41
Update README.md
render table correctly
2018-12-21 16:58:44 +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
강동윤
ea910a4dfb
add #[inline] to folder / visitors (#81) 2018-11-28 18:14:44 +09:00