mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:57:43 +00:00
18d6c38ac6
Review URL: https://codereview.chromium.org/2320593002 .
54 lines
688 B
Dart
54 lines
688 B
Dart
import 'dart:html';
|
|
import 'package:js/js.dart';
|
|
import 'package:expect/expect.dart';
|
|
|
|
@JS()
|
|
@anonymous
|
|
class C {
|
|
final foo;
|
|
|
|
external factory C({foo});
|
|
}
|
|
|
|
@JS()
|
|
@anonymous
|
|
class D {
|
|
final foo;
|
|
|
|
external factory D({foo});
|
|
}
|
|
|
|
class F {
|
|
final foo;
|
|
|
|
F(this.foo);
|
|
}
|
|
|
|
@NoInline()
|
|
testC(C o) {
|
|
return o.foo;
|
|
}
|
|
|
|
@NoInline()
|
|
testF(F o) {
|
|
return o.foo;
|
|
}
|
|
|
|
void expectValueOrTypeError(f(), value) {
|
|
try {
|
|
var i = 0;
|
|
String s = i; // Test for checked mode.
|
|
} on TypeError catch (error) {
|
|
Expect.throws(f, (ex) => ex is TypeError);
|
|
}
|
|
}
|
|
|
|
main() {
|
|
var d = new D(foo: 4);
|
|
var f = new F(6);
|
|
Expect.equals(testC(d), 4);
|
|
Expect.equals(testF(f), 6); /// 01: ok
|
|
}
|
|
|
|
|