-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add api list_variables to select variable (#1214)
* feat: add api list_variables to select variable Signed-off-by: zongz <[email protected]> * fix: add test case with format expr Signed-off-by: zongz <[email protected]> --------- Signed-off-by: zongz <[email protected]>
- Loading branch information
Showing
16 changed files
with
887 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,4 @@ | ||
{ | ||
"file": "./src/testdata/variables/main.k", | ||
"specs": ["a"] | ||
} |
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 @@ | ||
{"variables":{"a":{"value":"1"}},"unsupported_codes":[]} |
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 @@ | ||
a = 1 |
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
72 changes: 72 additions & 0 deletions
72
kclvm/loader/src/test_data/test_list_variables/supported.k
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,72 @@ | ||
a = 1 | ||
a1 = 2 | ||
a3 = 3m | ||
|
||
b1 = True | ||
b2 = False | ||
|
||
s1 = "Hello" | ||
|
||
array1 = [1, 2, 3] | ||
|
||
dict1 = {"a": 1, "b": 2} | ||
dict2 = { | ||
"a": 1 | ||
"b": { | ||
"c": 2 | ||
"d": 3 | ||
} | ||
} | ||
|
||
schema A: | ||
name: str | ||
ids: [int] | ||
data?: {str: {str: {str: int}}} | ||
|
||
sha = A { | ||
name: "Hello" | ||
ids: [1, 2, 3] | ||
data: { | ||
"a": { | ||
"b": { | ||
"c": 2 | ||
} | ||
} | ||
} | ||
} | ||
|
||
schema B: | ||
a: A | ||
|
||
shb = B { | ||
a: { | ||
name: "HelloB" | ||
ids: [4, 5, 6] | ||
data: { | ||
"d": { | ||
"e": { | ||
"f": 3 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
schema UnificationConf: | ||
name: str | ||
|
||
uconfa = UnificationConf{ | ||
name = "a" | ||
} | ||
|
||
uconfa : UnificationConf { | ||
name = "b" | ||
} | ||
|
||
schema C: | ||
a: A | ||
|
||
c = C { | ||
a: {name: "Hello"} | ||
a: {ids: [7, 8, 9]} | ||
} |
18 changes: 18 additions & 0 deletions
18
kclvm/loader/src/test_data/test_list_variables/unsupported.k
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,18 @@ | ||
list = [ _x for _x in range(20) if _x % 2 == 0] | ||
list1 = [i if i > 2 else i + 1 for i in [1,2,3]] | ||
|
||
|
||
dict = {str(i): 2 * i for i in range(3)} | ||
|
||
func = lambda x: int, y: int -> int { x + y } | ||
|
||
schema IfSchema: | ||
trueValue?: int | ||
falseValue?: int | ||
|
||
if_schema = IfSchema { | ||
if True : | ||
trueValue: 1 | ||
else : | ||
falseValue: 2 | ||
} |
Oops, something went wrong.