tamer: obj::xmlo: Compile quickxml even with flag off

This was previous gated behind the negation of the wip-xmlo-xir-reader flag,
which meant that it was not being compiled or picked up by LSP.  Both of
those things are inconvenient and unideal.

DEV-10863
main
Mike Gerwitz 2021-11-04 12:35:08 -04:00
parent e494f3fdfd
commit d06f31b4d3
2 changed files with 3 additions and 88 deletions

View File

@ -22,7 +22,9 @@ use crate::sym::SymbolId;
use crate::tpwrap::quick_xml::{Error as XmlError, InnerXmlError};
use std::fmt::Display;
#[cfg(not(feature = "wip-xmlo-xir-reader"))]
// While the _use_ is gated, this isn't, to ensure that we still try to
// compile it while the flag is off (and so it's parsed by the language
// server).
mod quickxml;
#[cfg(not(feature = "wip-xmlo-xir-reader"))]

View File

@ -48,93 +48,6 @@
//! The next [`XmloEvent`] is retrieved using [`XmloReader::read_event`].
//! _You should stop reading at [`XmloEvent::Eoh`];_
//! reading the remainder of the object file has not yet been implemented.
//!
//! ```
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! use tamer::global;
//! use tamer::ir::legacyir::SymType;
//! use tamer::obj::xmlo::{XmloEvent, XmloReader};
//! use tamer::sym::{GlobalSymbolIntern, GlobalSymbolResolve};
//!
//! let xmlo = br#"<package name="foo">
//! <preproc:symtable>
//! <preproc:sym name="syma" type="class" />
//! <preproc:sym name="symb" type="cgen" />
//! </preproc:symtable>
//!
//! <preproc:sym-deps>
//! <preproc:sym-dep name="syma">
//! <preproc:sym-ref name="depa-1" />
//! <preproc:sym-ref name="depa-2" />
//! </preproc:sym-dep>
//! <preproc:sym-dep name="symb">
//! <preproc:sym-ref name="depb-1" />
//! </preproc:sym-dep>
//! </preproc:sym-deps>
//!
//! <preproc:fragments>
//! <preproc:fragment id="syma">syma text</preproc:fragment>
//! <preproc:fragment id="symb">symb text</preproc:fragment>
//! </preproc:fragments>
//! </package>"#;
//!
//! let mut reader = XmloReader::<_>::new(xmlo as &[u8]);
//!
//! let mut pkgname = None;
//! let mut syms = Vec::new();
//! let mut deps = Vec::new();
//! let mut fragments = Vec::new();
//!
//! loop {
//! match reader.read_event()? {
//! XmloEvent::Package(attrs) => pkgname = attrs.name,
//! XmloEvent::SymDecl(sym, attrs) => syms.push((sym, attrs.ty)),
//! XmloEvent::SymDeps(sym, symdeps) => deps.push((sym, symdeps)),
//! XmloEvent::Fragment(sym, text) =>
//! fragments.push((sym, text.lookup_str())),
//!
//! // Do not read past end of header.
//! XmloEvent::Eoh => break,
//! }
//! }
//!
//! let syma = "syma".intern();
//! let symb = "symb".intern();
//!
//! assert_eq!(Some("foo".intern()), pkgname);
//!
//! assert_eq!(
//! vec![
//! (syma, Some(SymType::Class)),
//! (symb, Some(SymType::Cgen)),
//! ],
//! syms
//! );
//!
//! assert_eq!(
//! vec![
//! (syma, vec![
//! "depa-1".intern(),
//! "depa-2".intern(),
//! ]),
//! (symb, vec![
//! "depb-1".intern(),
//! ]),
//! ],
//! deps
//! );
//!
//! assert_eq!(
//! vec![
//! (syma, "syma text"),
//! (symb, "symb text"),
//! ],
//! fragments
//! );
//!
//! # Ok(())
//! # }
//! ```
use super::{XmloError, XmloEvent, XmloResult};
use crate::ir::legacyir::{PackageAttrs, SymAttrs, SymType};