language

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit a38198ce818127a70bb9a3a33bdcb0d2b1c0be52
parent ba4a019a07aef0e038d3e8f3ef10f00847b49e3a
Author: Paul Longtine <paullongtine@gmail.com>
Date:   Tue, 26 Sep 2017 18:37:49 -0400

Fixed issue where DEFUN op would skip next line

Diffstat:
Msrc/lc/test_files/example.ti | 7-------
Msrc/lc/test_files/problem.ti | 17+++++++++++++++++
Msrc/vm/src/ins_def.c | 3+++
Msrc/vm/src/main.c | 3++-
4 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/src/lc/test_files/example.ti b/src/lc/test_files/example.ti @@ -6,13 +6,6 @@ class Object(int init_args): { property = (arg1 * arg2) / property; } - - func init_method() -> void: - { - print "Initialized Object"; - } - - init_method(); } func main(int arg) -> void: diff --git a/src/lc/test_files/problem.ti b/src/lc/test_files/problem.ti @@ -1,6 +1,11 @@ class UsedByUsedByTesting: { int property_three = 3; + + func testing (int i) -> void: + { + property_three = property_three * i; + } } class UsedByTesting: @@ -8,6 +13,11 @@ class UsedByTesting: int property_two = 2; UsedByUsedByTesting x = new UsedByUsedByTesting(); + + func action -> void: + { + x.testing(property_two); + } } class Testing: @@ -19,6 +29,13 @@ class Testing: print y.x.property_three; print y.property_two; print property_one; + + y.action(); + + print y.x.property_three; + print y.property_two; + print property_one; } Testing t = new Testing(); + diff --git a/src/vm/src/ins_def.c b/src/vm/src/ins_def.c @@ -764,6 +764,7 @@ void _ins_def_DECLASS (rt_t* ctx, bc_cont* line) proc_setvar(ctx, 1, name, obj); pc_inc(ctx->pc, 1); + pc_update(ctx->pc); } void _ins_def_DEFUN (rt_t* ctx, bc_cont* line) { @@ -804,6 +805,7 @@ void _ins_def_DEFUN (rt_t* ctx, bc_cont* line) pc_update(ctx->pc); } + pc_update(ctx->pc); // Set all the values. data->end = ctx->pc->line->real_addr; // This is the end! data->size = nsize + alen + 1; // How many names will this @@ -821,4 +823,5 @@ void _ins_def_DEFUN (rt_t* ctx, bc_cont* line) proc_setvar(ctx, 1, name, func); pc_inc(ctx->pc, 1); + pc_update(ctx->pc); } diff --git a/src/vm/src/main.c b/src/vm/src/main.c @@ -10,7 +10,8 @@ int main(int argc, char** argv) { - ASSERT(argc > 1, "Specify a bytecode file in the first and only argument, please\n"); + ASSERT(argc > 1, + "Specify a bytecode file in the first and only argument, please\n"); init_mdata(); // Initalize the instruction defs init_adata();