Module: Jade::Frontend::SemanticAnalysis::RecordLiteral

Extended by:
Helper, RecordLiteral
Included in:
RecordLiteral
Defined in:
lib/jade/frontend/semantic_analysis/record_literal.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
# File 'lib/jade/frontend/semantic_analysis/record_literal.rb', line 8

def analyze(node, registry, scope, entry)
  node => AST::RecordLiteral(fields:)

  Result
    .combine(node, scope:,
      fields: analyze_in_parallel(fields, registry, scope, entry),
    )
    .map_node { it.with(symbol: Symbol.anonymous_record(fields.map(&:key))) }
    .add_errors(analyze_duplicate_fields(fields, entry))
end