View Issue Details

IDProjectCategoryView StatusLast Update
0000148LDMud 3.6Generalpublic2021-04-06 21:26
ReporterlarsAssigned ToGnomi  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.2.8 and before 
Fixed in Version3.6.4 
Summary0000148: Failed assignments leave behind empty mapping entries.
DescriptionFalls das schon bekannt ist, bitte ich um Entschuldigung:

map = ([1:2]); map[0][5]=1;

Fuehrt bei mir dazu, dass in map ein Key fuer den ersten Index angelegt wird
(also Effekt wie ein map[0]=0), obwohl die Zuweisung map[0][5]=1 einen
Fehler ausloest (Index out of bounds).

(map[0])[5]=1 verhaelt sich uebrigens nicht so.

---------------------------------
The problem is in how the expressions are parsed. In 'map[0][5] = 1', the
'map[0]' is parsed as possible lvalue, thus generating the opcodes
'push_indexed_lvalue', followed by 'index_lvalue'.

On the other hand '(map[0])[5]' parses the 'map[0]' as normal rvalue, leading
to the opcode sequence 'index' followed by 'index_lvalue'.

Given the obscurity in the parser when it comes to generating lvalues, I don't
know how to fix this yet.
TagsNo tags attached.

Relationships

child of 0000651 resolvedGnomi lvalue 3: Lvalues to mapping entries 

Activities

fufu

2008-07-02 04:15

manager   ~0000660

This is tricky.

In map[0][5] = 1, map[0] doesn't have to be an lvalue, and parsing it as an rvalue should fix the problem.

However, this idea fails for ranges, so map[0][5..5] = ({1}) would still create a new mapping entry.

Issue History

Date Modified Username Field Change
2004-11-26 19:18 lars New Issue
2008-07-02 04:15 fufu Note Added: 0000660
2008-07-02 06:11 Gnomi Relationship added child of 0000546
2008-07-02 06:11 Gnomi Project LDMud => LDMud 3.5
2009-06-03 12:38 Gnomi Relationship added child of 0000651
2009-06-03 12:38 Gnomi Relationship deleted child of 0000546
2021-04-06 21:25 Gnomi Project LDMud 3.5 => LDMud 3.6
2021-04-06 21:25 Gnomi Category LPC Compiler/Preprocessor => General
2021-04-06 21:26 Gnomi Assigned To => Gnomi
2021-04-06 21:26 Gnomi Status new => assigned
2021-04-06 21:26 Gnomi Status assigned => resolved
2021-04-06 21:26 Gnomi Resolution open => fixed
2021-04-06 21:26 Gnomi Fixed in Version => 3.6.4