From cc1e4b998acc523c62980e469f56f0572983e5be Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 19 Aug 2023 16:21:02 -0700 Subject: [PATCH] Remove some dead bridge code This was obviated after the AST was ported to Rust. --- fish-rust/src/parse_constants.rs | 40 +------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/fish-rust/src/parse_constants.rs b/fish-rust/src/parse_constants.rs index aa876d5cd..f090e66e2 100644 --- a/fish-rust/src/parse_constants.rs +++ b/fish-rust/src/parse_constants.rs @@ -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; - } - // 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 { - token_type_user_presentable_description(type_, keyword).to_ffi() -} - pub type ParseErrorList = Vec; #[derive(Clone)]