@@ -45,14 +45,14 @@ impl<'input> CssParser<'input> {
4545 self . locations . pop ( ) . unwrap ( ) . combine_with ( self . previous_token . 1 . clone ( ) )
4646 }
4747
48- fn add_syntax_error ( & self , location : & Location , kind : DiagnosticKind , arguments : Vec < DiagnosticArgument > ) {
48+ fn add_syntax_error ( & self , location : & Location , kind : DiagnosticKind , arguments : Vec < Rc < dyn DiagnosticArgument > > ) {
4949 if self . compilation_unit ( ) . prevent_equal_offset_error ( location) {
5050 return ;
5151 }
5252 self . compilation_unit ( ) . add_diagnostic ( Diagnostic :: new_syntax_error ( location, kind, arguments) ) ;
5353 }
5454
55- fn _patch_syntax_error ( & self , original : DiagnosticKind , location : & Location , kind : DiagnosticKind , arguments : Vec < DiagnosticArgument > ) {
55+ fn _patch_syntax_error ( & self , original : DiagnosticKind , location : & Location , kind : DiagnosticKind , arguments : Vec < Rc < dyn DiagnosticArgument > > ) {
5656 if self . compilation_unit ( ) . diagnostics . borrow ( ) . is_empty ( ) {
5757 return ;
5858 }
@@ -63,7 +63,7 @@ impl<'input> CssParser<'input> {
6363 }
6464
6565 /*
66- fn add_warning(&self, location: &Location, kind: DiagnosticKind, arguments: Vec<DiagnosticArgument>) {
66+ fn add_warning(&self, location: &Location, kind: DiagnosticKind, arguments: Vec<Rc<dyn DiagnosticArgument> >) {
6767 if self.compilation_unit().prevent_equal_offset_warning(location) {
6868 return;
6969 }
@@ -126,7 +126,7 @@ impl<'input> CssParser<'input> {
126126 fn expect ( & mut self , token : Token ) {
127127 if self . token . 0 != token {
128128 self . expecting_token_error = true ;
129- self . add_syntax_error ( & self . token_location ( ) , DiagnosticKind :: Expecting , diagarg ! [ Token ( token. clone( ) ) , Token ( self . token. 0 . clone( ) ) ] ) ;
129+ self . add_syntax_error ( & self . token_location ( ) , DiagnosticKind :: Expecting , diagarg ! [ token. clone( ) , self . token. 0 . clone( ) ] ) ;
130130 } else {
131131 self . expecting_token_error = false ;
132132 self . next ( ) ;
@@ -141,7 +141,7 @@ impl<'input> CssParser<'input> {
141141 ( id, location)
142142 } else {
143143 self . expecting_token_error = true ;
144- self . add_syntax_error ( & self . token_location ( ) , DiagnosticKind :: ExpectingIdentifier , diagarg ! [ Token ( self . token. 0 . clone( ) ) ] ) ;
144+ self . add_syntax_error ( & self . token_location ( ) , DiagnosticKind :: ExpectingIdentifier , diagarg ! [ self . token. 0 . clone( ) ] ) ;
145145 ( INVALIDATED_IDENTIFIER . to_owned ( ) , self . tokenizer . cursor_location ( ) )
146146 }
147147 }
@@ -153,7 +153,7 @@ impl<'input> CssParser<'input> {
153153 Some ( value)
154154 } else {
155155 self . expecting_token_error = true ;
156- self . add_syntax_error ( & self . token_location ( ) , DiagnosticKind :: Unexpected , diagarg ! [ Token ( self . token. 0 . clone( ) ) ] ) ;
156+ self . add_syntax_error ( & self . token_location ( ) , DiagnosticKind :: Unexpected , diagarg ! [ self . token. 0 . clone( ) ] ) ;
157157 None
158158 }
159159 }
@@ -166,7 +166,7 @@ impl<'input> CssParser<'input> {
166166 ( v, location)
167167 } else {
168168 self . expecting_token_error = true ;
169- self . add_syntax_error ( & self . token_location ( ) , DiagnosticKind :: ExpectingStringLiteral , diagarg ! [ Token ( self . token. 0 . clone( ) ) ] ) ;
169+ self . add_syntax_error ( & self . token_location ( ) , DiagnosticKind :: ExpectingStringLiteral , diagarg ! [ self . token. 0 . clone( ) ] ) ;
170170 ( "" . into ( ) , self . tokenizer . cursor_location ( ) )
171171 }
172172 }
@@ -248,7 +248,7 @@ impl<'input> CssParser<'input> {
248248 } else if self . peek ( Token :: CssAtFontFace ) {
249249 self . parse_font_face ( )
250250 } else {
251- self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: ExpectingDirective , diagarg ! [ Token ( self . token. 0 . clone( ) ) ] ) ;
251+ self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: ExpectingDirective , diagarg ! [ self . token. 0 . clone( ) ] ) ;
252252 let d = self . create_invalidated_directive ( & self . tokenizer . cursor_location ( ) ) ;
253253 self . next ( ) ;
254254 d
@@ -263,15 +263,15 @@ impl<'input> CssParser<'input> {
263263 if let Some ( condition) = condition {
264264 conditions. push ( condition) ;
265265 } else {
266- self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ Token ( self . token. 0 . clone( ) ) ] ) ;
266+ self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ self . token. 0 . clone( ) ] ) ;
267267 }
268268 loop {
269269 if let Some ( condition) = self . parse_opt_media_query_condition ( ) {
270270 conditions. push ( condition) ;
271271 } else if self . eof ( ) || self . peek ( Token :: BlockOpen ) {
272272 break ;
273273 } else if !self . consume ( Token :: Comma ) {
274- self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ Token ( self . token. 0 . clone( ) ) ] ) ;
274+ self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ self . token. 0 . clone( ) ] ) ;
275275 self . next ( ) ;
276276 }
277277 }
@@ -281,7 +281,7 @@ impl<'input> CssParser<'input> {
281281 if let Some ( rule) = self . parse_opt_rule ( ) {
282282 rules. push ( Rc :: new ( rule) ) ;
283283 } else {
284- self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ Token ( self . token. 0 . clone( ) ) ] ) ;
284+ self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ self . token. 0 . clone( ) ] ) ;
285285 self . next ( ) ;
286286 }
287287 }
@@ -342,7 +342,7 @@ impl<'input> CssParser<'input> {
342342 right,
343343 } ) ;
344344 } else {
345- self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ Token ( self . token. 0 . clone( ) ) ] ) ;
345+ self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ self . token. 0 . clone( ) ] ) ;
346346 base = Rc :: new ( CssMediaQueryCondition :: And {
347347 location : self . pop_location ( ) ,
348348 left : base,
@@ -357,7 +357,7 @@ impl<'input> CssParser<'input> {
357357
358358 fn parse_arguments ( & mut self ) -> Result < CssParserFacade , ParserError > {
359359 if !self . peek ( Token :: ParenOpen ) {
360- self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Expecting , diagarg ! [ Token ( Token :: ParenOpen ) , Token ( self . token. 0 . clone( ) ) ] ) ;
360+ self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Expecting , diagarg ! [ Token :: ParenOpen , self . token. 0 . clone( ) ] ) ;
361361 return Err ( ParserError :: Common ) ;
362362 }
363363 let ( byte_range, token) = self . tokenizer . scan_arguments ( ) ;
@@ -376,7 +376,7 @@ impl<'input> CssParser<'input> {
376376 if let Some ( s) = self . parse_opt_selector ( ) {
377377 selectors. push ( s) ;
378378 } else {
379- self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ Token ( self . token. 0 . clone( ) ) ] ) ;
379+ self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ self . token. 0 . clone( ) ] ) ;
380380 }
381381 }
382382 let mut properties: Vec < Rc < CssProperty > > = vec ! [ ] ;
@@ -436,7 +436,7 @@ impl<'input> CssParser<'input> {
436436
437437 fn parse_selector_condition ( & mut self ) -> Rc < CssSelectorCondition > {
438438 let Some ( c) = self . parse_opt_selector_condition ( ) else {
439- self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ Token ( self . token. 0 . clone( ) ) ] ) ;
439+ self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ self . token. 0 . clone( ) ] ) ;
440440 return self . create_invalidated_selector_condition ( & self . tokenizer . cursor_location ( ) ) ;
441441 } ;
442442 c
@@ -537,7 +537,7 @@ impl<'input> CssParser<'input> {
537537
538538 fn parse_property_value ( & mut self , min_precedence : CssOperatorPrecedence ) -> Rc < CssPropertyValue > {
539539 let Some ( v) = self . parse_opt_property_value ( min_precedence) else {
540- self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ Token ( self . token. 0 . clone( ) ) ] ) ;
540+ self . add_syntax_error ( & self . token . 1 , DiagnosticKind :: Unexpected , diagarg ! [ self . token. 0 . clone( ) ] ) ;
541541 return self . create_invalidated_property_value ( & self . tokenizer . cursor_location ( ) ) ;
542542 } ;
543543 v
0 commit comments