Implement a wrapper type for AST nodes.
This is to make it impossible to have a collision for attribute names that are real attributes vs attributes I've added for structure (like children and ast_node).
This commit is contained in:
@@ -5,6 +5,7 @@ use serde::Serialize;
|
||||
use super::additional_property::AdditionalProperties;
|
||||
use super::additional_property::AdditionalPropertyValue;
|
||||
use super::ast_node::WasmAstNode;
|
||||
use super::ast_node::WasmAstWrapper;
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
@@ -14,7 +15,7 @@ use crate::types::Document;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "__ast_node")]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub struct WasmDocument<'s, 'p> {
|
||||
#[serde(rename = "standard-properties")]
|
||||
@@ -85,3 +86,16 @@ impl<'s, 'p> ElispFact<'s> for WasmDocument<'s, 'p> {
|
||||
"org-data".into()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'b, 's, 'p> Into<WasmAstWrapper<'b, 's, 'p, &'b WasmDocument<'s, 'p>>>
|
||||
for &'b WasmDocument<'s, 'p>
|
||||
{
|
||||
fn into(self) -> WasmAstWrapper<'b, 's, 'p, &'b WasmDocument<'s, 'p>> {
|
||||
WasmAstWrapper::new(
|
||||
self.get_elisp_name(),
|
||||
&self.standard_properties,
|
||||
self,
|
||||
&self.children,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user