Skip to content

Commit f6920e0

Browse files
committed
Fix select case by func. Closes smallbasic#83
1 parent 8db539b commit f6920e0

File tree

7 files changed

+36
-24
lines changed

7 files changed

+36
-24
lines changed

NEWS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
For news please visit smallbasic.sourceforge.net
1+
For news please visit https://smallbasic.github.io

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dnl This program is distributed under the terms of the GPL v2.0
77
dnl Download the GNU Public License (GPL) from www.gnu.org
88
dnl
99

10-
AC_INIT([smallbasic], [0.12.16])
10+
AC_INIT([smallbasic], [0.12.17])
1111
AC_CONFIG_SRCDIR([configure.ac])
1212

1313
AC_CANONICAL_TARGET

debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
smallbasic (0.12.17) unstable; urgency=low
2+
* Various see web site
3+
4+
-- Chris Warren-Smith <[email protected]> Sat, 09 Nov 2019 09:45:25 +1000
5+
16
smallbasic (0.12.16) unstable; urgency=low
27
* Various see web site
38

samples/distro-examples/tests/output/trycatch.out

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,5 @@ open failed FS(2): NO SUCH FILE OR DIRECTORY
44
after try
55
catch by error name
66
outer after try
7-
8-
9-
* RTE-ERROR AT ../../../samples/distro-examples/tests/trycatch.bas:200 *
10-
Description:
11-
Division by zero
12-
13-
Stack:
14-
TRY: 199
15-
TRY: 198
16-
TRY: 197
17-
TRY: 196
18-
TRY: 195
19-
IF: 194
20-
IF: 193
21-
IF: 192
22-
SUB: 216
7+
Error: Division by zero
8+
End of test

samples/distro-examples/tests/trycatch.bas

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,11 @@ if 1 == 1 then
213213
fi
214214
end
215215

216-
stack_test
216+
try
217+
stack_test
218+
catch e
219+
print "Error: " + e
220+
end try
217221

218222
sub manageFiles()
219223
sub renameFile()
@@ -229,7 +233,6 @@ sub manageFiles()
229233
viewFile()
230234
end
231235

232-
233236
try
234237
try
235238
throw "!!!error!!!"
@@ -244,3 +247,21 @@ if (inner == "!!!error!!!") then
244247
throw "inner still in scope"
245248
endif
246249

250+
rem test for select case <udf>
251+
func num(n)
252+
return n
253+
end
254+
select case num(10)
255+
case 10
256+
rem success!
257+
case else
258+
throw "fail"
259+
end select
260+
select case round(pi)
261+
case 3
262+
rem "success!"
263+
case else
264+
throw "fail"
265+
end select
266+
267+
print "End of test"

src/common/scan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3567,9 +3567,9 @@ void comp_pass2_scan() {
35673567
break;
35683568

35693569
case kwSELECT:
3570-
// next instruction should be CASE
3570+
// next instruction should be CASE (or UDF)
35713571
false_ip = comp_next_bc_peek(i + 1);
3572-
if (false_ip != kwCASE && false_ip != kwCASE_ELSE) {
3572+
if (false_ip != kwCASE && false_ip != kwCASE_ELSE && false_ip != kwTYPE_CALL_UDF) {
35733573
sc_raise(MSG_MISSING_CASE);
35743574
print_pass2_stack(i, kwCASE, node->level);
35753575
return;

src/platform/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ android {
99
applicationId 'net.sourceforge.smallbasic'
1010
minSdkVersion 16
1111
targetSdkVersion 28
12-
versionCode 38
13-
versionName "0.12.16"
12+
versionCode 39
13+
versionName "0.12.17"
1414
resConfigs "en"
1515
}
1616

0 commit comments

Comments
 (0)