MCPcopy Create free account
hub / github.com/csskit/csskit / unexpected_function

Method unexpected_function

crates/css_ast/src/diagnostics.rs:64–75  ·  view source on GitHub ↗
(diagnostic: &Diagnostic, source: &str)

Source from the content-addressed store, hash-verified

62 }
63
64 fn unexpected_function(diagnostic: &Diagnostic, source: &str) -> DiagnosticMeta {
65 let cursor = diagnostic.start_cursor;
66 let start = cursor.offset().0 as usize;
67 let len = cursor.token().len() as usize;
68 let text = if start + len <= source.len() { &source[start..start + len] } else { "<unknown>" };
69 DiagnosticMeta {
70 code: "UnexpectedFunction",
71 message: format!("Unexpected function '{text}'()"),
72 help: "A function with this name wasn't expected in this position.".into(),
73 labels: vec![],
74 }
75 }
76
77 fn expected_unsigned(diagnostic: &Diagnostic, _source: &str) -> DiagnosticMeta {
78 DiagnosticMeta {

Callers

nothing calls this directly

Calls 3

offsetMethod · 0.45
lenMethod · 0.45
tokenMethod · 0.45

Tested by

no test coverage detected