mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-03 06:41:14 -03:00
Cleanup ParserTestErrorBits harder
We don't need this bitwise operator override.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
use crate::prelude::*;
|
||||
use fish_fallback::{fish_wcswidth, fish_wcwidth};
|
||||
use std::ops::{BitOr, BitOrAssign};
|
||||
|
||||
pub type SourceOffset = u32;
|
||||
|
||||
@@ -47,23 +46,6 @@ impl ParseIssue {
|
||||
});
|
||||
}
|
||||
|
||||
// Allow | and |= to combine ParseIssues.
|
||||
impl BitOr for ParseIssue {
|
||||
type Output = Self;
|
||||
fn bitor(self, rhs: Self) -> Self {
|
||||
Self {
|
||||
error: self.error | rhs.error,
|
||||
incomplete: self.incomplete | rhs.incomplete,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl BitOrAssign for ParseIssue {
|
||||
fn bitor_assign(&mut self, rhs: Self) {
|
||||
*self = *self | rhs;
|
||||
}
|
||||
}
|
||||
|
||||
/// A range of source code.
|
||||
#[derive(PartialEq, Eq, Clone, Copy, Debug, Default)]
|
||||
pub struct SourceRange {
|
||||
|
||||
@@ -1228,7 +1228,8 @@ pub fn detect_parse_errors_in_ast(
|
||||
Kind::Argument(arg) => {
|
||||
let arg_src = arg.source(buff_src);
|
||||
if let Err(e) = detect_errors_in_argument(arg, arg_src, &mut out_errors) {
|
||||
issue |= e;
|
||||
issue.error |= e.error;
|
||||
issue.incomplete |= e.incomplete;
|
||||
}
|
||||
}
|
||||
Kind::JobPipeline(job) => {
|
||||
@@ -1481,10 +1482,12 @@ pub fn detect_errors_in_argument(
|
||||
out_errors,
|
||||
);
|
||||
let mut subst_errors = ParseErrorList::new();
|
||||
issue |=
|
||||
if let Err(e) =
|
||||
detect_parse_errors(&arg_src[parens.command()], Some(&mut subst_errors), false)
|
||||
.err()
|
||||
.unwrap_or_default();
|
||||
{
|
||||
issue.error |= e.error;
|
||||
issue.incomplete |= e.incomplete;
|
||||
}
|
||||
|
||||
// Our command substitution produced error offsets relative to its source. Tweak the
|
||||
// offsets of the errors in the command substitution to account for both its offset
|
||||
|
||||
Reference in New Issue
Block a user