Module: Jade::Frontend::SemanticAnalysis::PatternConstructor
- Extended by:
- Helper, PatternConstructor
- Included in:
- PatternConstructor
- Defined in:
- lib/jade/frontend/semantic_analysis/pattern_constructor.rb
Instance Method Summary collapse
Methods included from Helper
analyze_duplicate_fields, analyze_in_parallel, analyze_in_sequence, analyze_node, bind, collect_vars, lookup, validate_type_symbol
Instance Method Details
#analyze(node, registry, scope, entry) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/jade/frontend/semantic_analysis/pattern_constructor.rb', line 8 def analyze(node, registry, scope, entry) node => AST::Pattern::Constructor(constructor:, patterns:) constructor_r = analyze_node(constructor, registry, scope, entry) symbol_ref = constructor_r.node.symbol&.to_ref if symbol_ref.nil? return Result.combine(node, scope:, constructor: constructor_r) end arity_errors = arity_mismatch_errors( registry.lookup(symbol_ref), patterns, constructor, node.range, entry, ) patterns_r = analyze_in_sequence(patterns, registry, scope, entry) Result .combine(node, scope: patterns_r.scope, constructor: constructor_r, patterns: patterns_r, ) .map_node { it.with(symbol: symbol_ref) } .add_errors(arity_errors) end |