microsoft/qdk

Public

mirrored from https://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
c8adde746a7aaa0185fd4eac69af19d259ce1faa

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

compiler/qsc_eval/src/debug.rs

40lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4use qsc_data_structures::span::Span;
5
6use crate::{val::FunctorApp, GlobalId};
7use qsc_hir::hir::PackageId;
8
9#[derive(Clone, Copy, Debug, PartialEq)]
10pub struct Frame {
11 pub span: Option<Span>,
12 pub id: GlobalId,
13 pub caller: PackageId,
14 pub functor: FunctorApp,
15}
16
17#[derive(Debug, Default, Clone, PartialEq)]
18pub struct CallStack {
19 frames: Vec<Frame>,
20}
21
22impl CallStack {
23 #[must_use]
24 pub fn is_empty(&self) -> bool {
25 self.frames.is_empty()
26 }
27
28 #[must_use]
29 pub fn into_frames(self) -> Vec<Frame> {
30 self.frames
31 }
32
33 pub fn push_frame(&mut self, frame: Frame) {
34 self.frames.push(frame);
35 }
36
37 pub fn pop_frame(&mut self) -> Option<Frame> {
38 self.frames.pop()
39 }
40}
41