Allow lists to contain void elements if not optimizing and not lazy

LSO allows this. The compiler does too, but it chokes in RAIL.

This affected a test, which has been adjusted too.

Untyped lazy list elements can no longer be used in isolation in expression lists (including FOR initializator and iterator).

Also rename the terribly named 'self.forbidlabels' to 'self.optenabled' which is more descriptive.
This commit is contained in:
Sei Lisa 2018-04-09 18:42:31 +02:00
parent 4a554d60e8
commit 1afe1643c0
2 changed files with 11 additions and 4 deletions

View file

@ -128,7 +128,7 @@ class Test02_Parser(UnitTestCase):
self.assertRaises(EParseFunctionMismatch, self.parser.parse, '''f(integer i){f(f(1));}''')
self.assertRaises(EParseFunctionMismatch, self.parser.parse, '''f(integer i){f();}''')
self.assertRaises(EParseDeclarationScope, self.parser.parse, '''f(){if (1) integer i;}''')
self.assertRaises(EParseTypeMismatch, self.parser.parse, '''f(){[f()];}''')
self.assertRaises(EParseTypeMismatch, self.parser.parse, '''f(){[f()];}''', ('optimize',))
self.assertRaises(EParseTypeMismatch, self.parser.parse, '''f(){3.||2;}''')
self.assertRaises(EParseTypeMismatch, self.parser.parse, '''f(){3||2.;}''')
self.assertRaises(EParseTypeMismatch, self.parser.parse, '''f(){3.|2;}''')
@ -185,6 +185,9 @@ class Test02_Parser(UnitTestCase):
self.assertRaises(EParseUndefined, self.parser.parse, '''key a=b;key b;default{timer(){}}''',
['extendedglobalexpr'])
self.parser.parse('''f(){[f()];}default{timer(){}}''')
# Force a list constant down its throat, to test coverage of LIST_VALUE
self.parser.constants['LISTCONST']=[1,2,3]
print self.outscript.output(self.parser.parse('default{timer(){LISTCONST;}}'))