Inline vector element check
These will need to diverge shortly; in particular we'd like to support
Rust vectors containing Rust strings and C++ vectors containing C++
strings.
diff --git a/syntax/check.rs b/syntax/check.rs
index 090a9ae..fd5ed67 100644
--- a/syntax/check.rs
+++ b/syntax/check.rs
@@ -97,9 +97,10 @@
}
match Atom::from(ident) {
- Some(atom) if is_valid_vector_element(atom) => return,
- None => return,
- _ => {}
+ None | Some(U8) | Some(U16) | Some(U32) | Some(U64) | Some(Usize) | Some(I8)
+ | Some(I16) | Some(I32) | Some(I64) | Some(Isize) | Some(F32) | Some(F64) => return,
+ Some(Bool) | Some(RustString) => { /* todo */ }
+ Some(CxxString) => {}
}
}
@@ -133,9 +134,10 @@
}
match Atom::from(ident) {
- Some(atom) if is_valid_vector_element(atom) => return,
- None => return,
- _ => {}
+ None | Some(U8) | Some(U16) | Some(U32) | Some(U64) | Some(Usize) | Some(I8)
+ | Some(I16) | Some(I32) | Some(I64) | Some(Isize) | Some(F32) | Some(F64) => return,
+ Some(CxxString) => { /* todo */ }
+ Some(Bool) | Some(RustString) => {}
}
}
@@ -302,13 +304,6 @@
ident == CxxString || cx.types.cxx.contains(ident) || cx.types.rust.contains(ident)
}
-fn is_valid_vector_element(atom: Atom) -> bool {
- match atom {
- U8 | U16 | U32 | U64 | Usize | I8 | I16 | I32 | I64 | Isize | F32 | F64 => true,
- Bool | CxxString | RustString => false,
- }
-}
-
fn span_for_struct_error(strct: &Struct) -> TokenStream {
let struct_token = strct.struct_token;
let mut brace_token = Group::new(Delimiter::Brace, TokenStream::new());