17e2e9c0cSopenharmony_ciuse crate::internals::ast::Container;
27e2e9c0cSopenharmony_ciuse syn::{Path, PathArguments, Token};
37e2e9c0cSopenharmony_ci
47e2e9c0cSopenharmony_cipub fn this_type(cont: &Container) -> Path {
57e2e9c0cSopenharmony_ci    if let Some(remote) = cont.attrs.remote() {
67e2e9c0cSopenharmony_ci        let mut this = remote.clone();
77e2e9c0cSopenharmony_ci        for segment in &mut this.segments {
87e2e9c0cSopenharmony_ci            if let PathArguments::AngleBracketed(arguments) = &mut segment.arguments {
97e2e9c0cSopenharmony_ci                arguments.colon2_token = None;
107e2e9c0cSopenharmony_ci            }
117e2e9c0cSopenharmony_ci        }
127e2e9c0cSopenharmony_ci        this
137e2e9c0cSopenharmony_ci    } else {
147e2e9c0cSopenharmony_ci        Path::from(cont.ident.clone())
157e2e9c0cSopenharmony_ci    }
167e2e9c0cSopenharmony_ci}
177e2e9c0cSopenharmony_ci
187e2e9c0cSopenharmony_cipub fn this_value(cont: &Container) -> Path {
197e2e9c0cSopenharmony_ci    if let Some(remote) = cont.attrs.remote() {
207e2e9c0cSopenharmony_ci        let mut this = remote.clone();
217e2e9c0cSopenharmony_ci        for segment in &mut this.segments {
227e2e9c0cSopenharmony_ci            if let PathArguments::AngleBracketed(arguments) = &mut segment.arguments {
237e2e9c0cSopenharmony_ci                if arguments.colon2_token.is_none() {
247e2e9c0cSopenharmony_ci                    arguments.colon2_token = Some(Token![::](arguments.lt_token.span));
257e2e9c0cSopenharmony_ci                }
267e2e9c0cSopenharmony_ci            }
277e2e9c0cSopenharmony_ci        }
287e2e9c0cSopenharmony_ci        this
297e2e9c0cSopenharmony_ci    } else {
307e2e9c0cSopenharmony_ci        Path::from(cont.ident.clone())
317e2e9c0cSopenharmony_ci    }
327e2e9c0cSopenharmony_ci}
33