-
-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ast): remove serde skip for symbol_id and reference_id (#2220)
We want to see symbol_id and reference_id in ast
- Loading branch information
Showing
9 changed files
with
60 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use bitflags::bitflags; | ||
use oxc_index::define_index_type; | ||
|
||
define_index_type! { | ||
pub struct AstNodeId = usize; | ||
} | ||
|
||
#[cfg_attr( | ||
all(feature = "serde", feature = "wasm"), | ||
wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section) | ||
)] | ||
const TS_APPEND_CONTENT: &'static str = r#" | ||
export type AstNodeId = number; | ||
export type NodeFlags = { | ||
JSDoc: 1, | ||
Class: 2, | ||
HasYield: 4 | ||
}; | ||
"#; | ||
|
||
bitflags! { | ||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] | ||
pub struct NodeFlags: u8 { | ||
const JSDoc = 1 << 0; // If the Node has a JSDoc comment attached | ||
const Class = 1 << 1; // If Node is inside a class | ||
const HasYield = 1 << 2; // If function has yield statement | ||
|
||
} | ||
} | ||
|
||
impl NodeFlags { | ||
pub fn has_jsdoc(&self) -> bool { | ||
self.contains(Self::JSDoc) | ||
} | ||
|
||
pub fn has_class(&self) -> bool { | ||
self.contains(Self::Class) | ||
} | ||
|
||
pub fn has_yield(&self) -> bool { | ||
self.contains(Self::HasYield) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters