Skip to content

Commit f43b756

Browse files
author
John Messerly
committed
fix #43, remove => workaround
also fixes node.js test to use a temp directory, instead of creating "tmp" under dev_compiler checkout [email protected] Review URL: https://codereview.chromium.org/1643523008 .
1 parent c43cb16 commit f43b756

File tree

18 files changed

+111
-151
lines changed

18 files changed

+111
-151
lines changed

pkg/dev_compiler/bin/devrun.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ void _showUsageAndExit() {
2828
}
2929

3030
main(List<String> args) async {
31-
args = []
32-
..add('--arrow-fn-bind-this')
33-
..addAll(args);
34-
3531
CompilerOptions options;
3632

3733
try {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ dart_library.library('dart/_debugger', null, /* Imports */[
156156
let _ = this.createChild('object');
157157
_.addAttribute('object', object);
158158
return _;
159-
}).bind(this)();
159+
})();
160160
}
161161
setStyle(style) {
162162
dart.dput(this[_attributes], 'style', style);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,11 +1235,11 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
12351235
isolate.handleControlMessage(msg);
12361236
return;
12371237
}
1238-
exports._globalState.topEventLoop.enqueue(isolate, dart.fn((() => {
1238+
exports._globalState.topEventLoop.enqueue(isolate, dart.fn(() => {
12391239
if (!dart.notNull(this[_receivePort][_isClosed])) {
12401240
this[_receivePort][_add](msg);
12411241
}
1242-
}).bind(this)), `receive ${message}`);
1242+
}), `receive ${message}`);
12431243
}
12441244
['=='](other) {
12451245
return dart.is(other, _NativeJsSendPort) && dart.equals(this[_receivePort], other[_receivePort]);
@@ -1427,9 +1427,9 @@ dart_library.library('dart/_isolate_helper', null, /* Imports */[
14271427
this[_handle] = null;
14281428
if (dart.notNull(hasTimer())) {
14291429
enterJsAsync();
1430-
this[_handle] = self.setInterval(dart.fn((() => {
1430+
this[_handle] = self.setInterval(dart.fn(() => {
14311431
callback(this);
1432-
}).bind(this)), milliseconds);
1432+
}), milliseconds);
14331433
} else {
14341434
dart.throw(new core.UnsupportedError("Periodic timer."));
14351435
}

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ dart_library.library('dart/_runtime', null, /* Imports */[
274274
this.canceler = null;
275275
this.iterator = generator(this, ...args)[Symbol.iterator]();
276276
this.controller = getGenericClass(async.StreamController)(T).new({
277-
onListen: (() => this.scheduleGenerator()).bind(this),
278-
onResume: (() => this.onResume()).bind(this),
279-
onCancel: (() => this.onCancel()).bind(this)
277+
onListen: () => this.scheduleGenerator(),
278+
onResume: () => this.onResume(),
279+
onCancel: () => this.onCancel()
280280
});
281281
}
282282
onResume() {
@@ -305,7 +305,7 @@ dart_library.library('dart/_runtime', null, /* Imports */[
305305
return;
306306
}
307307
this.isScheduled = true;
308-
async.scheduleMicrotask((() => this.runBody()).bind(this));
308+
async.scheduleMicrotask(() => this.runBody());
309309
}
310310
runBody(opt_awaitValue) {
311311
this.isScheduled = false;
@@ -330,8 +330,8 @@ dart_library.library('dart/_runtime', null, /* Imports */[
330330
if (!instanceOf(future, getGenericClass(async.Future))) {
331331
future = async.Future.value(future);
332332
}
333-
return future.then((x => this.runBody(x)).bind(this), {
334-
onError: ((e, s) => this.throwError(e, s)).bind(this)
333+
return future.then(x => this.runBody(x), {
334+
onError: (e, s) => this.throwError(e, s)
335335
});
336336
}
337337
add(event) {
@@ -344,11 +344,11 @@ dart_library.library('dart/_runtime', null, /* Imports */[
344344
addStream(stream) {
345345
if (!this.controller.hasListener) return true;
346346
this.isAdding = true;
347-
this.controller.addStream(stream, {cancelOnError: false}).then((() => {
347+
this.controller.addStream(stream, {cancelOnError: false}).then(() => {
348348
this.isAdding = false;
349349
this.scheduleGenerator();
350-
}).bind(this), {
351-
onError: ((e, s) => this.throwError(e, s)).bind(this)
350+
}, {
351+
onError: (e, s) => this.throwError(e, s)
352352
});
353353
}
354354
throwError(error, stackTrace) {

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

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,9 @@ dart_library.library('dart/async', null, /* Imports */[
642642
return;
643643
}
644644
elementIndex = elementIndex + 1;
645-
}, dart.void, [T]), {onError: dart.bind(future, _completeError), onDone: dart.fn((() => {
645+
}, dart.void, [T]), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
646646
future[_completeError](core.RangeError.index(index, this, "index", null, elementIndex));
647-
}).bind(this), dart.void, []), cancelOnError: true});
647+
}, dart.void, []), cancelOnError: true});
648648
return future;
649649
}
650650
timeout(timeLimit, opts) {
@@ -956,10 +956,10 @@ dart_library.library('dart/async', null, /* Imports */[
956956
this[_onDone] = dart.fn(() => {
957957
result[_complete](futureValue);
958958
}, dart.void, []);
959-
this[_onError] = dart.fn(((error, stackTrace) => {
959+
this[_onError] = dart.fn((error, stackTrace) => {
960960
this.cancel();
961961
result[_completeError](error, dart.as(stackTrace, core.StackTrace));
962-
}).bind(this));
962+
});
963963
return result;
964964
}
965965
get [_isInputPaused]() {
@@ -2285,9 +2285,9 @@ dart_library.library('dart/async', null, /* Imports */[
22852285
[_addListener](listener) {
22862286
dart.assert(listener[_nextListener] == null);
22872287
if (dart.notNull(this[_isComplete])) {
2288-
this[_zone].scheduleMicrotask(dart.fn((() => {
2288+
this[_zone].scheduleMicrotask(dart.fn(() => {
22892289
_Future$()._propagateToListeners(this, listener);
2290-
}).bind(this), dart.void, []));
2290+
}, dart.void, []));
22912291
} else {
22922292
listener[_nextListener] = dart.as(this[_resultOrListeners], _FutureListener);
22932293
this[_resultOrListeners] = listener;
@@ -2367,9 +2367,9 @@ dart_library.library('dart/async', null, /* Imports */[
23672367
let coreFuture = dart.as(typedFuture, _Future$(T));
23682368
if (dart.notNull(coreFuture[_isComplete]) && dart.notNull(coreFuture[_hasError])) {
23692369
this[_markPendingCompletion]();
2370-
this[_zone].scheduleMicrotask(dart.fn((() => {
2370+
this[_zone].scheduleMicrotask(dart.fn(() => {
23712371
_Future$()._chainCoreFuture(coreFuture, this);
2372-
}).bind(this), dart.void, []));
2372+
}, dart.void, []));
23732373
} else {
23742374
_Future$()._chainCoreFuture(coreFuture, this);
23752375
}
@@ -2381,16 +2381,16 @@ dart_library.library('dart/async', null, /* Imports */[
23812381
let typedValue = dart.as(value, T);
23822382
}
23832383
this[_markPendingCompletion]();
2384-
this[_zone].scheduleMicrotask(dart.fn((() => {
2384+
this[_zone].scheduleMicrotask(dart.fn(() => {
23852385
this[_completeWithValue](value);
2386-
}).bind(this), dart.void, []));
2386+
}, dart.void, []));
23872387
}
23882388
[_asyncCompleteError](error, stackTrace) {
23892389
dart.assert(!dart.notNull(this[_isComplete]));
23902390
this[_markPendingCompletion]();
2391-
this[_zone].scheduleMicrotask(dart.fn((() => {
2391+
this[_zone].scheduleMicrotask(dart.fn(() => {
23922392
this[_completeError](error, stackTrace);
2393-
}).bind(this), dart.void, []));
2393+
}, dart.void, []));
23942394
}
23952395
static _propagateToListeners(source, listeners) {
23962396
while (true) {
@@ -3117,9 +3117,9 @@ dart_library.library('dart/async', null, /* Imports */[
31173117
this[_varData] = subscription;
31183118
}
31193119
subscription[_setPendingEvents](pendingEvents);
3120-
subscription[_guardCallback](dart.fn((() => {
3120+
subscription[_guardCallback](dart.fn(() => {
31213121
_runGuarded(this[_onListen]);
3122-
}).bind(this)));
3122+
}));
31233123
return dart.as(subscription, StreamSubscription$(T));
31243124
}
31253125
[_recordCancel](subscription) {
@@ -3394,9 +3394,9 @@ dart_library.library('dart/async', null, /* Imports */[
33943394
this.addStreamFuture[_asyncComplete](null);
33953395
return null;
33963396
}
3397-
return cancel2.whenComplete(dart.fn((() => {
3397+
return cancel2.whenComplete(dart.fn(() => {
33983398
this.addStreamFuture[_asyncComplete](null);
3399-
}).bind(this)));
3399+
}));
34003400
}
34013401
complete() {
34023402
this.addStreamFuture[_asyncComplete](null);
@@ -3486,12 +3486,12 @@ dart_library.library('dart/async', null, /* Imports */[
34863486
this[_state] = _PendingEvents._STATE_SCHEDULED;
34873487
return;
34883488
}
3489-
scheduleMicrotask(dart.fn((() => {
3489+
scheduleMicrotask(dart.fn(() => {
34903490
let oldState = this[_state];
34913491
this[_state] = _PendingEvents._STATE_UNSCHEDULED;
34923492
if (oldState == _PendingEvents._STATE_CANCELED) return;
34933493
this.handleNext(dispatch);
3494-
}).bind(this), dart.void, []));
3494+
}, dart.void, []));
34953495
this[_state] = _PendingEvents._STATE_SCHEDULED;
34963496
}
34973497
cancelSchedule() {
@@ -5226,27 +5226,27 @@ dart_library.library('dart/async', null, /* Imports */[
52265226
let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true;
52275227
let registered = this.registerCallback(f);
52285228
if (dart.notNull(runGuarded)) {
5229-
return dart.fn((() => this.runGuarded(registered)).bind(this));
5229+
return dart.fn(() => this.runGuarded(registered));
52305230
} else {
5231-
return dart.fn((() => this.run(registered)).bind(this));
5231+
return dart.fn(() => this.run(registered));
52325232
}
52335233
}
52345234
bindUnaryCallback(f, opts) {
52355235
let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true;
52365236
let registered = this.registerUnaryCallback(f);
52375237
if (dart.notNull(runGuarded)) {
5238-
return dart.fn((arg => this.runUnaryGuarded(registered, arg)).bind(this));
5238+
return dart.fn(arg => this.runUnaryGuarded(registered, arg));
52395239
} else {
5240-
return dart.fn((arg => this.runUnary(registered, arg)).bind(this));
5240+
return dart.fn(arg => this.runUnary(registered, arg));
52415241
}
52425242
}
52435243
bindBinaryCallback(f, opts) {
52445244
let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true;
52455245
let registered = this.registerBinaryCallback(f);
52465246
if (dart.notNull(runGuarded)) {
5247-
return dart.fn(((arg1, arg2) => this.runBinaryGuarded(registered, arg1, arg2)).bind(this));
5247+
return dart.fn((arg1, arg2) => this.runBinaryGuarded(registered, arg1, arg2));
52485248
} else {
5249-
return dart.fn(((arg1, arg2) => this.runBinary(registered, arg1, arg2)).bind(this));
5249+
return dart.fn((arg1, arg2) => this.runBinary(registered, arg1, arg2));
52505250
}
52515251
}
52525252
get(key) {
@@ -5609,25 +5609,25 @@ dart_library.library('dart/async', null, /* Imports */[
56095609
bindCallback(f, opts) {
56105610
let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true;
56115611
if (dart.notNull(runGuarded)) {
5612-
return dart.fn((() => this.runGuarded(f)).bind(this));
5612+
return dart.fn(() => this.runGuarded(f));
56135613
} else {
5614-
return dart.fn((() => this.run(f)).bind(this));
5614+
return dart.fn(() => this.run(f));
56155615
}
56165616
}
56175617
bindUnaryCallback(f, opts) {
56185618
let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true;
56195619
if (dart.notNull(runGuarded)) {
5620-
return dart.fn((arg => this.runUnaryGuarded(f, arg)).bind(this));
5620+
return dart.fn(arg => this.runUnaryGuarded(f, arg));
56215621
} else {
5622-
return dart.fn((arg => this.runUnary(f, arg)).bind(this));
5622+
return dart.fn(arg => this.runUnary(f, arg));
56235623
}
56245624
}
56255625
bindBinaryCallback(f, opts) {
56265626
let runGuarded = opts && 'runGuarded' in opts ? opts.runGuarded : true;
56275627
if (dart.notNull(runGuarded)) {
5628-
return dart.fn(((arg1, arg2) => this.runBinaryGuarded(f, arg1, arg2)).bind(this));
5628+
return dart.fn((arg1, arg2) => this.runBinaryGuarded(f, arg1, arg2));
56295629
} else {
5630-
return dart.fn(((arg1, arg2) => this.runBinary(f, arg1, arg2)).bind(this));
5630+
return dart.fn((arg1, arg2) => this.runBinary(f, arg1, arg2));
56315631
}
56325632
}
56335633
get(key) {

0 commit comments

Comments
 (0)