microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
alex/telemmocks

Branches

Tags

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

Clone

HTTPS

Download ZIP

compiler/qsc_eval/src/debug.rs

45lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4use qsc_data_structures::span::Span;
5
6use qsc_data_structures::functors::FunctorApp;
7use qsc_fir::fir::{PackageId, StoreItemId};
8
9#[derive(Clone, Copy, Debug, PartialEq)]
10pub struct Frame {
11 pub span: Span,
12 pub id: StoreItemId,
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 len(&self) -> usize {
30 self.frames.len()
31 }
32
33 #[must_use]
34 pub fn into_frames(self) -> Vec<Frame> {
35 self.frames
36 }
37
38 pub fn push_frame(&mut self, frame: Frame) {
39 self.frames.push(frame);
40 }
41
42 pub fn pop_frame(&mut self) -> Option<Frame> {
43 self.frames.pop()
44 }
45}
46