mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 15:17:07 +00:00
732d1cc0a4
This reverts commit 4f8333e80e
.
Reason for revert: causes breakages in google3
Original change's description:
> Add more `interface` and `final` modifiers to `dart:core`.
>
> Make intent explicit for classes which are intended as interfaces,
> or which are not intended to be subclassed.
>
> Mainly classes which are pure interfaces are marked as such,
> and platform-specific classes not intended for subclassing
> are made `final`.
>
> The `final` classes includes `BigInt`, which is written to assume
> that arguments inherit its private members
> (it runs `_ensureSystemBigInt` on arguments).
>
> It also includes the `Expando`, `WeakReference` and `Finalizer` classes,
> which are just intended as stand-alone implementation classes for accessing
> platform-specific functionality.
>
> Change-Id: Ib770c265edff127a289a67fe72d15b9ff0499407
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287180
> Reviewed-by: Stephen Adams <sra@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
Change-Id: I94ff95f72410a4e1ae80744971c4c920fecc1493
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287760
Reviewed-by: Martin Kustermann <kustermann@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
58 lines
2.1 KiB
Dart
58 lines
2.1 KiB
Dart
// Copyright (c) 2013, 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.
|
|
|
|
part of dart.core;
|
|
|
|
/// An interface implemented by all stack trace objects.
|
|
///
|
|
/// A [StackTrace] is intended to convey information to the user about the call
|
|
/// sequence that triggered an exception.
|
|
///
|
|
/// These objects are created by the runtime, it is not possible to create
|
|
/// them programmatically.
|
|
abstract class StackTrace {
|
|
/// A stack trace object with no information.
|
|
///
|
|
/// This stack trace is used as the default in situations where
|
|
/// a stack trace is required, but the user has not supplied one.
|
|
@Since("2.8")
|
|
static const empty = const _StringStackTrace("");
|
|
|
|
StackTrace(); // In case existing classes extend StackTrace.
|
|
|
|
/// Create a `StackTrace` object from [stackTraceString].
|
|
///
|
|
/// The created stack trace will have a `toString` method returning
|
|
/// `stackTraceString`.
|
|
///
|
|
/// The `stackTraceString` can be a string returned by some other
|
|
/// stack trace, or it can be any string at all.
|
|
/// If the string doesn't look like a stack trace, code that interprets
|
|
/// stack traces is likely to fail, so fake stack traces should be used
|
|
/// with care.
|
|
factory StackTrace.fromString(String stackTraceString) = _StringStackTrace;
|
|
|
|
/// Returns a representation of the current stack trace.
|
|
///
|
|
/// This is similar to what can be achieved by doing:
|
|
/// ```dart
|
|
/// try { throw 0; } catch (_, stack) { return stack; }
|
|
/// ```
|
|
/// The getter achieves this without throwing if possible.
|
|
external static StackTrace get current;
|
|
|
|
/// Returns a [String] representation of the stack trace.
|
|
///
|
|
/// The string represents the full stack trace starting from
|
|
/// the point where a throw occurred to the top of the current call sequence.
|
|
///
|
|
/// The exact format of the string representation is not final.
|
|
String toString();
|
|
}
|
|
|
|
class _StringStackTrace implements StackTrace {
|
|
final String _stackTrace;
|
|
const _StringStackTrace(this._stackTrace);
|
|
String toString() => _stackTrace;
|
|
}
|