-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trailing commas added to generated modes #56
base: main
Are you sure you want to change the base?
Conversation
tool/src/porting.ts
Outdated
@@ -67,7 +71,7 @@ export function generateMode( | |||
code += `${k}: ${JSON.stringify(v)}`; | |||
} | |||
|
|||
if (i < arr.length - 1) { | |||
if (i < arr.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just drop the condition?
tool/src/porting.ts
Outdated
if (arr.length != 0) { | ||
code += `${k}: [${arr.join(",")},]`; | ||
break; | ||
} | ||
code += `${k}: []`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (arr.length != 0) { | |
code += `${k}: [${arr.join(",")},]`; | |
break; | |
} | |
code += `${k}: []`; | |
if (arr.length === 0) { | |
code += `${k}: []`; | |
break; | |
} | |
code += `${k}: [${arr.join(",")},]`; |
"void", | ||
"while", | ||
"with", | ||
"yield" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not complete yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keywords are dumped with JSON.stringify()
which does not add trailing commas. We need a replacement to it that does. There must be 3rd party packages for this. This may also reduce special cases elsewhere, like arr.length === 0
in variants
.
No description provided.