-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from myuon/issue-199
fix: introduce env for typecheck to capture correct variables
- Loading branch information
Showing
7 changed files
with
104 additions
and
39 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
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 @@ | ||
5 | ||
10 | ||
called with 7 | ||
ok |
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,45 @@ | ||
fun js_fetch(url: string, call: fun[(i32), nil]) { | ||
call(10); | ||
} | ||
|
||
fun js_image_set_onload(image: any, call: fun[(), nil]) { | ||
call(); | ||
} | ||
|
||
fun js_image_set_onerror(image: any, call: fun[(), nil]) { | ||
call(); | ||
} | ||
|
||
fun js_context_draw_image(context: string, image: i32, x: i32, y: i32) { | ||
println(context); | ||
println("{}", image.to_string()); | ||
println("{}", x.to_string()); | ||
println("{}", y.to_string()); | ||
} | ||
|
||
fun main() { | ||
let rhb = 200; | ||
let context = "context"; | ||
let image = "image"; | ||
|
||
js_fetch( | ||
"assets/rhb.json", | ||
fun (resp_id: i32) { | ||
js_image_set_onload( | ||
rhb, | ||
fun () { | ||
js_context_draw_image(context, rhb, 0, 0); | ||
}, | ||
); | ||
js_image_set_onerror( | ||
image, | ||
fun () { | ||
println("Image failed to load"); | ||
}, | ||
); | ||
}, | ||
); | ||
|
||
println("ok"); | ||
} | ||
|
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,6 @@ | ||
context | ||
200 | ||
0 | ||
0 | ||
Image failed to load | ||
ok |
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