Skip to content

Commit 0efa91a

Browse files
author
John Messerly
committed
1 parent bbe6801 commit 0efa91a

File tree

13 files changed

+134
-82
lines changed

13 files changed

+134
-82
lines changed

pkg/dev_compiler/lib/runtime/dart/_internal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ var _internal;
10821082
}
10831083
static sortList(list, compare) {
10841084
if (compare == null)
1085-
compare = core.Comparable.compare;
1085+
compare = dart.bind(core.Comparable, 'compare');
10861086
Sort.sort(list, compare);
10871087
}
10881088
static shuffleList(list, random) {

pkg/dev_compiler/lib/runtime/dart/_isolate_helper.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ var _isolate_helper;
110110
return x;
111111
}
112112
serializeMap(x) {
113-
let serializeTearOff = this.serialize;
113+
let serializeTearOff = this.serialize.bind(this);
114114
return ['map', x.keys[core.$map](dart.as(serializeTearOff, __CastType0))[core.$toList](), x.values[core.$map](dart.as(serializeTearOff, dart.functionType(dart.dynamic, [dart.dynamic])))[core.$toList]()];
115115
}
116116
serializeJSObject(x) {
@@ -287,7 +287,7 @@ var _isolate_helper;
287287
let values = dart.as(dart.dindex(x, 2), core.List);
288288
let result = dart.map();
289289
this.deserializedObjects[core.$add](result);
290-
keys = keys[core.$map](this.deserialize)[core.$toList]();
290+
keys = keys[core.$map](this.deserialize.bind(this))[core.$toList]();
291291
for (let i = 0; dart.notNull(i) < dart.notNull(keys[core.$length]); i = dart.notNull(i) + 1) {
292292
result.set(keys[core.$get](i), this.deserialize(values[core.$get](i)));
293293
}
@@ -454,7 +454,7 @@ var _isolate_helper;
454454
return function(e) {
455455
f(a, e);
456456
};
457-
}(_foreign_helper.DART_CLOSURE_TO_JS(IsolateNatives[_processWorkerMessage]), this.mainManager);
457+
}(_foreign_helper.DART_CLOSURE_TO_JS(dart.bind(IsolateNatives, _processWorkerMessage)), this.mainManager);
458458
self.onmessage = func;
459459
self.dartPrint = self.dartPrint || function(serialize) {
460460
return function(object) {
@@ -572,14 +572,14 @@ var _isolate_helper;
572572
return;
573573
}
574574
if (priority == isolate.Isolate.AS_EVENT) {
575-
exports._globalState.topEventLoop.enqueue(this, this.kill, "kill");
575+
exports._globalState.topEventLoop.enqueue(this, this.kill.bind(this), "kill");
576576
return;
577577
}
578578
dart.assert(priority == isolate.Isolate.BEFORE_NEXT_EVENT);
579579
if (this[_scheduledControlEvents] == null) {
580580
this[_scheduledControlEvents] = new collection.Queue();
581581
}
582-
dart.dsend(this[_scheduledControlEvents], 'addLast', this.kill);
582+
dart.dsend(this[_scheduledControlEvents], 'addLast', this.kill.bind(this));
583583
}
584584
addErrorListener(port) {
585585
this.errorPorts.add(port);
@@ -1265,8 +1265,8 @@ var _isolate_helper;
12651265
this[_rawPort] = rawPort;
12661266
this[_controller] = null;
12671267
super.Stream();
1268-
this[_controller] = new async.StreamController({onCancel: this.close, sync: true});
1269-
this[_rawPort].handler = this[_controller].add;
1268+
this[_controller] = new async.StreamController({onCancel: this.close.bind(this), sync: true});
1269+
this[_rawPort].handler = dart.bind(this[_controller], 'add');
12701270
}
12711271
listen(onData, opts) {
12721272
let onError = opts && 'onError' in opts ? opts.onError : null;

pkg/dev_compiler/lib/runtime/dart/_js_helper.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,7 +2632,7 @@ var _js_helper;
26322632
};
26332633
}(functionType);
26342634
} else if (!dart.notNull(isStatic) && typeof functionType == "function") {
2635-
let getReceiver = isIntercepted ? _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.receiverOf) : _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
2635+
let getReceiver = isIntercepted ? _foreign_helper.RAW_DART_FUNCTION_REF(dart.bind(BoundClosure, 'receiverOf')) : _foreign_helper.RAW_DART_FUNCTION_REF(dart.bind(BoundClosure, 'selfOf'));
26362636
signatureFunction = function(f, r) {
26372637
return function() {
26382638
return f.apply({$receiver: r(this)}, arguments$);
@@ -2654,7 +2654,7 @@ var _js_helper;
26542654
return constructor;
26552655
}
26562656
static cspForwardCall(arity, isSuperCall, stubName, func) {
2657-
let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
2657+
let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(dart.bind(BoundClosure, 'selfOf'));
26582658
if (isSuperCall)
26592659
arity = -1;
26602660
switch (arity) {
@@ -2745,8 +2745,8 @@ var _js_helper;
27452745
})()}` + '}')();
27462746
}
27472747
static cspForwardInterceptedCall(arity, isSuperCall, name, func) {
2748-
let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
2749-
let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.receiverOf);
2748+
let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(dart.bind(BoundClosure, 'selfOf'));
2749+
let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(dart.bind(BoundClosure, 'receiverOf'));
27502750
if (isSuperCall)
27512751
arity = -1;
27522752
switch (arity) {

0 commit comments

Comments
 (0)