File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -1642,7 +1642,7 @@ foo
1642
1642
1643
1643
// Test that non-exported symbols still generate diagnostics
1644
1644
let code = "
1645
- library(mockpkg)
1645
+ library(' mockpkg' )
1646
1646
undefined()
1647
1647
also_undefined
1648
1648
" ;
Original file line number Diff line number Diff line change @@ -330,9 +330,10 @@ impl NodeTypeExt for Node<'_> {
330
330
match self . node_type ( ) {
331
331
NodeType :: Identifier => return Ok ( contents. node_slice ( self ) ?. to_string ( ) ) ,
332
332
NodeType :: String => {
333
- // Remove quotes from string literal
334
- let string = contents. node_slice ( self ) ?. to_string ( ) ;
335
- Ok ( string. trim_matches ( '"' ) . trim_matches ( '\'' ) . to_string ( ) )
333
+ let string_content = self
334
+ . child_by_field_name ( "content" )
335
+ . ok_or_else ( || anyhow:: anyhow!( "Can't extract string's `content` field" ) ) ?;
336
+ Ok ( contents. node_slice ( & string_content) ?. to_string ( ) )
336
337
} ,
337
338
_ => {
338
339
return Err ( anyhow:: anyhow!( "Not an identifier or string" ) ) ;
You can’t perform that action at this time.
0 commit comments