20faaa5d94
Change-Id: Ib18f554c1076f27a3f7c0df5a36410da41a1f467 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148784 Reviewed-by: Paul Berry <paulberry@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
171 lines
2.7 KiB
Dart
171 lines
2.7 KiB
Dart
// Copyright (c) 2018, 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.
|
|
|
|
// @dart = 2.7
|
|
|
|
/*member: returnInt1:[exact=JSUInt31]*/
|
|
returnInt1() {
|
|
var a = 42;
|
|
try {
|
|
a = 54;
|
|
} catch (e) {}
|
|
return a;
|
|
}
|
|
|
|
/*member: returnDyn1:Union([exact=JSString], [exact=JSUInt31])*/
|
|
returnDyn1() {
|
|
dynamic a = 42;
|
|
try {
|
|
a = 'foo';
|
|
} catch (e) {}
|
|
return a;
|
|
}
|
|
|
|
/*member: returnInt2:[exact=JSUInt31]*/
|
|
returnInt2() {
|
|
var a = 42;
|
|
try {
|
|
a = 54;
|
|
} catch (e) {
|
|
a = 2;
|
|
}
|
|
return a;
|
|
}
|
|
|
|
/*member: returnDyn2:Union([exact=JSString], [exact=JSUInt31])*/
|
|
returnDyn2() {
|
|
dynamic a = 42;
|
|
try {
|
|
a = 54;
|
|
} catch (e) {
|
|
a = 'foo';
|
|
}
|
|
return a;
|
|
}
|
|
|
|
/*member: returnInt3:[exact=JSUInt31]*/
|
|
returnInt3() {
|
|
dynamic a = 42;
|
|
try {
|
|
a = 54;
|
|
} catch (e) {
|
|
a = 'foo';
|
|
} finally {
|
|
a = 4;
|
|
}
|
|
return a;
|
|
}
|
|
|
|
/*member: returnDyn3:Union([exact=JSString], [exact=JSUInt31])*/
|
|
returnDyn3() {
|
|
dynamic a = 42;
|
|
try {
|
|
a = 54;
|
|
// ignore: unused_catch_clause
|
|
} on String catch (e) {
|
|
a = 2;
|
|
// ignore: unused_catch_clause
|
|
} on Object catch (e) {
|
|
a = 'foo';
|
|
}
|
|
return a;
|
|
}
|
|
|
|
/*member: returnInt4:[exact=JSUInt31]*/
|
|
returnInt4() {
|
|
var a = 42;
|
|
try {
|
|
a = 54;
|
|
// ignore: unused_catch_clause
|
|
} on String catch (e) {
|
|
a = 2;
|
|
// ignore: unused_catch_clause
|
|
} on Object catch (e) {
|
|
a = 32;
|
|
}
|
|
return a;
|
|
}
|
|
|
|
/*member: returnDyn4:Union([exact=JSString], [exact=JSUInt31])*/
|
|
returnDyn4() {
|
|
dynamic a = 42;
|
|
if (a /*invoke: [exact=JSUInt31]*/ == 54) {
|
|
try {
|
|
a = 'foo';
|
|
} catch (e) {}
|
|
}
|
|
return a;
|
|
}
|
|
|
|
/*member: returnInt5:[exact=JSUInt31]*/
|
|
returnInt5() {
|
|
var a = 42;
|
|
if (a /*invoke: [exact=JSUInt31]*/ == 54) {
|
|
try {
|
|
a = 42;
|
|
} catch (e) {}
|
|
}
|
|
return a;
|
|
}
|
|
|
|
/*member: returnDyn5:Union([exact=JSString], [exact=JSUInt31])*/
|
|
returnDyn5() {
|
|
dynamic a = 42;
|
|
if (a /*invoke: [exact=JSUInt31]*/ == 54) {
|
|
try {
|
|
a = 'foo';
|
|
print(a);
|
|
a = 42;
|
|
} catch (e) {}
|
|
}
|
|
return a;
|
|
}
|
|
|
|
/*member: returnInt6:[subclass=JSInt]*/
|
|
returnInt6() {
|
|
try {
|
|
throw 42;
|
|
} on int catch (e) {
|
|
return e;
|
|
}
|
|
// ignore: dead_code
|
|
return 42;
|
|
}
|
|
|
|
/*member: returnDyn6:[null|subclass=Object]*/
|
|
returnDyn6() {
|
|
try {
|
|
throw 42;
|
|
} catch (e) {
|
|
return e;
|
|
}
|
|
}
|
|
|
|
/*member: returnInt7:[exact=JSUInt31]*/
|
|
returnInt7() {
|
|
dynamic a = 'foo';
|
|
try {
|
|
a = 42;
|
|
return a;
|
|
} catch (e) {}
|
|
return 2;
|
|
}
|
|
|
|
/*member: main:[null]*/
|
|
main() {
|
|
returnInt1();
|
|
returnDyn1();
|
|
returnInt2();
|
|
returnDyn2();
|
|
returnInt3();
|
|
returnDyn3();
|
|
returnInt4();
|
|
returnDyn4();
|
|
returnInt5();
|
|
returnDyn5();
|
|
returnInt6();
|
|
returnDyn6();
|
|
returnInt7();
|
|
}
|