class TypeProf::Core::AST::Node::ProgramNode - typeprof: Ruby Standard Library Documentation

# class TypeProf::Core::AST::Node::ProgramNode

### Attributes

body[R]
tbl[R]

### Public Class Methods

new(raw_node, lenv) click to toggle source
Calls superclass method `TypeProf::Core::AST::Node::new`

    # File typeprof-0.30.1/lib/typeprof/core/ast/base.rb, line 195
    def initialize(raw_node, lenv)
      super(raw_node, lenv)

      @tbl = raw_node.locals
      raw_body = raw_node.statements

      @body = AST.create_node(raw_body, lenv, false)
    end

### Public Instance Methods

attrs(= { tbl: }) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/base.rb, line 207
      def attrs = { tbl: }

      def install0(genv)
        @tbl.each {|var| @lenv.locals[var] = Source.new(genv.nil_type) }
        @lenv.locals[:"*self"] = lenv.cref.get_self(genv)

        # for toplevel return
        @body.lenv.locals[:"*expected_method_ret"] = Vertex.new(self)
        @body.install(genv)
      end
    end

install0(genv) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/base.rb, line 209
    def install0(genv)
      @tbl.each {|var| @lenv.locals[var] = Source.new(genv.nil_type) }
      @lenv.locals[:"*self"] = lenv.cref.get_self(genv)

      # for toplevel return
      @body.lenv.locals[:"*expected_method_ret"] = Vertex.new(self)
      @body.install(genv)
    end

subnodes(= { body: }) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/base.rb, line 206
        def subnodes = { body: }
        def attrs = { tbl: }

        def install0(genv)
          @tbl.each {|var| @lenv.locals[var] = Source.new(genv.nil_type) }
          @lenv.locals[:"*self"] = lenv.cref.get_self(genv)

          # for toplevel return
          @body.lenv.locals[:"*expected_method_ret"] = Vertex.new(self)
          @body.install(genv)
        end
      end

      class DummyNilNode < Node
        def initialize(code_range, lenv)
          @code_range = code_range
          super(nil, lenv)
        end

        def code_range
          @code_range
        end

        def install0(genv)
          Source.new(genv.nil_type)
        end
      end

      class DummyRHSNode < Node
        def initialize(code_range, lenv)
          @code_range = code_range
          super(nil, lenv)
        end

        def code_range
          @code_range
        end

        def install0(_)
          Vertex.new(self)
        end
      end

      class DummySymbolNode
        def initialize(sym, code_range, ret)
          @sym = sym
          @code_range = code_range
          @ret = ret
        end

        attr_reader :lenv, :prev_node, :ret

        def boxes(_)
          []
        end
      end
    end