Skip to content

Commit 5b45c6e

Browse files
author
John Messerly
committed
partial fix for #414, avoid dcall in _convertToDart
this doesn't fix the root call, but still, it's nice to clean up this dead code [email protected] Review URL: https://codereview.chromium.org/1609843002 .
1 parent 51c3bcb commit 5b45c6e

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,8 @@ dart_library.library('dart/js', null, /* Imports */[
343343
return wrapper;
344344
}
345345
dart.fn(_wrapDartFunction);
346-
function _convertToDart(o, isBrowserType) {
347-
if (isBrowserType === void 0) isBrowserType = null;
348-
if (isBrowserType == null) isBrowserType = _isBrowserType;
349-
if (o == null || typeof o == "string" || typeof o == "number" || typeof o == "boolean" || dart.notNull(dart.dcall(isBrowserType, o))) {
346+
function _convertToDart(o) {
347+
if (o == null || typeof o == "string" || typeof o == "number" || typeof o == "boolean" || dart.notNull(_isBrowserType(o))) {
350348
return o;
351349
} else if (o instanceof Date) {
352350
let ms = o.getTime();
@@ -357,7 +355,7 @@ dart_library.library('dart/js', null, /* Imports */[
357355
return _putIfAbsent(_dartProxies, o, _wrapToDart);
358356
}
359357
}
360-
dart.fn(_convertToDart, core.Object, [dart.dynamic], [dart.functionType(core.bool, [dart.dynamic])]);
358+
dart.fn(_convertToDart, core.Object, [dart.dynamic]);
361359
function _wrapToDart(o) {
362360
if (typeof o == "function") {
363361
return new JsFunction._fromJs(o);

pkg/dev_compiler/test/codegen/expect/collection/wrappers.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// Messages from compiling wrappers.dart
22
severe: [INVALID_METHOD_OVERRIDE] Invalid override. The type of _DelegatingIterableBase.expand (((E) → Iterable<dynamic>) → Iterable<dynamic>) is not a subtype of Iterable<E>.expand (<T>((E) → Iterable<T>) → Iterable<T>). (package:collection/wrappers.dart, line 41, col 3)
33
severe: [INVALID_METHOD_OVERRIDE] Invalid override. The type of _DelegatingIterableBase.map (((E) → dynamic) → Iterable<dynamic>) is not a subtype of Iterable<E>.map (<T>((E) → T) → Iterable<T>). (package:collection/wrappers.dart, line 68, col 3)
4-
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.expand' and 'Iterable.map' (package:collection/wrappers.dart, line 117, col 7)
4+
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.map' and 'Iterable.expand' (package:collection/wrappers.dart, line 117, col 7)
55
severe: [INVALID_METHOD_OVERRIDE] Base class introduces an invalid override. The type of _DelegatingIterableBase.expand (((E) → Iterable<dynamic>) → Iterable<dynamic>) is not a subtype of Iterable<E>.expand (<T>((E) → Iterable<T>) → Iterable<T>). (package:collection/wrappers.dart, line 117, col 25)
66
severe: [INVALID_METHOD_OVERRIDE] Base class introduces an invalid override. The type of _DelegatingIterableBase.map (((E) → dynamic) → Iterable<dynamic>) is not a subtype of Iterable<E>.map (<T>((E) → T) → Iterable<T>). (package:collection/wrappers.dart, line 117, col 25)
77
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.map' and 'Iterable.expand' (package:collection/wrappers.dart, line 216, col 7)
88
severe: [INVALID_METHOD_OVERRIDE] Base class introduces an invalid override. The type of _DelegatingIterableBase.expand (((E) → Iterable<dynamic>) → Iterable<dynamic>) is not a subtype of Iterable<E>.expand (<T>((E) → Iterable<T>) → Iterable<T>). (package:collection/wrappers.dart, line 216, col 24)
99
severe: [INVALID_METHOD_OVERRIDE] Base class introduces an invalid override. The type of _DelegatingIterableBase.map (((E) → dynamic) → Iterable<dynamic>) is not a subtype of Iterable<E>.map (<T>((E) → T) → Iterable<T>). (package:collection/wrappers.dart, line 216, col 24)
10-
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.expand' and 'Iterable.map' (package:collection/wrappers.dart, line 269, col 7)
10+
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.map' and 'Iterable.expand' (package:collection/wrappers.dart, line 269, col 7)
1111
severe: [INVALID_METHOD_OVERRIDE] Base class introduces an invalid override. The type of _DelegatingIterableBase.expand (((E) → Iterable<dynamic>) → Iterable<dynamic>) is not a subtype of Iterable<E>.expand (<T>((E) → Iterable<T>) → Iterable<T>). (package:collection/wrappers.dart, line 269, col 26)
1212
severe: [INVALID_METHOD_OVERRIDE] Base class introduces an invalid override. The type of _DelegatingIterableBase.map (((E) → dynamic) → Iterable<dynamic>) is not a subtype of Iterable<E>.map (<T>((E) → T) → Iterable<T>). (package:collection/wrappers.dart, line 269, col 26)
1313
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.expand' and 'Iterable.map' (package:collection/wrappers.dart, line 367, col 7)
14-
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.expand' and 'Iterable.map' (package:collection/wrappers.dart, line 452, col 7)
14+
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.map' and 'Iterable.expand' (package:collection/wrappers.dart, line 452, col 7)
1515
severe: [INVALID_METHOD_OVERRIDE] Base class introduces an invalid override. The type of _DelegatingIterableBase.expand (((V) → Iterable<dynamic>) → Iterable<dynamic>) is not a subtype of Iterable<V>.expand (<T>((V) → Iterable<T>) → Iterable<T>). (package:collection/wrappers.dart, line 452, col 25)
1616
severe: [INVALID_METHOD_OVERRIDE] Base class introduces an invalid override. The type of _DelegatingIterableBase.map (((V) → dynamic) → Iterable<dynamic>) is not a subtype of Iterable<V>.map (<T>((V) → T) → Iterable<T>). (package:collection/wrappers.dart, line 452, col 25)
1717
warning: [DOWN_CAST_COMPOSITE] _base.fold(initialValue, combine) (dynamic) will need runtime check to cast to type T (package:collection/wrappers.dart, line 49, col 7)

pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,13 +475,12 @@ dynamic _wrapDartFunction(f) {
475475

476476
// converts a Dart object to a reference to a native JS object
477477
// which might be a DartObject JS->Dart proxy
478-
Object _convertToDart(o, [bool isBrowserType(x)]) {
479-
if (isBrowserType == null) isBrowserType = _isBrowserType;
478+
Object _convertToDart(o) {
480479
if (JS('bool', '# == null', o) ||
481480
JS('bool', 'typeof # == "string"', o) ||
482481
JS('bool', 'typeof # == "number"', o) ||
483482
JS('bool', 'typeof # == "boolean"', o) ||
484-
isBrowserType(o)) {
483+
_isBrowserType(o)) {
485484
return o;
486485
} else if (JS('bool', '# instanceof Date', o)) {
487486
var ms = JS('num', '#.getTime()', o);

0 commit comments

Comments
 (0)