@@ -442,7 +442,7 @@ function check_farg_unused(x::EXPR)
442442 end
443443end
444444
445- const default_options = (false , true , false , true , true , false , true , true , true , true )
445+ const default_options = (true , true , true , true , true , true , true , true , true , true )
446446
447447struct LintOptions
448448 call:: Bool
@@ -483,7 +483,13 @@ function check_all(x::EXPR, opts::LintOptions, server)
483483end
484484
485485
486- function collect_hints (x:: EXPR , server, missing = true , isquoted = false , errs = Tuple{Int,EXPR}[], pos = 0 )
486+ """
487+ collect_hints(x::EXPR, server, missingrefs = :all, isquoted = false, errs = Tuple{Int,EXPR}[], pos = 0)
488+
489+ Collect hints and errors from an expression. `missingrefs` = (:none, :id, :all) determines whether unresolved
490+ identifiers are marked, the :all option will mark identifiers used in getfield calls."
491+ """
492+ function collect_hints (x:: EXPR , server, missingrefs = :all , isquoted = false , errs = Tuple{Int,EXPR}[], pos = 0 )
487493 if quoted (x)
488494 isquoted = true
489495 elseif isquoted && unquoted (x)
@@ -493,20 +499,20 @@ function collect_hints(x::EXPR, server, missing = true, isquoted = false, errs =
493499 # collect parse errors
494500 push! (errs, (pos, x))
495501 elseif ! isquoted
496- if missing && CSTParser. isidentifier (x) && ! hasref (x) &&
502+ if missingrefs != :none && CSTParser. isidentifier (x) && ! hasref (x) &&
497503 ! (valof (x) == " var" && parentof (x) isa EXPR && typof (parentof (x)) === CSTParser. NONSTDIDENTIFIER) &&
498504 ! ((valof (x) == " stdcall" || valof (x) == " cdecl" || valof (x) == " fastcall" || valof (x) == " thiscall" || valof (x) == " llvmcall" ) && is_in_fexpr (x, x-> typof (x) === CSTParser. Call && isidentifier (x[1 ]) && valof (x[1 ]) == " ccall" ))
499505 push! (errs, (pos, x))
500506 elseif haserror (x) && errorof (x) isa StaticLint. LintCodes
501507 # collect lint hints
502508 push! (errs, (pos, x))
503509 end
504- elseif isquoted && should_mark_missing_getfield_ref (x, server)
510+ elseif isquoted && missingrefs == :all && should_mark_missing_getfield_ref (x, server)
505511 push! (errs, (pos, x))
506512 end
507513
508514 for i in 1 : length (x)
509- collect_hints (x[i], server, missing , isquoted, errs, pos)
515+ collect_hints (x[i], server, missingrefs , isquoted, errs, pos)
510516 pos += x[i]. fullspan
511517 end
512518
0 commit comments