Minor optimization on FOR when assignment and loop var is the same
This commit is contained in:
parent
23a721217d
commit
22e6759409
1 changed files with 5 additions and 0 deletions
|
|
@ -234,6 +234,11 @@ func (c *ForCommand) Generate(ctx *compiler.CompilerContext) ([]string, error) {
|
|||
func (c *ForCommand) generateAssignment() []string {
|
||||
var asm []string
|
||||
|
||||
// If startOp is also the iterator (varName) no need to load it.
|
||||
if c.startOp.IsVar && c.startOp.VarName == c.varName {
|
||||
return asm
|
||||
}
|
||||
|
||||
// Variable assignment from startOp
|
||||
if c.startOp.IsVar {
|
||||
// Destination: byte
|
||||
|
|
|
|||
Loading…
Reference in a new issue