Remove some dead bridge code

This was obviated after the AST was ported to Rust.
This commit is contained in:
ridiculousfish
2023-08-19 16:21:02 -07:00
parent 0f19d7118b
commit cc1e4b998a

View File

@@ -3,7 +3,7 @@
use crate::ffi::{fish_wcswidth, fish_wcwidth, wcharz_t};
use crate::tokenizer::variable_assignment_equals_pos;
use crate::wchar::prelude::*;
use crate::wchar_ffi::{wcharz, AsWstr, WCharFromFFI, WCharToFFI};
use crate::wchar_ffi::{AsWstr, WCharFromFFI, WCharToFFI};
use bitflags::bitflags;
use cxx::{type_id, ExternType};
use cxx::{CxxWString, UniquePtr};
@@ -61,8 +61,6 @@ pub struct SourceRange {
fn contains_inclusive_ffi(self: &SourceRange, loc: u32) -> bool;
}
/// IMPORTANT: If the following enum table is modified you must also update token_type_description below.
/// TODO above comment can be removed when we drop the FFI and get real enums.
#[derive(Clone, Copy, Debug)]
pub enum ParseTokenType {
invalid = 1,
@@ -109,12 +107,6 @@ pub enum ParseKeyword {
kw_while,
}
extern "Rust" {
fn token_type_description(token_type: ParseTokenType) -> wcharz_t;
fn keyword_description(keyword: ParseKeyword) -> wcharz_t;
fn keyword_from_string(s: wcharz_t) -> ParseKeyword;
}
// Statement decorations like 'command' or 'exec'.
pub enum StatementDecoration {
none,
@@ -196,14 +188,6 @@ fn describe_with_prefix(
fn clear(self: &mut ParseErrorListFfi);
}
extern "Rust" {
#[cxx_name = "token_type_user_presentable_description"]
fn token_type_user_presentable_description_ffi(
type_: ParseTokenType,
keyword: ParseKeyword,
) -> UniquePtr<CxxWString>;
}
// The location of a pipeline.
pub enum PipelinePosition {
none, // not part of a pipeline
@@ -289,11 +273,6 @@ fn from(token_type: ParseTokenType) -> Self {
}
}
fn token_type_description(token_type: ParseTokenType) -> wcharz_t {
let s: &'static wstr = token_type.into();
wcharz!(s)
}
impl Default for ParseKeyword {
fn default() -> Self {
ParseKeyword::none
@@ -333,11 +312,6 @@ fn to_arg(self) -> printf_compat::args::Arg<'static> {
}
}
fn keyword_description(keyword: ParseKeyword) -> wcharz_t {
let s: &'static wstr = keyword.into();
wcharz!(s)
}
impl From<&wstr> for ParseKeyword {
#[widestrs]
fn from(s: &wstr) -> Self {
@@ -365,11 +339,6 @@ fn from(s: &wstr) -> Self {
}
}
fn keyword_from_string<'a>(s: impl Into<&'a wstr>) -> ParseKeyword {
let s: &wstr = s.into();
ParseKeyword::from(s)
}
impl Default for ParseErrorCode {
fn default() -> Self {
ParseErrorCode::none
@@ -608,13 +577,6 @@ pub fn token_type_user_presentable_description(
}
}
fn token_type_user_presentable_description_ffi(
type_: ParseTokenType,
keyword: ParseKeyword,
) -> UniquePtr<CxxWString> {
token_type_user_presentable_description(type_, keyword).to_ffi()
}
pub type ParseErrorList = Vec<ParseError>;
#[derive(Clone)]