• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16package std.core;
17
18// synchronize with mirror class in runtime
19export class StackTraceElement {
20    private className: String
21    private methodName: String
22    private sourceFileName: String
23    private lineNumber: int
24
25    private constructor () {}
26
27    /**
28    * Packs data to single string and
29    *
30    * @returns data in formatted string
31    */
32    public override toString(): String {
33        return "\tat " + this.className + "." + this.methodName +
34             " (" + this.sourceFileName + ":" + this.lineNumber + ")"
35    }
36}
37
38export class StackTrace {
39    /**
40    * Method provides stack of methods at the place of a call
41    *
42    * @returns stack trace
43    */
44    static native provisionStackTrace(): StackTraceElement[]
45}
46