David Sherret
e5004da87e
- Spans of class members and classes should include decorators. ( #581 )
...
- spans of class members and classes should include decorators.
- fix hi position for class parameter properties.
- fix span of members with accessibility.
2020-01-12 08:41:43 +09:00
David Sherret
b7b7fda982
Fix type predicate start position. ( #580 )
2020-01-12 08:38:58 +09:00
David Sherret
fea4c5bd63
TypePredicate - Parse the asserts modifier ( #567 )
...
swc_ecma_parser:
- add support for asserts modifier from typescript 3.7
2020-01-09 14:14:44 +09:00
kdy1
6eb066166f
Don't emit error messages while trying ( #574 )
...
swc_ecma_parser:
- don't emit error messages while trying (Closes #573 )
2020-01-07 12:36:51 +00:00
dsherret
8e3827403e
Fix class and interface spans ( #566 )
...
The interface span for something like `interface Test {}` was `Test {}`. Also, for stuff like `export default abstract class Test{}` it was `class Test{}` instead of `abstract class Test {}`.
2020-01-06 00:08:59 +00:00
dsherret
9676a05853
Import type should have type arguments rather than type params ( #560 )
...
Just found another occurrence of this. Similar to #548 .
![image](https://user-images.githubusercontent.com/1609021/71735836-716b2d00-2e1d-11ea-8878-50d28da9fa5e.png )
I'm currently going through all the types right now so you might want to hold off on merging this or doing a breaking change release until I finish that.
2020-01-04 23:56:31 +00:00
강동윤
c0cc2185ea
Fix ci ( #561 )
...
- line endings are normalized
- switched to github actions from travis to check forked branches
2020-01-04 13:33:25 +09:00
David Sherret
c43bc471dd
Fix span for patterns with a type annotation ( #558 )
...
swc_ecma_parser:
* fix span for patterns with a type annotation.
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-01-03 14:37:48 +09:00
David Sherret
5acf557e35
GetterProp - Add type_ann ( #557 )
...
swc_ecma_ast:
- add type_ann to GetterProp
swc_ecmascript_parser:
- parse type annotation after a getter property
2020-01-03 13:08:27 +09:00
강동윤
916858ae81
Bugfixes ( #549 )
...
swc_ecma_ast:
- fix TsExprWithTypeArgs (closes #548 )
swc_ecma_codegen:
- allow using default import with namespace import (closes #546 )
swc_ecma_parser:
- parse import.meta (closes #545 )
2020-01-01 06:57:34 +09:00
David Sherret
64bddebb2b
Fix parsing class properties as readonly ( #547 )
...
swc_ecma_parser
- parse readonly property correctly
2020-01-01 03:14:46 +09:00
강동윤
aa2a394f7d
Fix #542 ( #543 )
...
swc_ecma_transforms:
- preserve space after a jsx element
2019-12-30 00:05:43 +09:00
David Sherret
bde5341bd7
Fix string literal span on import/export specifiers to only include string literal ( #540 )
2019-12-29 16:18:14 +09:00
강동윤
8562d3fbfb
Fix parser ( #539 )
...
swc_ecma_parser:
- mark `declare` as `declare` (#538 )
- fix span of `export * from 'foo'` (#535 )
2019-12-28 12:19:44 +09:00
강동윤
b1e4122b02
Nullish coalescing / optional chaining / comments ( #529 )
...
swc_ecma_ast:
- rename `TsOptChain` to `OptChainExpr` (Fixes #525 )
- add `BinOp::NullishCoalescing`
swc_ecma_parser:
- parse `??` (Fixes #526 )
swc_ecma_transforms:
- remap comments from fixer (Fixes #528 )
2019-12-24 17:01:32 +09:00
강동윤
24b5c44ba3
Numeric separator & Bigint ( #523 )
...
swc_ecma_ast:
- `BigInt` literal
swc_ecma_parser:
- numeric separators. (#521 )
- parsing of bigint literal
2019-12-22 17:14:04 +09:00
강동윤
ed8ba26ae6
Fix tests
2019-12-21 17:09:53 +09:00
강동윤
6186af04a9
Fix handling of jsx texts ( #519 )
...
swc_ecma_transforms:
- Fix handling of jsx texts (#517 )
2019-12-21 16:59:04 +09:00
강동윤
51d21af031
Fix #516
2019-12-19 13:08:52 +09:00
강동윤
30af06bb70
Ast ( #513 )
...
swc_ecmascript:
- add `ExprStmt`.
- change type of regex.expression and regex.flags.
2019-12-16 18:08:21 +09:00
강동윤
332061f44d
Parser: respect jsc.target ( #507 )
...
swc:
- make parser respect `jsc.target`.
2019-12-14 18:51:08 +09:00
kdy1
3ec395ba75
Improve performance & update rustfmt ( #504 )
2019-12-13 06:21:25 +00:00
kdy1
0df908fdb4
ast & parser improvement ( #502 )
...
Parser can now parse typescript source code and rxjs.
Closes #468 .
2019-12-11 14:28:35 +00:00
강동윤
1a48efa4e4
ES3 ( #498 )
...
* Add a test for #496
- Better error message for TS1056
- Allow using dynamic import with es3 target
2019-12-11 13:35:15 +09:00
Nurbol Alpysbayev
2f4ce50d06
Fix the Wasm blocker for Parser ( #495 )
2019-12-11 00:02:39 +09:00
강동윤
ef45401a18
Update tests
2019-12-10 10:50:37 +09:00
강동윤
ae6de87abb
Add more tests ( #489 )
2019-12-09 21:02:51 +09:00
강동윤
bc19ee274b
Update parser test references
2019-12-02 17:12:53 +09:00
Zimon Dai
ec086a1dab
use 2018 edition syntax ( #479 )
2019-12-02 17:10:05 +09:00
강동윤
776e014a11
Fix tests ( #478 )
2019-12-01 18:11:59 +09:00
강동윤
265eb9e30c
Improve performance of serialization and deserialization ( #475 )
2019-11-30 14:49:18 +09:00
강동윤
41c6941dc5
fixup! Don't omit empty values while serializing
2019-11-28 17:53:03 +09:00
강동윤
5532e628b2
Don't run cargo clippy on push
2019-11-28 13:38:11 +09:00
강동윤
747a07f566
Update submodules
2019-11-26 20:42:41 +09:00
강동윤
b81200b1db
Update references
2019-11-26 11:31:16 +09:00
강동윤
fa941b3ea3
resolver: Handle arrow expression correctly ( #462 )
...
swc_ecma_transforms:
- resolver: Handle arrow expression correctly (#462 )
2019-11-23 19:14:52 +09:00
강동윤
d50ab99ef0
Fix #451 ( #452 )
...
swc_ecma_parser:
- Fix parser of eval and arguments
swc_ecma_transforms:
- Improve fixer (#451 )
2019-11-18 18:19:25 +09:00
강동윤
d074063867
Parser: Error recovery ( #449 )
...
Implement some error recovery logic to parser
2019-11-17 18:36:47 +09:00
Jasper De Sutter
716bfe05b2
Cleanup ( #448 )
...
- cargo fix
- update all crates to 2018 edition
2019-11-17 13:21:53 +09:00
강동윤
bc4a2976e5
Validate spans ( #447 )
...
- Add span validator to swc_ecma_transforms
2019-11-16 23:49:32 +09:00
강동윤
37b80dfd08
Optional chaining for typescript ( #444 )
...
Implement typescript 3.7's optional chaining
2019-11-15 14:34:48 +09:00
강동윤
167008de6f
Expose tokenizer ( #437 )
...
swc_common:
- Added input::Input
swc_ecma_parser:
- Made lexer public
- Make input type of parser generic
- Added example of using lexer
2019-11-06 13:14:44 +09:00
강동윤
7f5d3a4db1
Fix parsing of single untyped param in IIFE
...
Closes #433
2019-10-23 20:53:28 +09:00
강동윤
2e5c81ee8e
Fix parsing readonly array and tests
...
Closes #432
2019-10-23 20:20:17 +09:00
강동윤
9f1fca55ff
Update rustc toolchain to nightly-2019-09-30
2019-10-02 13:53:56 +09:00
강동윤
61a1367974
Fix #410
2019-09-20 23:35:45 +09:00
강동윤
c7abda95d4
typescript const assertion ( #419 )
...
Fixes #401 .
2019-09-18 22:54:12 +09:00
강동윤
0e1991f62d
Fix bugs ( #394 )
...
- Add a test case for #392
- Add tests for #389
- Fix #388
- Fix #387
- Add tests for #392
swc_ecma_parser:
- Make non-last rest paramters in object pattern error
- `...` must be followed by an identifier
2019-06-03 21:54:09 +09:00
강동윤
b4dde98c09
Fix #380 ( #381 )
...
swc_ecma_parser:
- fix parsing of dot after dynamic imports (#380 )
- fix parsing of dynamic imports on top level
2019-04-29 23:36:30 +09:00
강동윤
b44da9dbe4
Fix #369 , #370 ( #373 )
...
swc_common:
- don't emit `loc` for dummy spans
swc_ecma_transforms:
- prevent hygiene from changing key in object pattern (#369 )
- fix module tests (iteration order of FxHashSet is changed)
swc_ecma_parser:
- fix parsing of arrow function (#370 )
2019-04-27 16:28:34 +09:00
강동윤
fe451d5809
Fix #360 and update rustc
2019-04-05 12:19:18 +09:00
Michael Stewart
6f97012821
fix test imports for latest nightly ( #355 )
2019-03-23 13:18:55 +09:00
강동윤
13bf89d08c
Fix bugs ( #339 )
...
swc_ecma_parser:
- fix parsing of type query (#338 )
- fix parsing of `in` in a let / const declaration (#337 )
swc_ecma_transforms:
- string literal is computed (#336 )
- modules: handle imports in lhs of assignment correctly (#335 )
2019-03-11 20:33:15 +09:00
강동윤
a40518f667
v1.0.36 ( #330 )
...
swc_ecma_parser
- decorator_before_export is true for typescript. (#325 )
- fix parsing of dynamic imports. (#328 )
- fix parsing of conditional expression. (#327 )
2019-03-09 09:07:15 +09:00
강동윤
248a53ce7c
Make deserialization faster ( #324 )
...
swc_ecma_ast:
- make deserialization faster
2019-03-08 11:36:23 +09:00
강동윤
f49fbea2af
Update referenes
2019-02-28 19:30:58 +09:00
강동윤
a75dbdf2f2
Update references
2019-02-25 19:47:53 +09:00
강동윤
dff2cb8f75
Implement deserialize for ast nodes ( #274 )
...
string_enum:
- #[derive(StringEnum)] now derives `Deserialize`
swc_ecma_ast:
- implement deserialize for ast nodes.
- change ast to make it serialized / deserialized correctly
swc_ecma_parser:
- jsx, test262, typescript tests now verify serialization and deserialization of module
2019-02-24 14:12:04 +09:00
강동윤
07e2cffb43
Fixes ( #265 )
...
swc_ecma_parsr:
- fix parsing of invalid utf8 characters (#261 )
- fix parsing of function body (#257 )
- fix parsing of () => (x = true) (#259 )
swc_ecma_transforms:
- fix default arguments in arrow expression (#254 )
- fix assignment pattern in array pattern (#260 )
- make amd / umd configurable. (#262 )
2019-02-21 22:21:48 +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
강동윤
4dc10d849e
Fixes ( #237 )
...
swc_ecma_transforms:
- handle pattern correctly in coomon_js pass (#235 )
- fix object rest in arrow expression (#233 )
2019-02-19 12:52:03 +09:00
강동윤
b27829825e
Fix Bugs ( #205 )
...
swc_ecma_codegen:
- escape characters (#204 )
swc_ecma_parser:
- fix parsing of `<!--`
swc_ecma_transforms:
- promote VarCollector to crate-level utility
- fix es3::member_expr_lits (#206 )
- fix es2015::duplicate_keys pass (#203 )
- improve fixer (paren for assignment) (#201 )
- improve fixer (arrow expression) (#207 )
- make typescript pass strip out type-only exports (#196 )
2019-02-14 11:03:06 +09:00
강동윤
c1a3cc53c1
React jsx / improve fixer ( #202 )
...
swc_ecma_parser:
- fix parsing of jsx
swc_ecma_transforms:
- fix fixer (#199 )
2019-02-13 19:12:00 +09:00
강동윤
c647cf1bc0
Fix bugs ( #193 )
...
swc_ecma_parser:
- fix lexer
- better error reporting for jsx reference test
swc_ecma_codegen:
- Update references
2019-02-13 16:03:38 +09:00
강동윤
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
강동윤
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
강동윤
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
강동윤
ab4f619257
Fix tests ( #142 )
2019-02-10 20:49:29 +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
강동윤
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
강동윤
9313b04c6c
Enable some assertions and fix ICE on release mode
2019-01-22 12:37:51 +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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
4d5efb4a9b
Fix test262-parser-tests
2018-03-08 11:17:41 +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
강동윤
92c7defc2e
fix tests
2018-01-27 11:31:45 +09:00
강동윤
5602c376e5
Implement error reporting for ecmascript parser
...
Passes all test262-identity tests and all fail tests.
2018-01-26 21:53:30 +09:00
강동윤
9b2a5880bb
Use FileMap as an input.
2018-01-23 21:38:48 +09:00
강동윤
0a2473fe1c
Improve error reporting of ecmascript parser
...
And drop nll because it's currently too slow.
2018-01-22 21:47:16 +09:00
강동윤
4d52cb49d4
Implement error reporting.
...
* Use syntax_pos and rustc_error.
* Use syntax_pos::Span
2018-01-21 17:47:37 +09:00
강동윤
d6e61f9638
Make expression and statement consistent. Fixes #19
2018-01-16 11:35:05 +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
강동윤
3b02b27d62
groundwork for docs
...
Ignore two tests. See #8 .
Add code coverage and travis to readme.
2018-01-13 20:42:52 +09:00
강동윤
4a9d66a0f3
update test262.rs
2018-01-13 19:06:50 +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