-
-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed top level indents * Fixed function definitions * For loops display correctly now * Await expressions display correctly * Await calls no longer have a custom display() function * Fixed async function declaration * Added spacing to do-while loop * Fixed for of loop * Fixed object declaration formatter * Fixed switch statements formatting * Added operator fmt test * Added array display test * Added tests for await expressions. Unclear if let a = await blah() has been implemented yet, but I got parse errors when testing that * Added block display test * Added break formatting test * Added a potential test for when block labels are added * Added call formatting tests * Added a testing utility function for formatting tests * Using custom testing function instead of a bunch of asserts in formatting tests * Improved formatting of failed parsing formatting tests * Added conditional formatting tests * Wrote function tests, and found out that functions are still horribly broken * Fixed arrow function declaration * Fixed the formatting for the rest of the functions. Async function expressions don't seem to be parsed correctly * Re-ordered functions to match the output of StatementList * Fixed async function expressions * Added field formatting tests * Added formatting test for 'for' loops * For in loops now display their label if they have one * Added test for the rest of the loops * Added fmt for labels for all the types of loops * Added test for new keyword formatting * Added object formatting * Partially fixed object display function * Split Node::display into two functions, allowing objects to be displayed correctly * Added a first implementation of a MethodDefinition formatter * Added tests for the rest of object function fields (every branch of MethodDefinitionField) * Operator test uses propper formatting test * Added return statment formatter test * Added spread argument formatting test * Added switch statement formatting test * Added a formatting test for templates * Added a throw statement formatter test * Added try catch test * Removed unused import * Formatting test now uses eprintln! instead of println!
- Loading branch information
Showing
42 changed files
with
581 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#[test] | ||
fn fmt() { | ||
super::super::test_formatting( | ||
r#" | ||
let a = [1, 2, 3, "words", "more words"]; | ||
let b = []; | ||
"#, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#[test] | ||
fn fmt() { | ||
// TODO: `let a = await fn()` is invalid syntax as of writing. It should be tested here once implemented. | ||
super::super::test_formatting( | ||
r#" | ||
await function_call(); | ||
"#, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#[test] | ||
fn fmt() { | ||
super::super::test_formatting( | ||
r#" | ||
{ | ||
let a = function_call(); | ||
console.log("hello"); | ||
} | ||
another_statement(); | ||
"#, | ||
); | ||
// TODO: Once block labels are implemtned, this should be tested: | ||
// super::super::test_formatting( | ||
// r#" | ||
// block_name: { | ||
// let a = function_call(); | ||
// console.log("hello"); | ||
// } | ||
// another_statement(); | ||
// "#, | ||
// ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#[test] | ||
fn fmt() { | ||
super::super::test_formatting( | ||
r#" | ||
call_1(1, 2, 3); | ||
call_2("argument here"); | ||
call_3(); | ||
"#, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#[test] | ||
fn fmt() { | ||
super::super::test_formatting( | ||
r#" | ||
let a = true ? 5 : 6; | ||
if (false) { | ||
a = 10; | ||
} else { | ||
a = 20; | ||
} | ||
"#, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#[test] | ||
fn fmt() { | ||
super::super::test_formatting( | ||
r#" | ||
a.field_name; | ||
a[5]; | ||
a["other_field_name"]; | ||
"#, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.