diff options
Diffstat (limited to '')
-rw-r--r-- | spec/inputs/with.yue | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/spec/inputs/with.yue b/spec/inputs/with.yue index 3fee48e..2256833 100644 --- a/spec/inputs/with.yue +++ b/spec/inputs/with.yue | |||
@@ -48,21 +48,21 @@ do | |||
48 | with a -- only one value allowed | 48 | with a -- only one value allowed |
49 | print .world | 49 | print .world |
50 | 50 | ||
51 | mod = with _M = {} | 51 | mod = with _M := {} |
52 | .Thing = "hi" | 52 | .Thing = "hi" |
53 | 53 | ||
54 | -- operate on a only | 54 | -- operate on a only |
55 | with a, b = something, pooh | 55 | with a, b := something, pooh |
56 | print .world | 56 | print .world |
57 | 57 | ||
58 | x = with a, b = 1, 2 | 58 | x = with a, b := 1, 2 |
59 | print a + b | 59 | print a + b |
60 | 60 | ||
61 | print with a, b = 1, 2 | 61 | print with a, b := 1, 2 |
62 | print a + b | 62 | print a + b |
63 | 63 | ||
64 | -- assignment lhs must be evaluated in the order they appear | 64 | -- assignment lhs must be evaluated in the order they appear |
65 | p = with hello!.x, world!.y = 1, 2 | 65 | p = with hello!.x, world!.y := 1, 2 |
66 | print a + b | 66 | print a + b |
67 | 67 | ||
68 | -- | 68 | -- |
@@ -73,16 +73,16 @@ do | |||
73 | x\upper! | 73 | x\upper! |
74 | 74 | ||
75 | do | 75 | do |
76 | with k = "jo" | 76 | with k := "jo" |
77 | print \upper! | 77 | print \upper! |
78 | 78 | ||
79 | do | 79 | do |
80 | with a,b,c = "", "", "" | 80 | with a,b,c := "", "", "" |
81 | print \upper! | 81 | print \upper! |
82 | 82 | ||
83 | do | 83 | do |
84 | a = "bunk" | 84 | a = "bunk" |
85 | with a,b,c = "", "", "" | 85 | with a,b,c := "", "", "" |
86 | print \upper! | 86 | print \upper! |
87 | 87 | ||
88 | do | 88 | do |
@@ -90,7 +90,7 @@ do | |||
90 | print \upper! | 90 | print \upper! |
91 | 91 | ||
92 | do | 92 | do |
93 | with k.j = "jo" | 93 | with k.j := "jo" |
94 | print \upper! | 94 | print \upper! |
95 | 95 | ||
96 | do | 96 | do |
@@ -103,7 +103,7 @@ do | |||
103 | do | 103 | do |
104 | with a | 104 | with a |
105 | -- nested `with`s with assignments should change the scope correctly | 105 | -- nested `with`s with assignments should change the scope correctly |
106 | with .b = 2 | 106 | with .b := 2 |
107 | print .c | 107 | print .c |
108 | 108 | ||
109 | do | 109 | do |
@@ -138,12 +138,12 @@ do | |||
138 | 138 | ||
139 | do | 139 | do |
140 | global mask | 140 | global mask |
141 | with? mask = SolidRect width: w, height: h, color: 0x66000000 | 141 | with? mask := SolidRect width: w, height: h, color: 0x66000000 |
142 | .touchEnabled = true | 142 | .touchEnabled = true |
143 | .swallowTouches = true | 143 | .swallowTouches = true |
144 | 144 | ||
145 | do | 145 | do |
146 | with? mask = SolidRect width: w, height: h, color: 0x66000000 | 146 | with? mask := SolidRect width: w, height: h, color: 0x66000000 |
147 | .touchEnabled = true | 147 | .touchEnabled = true |
148 | .swallowTouches = true | 148 | .swallowTouches = true |
149 | 149 | ||
@@ -161,4 +161,13 @@ do | |||
161 | if .v | 161 | if .v |
162 | break .a | 162 | break .a |
163 | 163 | ||
164 | a = while true | ||
165 | break with? tb | ||
166 | break 1 | ||
167 | |||
168 | do | ||
169 | a = for i = 1, 100 | ||
170 | with? x := tb[i] | ||
171 | break x if .id := 1 | ||
172 | |||
164 | nil | 173 | nil |