Skip to content

Commit

Permalink
Fix indent num
Browse files Browse the repository at this point in the history
  • Loading branch information
goccy committed Jun 12, 2021
1 parent 56e5d7a commit b972a9b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion internal/cmd/generator/vm.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
oldOffset := ptrOffset
ptrOffset += code.Jmp.CurLen * uintptrSize
oldBaseIndent := ctx.BaseIndent
ctx.BaseIndent += code.Indent
indentDiffFromTop := c.Indent - 1
ctx.BaseIndent += code.Indent - indentDiffFromTop

newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
if curlen < newLen {
Expand Down
3 changes: 2 additions & 1 deletion internal/encoder/vm/vm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion internal/encoder/vm_color/vm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion internal/encoder/vm_color_indent/vm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion internal/encoder/vm_indent/vm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b972a9b

Please sign in to comment.