microsoft/qdk

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.25.1

Branches

Tags

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

Clone

HTTPS

Download ZIP

source/language_service/src/openqasm/references.rs

31lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4use std::sync::Arc;
5
6use qsc::line_column::{Encoding, Position};
7use qsc::location::Location;
8
9use crate::openqasm::get_reference_locations;
10
11pub fn get_references(
12 sources: &[(Arc<str>, Arc<str>)],
13 source_name: &str,
14 position: Position,
15 position_encoding: Encoding,
16) -> Vec<Location> {
17 let (res, id) =
18 super::find_symbol_in_sources(sources, source_name, position, position_encoding);
19
20 let Some(id) = id else {
21 return vec![];
22 };
23
24 get_reference_locations(
25 position_encoding,
26 &res.program,
27 &res.source_map,
28 &res.symbols,
29 id,
30 )
31}
32