Module: Jade::Frontend::SemanticAnalysis::PatternRecord
- Extended by:
- Helper, PatternRecord
- Included in:
- PatternRecord
- Defined in:
- lib/jade/frontend/semantic_analysis/pattern_record.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 |
# File 'lib/jade/frontend/semantic_analysis/pattern_record.rb', line 8 def analyze(node, registry, scope, entry) node => AST::Pattern::Record(fields:) symbol = Symbol .anonymous_record(fields.map(&:name), Symbol.var('a', nil)) patterns_r = analyze_in_sequence(fields.map(&:pattern), registry, scope, entry) fields .zip(patterns_r.node) .map { |f, p| f.with(pattern: p) } .then { node.with(fields: it, symbol:) } .then { Result[it, patterns_r.errors, patterns_r.scope] } end |