summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core/codegen.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-11-15 23:29:55 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-11-15 23:34:32 +0900
commit418ad65db40200058a023b57682f4a3853fd63bc (patch)
treee8752f370c6022b80eae635bb8bca7274cd42582 /mrbgems/mruby-compiler/core/codegen.c
parent7e3e8d8ed5d9d12e7d3b0d616bf9b770f07e0d4f (diff)
downloadmruby-418ad65db40200058a023b57682f4a3853fd63bc.tar.gz
mruby-418ad65db40200058a023b57682f4a3853fd63bc.zip
Fixed a bug in continuous read of target files; ref #4138
Line number information in a compiled file was wrong.
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index dbd3b8ecf..ba7d8cf63 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -156,7 +156,10 @@ emit_B(codegen_scope *s, uint32_t pc, uint8_t i)
}
}
if (s->lines) {
- s->lines[pc] = s->lineno;
+ if (s->lineno > 0 || pc == 0)
+ s->lines[pc] = s->lineno;
+ else
+ s->lines[pc] = s->lines[pc-1];
}
s->iseq[pc] = i;
}