-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix accessing local variables decl after funcion that uses the variable
- Loading branch information
Showing
5 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
for( auto x : [[1,2],[3,4]] ) | ||
for( auto y : x ) | ||
{ <<< y >>>; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
1 :(int) | ||
2 :(int) | ||
3 :(int) | ||
4 :(int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// test using a local variable declared after a function that uses that variable | ||
// | ||
// added 1.5.4.4; previously this would cause a crash because the emitter | ||
// emitted foo() first, at which point the variable `osc` has not yet received | ||
// it's stack offset, since `SinOsc osc(440);` appears later in the file | ||
// fix: now code emisison is sorted for file-level code, function defs, class | ||
// defs. | ||
|
||
// function def | ||
fun void foo() | ||
{ | ||
// uses `osc` | ||
if( Math.equal(osc.freq(),440) ) <<< "success" >>>; | ||
} | ||
|
||
// osc is declared | ||
SinOsc osc(440); | ||
|
||
// call foo | ||
foo(); |