Module: Jade::Frontend::SemanticAnalysis::Literal

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

def analyze(node, _registry, scope, _entry)
  node => AST::Literal(value:)

  symbol = case value
  in Integer then Symbol::TypeRef['Basics', 'Int']
  in TrueClass | FalseClass then Symbol::TypeRef['Basics', 'Bool']
  in String then Symbol::TypeRef['String', 'String']
  in Float then Symbol::TypeRef['Basics', 'Float']
  end

  Result.init(node.with(symbol:), scope)
end