MCPcopy Index your code
hub / github.com/endbasic/endbasic / start_pos

Method start_pos

core/src/ast.rs:159–194  ·  view source on GitHub ↗

Returns the start position of the expression.

(&self)

Source from the content-addressed store, hash-verified

157impl Expr {
158 /// Returns the start position of the expression.
159 pub fn start_pos(&self) -> LineCol {
160 let mut expr = self;
161 loop {
162 match expr {
163 Expr::Boolean(span) => return span.pos,
164 Expr::Double(span) => return span.pos,
165 Expr::Integer(span) => return span.pos,
166 Expr::Text(span) => return span.pos,
167
168 Expr::Symbol(span) => return span.pos,
169
170 Expr::Not(span) => return span.pos,
171 Expr::Negate(span) => return span.pos,
172
173 Expr::Call(span) => return span.vref_pos,
174
175 Expr::Add(span)
176 | Expr::And(span)
177 | Expr::Divide(span)
178 | Expr::Equal(span)
179 | Expr::Greater(span)
180 | Expr::GreaterEqual(span)
181 | Expr::Less(span)
182 | Expr::LessEqual(span)
183 | Expr::Modulo(span)
184 | Expr::Multiply(span)
185 | Expr::NotEqual(span)
186 | Expr::Or(span)
187 | Expr::Power(span)
188 | Expr::ShiftLeft(span)
189 | Expr::ShiftRight(span)
190 | Expr::Subtract(span)
191 | Expr::Xor(span) => expr = &span.lhs,
192 }
193 }
194 }
195}
196
197/// Represents type of an expression.

Callers 10

parse_forMethod · 0.80
compile_pending_opsFunction · 0.80
compile_expr_as_typeFunction · 0.80
compile_case_guardFunction · 0.80
compile_selectFunction · 0.80
compile_guardFunction · 0.80
compile_forFunction · 0.80
compile_ifFunction · 0.80
compile_whileFunction · 0.80
compile_argsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected