diff options
author | Li Jin <dragon-fly@qq.com> | 2021-02-20 17:34:52 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-02-20 17:34:52 +0800 |
commit | c44cab60b7b6cf0a36e1dd011c2fe483e8d87b38 (patch) | |
tree | 9fcf8a06e63991a27b8f73b4e5040788338d115f /CHANGELOG.md | |
parent | 3ea3f9b1c42eae103c370a986f539a0f1550db9f (diff) | |
download | yuescript-c44cab60b7b6cf0a36e1dd011c2fe483e8d87b38.tar.gz yuescript-c44cab60b7b6cf0a36e1dd011c2fe483e8d87b38.tar.bz2 yuescript-c44cab60b7b6cf0a36e1dd011c2fe483e8d87b38.zip |
fix issue in destructure syntax.
Diffstat (limited to 'CHANGELOG.md')
-rw-r--r-- | CHANGELOG.md | 91 |
1 files changed, 78 insertions, 13 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e1be05..347f6e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
@@ -3,33 +3,98 @@ | |||
3 | The implementation for original Moonscript language 0.5.0 can be found in the `0.5.0` branch of Yuescript. The Moonscript with fixes and new features is in the main branch of Yuescript. Here are the changelogs for each Yuescript version. | 3 | The implementation for original Moonscript language 0.5.0 can be found in the `0.5.0` branch of Yuescript. The Moonscript with fixes and new features is in the main branch of Yuescript. Here are the changelogs for each Yuescript version. |
4 | 4 | ||
5 | 5 | ||
6 | ## v0.6.6 | 6 | ## v0.6.7 |
7 | 7 | ||
8 | ### Fixed Issues | 8 | ### Fixed Issues |
9 | 9 | ||
10 | * Simplify macro syntax. Macro function can either return a code string or a config table. | 10 | * Simplify macro syntax. Macro function can either return a Yuescript string or a config table containing Lua codes. |
11 | 11 | ||
12 | ```moonscript | 12 | ```moonscript |
13 | macro local = (var)-> "global *" | 13 | macro localFunc = (var)-> "local #{var} = ->" |
14 | $localFunc f1 | ||
15 | f1 = -> "another function" | ||
14 | 16 | ||
15 | $local x | 17 | -- or |
16 | x = 1 | ||
17 | y = 2 | ||
18 | z = 3 | ||
19 | 18 | ||
20 | macro local = (var)-> | 19 | macro localFunc = (var)-> |
21 | { | 20 | { |
22 | codes: "local #{var}" | 21 | codes: "local function #{var}() end" |
23 | type: "lua" | 22 | type: "lua" |
24 | locals: {var} | 23 | locals: {var} |
25 | } | 24 | } |
26 | 25 | $localFunc f2 | |
27 | $local y | 26 | f2 = -> "another function" |
28 | y = 1 | 27 | ``` |
28 | Compiles to: | ||
29 | ```Lua | ||
30 | local f1 | ||
31 | f1 = function() end | ||
32 | f1 = function() | ||
33 | return "another function" | ||
34 | end | ||
35 | local function f2() end | ||
36 | f2 = function() | ||
37 | return "another function" | ||
38 | end | ||
29 | ``` | 39 | ``` |
30 | 40 | ||
31 | * Change Yuescript file extension to '.yue' because some of the Moonscript syntax are no longer supported and some codes written in Yuescript syntax won't be accepted by Moonscript compiler. | 41 | * Change Yuescript file extension to '.yue' because some of the Moonscript syntax are no longer supported and some codes written in Yuescript syntax won't be accepted by Moonscript compiler. |
32 | * | 42 | * Disable the use of local and global statement with wildcard operators. |
43 | * Change backcall operator syntax, extra parentheses for multiline chains are no longer needed. | ||
44 | ```moonscript | ||
45 | readFile "example.txt" | ||
46 | |> extract language, {} | ||
47 | |> parse language | ||
48 | |> emit | ||
49 | |> render | ||
50 | |||
51 | ``` | ||
52 | Compiles to: | ||
53 | ```Lua | ||
54 | return print(render(emit(parse(extract(readFile("example.txt"), language, { }), language)))) | ||
55 | ``` | ||
56 | |||
57 | |||
58 | ### Added Features | ||
59 | |||
60 | * Supporting multiline chaining function call syntax. | ||
61 | ```Moonscript | ||
62 | result = origin | ||
63 | .transform.root | ||
64 | .gameObject | ||
65 | \Parents! | ||
66 | \Descendants! | ||
67 | \SelectEnable! | ||
68 | \SelectVisible! | ||
69 | \TagEqual "fx" | ||
70 | \Where (x)-> | ||
71 | if x\IsTargeted! | ||
72 | return false | ||
73 | x.name\EndsWith "(Clone)" | ||
74 | \Destroy! | ||
75 | |||
76 | origin.transform.root.gameObject | ||
77 | \Parents!\Descendants! | ||
78 | \SelectEnable! | ||
79 | \SelectVisible! | ||
80 | \TagEqual "fx" | ||
81 | \Where (x)-> x.name\EndsWith "(Clone)" | ||
82 | \Destroy! | ||
83 | ``` | ||
84 | Compiles to: | ||
85 | ```Lua | ||
86 | local result = origin.transform.root.gameObject:Parents():Descendants():SelectEnable():SelectVisible():TagEqual("fx"):Where(function(x) | ||
87 | if x:IsTargeted() then | ||
88 | return false | ||
89 | end | ||
90 | return x.name:EndsWith("(Clone)") | ||
91 | end):Destroy() | ||
92 | return origin.transform.root.gameObject:Parents():Descendants():SelectEnable():SelectVisible():TagEqual("fx"):Where(function(x) | ||
93 | return x.name:EndsWith("(Clone)") | ||
94 | end):Destroy() | ||
95 | ``` | ||
96 | |||
97 | |||
33 | 98 | ||
34 | ## v0.4.16 | 99 | ## v0.4.16 |
35 | 100 | ||