File: abstract-syntax/core/expression/unit.rb

Overview
Module Structure
Class Hierarchy
Code

Overview

Module Structure

  module: <Toplevel Module>
  module: Umu#6
  module: AbstractSyntax#8
  module: Core#10
  module: Expression#12
has properties
function: make_unit / 1 #39
  class: Unit#14
inherits from
  Abstract ( Umu::AbstractSyntax::Core::Expression )
has properties
method: to_s #15
method: evaluate / 1 #20

Code

   1  # coding: utf-8
   2  # frozen_string_literal: true
   3 
   4 
   5 
   6  module Umu
   7 
   8  module AbstractSyntax
   9 
  10  module Core
  11 
  12  module Expression
  13 
  14  class Unit < Expression::Abstract
  15      def to_s
  16          '()'
  17      end
  18 
  19 
  20      def evaluate(env)
  21          value = E::Tracer.trace_single(
  22                      env.pref,
  23                      env.trace_stack.count,
  24                      'Eval(Expr)',
  25                      self.class,
  26                      self.loc,
  27                      self.to_s
  28                  ) { |_event|
  29                      VC.make_unit
  30                  }
  31 
  32          ASR.make_value value
  33      end
  34  end
  35 
  36 
  37  module_function
  38 
  39      def make_unit(loc)
  40          ASSERT.kind_of loc, LOC::Entry
  41 
  42          Unit.new(loc).freeze
  43      end
  44 
  45  end # Umu::AbstractSyntax::Core::Expression
  46 
  47  end # Umu::AbstractSyntax::Core
  48 
  49  end # Umu::AbstractSyntax
  50 
  51  end # Umu