Commit Graph

200 Commits

Author SHA1 Message Date
강동윤
2d062432a8
Shebang & small improvement for object rest spread (#184)
swc_ecma_ast:
 - handle shebang

swc_ecma_codegen:
 - handle shebang

swc_ecma_parser:
 - handle shebang

swc_ecma_transforms:
 - fix arrow expression used with object rest spread
2019-02-13 11:08:21 +09:00
강동윤
f797019b79
Use strict (#183)
swc_ecma_parser:
- fix parsing of use strict without semicolon.

swc_ecma_transforms:
 - emit helpers after use strict.
2019-02-13 08:44:54 +09:00
강동윤
fc661f24f0
Bugfixes (#182)
swc_ecma_ast:
 - rename ast to be consistent
2019-02-13 08:18:19 +09:00
강동윤
cc36bbe3ad Add tests for #169. 2019-02-12 22:18:14 +09:00
강동윤
bd219688ac
Typescript bugs (#170)
swc_ecma_parser:
 - fix parsing of cond expression (Closes #158)
 - fix parsing of function signature (Closes #159)
2019-02-12 22:05:46 +09:00
강동윤
227423d5f6
Export default from & fix codegen of imports (#168)
swc_ecma_ast:
 - Support `export v from 'foo';`

swc_ecma_parser:
 - Support `export v from 'foo';`

swc_ecma_codegen:
 - Fix codegen of side-effect imports
2019-02-12 15:30:11 +09:00
강동윤
45e78e40d4
Amd & Correct named exports (#165) 2019-02-12 11:41:08 +09:00
강동윤
a0c6b4458e
Revert "Amd & Fix for exports (#164)" (#166)
This reverts commit 8c5c7b55b7.
2019-02-12 11:40:36 +09:00
강동윤
8c5c7b55b7
Amd & Fix for exports (#164)
swc_ecma_transforms:
 - correctly tracks exported names.
 - Implement amd

Fix #162
2019-02-12 11:23:19 +09:00
Nate Mara
42f94a3f24 Remove HERE eprintln (#161) 2019-02-12 06:24:12 +09:00
강동윤
d98219cd42 Reduce vtable size of Pass. 2019-02-11 19:11:14 +09:00
강동윤
7fe2245a3d
Cleanup (#152)
- replace Lrc with std::sync::Arc
swc_common:
 - make swc_common::sync private
 - improve MoveMap

swc_ecma_codegen:
 - fix codegen of import.

swc_ecma_transforms:
 - properly detect valid identifier.

swc_ecma_parser:
 - Fix parsing of cond expr inside paren.
2019-02-11 11:39:20 +09:00
Adrian Adamiak
c2142bc225 Remove a leftover (#149)
Remove unused variable from colors.js
2019-02-11 09:40:53 +09:00
nateroling
5afed275f1 Typo correction (#150)
Fix a couple comment typos.
2019-02-11 09:40:28 +09:00
강동윤
ab4f619257
Fix tests (#142) 2019-02-10 20:49:29 +09:00
강동윤
605019280f Fix parsing of import expression 2019-02-10 14:33:21 +09:00
강동윤
b1bf99c67c improve error messages 2019-02-10 12:26:27 +09:00
강동윤
3b8d36dc58 Parse dynamic imports 2019-02-10 12:07:40 +09:00
강동윤
654f55b658 Closes #137, Closes #138 2019-02-09 12:19:20 +09:00
강동윤
7482836d5e Support typescript constructor parameter property 2019-02-08 18:13:32 +09:00
강동윤
e1b83e594f Merge branch 'master' of ssh://github.com/swc-project/swc 2019-02-08 13:29:31 +09:00
강동윤
2c9fe1a555 Comments 2019-02-08 13:28:49 +09:00
강동윤
43d633b44d
Handle comments and improve codegen (#136)
swc_ecma_codegen:
 - Improve codegen
 - Handle comments

swc_ecma_parser:
 - Handle comments
2019-02-08 13:00:58 +09:00
강동윤
b516c19133
Update dependencies (#135) 2019-02-07 00:05:25 +09:00
강동윤
cc83b863ec Threading support 2019-02-06 12:09:42 +09:00
강동윤
17ed32a73c Fix common_js::lazy 2019-02-05 15:47:17 +09:00
강동윤
c5e18e06d1 Use objekt::Clone 2019-02-05 15:24:30 +09:00
강동윤
ea013a1e12 Export module configs 2019-02-05 14:33:29 +09:00
강동윤
4c6c4bc595
Make Helper scoped thread local (#134)
This allows injecting helpers per file without any multi threading issue.
2019-02-05 14:15:38 +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
강동윤
33fe3a9515 Remove dbg! 2019-02-02 23:17:06 +09:00
강동윤
ca6f4eb096 Remove unnecessary logging 2019-01-31 19:49:02 +09:00
강동윤
d8d117b494 implement Clone for HelperResetter 2019-01-31 19:44:34 +09:00
강동윤
976943ba97
Add HelperResetter pass (#132) 2019-01-31 19:39:26 +09:00
강동윤
f914c8579e
Revert "Fix Arc<Helpers> (#130)" (#131)
This reverts commit 6865370205.
2019-01-31 18:22:35 +09:00
강동윤
6865370205
Fix Arc<Helpers> (#130)
Don't clone Arc<Helpers>
2019-01-31 15:14:49 +09:00
강동윤
e681ae37e4 mute resolver 2019-01-30 13:09:21 +09:00
강동윤
e63be11d0e Fix order of the classes pass 2019-01-30 13:05:45 +09:00
강동윤
c87fac213a Add a test about inheriting native class 2019-01-30 11:30:09 +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
강동윤
90135ede1e fix a bug 2019-01-24 16:41:19 +09:00
강동윤
fd79f4eb78 fix swc_ecma_codegen 2019-01-24 16:18:39 +09:00
강동윤
c648232864
Classes improvements (#123)
Now swc passes all tests from `@babel/plugin-transform-classes`
2019-01-24 16:07:09 +09:00
강동윤
0bca2e6ff5 Fix tests 2019-01-23 11:06:17 +09:00
강동윤
3d13d330bb
swc_ecma_codgen for stable rust (#122)
Now swc_ecma_codegen can be built with stable rust
2019-01-23 10:55:47 +09:00
강동윤
9313b04c6c Enable some assertions and fix ICE on release mode 2019-01-22 12:37:51 +09:00
강동윤
4379515f00 Bump version 2019-01-20 11:10:31 +09:00
강동윤
f87e2fb123 Fix parser 2019-01-20 11:08:26 +09:00
강동윤
cb12e13a0b Fix cfg(not(procmacro2_semver_exempt)) 2019-01-19 09:31:31 +09:00
강동윤
29c5faed9b Remove usage of nightly features 2019-01-18 10:26:04 +09:00
강동윤
d534ebcba7 swc_ecma_codegen v0.5.0 2019-01-18 00:11:41 +09:00
강동윤
8ff21b9c99 Bump version (again) 2019-01-18 00:01:10 +09:00
강동윤
ca235e1c67 Bump version 2019-01-17 23:58:43 +09:00
강동윤
3facfd8810 Bump version 2019-01-17 23:57:56 +09:00
강동윤
12944c006a Fix to publish it 2019-01-17 23:38:45 +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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
dc8e178088 fix parser tests 2018-11-19 19:58:35 +09:00
강동윤
c816d699ca
Improve ast (#70)
* Update ast (bool -> Option<Span>)

* fixup! Update ast (bool -> Option<Span>)
2018-11-19 15:52:06 +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
강동윤
8e0e9ca4c7 Make it thread safe 2018-11-17 17:02:34 +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
강동윤
fb08c18f7e
Support es2019 (#63)
ast:
 - Update ast to match es2019 spec

parser:
 - implement es2019 parser
 - ignore an old test

codegen:
 - fix

testing:
 - better output while testing (when failed)

transforms:
 - fix
2018-11-17 12:30:49 +09:00