mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
migrate to untyped rowan
This commit is contained in:
parent
ac6ab07587
commit
faf526e021
10 changed files with 192 additions and 158 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -1088,7 +1088,7 @@ dependencies = [
|
|||
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ra_parser 0.1.0",
|
||||
"ra_text_edit 0.1.0",
|
||||
"rowan 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rowan 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smol_str 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"test_utils 0.1.0",
|
||||
"text_unit 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1309,7 +1309,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rowan"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"colosseum 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1975,7 +1975,7 @@ dependencies = [
|
|||
"checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c"
|
||||
"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"
|
||||
"checksum ron 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "17f52a24414403f81528b67488cf8edc4eda977d3af1646bb6b106a600ead78f"
|
||||
"checksum rowan 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "397cd19c109641f10f3c66433440285e232d8cbd37406cf8f944a15ab1e63a8e"
|
||||
"checksum rowan 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91237e0f16ac1073139acd696d9d386c3225ba1d6eafc09b105984905994068d"
|
||||
"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619"
|
||||
"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8"
|
||||
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||
|
|
|
@ -7,6 +7,7 @@ use super::SyntaxInfo;
|
|||
|
||||
/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[repr(u16)]
|
||||
pub enum SyntaxKind {
|
||||
// Technical SyntaxKinds: they appear temporally during parsing,
|
||||
// but never end up in the final tree
|
||||
|
@ -230,9 +231,25 @@ pub enum SyntaxKind {
|
|||
ARG_LIST,
|
||||
TYPE_BOUND,
|
||||
TYPE_BOUND_LIST,
|
||||
// Technical kind so that we can cast from u16 safely
|
||||
#[doc(hidden)]
|
||||
__LAST,
|
||||
}
|
||||
use self::SyntaxKind::*;
|
||||
|
||||
impl From<u16> for SyntaxKind {
|
||||
fn from(d: u16) -> SyntaxKind {
|
||||
assert!(d <= (__LAST as u16));
|
||||
unsafe { std::mem::transmute::<u16, SyntaxKind>(d) }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SyntaxKind> for u16 {
|
||||
fn from(k: SyntaxKind) -> u16 {
|
||||
k as u16
|
||||
}
|
||||
}
|
||||
|
||||
impl SyntaxKind {
|
||||
pub fn is_keyword(self) -> bool {
|
||||
match self {
|
||||
|
@ -573,6 +590,7 @@ impl SyntaxKind {
|
|||
TYPE_BOUND_LIST => &SyntaxInfo { name: "TYPE_BOUND_LIST" },
|
||||
TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" },
|
||||
EOF => &SyntaxInfo { name: "EOF" },
|
||||
__LAST => &SyntaxInfo { name: "__LAST" },
|
||||
}
|
||||
}
|
||||
pub fn from_keyword(ident: &str) -> Option<SyntaxKind> {
|
||||
|
|
|
@ -9,6 +9,7 @@ use super::SyntaxInfo;
|
|||
|
||||
/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[repr(u16)]
|
||||
pub enum SyntaxKind {
|
||||
// Technical SyntaxKinds: they appear temporally during parsing,
|
||||
// but never end up in the final tree
|
||||
|
@ -26,9 +27,25 @@ pub enum SyntaxKind {
|
|||
{% for t in concat(a=literals, b=tokens, c=nodes) %}
|
||||
{{t}},
|
||||
{%- endfor %}
|
||||
// Technical kind so that we can cast from u16 safely
|
||||
#[doc(hidden)]
|
||||
__LAST,
|
||||
}
|
||||
use self::SyntaxKind::*;
|
||||
|
||||
impl From<u16> for SyntaxKind {
|
||||
fn from(d: u16) -> SyntaxKind {
|
||||
assert!(d <= (__LAST as u16));
|
||||
unsafe { std::mem::transmute::<u16, SyntaxKind>(d) }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SyntaxKind> for u16 {
|
||||
fn from(k: SyntaxKind) -> u16 {
|
||||
k as u16
|
||||
}
|
||||
}
|
||||
|
||||
impl SyntaxKind {
|
||||
pub fn is_keyword(self) -> bool {
|
||||
match self {
|
||||
|
@ -72,6 +89,7 @@ impl SyntaxKind {
|
|||
{%- endfor %}
|
||||
TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" },
|
||||
EOF => &SyntaxInfo { name: "EOF" },
|
||||
__LAST => &SyntaxInfo { name: "__LAST" },
|
||||
}
|
||||
}
|
||||
pub fn from_keyword(ident: &str) -> Option<SyntaxKind> {
|
||||
|
|
|
@ -13,7 +13,7 @@ unicode-xid = "0.1.0"
|
|||
itertools = "0.8.0"
|
||||
drop_bomb = "0.1.4"
|
||||
parking_lot = "0.7.0"
|
||||
rowan = "0.4.0"
|
||||
rowan = "0.5.0"
|
||||
|
||||
# ideally, `serde` should be enabled by `ra_lsp_server`, but we enable it here
|
||||
# to reduce number of compilations
|
||||
|
|
|
@ -9,7 +9,7 @@ mod expr_extensions;
|
|||
use std::marker::PhantomData;
|
||||
|
||||
use crate::{
|
||||
syntax_node::{SyntaxNode, SyntaxNodeChildren, TreeArc, RaTypes, SyntaxToken},
|
||||
syntax_node::{SyntaxNode, SyntaxNodeChildren, TreeArc, SyntaxToken},
|
||||
SmolStr,
|
||||
};
|
||||
|
||||
|
@ -26,7 +26,7 @@ pub use self::{
|
|||
/// the same representation: a pointer to the tree root and a pointer to the
|
||||
/// node itself.
|
||||
pub trait AstNode:
|
||||
rowan::TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>> + ToOwned<Owned = TreeArc<Self>>
|
||||
rowan::TransparentNewType<Repr = rowan::SyntaxNode> + ToOwned<Owned = TreeArc<Self>>
|
||||
{
|
||||
fn cast(syntax: &SyntaxNode) -> Option<&Self>
|
||||
where
|
||||
|
|
|
@ -13,7 +13,7 @@ use rowan::TransparentNewType;
|
|||
|
||||
use crate::{
|
||||
SyntaxNode, SyntaxKind::*,
|
||||
syntax_node::{RaTypes, TreeArc},
|
||||
syntax_node::{TreeArc},
|
||||
ast::{self, AstNode},
|
||||
};
|
||||
|
||||
|
@ -24,7 +24,7 @@ pub struct Alias {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Alias {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for Alias {
|
||||
|
@ -53,7 +53,7 @@ pub struct ArgList {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ArgList {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ArgList {
|
||||
|
@ -85,7 +85,7 @@ pub struct ArrayExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ArrayExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ArrayExpr {
|
||||
|
@ -117,7 +117,7 @@ pub struct ArrayType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ArrayType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ArrayType {
|
||||
|
@ -153,7 +153,7 @@ pub struct AssocTypeArg {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for AssocTypeArg {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for AssocTypeArg {
|
||||
|
@ -189,7 +189,7 @@ pub struct Attr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Attr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for Attr {
|
||||
|
@ -221,7 +221,7 @@ pub struct BinExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for BinExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for BinExpr {
|
||||
|
@ -249,7 +249,7 @@ pub struct BindPat {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for BindPat {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for BindPat {
|
||||
|
@ -282,7 +282,7 @@ pub struct Block {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Block {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for Block {
|
||||
|
@ -319,7 +319,7 @@ pub struct BlockExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for BlockExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for BlockExpr {
|
||||
|
@ -351,7 +351,7 @@ pub struct BreakExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for BreakExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for BreakExpr {
|
||||
|
@ -383,7 +383,7 @@ pub struct CallExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for CallExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for CallExpr {
|
||||
|
@ -416,7 +416,7 @@ pub struct CastExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for CastExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for CastExpr {
|
||||
|
@ -452,7 +452,7 @@ pub struct Condition {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Condition {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for Condition {
|
||||
|
@ -488,7 +488,7 @@ pub struct ConstDef {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ConstDef {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ConstDef {
|
||||
|
@ -526,7 +526,7 @@ pub struct ContinueExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ContinueExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ContinueExpr {
|
||||
|
@ -554,7 +554,7 @@ pub struct DynTraitType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for DynTraitType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for DynTraitType {
|
||||
|
@ -583,7 +583,7 @@ pub struct EnumDef {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for EnumDef {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for EnumDef {
|
||||
|
@ -620,7 +620,7 @@ pub struct EnumVariant {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for EnumVariant {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for EnumVariant {
|
||||
|
@ -655,7 +655,7 @@ pub struct EnumVariantList {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for EnumVariantList {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for EnumVariantList {
|
||||
|
@ -687,7 +687,7 @@ pub struct Expr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Expr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -950,7 +950,7 @@ pub struct ExprStmt {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ExprStmt {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ExprStmt {
|
||||
|
@ -982,7 +982,7 @@ pub struct ExternCrateItem {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ExternCrateItem {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ExternCrateItem {
|
||||
|
@ -1018,7 +1018,7 @@ pub struct FieldExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for FieldExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for FieldExpr {
|
||||
|
@ -1054,7 +1054,7 @@ pub struct FieldPat {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for FieldPat {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for FieldPat {
|
||||
|
@ -1087,7 +1087,7 @@ pub struct FieldPatList {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for FieldPatList {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for FieldPatList {
|
||||
|
@ -1123,7 +1123,7 @@ pub struct FnDef {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for FnDef {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for FnDef {
|
||||
|
@ -1168,7 +1168,7 @@ pub struct FnPointerType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for FnPointerType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for FnPointerType {
|
||||
|
@ -1204,7 +1204,7 @@ pub struct ForExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ForExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ForExpr {
|
||||
|
@ -1241,7 +1241,7 @@ pub struct ForType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ForType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ForType {
|
||||
|
@ -1273,7 +1273,7 @@ pub struct IfExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for IfExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for IfExpr {
|
||||
|
@ -1305,7 +1305,7 @@ pub struct ImplBlock {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ImplBlock {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ImplBlock {
|
||||
|
@ -1338,7 +1338,7 @@ pub struct ImplItem {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ImplItem {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -1401,7 +1401,7 @@ pub struct ImplTraitType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ImplTraitType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ImplTraitType {
|
||||
|
@ -1430,7 +1430,7 @@ pub struct IndexExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for IndexExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for IndexExpr {
|
||||
|
@ -1458,7 +1458,7 @@ pub struct ItemList {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ItemList {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ItemList {
|
||||
|
@ -1492,7 +1492,7 @@ pub struct Label {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Label {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for Label {
|
||||
|
@ -1520,7 +1520,7 @@ pub struct LambdaExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for LambdaExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for LambdaExpr {
|
||||
|
@ -1556,7 +1556,7 @@ pub struct LetStmt {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for LetStmt {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for LetStmt {
|
||||
|
@ -1593,7 +1593,7 @@ pub struct LifetimeArg {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for LifetimeArg {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for LifetimeArg {
|
||||
|
@ -1621,7 +1621,7 @@ pub struct LifetimeParam {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for LifetimeParam {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for LifetimeParam {
|
||||
|
@ -1650,7 +1650,7 @@ pub struct Literal {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Literal {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for Literal {
|
||||
|
@ -1678,7 +1678,7 @@ pub struct LiteralPat {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for LiteralPat {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for LiteralPat {
|
||||
|
@ -1710,7 +1710,7 @@ pub struct LoopExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for LoopExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for LoopExpr {
|
||||
|
@ -1739,7 +1739,7 @@ pub struct MacroCall {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for MacroCall {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for MacroCall {
|
||||
|
@ -1777,7 +1777,7 @@ pub struct MatchArm {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for MatchArm {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for MatchArm {
|
||||
|
@ -1818,7 +1818,7 @@ pub struct MatchArmList {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for MatchArmList {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for MatchArmList {
|
||||
|
@ -1851,7 +1851,7 @@ pub struct MatchExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for MatchExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for MatchExpr {
|
||||
|
@ -1887,7 +1887,7 @@ pub struct MatchGuard {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for MatchGuard {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for MatchGuard {
|
||||
|
@ -1919,7 +1919,7 @@ pub struct MethodCallExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for MethodCallExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for MethodCallExpr {
|
||||
|
@ -1960,7 +1960,7 @@ pub struct Module {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Module {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for Module {
|
||||
|
@ -1996,7 +1996,7 @@ pub struct ModuleItem {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ModuleItem {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -2123,7 +2123,7 @@ pub struct Name {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Name {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for Name {
|
||||
|
@ -2151,7 +2151,7 @@ pub struct NameRef {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for NameRef {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for NameRef {
|
||||
|
@ -2179,7 +2179,7 @@ pub struct NamedField {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for NamedField {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for NamedField {
|
||||
|
@ -2215,7 +2215,7 @@ pub struct NamedFieldDef {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for NamedFieldDef {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for NamedFieldDef {
|
||||
|
@ -2248,7 +2248,7 @@ pub struct NamedFieldDefList {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for NamedFieldDefList {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for NamedFieldDefList {
|
||||
|
@ -2280,7 +2280,7 @@ pub struct NamedFieldList {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for NamedFieldList {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for NamedFieldList {
|
||||
|
@ -2312,7 +2312,7 @@ pub struct NeverType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for NeverType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for NeverType {
|
||||
|
@ -2340,7 +2340,7 @@ pub struct NominalDef {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for NominalDef {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -2398,7 +2398,7 @@ pub struct Param {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Param {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for Param {
|
||||
|
@ -2431,7 +2431,7 @@ pub struct ParamList {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ParamList {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ParamList {
|
||||
|
@ -2467,7 +2467,7 @@ pub struct ParenExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ParenExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ParenExpr {
|
||||
|
@ -2499,7 +2499,7 @@ pub struct ParenType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ParenType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ParenType {
|
||||
|
@ -2531,7 +2531,7 @@ pub struct Pat {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Pat {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -2650,7 +2650,7 @@ pub struct Path {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Path {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for Path {
|
||||
|
@ -2686,7 +2686,7 @@ pub struct PathExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for PathExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for PathExpr {
|
||||
|
@ -2718,7 +2718,7 @@ pub struct PathPat {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for PathPat {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for PathPat {
|
||||
|
@ -2750,7 +2750,7 @@ pub struct PathSegment {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for PathSegment {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for PathSegment {
|
||||
|
@ -2786,7 +2786,7 @@ pub struct PathType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for PathType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for PathType {
|
||||
|
@ -2818,7 +2818,7 @@ pub struct PlaceholderPat {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for PlaceholderPat {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for PlaceholderPat {
|
||||
|
@ -2846,7 +2846,7 @@ pub struct PlaceholderType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for PlaceholderType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for PlaceholderType {
|
||||
|
@ -2874,7 +2874,7 @@ pub struct PointerType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for PointerType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for PointerType {
|
||||
|
@ -2906,7 +2906,7 @@ pub struct PosFieldDef {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for PosFieldDef {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for PosFieldDef {
|
||||
|
@ -2940,7 +2940,7 @@ pub struct PosFieldDefList {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for PosFieldDefList {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for PosFieldDefList {
|
||||
|
@ -2972,7 +2972,7 @@ pub struct PrefixExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for PrefixExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for PrefixExpr {
|
||||
|
@ -3004,7 +3004,7 @@ pub struct RangeExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for RangeExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for RangeExpr {
|
||||
|
@ -3032,7 +3032,7 @@ pub struct RangePat {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for RangePat {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for RangePat {
|
||||
|
@ -3060,7 +3060,7 @@ pub struct RefExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for RefExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for RefExpr {
|
||||
|
@ -3092,7 +3092,7 @@ pub struct RefPat {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for RefPat {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for RefPat {
|
||||
|
@ -3124,7 +3124,7 @@ pub struct ReferenceType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ReferenceType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ReferenceType {
|
||||
|
@ -3156,7 +3156,7 @@ pub struct RetType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for RetType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for RetType {
|
||||
|
@ -3188,7 +3188,7 @@ pub struct ReturnExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for ReturnExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for ReturnExpr {
|
||||
|
@ -3220,7 +3220,7 @@ pub struct SelfParam {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for SelfParam {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for SelfParam {
|
||||
|
@ -3249,7 +3249,7 @@ pub struct SlicePat {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for SlicePat {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for SlicePat {
|
||||
|
@ -3277,7 +3277,7 @@ pub struct SliceType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for SliceType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for SliceType {
|
||||
|
@ -3309,7 +3309,7 @@ pub struct SourceFile {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for SourceFile {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for SourceFile {
|
||||
|
@ -3343,7 +3343,7 @@ pub struct StaticDef {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for StaticDef {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for StaticDef {
|
||||
|
@ -3381,7 +3381,7 @@ pub struct Stmt {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Stmt {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -3436,7 +3436,7 @@ pub struct StructDef {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for StructDef {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for StructDef {
|
||||
|
@ -3469,7 +3469,7 @@ pub struct StructLit {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for StructLit {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for StructLit {
|
||||
|
@ -3509,7 +3509,7 @@ pub struct StructPat {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for StructPat {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for StructPat {
|
||||
|
@ -3545,7 +3545,7 @@ pub struct TokenTree {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TokenTree {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TokenTree {
|
||||
|
@ -3573,7 +3573,7 @@ pub struct TraitDef {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TraitDef {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TraitDef {
|
||||
|
@ -3611,7 +3611,7 @@ pub struct TryExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TryExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TryExpr {
|
||||
|
@ -3643,7 +3643,7 @@ pub struct TupleExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TupleExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TupleExpr {
|
||||
|
@ -3675,7 +3675,7 @@ pub struct TuplePat {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TuplePat {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TuplePat {
|
||||
|
@ -3707,7 +3707,7 @@ pub struct TupleStructPat {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TupleStructPat {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TupleStructPat {
|
||||
|
@ -3743,7 +3743,7 @@ pub struct TupleType {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TupleType {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TupleType {
|
||||
|
@ -3775,7 +3775,7 @@ pub struct TypeAliasDef {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TypeAliasDef {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TypeAliasDef {
|
||||
|
@ -3813,7 +3813,7 @@ pub struct TypeArg {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TypeArg {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TypeArg {
|
||||
|
@ -3845,7 +3845,7 @@ pub struct TypeArgList {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TypeArgList {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TypeArgList {
|
||||
|
@ -3885,7 +3885,7 @@ pub struct TypeBound {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TypeBound {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TypeBound {
|
||||
|
@ -3917,7 +3917,7 @@ pub struct TypeBoundList {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TypeBoundList {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TypeBoundList {
|
||||
|
@ -3949,7 +3949,7 @@ pub struct TypeParam {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TypeParam {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TypeParam {
|
||||
|
@ -3980,7 +3980,7 @@ pub struct TypeParamList {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TypeParamList {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for TypeParamList {
|
||||
|
@ -4016,7 +4016,7 @@ pub struct TypeRef {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for TypeRef {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -4159,7 +4159,7 @@ pub struct UseItem {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for UseItem {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for UseItem {
|
||||
|
@ -4192,7 +4192,7 @@ pub struct UseTree {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for UseTree {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for UseTree {
|
||||
|
@ -4232,7 +4232,7 @@ pub struct UseTreeList {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for UseTreeList {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for UseTreeList {
|
||||
|
@ -4264,7 +4264,7 @@ pub struct Visibility {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for Visibility {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for Visibility {
|
||||
|
@ -4292,7 +4292,7 @@ pub struct WhereClause {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for WhereClause {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for WhereClause {
|
||||
|
@ -4324,7 +4324,7 @@ pub struct WherePred {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for WherePred {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for WherePred {
|
||||
|
@ -4357,7 +4357,7 @@ pub struct WhileExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for WhileExpr {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for WhileExpr {
|
||||
|
|
|
@ -15,7 +15,7 @@ use rowan::TransparentNewType;
|
|||
|
||||
use crate::{
|
||||
SyntaxNode, SyntaxKind::*,
|
||||
syntax_node::{RaTypes, TreeArc},
|
||||
syntax_node::{TreeArc},
|
||||
ast::{self, AstNode},
|
||||
};
|
||||
{% for node, methods in ast %}
|
||||
|
@ -28,7 +28,7 @@ pub struct {{ node }} {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for {{ node }} {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -81,7 +81,7 @@ pub struct {{ node }} {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
unsafe impl TransparentNewType for {{ node }} {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl AstNode for {{ node }} {
|
||||
|
|
|
@ -79,7 +79,7 @@ impl SourceFile {
|
|||
}
|
||||
|
||||
pub fn errors(&self) -> Vec<SyntaxError> {
|
||||
let mut errors = self.syntax.root_data().clone();
|
||||
let mut errors = self.syntax.root_data().to_vec();
|
||||
errors.extend(validation::validate(self));
|
||||
errors
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ fn reparse_token<'node>(
|
|||
}
|
||||
}
|
||||
|
||||
let new_token = GreenToken::new(token.kind(), text.into());
|
||||
let new_token = GreenToken::new(rowan::SyntaxKind(token.kind().into()), text.into());
|
||||
Some((token.replace_with(new_token), token.range()))
|
||||
}
|
||||
_ => None,
|
||||
|
|
|
@ -8,11 +8,12 @@
|
|||
|
||||
use std::{
|
||||
fmt::{self, Write},
|
||||
any::Any,
|
||||
borrow::Borrow,
|
||||
};
|
||||
|
||||
use ra_parser::ParseError;
|
||||
use rowan::{Types, TransparentNewType, GreenNodeBuilder};
|
||||
use rowan::{TransparentNewType, GreenNodeBuilder};
|
||||
|
||||
use crate::{
|
||||
SmolStr, SyntaxKind, TextUnit, TextRange, SyntaxText, SourceFile, AstNode,
|
||||
|
@ -20,26 +21,15 @@ use crate::{
|
|||
};
|
||||
|
||||
pub use rowan::WalkEvent;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum RaTypes {}
|
||||
impl Types for RaTypes {
|
||||
type Kind = SyntaxKind;
|
||||
type RootData = Vec<SyntaxError>;
|
||||
}
|
||||
|
||||
pub(crate) type GreenNode = rowan::GreenNode<RaTypes>;
|
||||
pub(crate) type GreenToken = rowan::GreenToken<RaTypes>;
|
||||
#[allow(unused)]
|
||||
pub(crate) type GreenElement = rowan::GreenElement<RaTypes>;
|
||||
pub(crate) use rowan::{GreenNode, GreenToken};
|
||||
|
||||
/// Marker trait for CST and AST nodes
|
||||
pub trait SyntaxNodeWrapper: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>> {}
|
||||
impl<T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>> SyntaxNodeWrapper for T {}
|
||||
pub trait SyntaxNodeWrapper: TransparentNewType<Repr = rowan::SyntaxNode> {}
|
||||
impl<T: TransparentNewType<Repr = rowan::SyntaxNode>> SyntaxNodeWrapper for T {}
|
||||
|
||||
/// An owning smart pointer for CST or AST node.
|
||||
#[derive(PartialEq, Eq, Hash)]
|
||||
pub struct TreeArc<T: SyntaxNodeWrapper>(pub(crate) rowan::TreeArc<RaTypes, T>);
|
||||
pub struct TreeArc<T: SyntaxNodeWrapper>(pub(crate) rowan::TreeArc<T>);
|
||||
|
||||
impl<T: SyntaxNodeWrapper> Borrow<T> for TreeArc<T> {
|
||||
fn borrow(&self) -> &T {
|
||||
|
@ -101,9 +91,9 @@ where
|
|||
|
||||
#[derive(PartialEq, Eq, Hash)]
|
||||
#[repr(transparent)]
|
||||
pub struct SyntaxNode(pub(crate) rowan::SyntaxNode<RaTypes>);
|
||||
pub struct SyntaxNode(pub(crate) rowan::SyntaxNode);
|
||||
unsafe impl TransparentNewType for SyntaxNode {
|
||||
type Repr = rowan::SyntaxNode<RaTypes>;
|
||||
type Repr = rowan::SyntaxNode;
|
||||
}
|
||||
|
||||
impl ToOwned for SyntaxNode {
|
||||
|
@ -134,12 +124,14 @@ pub enum Direction {
|
|||
|
||||
impl SyntaxNode {
|
||||
pub(crate) fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreeArc<SyntaxNode> {
|
||||
let errors: Option<Box<Any + Send + Sync>> =
|
||||
if errors.is_empty() { None } else { Some(Box::new(errors)) };
|
||||
let ptr = TreeArc(rowan::SyntaxNode::new(green, errors));
|
||||
TreeArc::cast(ptr)
|
||||
}
|
||||
|
||||
pub fn kind(&self) -> SyntaxKind {
|
||||
self.0.kind()
|
||||
self.0.kind().0.into()
|
||||
}
|
||||
|
||||
pub fn range(&self) -> TextRange {
|
||||
|
@ -303,8 +295,14 @@ impl SyntaxNode {
|
|||
buf
|
||||
}
|
||||
|
||||
pub(crate) fn root_data(&self) -> &Vec<SyntaxError> {
|
||||
self.0.root_data()
|
||||
pub(crate) fn root_data(&self) -> &[SyntaxError] {
|
||||
match self.0.root_data() {
|
||||
None => &[],
|
||||
Some(data) => {
|
||||
let data: &Vec<SyntaxError> = std::any::Any::downcast_ref(data).unwrap();
|
||||
data.as_slice()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn replace_with(&self, replacement: GreenNode) -> GreenNode {
|
||||
|
@ -313,7 +311,7 @@ impl SyntaxNode {
|
|||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct SyntaxToken<'a>(pub(crate) rowan::SyntaxToken<'a, RaTypes>);
|
||||
pub struct SyntaxToken<'a>(pub(crate) rowan::SyntaxToken<'a>);
|
||||
|
||||
//FIXME: always output text
|
||||
impl<'a> fmt::Debug for SyntaxToken<'a> {
|
||||
|
@ -339,15 +337,15 @@ impl<'a> fmt::Display for SyntaxToken<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> From<rowan::SyntaxToken<'a, RaTypes>> for SyntaxToken<'a> {
|
||||
fn from(t: rowan::SyntaxToken<'a, RaTypes>) -> Self {
|
||||
impl<'a> From<rowan::SyntaxToken<'a>> for SyntaxToken<'a> {
|
||||
fn from(t: rowan::SyntaxToken<'a>) -> Self {
|
||||
SyntaxToken(t)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> SyntaxToken<'a> {
|
||||
pub fn kind(&self) -> SyntaxKind {
|
||||
self.0.kind()
|
||||
self.0.kind().0.into()
|
||||
}
|
||||
|
||||
pub fn text(&self) -> &'a SmolStr {
|
||||
|
@ -454,8 +452,8 @@ impl<'a> SyntaxElement<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> From<rowan::SyntaxElement<'a, RaTypes>> for SyntaxElement<'a> {
|
||||
fn from(el: rowan::SyntaxElement<'a, RaTypes>) -> Self {
|
||||
impl<'a> From<rowan::SyntaxElement<'a>> for SyntaxElement<'a> {
|
||||
fn from(el: rowan::SyntaxElement<'a>) -> Self {
|
||||
match el {
|
||||
rowan::SyntaxElement::Node(n) => SyntaxElement::Node(SyntaxNode::from_repr(n)),
|
||||
rowan::SyntaxElement::Token(t) => SyntaxElement::Token(t.into()),
|
||||
|
@ -485,7 +483,7 @@ impl<'a> SyntaxElement<'a> {
|
|||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SyntaxNodeChildren<'a>(rowan::SyntaxNodeChildren<'a, RaTypes>);
|
||||
pub struct SyntaxNodeChildren<'a>(rowan::SyntaxNodeChildren<'a>);
|
||||
|
||||
impl<'a> Iterator for SyntaxNodeChildren<'a> {
|
||||
type Item = &'a SyntaxNode;
|
||||
|
@ -496,7 +494,7 @@ impl<'a> Iterator for SyntaxNodeChildren<'a> {
|
|||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct SyntaxElementChildren<'a>(rowan::SyntaxElementChildren<'a, RaTypes>);
|
||||
pub struct SyntaxElementChildren<'a>(rowan::SyntaxElementChildren<'a>);
|
||||
|
||||
impl<'a> Iterator for SyntaxElementChildren<'a> {
|
||||
type Item = SyntaxElement<'a>;
|
||||
|
@ -508,7 +506,7 @@ impl<'a> Iterator for SyntaxElementChildren<'a> {
|
|||
|
||||
pub struct SyntaxTreeBuilder {
|
||||
errors: Vec<SyntaxError>,
|
||||
inner: GreenNodeBuilder<RaTypes>,
|
||||
inner: GreenNodeBuilder,
|
||||
}
|
||||
|
||||
impl Default for SyntaxTreeBuilder {
|
||||
|
@ -533,11 +531,11 @@ impl SyntaxTreeBuilder {
|
|||
}
|
||||
|
||||
pub fn token(&mut self, kind: SyntaxKind, text: SmolStr) {
|
||||
self.inner.token(kind, text)
|
||||
self.inner.token(rowan::SyntaxKind(kind.into()), text)
|
||||
}
|
||||
|
||||
pub fn start_node(&mut self, kind: SyntaxKind) {
|
||||
self.inner.start_node(kind)
|
||||
self.inner.start_node(rowan::SyntaxKind(kind.into()))
|
||||
}
|
||||
|
||||
pub fn finish_node(&mut self) {
|
||||
|
|
Loading…
Reference in a new issue