mirror of
https://github.com/dart-lang/sdk
synced 2024-09-30 09:20:41 +00:00
795c0b1b64
Since JavaScript constructor functions are not valid Dart functions, they should not be expected to have a Function type. For context see: https://github.com/dart-lang/sdk/issues/41259 Change-Id: I9092700ad60712f604cec7e5cf0189b23024839a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142321 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Sigmund Cherem <sigmund@google.com>
30 lines
660 B
Dart
30 lines
660 B
Dart
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
@JS()
|
|
library instanceof_test;
|
|
|
|
import 'package:js/js.dart';
|
|
import 'package:expect/expect.dart';
|
|
import 'dart:js_util';
|
|
|
|
@JS()
|
|
external void eval(String code);
|
|
|
|
@JS('Class')
|
|
class Class {
|
|
external Class();
|
|
external Constructor get constructor;
|
|
}
|
|
|
|
@JS()
|
|
class Constructor {}
|
|
|
|
void main() {
|
|
eval("self.Class = function Class() {}");
|
|
var o = new Class();
|
|
var constructor = o.constructor;
|
|
Expect.isTrue(instanceof(o, constructor));
|
|
}
|