Skip to content

Commit 5148afa

Browse files
fishythefishcommit-bot@chromium.org
authored andcommitted
[dart2js] Treat classes instantiated by a NativeBehavior as native.
Change-Id: Ib1d19a6047492cd1a0e0d93e45107eb74f1b4306 Bug: #37576 Fixes: #37576 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114466 Reviewed-by: Stephen Adams <[email protected]> Commit-Queue: Mayank Patke <[email protected]>
1 parent dda6995 commit 5148afa

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

pkg/compiler/lib/src/native/enqueue.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
112112
_dartTypes.isSubtype(type,
113113
_elementEnvironment.getRawType(_commonElements.jsArrayClass))) {
114114
registerInstantiation(type);
115+
} else if (_dartTypes.isSubtype(
116+
type,
117+
_elementEnvironment
118+
.getRawType(_commonElements.jsJavaScriptObjectClass))) {
119+
matchingClasses.add(type.element);
115120
}
116121
// TODO(johnniwinther): Improve spec string precision to handle type
117122
// arguments and implements relations that preserve generics. Currently
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:js/js.dart';
6+
7+
@JS('jsFun')
8+
external set jsFun(Function fun);
9+
10+
void main() {
11+
jsFun = allowInterop(dartFun);
12+
}
13+
14+
void dartFun() {}

0 commit comments

Comments
 (0)