Branch: Tag:

2015-03-25

2015-03-25 20:00:34 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Runtime: Fixed over optimization of F_APPEND_MAPPING.

F_APPEND_MAPPING now has the same special cases as F_APPEND_ARRAY.

Fixes obj->map += ([ x:y ]) and obj["map"] += ([ x:y ]) when obj
has lfun::`->=() and/or lfun::`[]=().

4113:   ]], 1)      test_any([[ +  // Since the addition of F_APPEND_MAPPING in set_bar below +  // the setter is not being called anymore. Instead, the mapping +  // _data->foo is modified in place. +  class A(mapping foo) { +  mapping _modified = ([]); +  +  mixed `->=(string sym, mixed v) { +  return _modified[sym] = v; +  } +  +  void set_bar(int v) { +  this->foo += ([ "bar" : v ]); +  } +  }; +  +  object a = A(([ "foo" : ([]) ])); +  +  a->set_bar(2); +  +  return has_index(a->_modified, "foo"); + ]], 1) +  + test_any([[    // Since the addition of F_APPEND_ARRAY the setter is not being    // called anymore. Instead, the array _data is modified in place.    class A(array _data) {