From 996e211d3a9a083f7bb4aab65a204d5b67001732 Mon Sep 17 00:00:00 2001 From: zyrouge Date: Thu, 30 Nov 2023 20:52:10 +0530 Subject: [PATCH] refactor: derive function module from constant --- packages/beize_vm/lib/vm/call_frame.dart | 5 +---- packages/beize_vm/lib/vm/vm.dart | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/beize_vm/lib/vm/call_frame.dart b/packages/beize_vm/lib/vm/call_frame.dart index 93e8dd7..7af3a44 100644 --- a/packages/beize_vm/lib/vm/call_frame.dart +++ b/packages/beize_vm/lib/vm/call_frame.dart @@ -9,7 +9,6 @@ import 'vm.dart'; class BeizeCallFrame { BeizeCallFrame({ required this.vm, - required this.moduleIndex, required this.function, required this.namespace, this.parent, @@ -22,7 +21,6 @@ class BeizeCallFrame { final BeizeVM vm; final BeizeCallFrame? parent; - final int moduleIndex; final BeizeFunctionConstant function; final BeizeNamespace namespace; @@ -76,7 +74,6 @@ class BeizeCallFrame { final BeizeCallFrame frame = BeizeCallFrame( vm: vm, parent: this, - moduleIndex: function.constant.moduleIndex, function: function.constant, namespace: namespace, ); @@ -113,7 +110,7 @@ class BeizeCallFrame { vm.program.constantAt(function.chunk.codeAt(index)); String toStackTraceLine(final int depth) { - final String moduleName = vm.program.moduleNameAt(moduleIndex); + final String moduleName = vm.program.moduleNameAt(function.moduleIndex); final int line = function.chunk.lineAt(sip); return '#$depth $moduleName at line $line'; } diff --git a/packages/beize_vm/lib/vm/vm.dart b/packages/beize_vm/lib/vm/vm.dart index f958ae0..f15f441 100644 --- a/packages/beize_vm/lib/vm/vm.dart +++ b/packages/beize_vm/lib/vm/vm.dart @@ -62,7 +62,6 @@ class BeizeVM { modules[moduleIndex] = value; final BeizeCallFrame frame = BeizeCallFrame( vm: this, - moduleIndex: moduleIndex, function: program.moduleFunctionAt(moduleIndex), namespace: namespace, parent: !isEntrypoint ? topFrame : null,