Class: Jade::Frontend::SemanticAnalysis::Error::PredicateNameNotAllowed
- Inherits:
-
Error
- Object
- Error
- Jade::Frontend::SemanticAnalysis::Error::PredicateNameNotAllowed
- Defined in:
- lib/jade/frontend/semantic_analysis/error/predicate_name_not_allowed.rb
Overview
Names ending in ‘?` are reserved for function declarations. Using the `?` suffix on a variable, parameter, or destructured binding would let a non-Bool value shadow the predicate convention.
Instance Attribute Summary
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(entry, span, name:) ⇒ PredicateNameNotAllowed
constructor
A new instance of PredicateNameNotAllowed.
- #label ⇒ Object
- #message ⇒ Object
Methods inherited from Error
#candidates, #notes, #queried_name, #to_diagnostic
Constructor Details
#initialize(entry, span, name:) ⇒ PredicateNameNotAllowed
Returns a new instance of PredicateNameNotAllowed.
9 10 11 12 |
# File 'lib/jade/frontend/semantic_analysis/error/predicate_name_not_allowed.rb', line 9 def initialize(entry, span, name:) super(entry:, span:) @name = name end |
Instance Method Details
#label ⇒ Object
18 19 20 |
# File 'lib/jade/frontend/semantic_analysis/error/predicate_name_not_allowed.rb', line 18 def label "`?` only on function names" end |
#message ⇒ Object
14 15 16 |
# File 'lib/jade/frontend/semantic_analysis/error/predicate_name_not_allowed.rb', line 14 def "`#{@name}` ends in `?` but only function names may use that suffix." end |