-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fixes #4299 fixes #12492 fixes #10849 It binds `function` with `env`: `function.bind(:env)` to ease codegen for now
- Loading branch information
Showing
10 changed files
with
118 additions
and
71 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
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
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,47 @@ | ||
discard """ | ||
targets: "c js" | ||
""" | ||
|
||
import std/assertions | ||
|
||
block: # bug #4299 | ||
proc scopeProc() = | ||
proc normalProc() = | ||
discard | ||
|
||
proc genericProc[T]() = | ||
normalProc() | ||
|
||
genericProc[string]() | ||
|
||
scopeProc() | ||
|
||
block: # bug #12492 | ||
proc foo() = | ||
var i = 0 | ||
proc bar() = | ||
inc i | ||
|
||
bar() | ||
doAssert i == 1 | ||
|
||
foo() | ||
static: | ||
foo() | ||
|
||
block: # bug #10849 | ||
type | ||
Generic[T] = ref object | ||
getState: proc(): T | ||
|
||
proc newGeneric[T](): Generic[T] = | ||
var state: T | ||
|
||
proc getState[T](): T = | ||
state | ||
|
||
Generic[T](getState: getState) | ||
|
||
let g = newGeneric[int]() | ||
let state = g.getState() | ||
doAssert state == 0 |