Class: Lilac::CLI::ScriptAnalyzer::Result
- Inherits:
-
Struct
- Object
- Struct
- Lilac::CLI::ScriptAnalyzer::Result
- Defined in:
- lib/lilac/cli/lint/script_analyzer.rb
Instance Attribute Summary collapse
-
#assigned_ivars ⇒ Object
Returns the value of attribute assigned_ivars.
-
#declared_methods ⇒ Object
Returns the value of attribute declared_methods.
-
#declared_signals ⇒ Object
Returns the value of attribute declared_signals.
-
#method_calls ⇒ Object
Returns the value of attribute method_calls.
-
#referenced_ivars ⇒ Object
Returns the value of attribute referenced_ivars.
Instance Method Summary collapse
-
#assigns_ivar?(name) ⇒ Boolean
Soft fallback for the linter's "signal not declared" warning.
- #calls_method?(name) ⇒ Boolean
- #declares_method?(name) ⇒ Boolean
- #declares_signal?(name) ⇒ Boolean
- #references_ivar?(name) ⇒ Boolean
Instance Attribute Details
#assigned_ivars ⇒ Object
Returns the value of attribute assigned_ivars
30 31 32 |
# File 'lib/lilac/cli/lint/script_analyzer.rb', line 30 def assigned_ivars @assigned_ivars end |
#declared_methods ⇒ Object
Returns the value of attribute declared_methods
30 31 32 |
# File 'lib/lilac/cli/lint/script_analyzer.rb', line 30 def declared_methods @declared_methods end |
#declared_signals ⇒ Object
Returns the value of attribute declared_signals
30 31 32 |
# File 'lib/lilac/cli/lint/script_analyzer.rb', line 30 def declared_signals @declared_signals end |
#method_calls ⇒ Object
Returns the value of attribute method_calls
30 31 32 |
# File 'lib/lilac/cli/lint/script_analyzer.rb', line 30 def method_calls @method_calls end |
#referenced_ivars ⇒ Object
Returns the value of attribute referenced_ivars
30 31 32 |
# File 'lib/lilac/cli/lint/script_analyzer.rb', line 30 def referenced_ivars @referenced_ivars end |
Instance Method Details
#assigns_ivar?(name) ⇒ Boolean
Soft fallback for the linter's "signal not declared" warning.
@x = make_counter doesn't put @x in declared_signals
(the RHS isn't a recognised signal factory), but the user
has plausibly initialised it via a helper. AST inter-
procedural analysis would be needed to be sure, so we
silence the warning when any assignment to the ivar exists.
60 61 62 |
# File 'lib/lilac/cli/lint/script_analyzer.rb', line 60 def assigns_ivar?(name) assigned_ivars.include?(name) end |
#calls_method?(name) ⇒ Boolean
50 51 52 |
# File 'lib/lilac/cli/lint/script_analyzer.rb', line 50 def calls_method?(name) method_calls.include?(name) end |
#declares_method?(name) ⇒ Boolean
42 43 44 |
# File 'lib/lilac/cli/lint/script_analyzer.rb', line 42 def declares_method?(name) declared_methods.key?(name) end |
#declares_signal?(name) ⇒ Boolean
38 39 40 |
# File 'lib/lilac/cli/lint/script_analyzer.rb', line 38 def declares_signal?(name) declared_signals.key?(name) end |
#references_ivar?(name) ⇒ Boolean
46 47 48 |
# File 'lib/lilac/cli/lint/script_analyzer.rb', line 46 def references_ivar?(name) referenced_ivars.include?(name) end |