fc158b1616
Change-Id: I2351571a665c8ffff8e9d57649fbf42b483e747b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142983 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Mayank Patke <fishythefish@google.com>
77 lines
2.2 KiB
Dart
77 lines
2.2 KiB
Dart
// Copyright (c) 2017, 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: main:[null]*/
|
|
main() {
|
|
asIntWithString();
|
|
asIntWithNegative();
|
|
asIntOfZero();
|
|
asIntOfMinusOne();
|
|
asIntOfString();
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// As int of int and non-int types.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/*member: _asIntWithString:[exact=JSUInt31]*/
|
|
_asIntWithString(/*Union([exact=JSString], [exact=JSUInt31])*/ o) => o as int;
|
|
|
|
/*member: asIntWithString:[null]*/
|
|
asIntWithString() {
|
|
_asIntWithString(0);
|
|
_asIntWithString('');
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// As int of known int and an unknown int types.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/*member: _asIntWithNegative:[subclass=JSInt]*/
|
|
_asIntWithNegative(/*[subclass=JSInt]*/ o) => o as int;
|
|
|
|
/*member: asIntWithNegative:[null]*/
|
|
asIntWithNegative() {
|
|
_asIntWithNegative(0);
|
|
_asIntWithNegative(-1);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// As int of 0.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/*member: _asIntOfZero:[exact=JSUInt31]*/
|
|
_asIntOfZero(/*[exact=JSUInt31]*/ o) => o as int;
|
|
|
|
/*member: asIntOfZero:[null]*/
|
|
asIntOfZero() {
|
|
_asIntOfZero(0);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// As int of -1.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/*member: _asIntOfMinusOne:[subclass=JSInt]*/
|
|
_asIntOfMinusOne(/*[subclass=JSInt]*/ o) => o as int;
|
|
|
|
/*member: asIntOfMinusOne:[null]*/
|
|
asIntOfMinusOne() {
|
|
_asIntOfMinusOne(-1);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// As int of string.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/*member: _asIntOfString:[empty]*/
|
|
_asIntOfString(/*Value([exact=JSString], value: "")*/ o) => o as int;
|
|
|
|
/*member: asIntOfString:[null]*/
|
|
asIntOfString() {
|
|
_asIntOfString('');
|
|
}
|