-
Notifications
You must be signed in to change notification settings - Fork 64
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 #2353 from lf-lang/self-defined
Define self variable so it can be used in instantiations
- Loading branch information
Showing
2 changed files
with
31 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
target Python | ||
|
||
reactor A(bank_index=0, value=0) { | ||
reaction(startup) {= | ||
print("bank_index: {:d}, value: {:d}".format(self.bank_index, self.value)) | ||
if (self.value != 4 - self.bank_index): | ||
sys.stderr.write("ERROR: Expected value to be 4 - bank_index.\n") | ||
exit(1) | ||
=} | ||
} | ||
|
||
main reactor(table = [4, 3, 2, 1]) { | ||
a = new[4] A(value = {= self.table[bank_index] =}) | ||
} |