Skip to content

Commit 2a82770

Browse files
authored
Replace position-based source code information with token-based source code information (#301)
1 parent 88cc1f3 commit 2a82770

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2553
-1924
lines changed

vhdl_lang/src/analysis/analyze.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub fn as_fatal<T>(res: EvalResult<T>) -> FatalResult<Option<T>> {
132132
}
133133
}
134134

135-
pub(super) struct AnalyzeContext<'a> {
135+
pub(super) struct AnalyzeContext<'a, 't> {
136136
pub(super) root: &'a DesignRoot,
137137

138138
pub work_sym: Symbol,
@@ -158,16 +158,16 @@ pub(super) struct AnalyzeContext<'a> {
158158
uses: RefCell<FnvHashSet<UnitId>>,
159159
missing_unit: RefCell<FnvHashSet<(Symbol, Symbol, Option<Symbol>)>>,
160160
uses_library_all: RefCell<FnvHashSet<Symbol>>,
161-
pub ctx: &'a dyn TokenAccess,
161+
pub ctx: &'t dyn TokenAccess,
162162
}
163163

164-
impl<'a> AnalyzeContext<'a> {
164+
impl<'a, 't> AnalyzeContext<'a, 't> {
165165
pub fn new(
166166
root: &'a DesignRoot,
167167
current_unit: &UnitId,
168168
arena: &'a Arena,
169-
ctx: &'a dyn TokenAccess,
170-
) -> AnalyzeContext<'a> {
169+
ctx: &'t dyn TokenAccess,
170+
) -> AnalyzeContext<'a, 't> {
171171
AnalyzeContext {
172172
work_sym: root.symbol_utf8("work"),
173173
std_sym: root.symbol_utf8("std"),

vhdl_lang/src/analysis/assignment.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@
77
use super::analyze::*;
88
use super::scope::*;
99
use super::target::AssignmentType;
10+
use crate::ast::token_range::WithTokenSpan;
1011
use crate::ast::*;
1112
use crate::data::*;
1213
use crate::named_entity::*;
1314

14-
impl<'a> AnalyzeContext<'a> {
15+
impl<'a, 't> AnalyzeContext<'a, 't> {
1516
// @TODO maybe make generic function for expression/waveform.
1617
// wait until type checking to see if it makes sense
1718
pub fn analyze_expr_assignment(
1819
&self,
1920
scope: &Scope<'a>,
20-
target: &mut WithPos<Target>,
21+
target: &mut WithTokenSpan<Target>,
2122
assignment_type: AssignmentType,
22-
rhs: &mut AssignmentRightHand<WithPos<Expression>>,
23+
rhs: &mut AssignmentRightHand<WithTokenSpan<Expression>>,
2324
diagnostics: &mut dyn DiagnosticHandler,
2425
) -> FatalResult {
2526
let ttyp = as_fatal(self.resolve_target(scope, target, assignment_type, diagnostics))?;
@@ -59,7 +60,7 @@ impl<'a> AnalyzeContext<'a> {
5960
pub fn analyze_waveform_assignment(
6061
&self,
6162
scope: &Scope<'a>,
62-
target: &mut WithPos<Target>,
63+
target: &mut WithTokenSpan<Target>,
6364
assignment_type: AssignmentType,
6465
rhs: &mut AssignmentRightHand<Waveform>,
6566
diagnostics: &mut dyn DiagnosticHandler,
@@ -124,7 +125,7 @@ impl<'a> AnalyzeContext<'a> {
124125
&self,
125126
scope: &Scope<'a>,
126127
ttyp: Option<TypeEnt<'a>>,
127-
expr: &mut WithPos<Expression>,
128+
expr: &mut WithTokenSpan<Expression>,
128129
diagnostics: &mut dyn DiagnosticHandler,
129130
) -> FatalResult {
130131
if let Some(ttyp) = ttyp {

0 commit comments

Comments
 (0)