Commit Graph

2068 Commits

Author SHA1 Message Date
강동윤
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
강동윤
f82c722588 update README.md 2018-11-28 12:26:19 +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
강동윤
8524d93e9a spdy -> speedy & black box for benchmark 2018-11-23 19:52:46 +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
강동윤
8b992d6401
improve travis' caching (#75) 2018-11-22 17:28:23 +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
강동윤
3638dbc42c
Groundwork for linter (#73) 2018-11-20 18:32:53 +09:00
bors[bot]
be129db2a6 Merge #72
72: Fix parser tests r=kdy1 a=kdy1



Co-authored-by: 강동윤 <kdy1@outlook.kr>
2018-11-19 10:59:17 +00:00