Commit 156e55f
committed
It seems like a struct named
That's my hunch anyway. The code at https://github.com/gopherjs/gopherjs/blob/a4630ec28c790dd1be785f097d0268c4aa4a423f/nosync/map.go#L37 was making an object that didn't have a `.get` function. This fixes it.
The before Javascript:
```
Map.ptr.prototype.LoadOrStore = function(key, value) {
var _entry, _key, _tmp, _tmp$1, _tmp$2, _tmp$3, _tuple, actual, key, loaded, m, ok, value, value$1, x;
actual = $ifaceNil;
loaded = false;
m = this;
_tuple = (x = m.m, (_entry = typeof x.get === "function" ? x.get($emptyInterface.keyFor(key)) : undefined, _entry !== undefined ? [_entry.v, true] : [$ifaceNil, false]));
value$1 = _tuple[0];
ok = _tuple[1];
if (ok) {
_tmp = value$1;
_tmp$1 = true;
actual = _tmp;
loaded = _tmp$1;
return [actual, loaded];
}
if (m.m === false) {
m.m = new Map();
}
_key = key; (m.m || $throwRuntimeError("assignment to entry in nil map")).set($emptyInterface.keyFor(_key), { k: _key, v: value });
_tmp$2 = value;
_tmp$3 = false;
actual = _tmp$2;
loaded = _tmp$3;
return [actual, loaded];
};
```Map could shadow the scope of window.Map and cause unexpected behavior.1 parent 0ab08ce commit 156e55f
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
931 | 931 | | |
932 | 932 | | |
933 | 933 | | |
934 | | - | |
| 934 | + | |
935 | 935 | | |
936 | | - | |
| 936 | + | |
937 | 937 | | |
938 | 938 | | |
939 | 939 | | |
| |||
0 commit comments