Skip to content

Improve one to multi-assigment  #328

@jespa007

Description

@jespa007

the following code,

var a,b

a=b=0

generates these byte code,

[0000| 1|01]    LOAD_INT                0
[0001| 1|02]    PUSH_STK_LOCAL          b
[0002|-1|01]    STORE                   n:1 
[0003| 1|02]    PUSH_STK_LOCAL          a
[0004|-1|00]    STORE                   n:1 [RST]

It's recommended to load both idenfitiers and then assign multiple like this,

[0000| 1|01]    LOAD_INT                0
[0001| 1|02]    PUSH_STK_LOCAL          b
[0003| 1|02]    PUSH_STK_LOCAL          a
[0004|-1|00]    STOREN                   n:2 [RST]

Conditions:

-Ensure that right expression is only one (avoid expression sequence )

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions