Skip to content
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

Typescript: Fix handling of parentheses in class property value #3659

Merged
merged 1 commit into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Units/parser-typescript.r/ts-class-member-init.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--sort=no
--kinds-typescript=*
--fields=+i
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
User input.ts /^class User {$/;" c
soundMan input.ts /^ private readonly soundMan = singletons.getSoundManager();$/;" p class:User
lssMan input.ts /^ private readonly lssMan = singletons.getLoopedSoundSourceManager();$/;" p class:User
minimapStyle input.ts /^ override minimapStyle = Color.USER;$/;" p class:User
destroy input.ts /^ override destroy(parent: any) {$/;" m class:User
parent input.ts /^ override destroy(parent: any) {$/;" z method:User.destroy
14 changes: 14 additions & 0 deletions Units/parser-typescript.r/ts-class-member-init.d/input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* base on User.ts from Stendhal -- License: AGPL */
/* https://github.com/arianne/stendhal/blob/master/srcjs/stendhal/entity/User.ts */

class User {
private readonly soundMan = singletons.getSoundManager();
private readonly lssMan = singletons.getLoopedSoundSourceManager();

override minimapStyle = Color.USER;

override destroy(parent: any) {
this.onExitZone();
super.destroy(parent);
}
}
5 changes: 4 additions & 1 deletion parsers/typescript.c
Original file line number Diff line number Diff line change
Expand Up @@ -1820,8 +1820,11 @@ static void parseClassBody (const int scope, tokenInfo *const token)
parsingValue = false;
break;
case TOKEN_OPEN_PAREN:
if (! member) break;
uwiUngetC ('(');
if (! member) {
parsed = tryParser (parseParens, token, false);
break;
}

const int nscope = emitTag (member, isGenerator ? TSTAG_GENERATOR : TSTAG_METHOD);

Expand Down