Skip to content

Conversation

@HerrCai0907
Copy link
Member

In original code, getLocalSetValue cannot get the original expression accurately. For managed objects, the original expression will be wrapped in a layer of tostack, and will be wrapped in another layer of tostack when called. Although the subsequent nested tostack can be eliminated, this brings some readability issues.

@HerrCai0907
Copy link
MemberAuthor

The original behaviour

classBar{v: i32=0; @operator.postfix("++")staticpostfix_inc(bar: Bar): string{bar.v++;return"i++";}}exportfunction_start(): void{leta=newBar();letc=a++;trace(`a.v = ${a.v}${c}`);}
(call$assembly/index/Bar.postfix_inc (call$~lib/rt/__tostack (call$~lib/rt/__tostack (local.get$0) ) ) )

Copy link
Member

@CountBleckCountBleck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but don't abbreviate getValueOriginal to getValueOrigin

@HerrCai0907HerrCai0907 merged commit ade022e into AssemblyScript:mainSep 19, 2025
14 checks passed
@HerrCai0907HerrCai0907 deleted the refactor/unary branch September 19, 2025 16:25
HerrCai0907 added a commit to HerrCai0907/assemblyscript that referenced this pull request Sep 25, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@HerrCai0907@CountBleck@KKiiim