pub struct TypeScriptSupport { /* private fields */ }Expand description
A grammar confirmed to speak TypeScript, and the resolver that goes with it.
Separate from the oracle because probing is 8.4 µs of a 9.2 µs construction — 23
id_for_node_kind calls, each a linear scan over a 383-kind table. Paying that once per
run rather than once per query is what keeps the type surface from costing thirty host
crossings on every call, against a crossing §15.1 measures at ~302 ns.
Implementations§
Source§impl TypeScriptSupport
impl TypeScriptSupport
Sourcepub fn probe(language: &dyn Language) -> Option<Self>
pub fn probe(language: &dyn Language) -> Option<Self>
Confirm a grammar has the vocabulary the oracle reads, and take its resolver.
None in two cases, both of which would otherwise produce confident nonsense rather
than an error. A grammar that does not know the node kinds this oracle reads is not
TypeScript, whatever it calls itself. And a language with no resolver cannot say where
a name was declared, so the oracle could type no identifier at all — which would look
exactly like a file with nothing to say about it.
Trait Implementations§
Source§impl Clone for TypeScriptSupport
impl Clone for TypeScriptSupport
Source§fn clone(&self) -> TypeScriptSupport
fn clone(&self) -> TypeScriptSupport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more