Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit d017ddf

Browse files
committed
Merge pull request #2051 from peter-b/bugfix-14893
[Bug 14893] LCB: Emit warnings for identifiers that may cause problems.
2 parents aedb510 + 3979bbd commit d017ddf

18 files changed

Lines changed: 610 additions & 356 deletions

File tree

docs/lcb/notes/14893.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# LiveCode Builder Language
2+
## Identifiers
3+
4+
* Identifiers are now expected to match `[A-Z0-9_.]`.
5+
6+
## Syntax
7+
8+
* Syntax keywords are no longer permitted to match `[A-Z0-9_.]`.
9+
10+
# LiveCode Builder Tools
11+
## lc-compile
12+
### Warnings
13+
14+
* A new warning has been added for identifiers that may conflict with
15+
syntax keywords.
16+
17+
# [14893] Emit warnings for identifiers that may cause problems.

tests/lc-run/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ check:
2424
$(LC_COMPILE) --modulepath $(TEST_DIR) --modulepath $(MODULE_DIR) \
2525
lc-run-test.mlc --output $(TEST_DIR)/lc-run-test.lcm
2626
$(LC_RUN) -l $(TEST_DIR)/lc-run-lib.lcm $(TEST_DIR)/lc-run-test.lcm
27-
test "`$(LC_RUN) -l $(TEST_DIR)/lc-run-lib.lcm --list-handlers $(TEST_DIR)/lc-run-test.lcm`" = "main"
27+
test "`$(LC_RUN) -l $(TEST_DIR)/lc-run-lib.lcm --list-handlers $(TEST_DIR)/lc-run-test.lcm`" = "Main"
28+
$(LC_RUN) $(TEST_DIR)/lc-run-lib.lcm
29+
test "`$(LC_RUN) --list-handlers $(TEST_DIR)/lc-run-lib.lcm`" = "main"

tests/lc-run/lc-run-lib.mlc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module com.livecode.lc_run_lib
22

3-
public handler lib_main()
3+
-- Intentional lower-case handler name
4+
public handler main()
45
-- Do nothing
56
end handler
67

tests/lc-run/lc-run-test.mlc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ module com.livecode.lc_run_test
22

33
use com.livecode.lc_run_lib
44

5-
public handler main()
6-
lib_main()
5+
public handler Main()
6+
main()
77
end handler
88

99
end module

tests/lcb/stdlib/arithmetic.lcb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
1818
module com.livecode.arithmetic.tests
1919

2020
public handler TestUnarySigns()
21-
variable t
22-
put 10 into t
23-
test "unary−" when -t is -10
21+
variable tNum
22+
put 10 into tNum
23+
test "unary−" when -tNum is -10
2424

25-
put -10 into t
26-
test "unary+" when +t is -10
25+
put -10 into tNum
26+
test "unary+" when +tNum is -10
2727
end handler
2828

2929
public handler TestAdd()
@@ -176,11 +176,11 @@ public handler TestFormatString()
176176
test diagnostic "TODO -1 formatted as string (bug 14594)"
177177
broken test "format as string (int)" when (-1) formatted as string is "-1" because "bug 14546"
178178

179-
variable t
180-
put (-1.0) formatted as string into t
179+
variable tNum
180+
put (-1.0) formatted as string into tNum
181181
test diagnostic "TODO test full string, not just prefix"
182-
test diagnostic t
183-
test "format as string (real)" when t begins with "-1."
182+
test diagnostic tNum
183+
test "format as string (real)" when tNum begins with "-1."
184184
end handler
185185

186186
public handler TestParseString()
@@ -199,12 +199,12 @@ end handler
199199
public handler TestParseStringList()
200200
test "parsed list" when ["-1", "+2.2"] parsed as list of number is [-1, 2.2]
201201

202-
variable t
202+
variable tList
203203
parse ["-1", "+2.2", "x"] as list of number
204-
put the result into t
204+
put the result into tList
205205

206-
test "parse list (defined)" when element 1 to 2 of t is [-1, 2.2]
207-
test "parse list (undefined)" when element 3 of t is not defined
206+
test "parse list (defined)" when element 1 to 2 of tList is [-1, 2.2]
207+
test "parse list (undefined)" when element 3 of tList is not defined
208208
end handler
209209

210210
end module

tests/lcb/stdlib/byte.lcb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,25 @@ handler TestByteWithCode_Overflow()
3535
return the byte with code 256
3636
end handler
3737
public handler TestByteWithCode()
38-
variable t
39-
put the byte with code 0 into t
38+
variable tString
39+
put the byte with code 0 into tString
4040

41-
test "code->byte" when the number of bytes in t is 1
41+
test "code->byte" when the number of bytes in tString is 1
4242

4343
MCUnitTestHandlerThrows(TestByteWithCode_Negative, "code->byte (negative)")
4444
MCUnitTestHandlerThrows(TestByteWithCode_Overflow, "code->byte (overflow)")
4545
end handler
4646

4747
handler TestCodeOfByte_Long()
48-
variable t
49-
put the byte with code 0 into t
50-
put t after t
51-
return the code of t
48+
variable tString
49+
put the byte with code 0 into tString
50+
put tString after tString
51+
return the code of tString
5252
end handler
5353
handler TestCodeOfByte_Empty()
54-
variable t
55-
put the empty data into t
56-
return the code of t
54+
variable tString
55+
put the empty data into tString
56+
return the code of tString
5757
end handler
5858
public handler TestCodeOfByte()
5959
test "byte->code" when the code of (the byte with code 1) is 1

0 commit comments

Comments
 (0)