diff options
| author | Li Jin <dragon-fly@qq.com> | 2021-03-05 10:14:10 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2021-03-05 10:14:10 +0800 |
| commit | 05283b77da4ba236f02b42d1205433f6b1fcb0d6 (patch) | |
| tree | ecb5e6688109ed3e9be6acd5f1b8c22d6fd407dc /spec/inputs | |
| parent | 1df786307c1983b8ce693e3916081a8bcd4e95ae (diff) | |
| download | yuescript-05283b77da4ba236f02b42d1205433f6b1fcb0d6.tar.gz yuescript-05283b77da4ba236f02b42d1205433f6b1fcb0d6.tar.bz2 yuescript-05283b77da4ba236f02b42d1205433f6b1fcb0d6.zip | |
fix issue #41, add square brackets support for metatable syntax. fix using metatable with "with" syntax issue.
Diffstat (limited to 'spec/inputs')
| -rw-r--r-- | spec/inputs/metatable.yue | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/inputs/metatable.yue b/spec/inputs/metatable.yue index 6f7b418..13ea917 100644 --- a/spec/inputs/metatable.yue +++ b/spec/inputs/metatable.yue | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | a = close: true, close#: => print "out of scope" | 1 | a = close: true, close#: => print "out of scope" |
| 2 | b = add#: (left, right)-> right - left | 2 | b = add#: (left, right)-> right - left |
| 3 | c = key1: true, :add#, key2: true | 3 | c = key1: true, :add#, key2: true |
| 4 | w = [name]#:123, ["new"]#:(val)=> {val} | ||
| 5 | w.#["new"] w.#[name] | ||
| 4 | 6 | ||
| 5 | close _ = close#: -> print "out of scope" | 7 | close _ = close#: -> print "out of scope" |
| 6 | 8 | ||
| @@ -40,4 +42,10 @@ tb\func# list | |||
| 40 | 42 | ||
| 41 | import "module" as :index#, newindex#:setFunc | 43 | import "module" as :index#, newindex#:setFunc |
| 42 | 44 | ||
| 45 | with tb | ||
| 46 | print .add#, .x\index# "key" | ||
| 47 | a = .index#.add#\new# 123 | ||
| 48 | b = t#.close#.test | ||
| 49 | c = t #.close# .test | ||
| 50 | |||
| 43 | nil | 51 | nil |
