Skip to content

Commit

Permalink
refactor: derive function module from constant
Browse files Browse the repository at this point in the history
  • Loading branch information
zyrouge committed Nov 30, 2023
1 parent a598268 commit 996e211
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
5 changes: 1 addition & 4 deletions packages/beize_vm/lib/vm/call_frame.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'vm.dart';
class BeizeCallFrame {
BeizeCallFrame({
required this.vm,
required this.moduleIndex,
required this.function,
required this.namespace,
this.parent,
Expand All @@ -22,7 +21,6 @@ class BeizeCallFrame {

final BeizeVM vm;
final BeizeCallFrame? parent;
final int moduleIndex;
final BeizeFunctionConstant function;
final BeizeNamespace namespace;

Expand Down Expand Up @@ -76,7 +74,6 @@ class BeizeCallFrame {
final BeizeCallFrame frame = BeizeCallFrame(
vm: vm,
parent: this,
moduleIndex: function.constant.moduleIndex,
function: function.constant,
namespace: namespace,
);
Expand Down Expand Up @@ -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';
}
Expand Down
1 change: 0 additions & 1 deletion packages/beize_vm/lib/vm/vm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 996e211

Please sign in to comment.