microsoft/qdk

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
alex/second-test-harness-take

Branches

Tags

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

Clone

HTTPS

Download ZIP

compiler/qsc/src/lib.rs

114lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4pub mod codegen;
5pub mod compile;
6pub mod error;
7pub mod incremental;
8pub mod interpret;
9pub mod location;
10pub mod packages;
11pub mod target;
12pub mod test_callables {
13 use qsc_data_structures::line_column::{Encoding, Range};
14 use qsc_frontend::compile::CompileUnit;
15
16 use crate::location::Location;
17
18 pub struct TestDescriptor {
19 pub callable_name: String,
20 pub location: Location,
21 }
22
23 pub fn collect_test_callables(
24 unit: &CompileUnit
25 ) -> Result<impl Iterator<Item = TestDescriptor> + '_, String> {
26 let test_callables = unit.package.collect_test_callables()?;
27
28 Ok(test_callables.into_iter().map(|(name, span)| {
29 let source = unit
30 .sources
31 .find_by_offset(span.lo)
32 .expect("source should exist for offset");
33
34 let location = Location {
35 source: source.name.clone(),
36 range: Range::from_span(
37 // TODO(@sezna) ask @minestarks if this is correct
38 Encoding::Utf8,
39 &source.contents,
40 &(span - source.offset),
41 ),
42 };
43 TestDescriptor {
44 callable_name: name,
45 location,
46 }
47 }))
48 }
49}
50
51pub use qsc_formatter::formatter;
52
53pub use qsc_frontend::compile::{CompileUnit, PackageStore, SourceContents, SourceMap, SourceName};
54
55pub mod resolve {
56 pub use qsc_frontend::resolve::{path_as_field_accessor, Local, LocalKind, Locals, Res};
57}
58
59pub mod fir {
60 pub use qsc_fir::{fir::*, *};
61}
62
63pub mod hir {
64 pub use qsc_hir::{hir::*, *};
65}
66
67pub mod ast {
68 pub use qsc_ast::{ast::*, *};
69}
70
71pub mod project {
72 pub use qsc_project::{
73 DirEntry, EntryType, Error, FileSystem, Manifest, ManifestDescriptor, PackageCache,
74 PackageGraphSources,
75 };
76}
77
78pub use qsc_data_structures::{
79 functors::FunctorApp, language_features::LanguageFeatures, namespaces::*, span::Span,
80 target::TargetCapabilityFlags,
81};
82
83pub use qsc_passes::{lower_hir_to_fir, PackageType, PassContext};
84
85pub mod line_column {
86 pub use qsc_data_structures::line_column::{Encoding, Position, Range};
87}
88
89pub use qsc_eval::{
90 backend::{Backend, SparseSim},
91 noise::PauliNoise,
92 state::{
93 fmt_basis_state_label, fmt_complex, format_state_id, get_matrix_latex, get_phase,
94 get_state_latex,
95 },
96};
97
98pub mod linter {
99 pub use qsc_linter::{run_lints, LintConfig, LintKind, LintLevel};
100}
101
102pub use qsc_doc_gen::{display, generate_docs};
103
104pub mod circuit {
105 pub use qsc_circuit::{operations::*, Circuit, Operation};
106}
107
108pub mod parse {
109 pub use qsc_parse::{completion, top_level_nodes};
110}
111
112pub mod partial_eval {
113 pub use qsc_partial_eval::Error;
114}
115