-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jade Abraham <[email protected]>
- Loading branch information
1 parent
5bdddc7
commit 8d40e44
Showing
6 changed files
with
14 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
In One: Local=None, Global='default' | ||
In Two: Local=None, Global='different default' | ||
In One: Local=None, Global=None | ||
In Two: Local=None, Global=None |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
In One: Local='x', Global='default' | ||
In Two: Local=None, Global='different default' | ||
In One: Local='x', Global=None | ||
In Two: Local=None, Global=None |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
In One: Local=None, Global='default' | ||
In Two: Local='y', Global='different default' | ||
In One: Local=None, Global=None | ||
In Two: Local='y', Global=None |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
In One: Local='y', Global='default' | ||
In Two: Local=None, Global='different default' | ||
In One: Local='y', Global=None | ||
In Two: Local=None, Global=None |
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 |
---|---|---|
@@ -1,25 +1,23 @@ | ||
|
||
from chapel import AstNode | ||
from typing import Optional | ||
|
||
|
||
def var_string(**kwargs): | ||
s = [] | ||
for k, v in kwargs.items(): | ||
val = v if v is None else f"'{v}'" | ||
s.append(f"{k}={val}") | ||
return ", ".join(s) | ||
|
||
|
||
def rules(driver): | ||
|
||
@driver.basic_rule(AstNode, settings=[".Local", "Global"]) | ||
def One(context, node, Local: Optional[str]=None, Global: str="default"): | ||
|
||
def One(c, n, Local: Optional[str] = None, Global: Optional[str] = None): | ||
print(f"In One:", var_string(Local=Local, Global=Global)) | ||
return True | ||
|
||
@driver.advanced_rule(settings=[".Local", "Global"]) | ||
def Two(context, node, Local: Optional[str]=None, Global: str="different default"): | ||
|
||
def Two(c, n, Local: Optional[str] = None, Global: Optional[str] = None): | ||
print(f"In Two:", var_string(Local=Local, Global=Global)) | ||
yield from [] | ||
|
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