11cb0ef41Sopenharmony_ci// Copyright 2020 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ciexport class LogEntry {
61cb0ef41Sopenharmony_ci  constructor(type, time) {
71cb0ef41Sopenharmony_ci    this._time = time;
81cb0ef41Sopenharmony_ci    this._type = type;
91cb0ef41Sopenharmony_ci    this.sourcePosition = undefined;
101cb0ef41Sopenharmony_ci  }
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ci  get time() {
131cb0ef41Sopenharmony_ci    return this._time;
141cb0ef41Sopenharmony_ci  }
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci  get type() {
171cb0ef41Sopenharmony_ci    return this._type;
181cb0ef41Sopenharmony_ci  }
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ci  get script() {
211cb0ef41Sopenharmony_ci    return this.sourcePosition?.script;
221cb0ef41Sopenharmony_ci  }
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ci  toString() {
251cb0ef41Sopenharmony_ci    let name = this.constructor.name;
261cb0ef41Sopenharmony_ci    const index = name.lastIndexOf('LogEntry');
271cb0ef41Sopenharmony_ci    if (index > 0) {
281cb0ef41Sopenharmony_ci      name = name.substr(0, index);
291cb0ef41Sopenharmony_ci    }
301cb0ef41Sopenharmony_ci    return `${name}(${this._type})`;
311cb0ef41Sopenharmony_ci  }
321cb0ef41Sopenharmony_ci
331cb0ef41Sopenharmony_ci  get toolTipDict() {
341cb0ef41Sopenharmony_ci    const toolTipDescription = {
351cb0ef41Sopenharmony_ci      __proto__: null,
361cb0ef41Sopenharmony_ci      __this__: this,
371cb0ef41Sopenharmony_ci      title: this.toString()
381cb0ef41Sopenharmony_ci    };
391cb0ef41Sopenharmony_ci    for (let key of this.constructor.propertyNames) {
401cb0ef41Sopenharmony_ci      toolTipDescription[key] = this[key];
411cb0ef41Sopenharmony_ci    }
421cb0ef41Sopenharmony_ci
431cb0ef41Sopenharmony_ci    return toolTipDescription;
441cb0ef41Sopenharmony_ci  }
451cb0ef41Sopenharmony_ci
461cb0ef41Sopenharmony_ci  // Returns an Array of all possible #type values.
471cb0ef41Sopenharmony_ci  static get allTypes() {
481cb0ef41Sopenharmony_ci    throw new Error('Not implemented.');
491cb0ef41Sopenharmony_ci  }
501cb0ef41Sopenharmony_ci
511cb0ef41Sopenharmony_ci  // Returns an array of public property names.
521cb0ef41Sopenharmony_ci  static get propertyNames() {
531cb0ef41Sopenharmony_ci    throw new Error('Not implemented.');
541cb0ef41Sopenharmony_ci  }
551cb0ef41Sopenharmony_ci}