Skip to content

Commit f4d2453

Browse files
committed
ast: Add a var decl to the stack trace
1 parent 8db842e commit f4d2453

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/main/java/org/piccode/ast/ImportAst.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ private List<Ast> loadModuleFromStdLib(String module) {
131131
return Context.top.getCached(path);
132132
}
133133

134-
for (var fp : _file.listFiles()) {
134+
var files = _file.listFiles();
135+
136+
for (var fp : files) {
135137
if (fp.getName().endsWith(".pics")) {
136138
var code = readFile(fp);
137139
if (code == null) {

src/main/java/org/piccode/ast/VarDecl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ public String toString() {
2525

2626
@Override
2727
public PiccodeValue execute() {
28+
Context.top.pushStackFrame(this);
2829
var _value = value.execute();
30+
Context.top.dropStackFrame();
2931
Context.top.putLocal(name, _value);
3032
return _value;
3133
}

0 commit comments

Comments
 (0)