
scope {
  var o = {}; 
  assert 'object' === typename o;
  o.x = o;
  o.x['x'].'z' = 1;
  assert 1 === o.x.'x'['x'].z;
  assert 1 === o.x['x'].('z');
  assert 1 === o.x['x'].('x').('z');
  assert 1 === o.x['x'].('x')['x'].('z');
  o.x = 1;
  o.x = o.x + 2;
  assert 3 === o.x;
  assert 6 === o.x * 2;
  assert 4 === 1 + o.('x');
  assert 2 === o['x'] * 3 % 7;
  var z = 'x';
  assert 3 === o[z];
  assert 9 === o.(z) * o[z];
}

scope {
  var o = {a:1};
  assert 2 === (o.a+=1);
  assert -2 === (o.a*=3*3-10);
  o.a = 2; 
  assert 10===(o.a*=3+2);
  assert 10 === o.a;
  assert 5 === (o['a'] /= 2);
  assert 20 === (o['a'] <<= 2);
  assert 20 === o.a;
}

scope {
  var o = {a:1}, o2 = {prototype:o};
  assert o2 inherits o;
  assert 1 === o2.a;
  o2.a = -1;
  assert 1 === o.a;
  assert -1 === o2.a;
  unset o2.a;
  assert 1 === o2.a;
  unset o2.a;
  assert 1 === o2.a /* o.a not cleared by unset */;
  o2.unset('a');
  assert 1 === o2.a /* o.a not cleared by o2.unset() */;
  o.clearProperties();
  assert undefined === o2.a;
}
