Skip to content

Commit 26aa052

Browse files
author
avi
committed
loop changes
1 parent d4e5945 commit 26aa052

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/examples/loops.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ let z = 0;
55
while(i<10){
66
console.log(i);
77
i = i + 1;
8-
z =i;
8+
let z = i;
9+
console.log(z)
910
}
1011

1112
let j=0;

src/syntax.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ export class SymbolTable{
6363
this.table[varName] = type
6464
}
6565

66+
lookupInHigherScope(varName: string){
67+
if(this.parent == null){
68+
return "__bt";
69+
}else{
70+
return this.lookup(varName);
71+
}
72+
}
73+
6674
lookup(varName: string){
6775

6876
if(this.table.hasOwnProperty(varName)){

0 commit comments

Comments
 (0)