Skip to content

Commit

Permalink
partial fix for #414, avoid dcall in _convertToDart
Browse files Browse the repository at this point in the history
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 .
  • Loading branch information
John Messerly committed Jan 19, 2016
1 parent 51c3bcb commit 5b45c6e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
8 changes: 3 additions & 5 deletions pkg/dev_compiler/lib/runtime/dart/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,8 @@ dart_library.library('dart/js', null, /* Imports */[
return wrapper;
}
dart.fn(_wrapDartFunction);
function _convertToDart(o, isBrowserType) {
if (isBrowserType === void 0) isBrowserType = null;
if (isBrowserType == null) isBrowserType = _isBrowserType;
if (o == null || typeof o == "string" || typeof o == "number" || typeof o == "boolean" || dart.notNull(dart.dcall(isBrowserType, o))) {
function _convertToDart(o) {
if (o == null || typeof o == "string" || typeof o == "number" || typeof o == "boolean" || dart.notNull(_isBrowserType(o))) {
return o;
} else if (o instanceof Date) {
let ms = o.getTime();
Expand All @@ -357,7 +355,7 @@ dart_library.library('dart/js', null, /* Imports */[
return _putIfAbsent(_dartProxies, o, _wrapToDart);
}
}
dart.fn(_convertToDart, core.Object, [dart.dynamic], [dart.functionType(core.bool, [dart.dynamic])]);
dart.fn(_convertToDart, core.Object, [dart.dynamic]);
function _wrapToDart(o) {
if (typeof o == "function") {
return new JsFunction._fromJs(o);
Expand Down
6 changes: 3 additions & 3 deletions pkg/dev_compiler/test/codegen/expect/collection/wrappers.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Messages from compiling wrappers.dart
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)
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)
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.expand' and 'Iterable.map' (package:collection/wrappers.dart, line 117, col 7)
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.map' and 'Iterable.expand' (package:collection/wrappers.dart, line 117, col 7)
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)
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)
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.map' and 'Iterable.expand' (package:collection/wrappers.dart, line 216, col 7)
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)
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)
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.expand' and 'Iterable.map' (package:collection/wrappers.dart, line 269, col 7)
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.map' and 'Iterable.expand' (package:collection/wrappers.dart, line 269, col 7)
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)
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)
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.expand' and 'Iterable.map' (package:collection/wrappers.dart, line 367, col 7)
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.expand' and 'Iterable.map' (package:collection/wrappers.dart, line 452, col 7)
severe: [AnalyzerMessage] Missing concrete implementation of 'Iterable.map' and 'Iterable.expand' (package:collection/wrappers.dart, line 452, col 7)
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)
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)
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,12 @@ dynamic _wrapDartFunction(f) {

// converts a Dart object to a reference to a native JS object
// which might be a DartObject JS->Dart proxy
Object _convertToDart(o, [bool isBrowserType(x)]) {
if (isBrowserType == null) isBrowserType = _isBrowserType;
Object _convertToDart(o) {
if (JS('bool', '# == null', o) ||
JS('bool', 'typeof # == "string"', o) ||
JS('bool', 'typeof # == "number"', o) ||
JS('bool', 'typeof # == "boolean"', o) ||
isBrowserType(o)) {
_isBrowserType(o)) {
return o;
} else if (JS('bool', '# instanceof Date', o)) {
var ms = JS('num', '#.getTime()', o);
Expand Down

0 comments on commit 5b45c6e

Please sign in to comment.