Report a type mismatch in globals in a more meaningful position.

For example, this script reported the type mismatch in default:

key k=0;
default{timer(){}}

Now it's reported at the semicolon, which is as early as it can be identified and much more meaningful.
This commit is contained in:
Sei Lisa 2016-04-04 13:58:25 +02:00
parent dc98e477d7
commit 41149a17aa

View file

@ -2049,9 +2049,7 @@ list lazy_list_set(list L, integer i, list v)
# Use LSL's dull global expression. # Use LSL's dull global expression.
value = self.Parse_simple_expr() value = self.Parse_simple_expr()
self.expect(';') self.expect(';')
self.NextToken()
else: # must be semicolon else: # must be semicolon
self.NextToken()
value = None value = None
assert self.scopeindex == 0 assert self.scopeindex == 0
@ -2059,6 +2057,7 @@ list lazy_list_set(list L, integer i, list v)
if value is not None: if value is not None:
value = self.autocastcheck(value, typ) value = self.autocastcheck(value, typ)
decl['ch'] = [value] decl['ch'] = [value]
self.NextToken()
self.AddSymbol('v', 0, name, Loc=len(self.tree), Type=typ) self.AddSymbol('v', 0, name, Loc=len(self.tree), Type=typ)
self.tree.append(decl) self.tree.append(decl)