class TypeProf::Core::AST::IncludeMetaNode::AttrReaderMetaNode - typeprof: Ruby Standard Library Documentation

# class TypeProf::Core::AST::IncludeMetaNode::AttrReaderMetaNode

### Attributes

args[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/meta.rb, line 48
    def initialize(raw_node, lenv)
      super(raw_node, lenv)
      @args = []
      raw_node.arguments.arguments.each do |raw_arg|
        @args << raw_arg.value.to_sym if raw_arg.type == :symbol_node
      end
      # TODO: error for non-LIT
      # TODO: fine-grained hover
    end

### Public Instance Methods

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

    # File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 60
      def attrs = { args: }

      def req_positionals = []
      def opt_positionals = []
      def post_positionals = []
      def rest_positionals = nil
      def req_keywords = []
      def opt_keywords = []
      def rest_keywords = nil

      def mname_code_range(name)
        idx = @args.index(name.to_sym) # TODO: support string args
        node = @raw_node.arguments.arguments[idx].location
        TypeProf::CodeRange.from_node(node)
      end

      def install0(genv)
        @args.each do |arg|
          ivar_name = :"@#{ arg }"
          ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, ivar_name)
          e_ret = Vertex.new(self)
          ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])
        end
        Source.new
      end
    end

    class AttrAccessorMetaNode < Node
      def initialize(raw_node, lenv)
        super(raw_node, lenv)
        @args = []
        raw_node.arguments.arguments.each do |raw_arg|
          @args << raw_arg.value.to_sym if raw_arg.type == :symbol_node
        end
        # TODO: error for non-LIT
        # TODO: fine-grained hover
      end

      attr_reader :args

      def attrs = { args: }

      def mname_code_range(name)
        idx = @args.index(name.to_sym) # TODO: support string args
        node = @raw_node.arguments.arguments[idx].location
        TypeProf::CodeRange.from_node(node)
      end

      def define0(genv)
        @args.map do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.add_def(self)
          mod
        end
      end

      def define_copy(genv)
        @args.map do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.add_def(self)
          mod.remove_def(@prev_node)
          mod
        end
        super(genv)
      end

      def undefine0(genv)
        @args.each do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.remove_def(self)
        end
      end

      def install0(genv)
        @args.zip(@static_ret) do |arg, ive|
          ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, :"@#{ arg }")
          e_ret = Vertex.new(self)
          ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])

          vtx = Vertex.new(self)
          @changes.add_edge(genv, vtx, ive.vtx)
          f_args = FormalArguments.new([vtx], [], nil, [], [], [], nil, nil)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, :"#{ arg }=", f_args, [ret_box])
        end
        Source.

install0(genv) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 76
    def install0(genv)
      @args.each do |arg|
        ivar_name = :"@#{ arg }"
        ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, ivar_name)
        e_ret = Vertex.new(self)
        ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
        @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])
      end
      Source.new
    end

mname_code_range(name) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 70
    def mname_code_range(name)
      idx = @args.index(name.to_sym) # TODO: support string args
      node = @raw_node.arguments.arguments[idx].location
      TypeProf::CodeRange.from_node(node)
    end

opt_keywords(= []) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 67
          def opt_keywords = []
          def rest_keywords = nil

          def mname_code_range(name)
            idx = @args.index(name.to_sym) # TODO: support string args
            node = @raw_node.arguments.arguments[idx].location
            TypeProf::CodeRange.from_node(node)
          end

          def install0(genv)
            @args.each do |arg|
              ivar_name = :"@#{ arg }"
              ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, ivar_name)
              e_ret = Vertex.new(self)
              ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
              @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])
            end
            Source.new
          end
        end

        class AttrAccessorMetaNode < Node
          def initialize(raw_node, lenv)
            super(raw_node, lenv)
            @args = []
            raw_node.arguments.arguments.each do |raw_arg|
              @args << raw_arg.value.to_sym if raw_arg.type == :symbol_node
            end
            # TODO: error for non-LIT
            # TODO: fine-grained hover
          end

          attr_reader :args

          def attrs = { args: }

          def mname_code_range(name)
            idx = @args.index(name.to_sym) # TODO: support string args
            node = @raw_node.arguments.arguments[idx].location
            TypeProf::CodeRange.from_node(node)
          end

          def define0(genv)
            @args.map do |arg|
              mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
              mod.add_def(self)
              mod
            end
          end

          def define_copy(genv)
            @args.map do |arg|
              mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
              mod.add_def(self)
              mod.remove_def(@prev_node)
              mod
            end
            super(genv)
          end

          def undefine0(genv)
            @args.each do |arg|
              mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
              mod.remove_def(self)
            end
          end

          def install0(genv)
            @args.zip(@static_ret) do |arg, ive|
              ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, :"@#{ arg }")
              e_ret = Vertex.new(self)
              ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
              @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])

              vtx = Vertex.new(self)
              @changes.add_edge(genv, vtx, ive.vtx)
              f_args = FormalArguments.new([vtx], [], nil, [], [], [], nil, nil)
              @changes.add_method_def_box(genv, @lenv.cref.cpath, false, :"#{ arg }=", f_args, [ret_box])
            end
            Source.new
          end
        end
      end
    end

opt_positionals(= []) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 63
      def opt_positionals = []
      def post_positionals = []
      def rest_positionals = nil
      def req_keywords = []
      def opt_keywords = []
      def rest_keywords = nil

      def mname_code_range(name)
        idx = @args.index(name.to_sym) # TODO: support string args
        node = @raw_node.arguments.arguments[idx].location
        TypeProf::CodeRange.from_node(node)
      end

      def install0(genv)
        @args.each do |arg|
          ivar_name = :"@#{ arg }"
          ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, ivar_name)
          e_ret = Vertex.new(self)
          ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])
        end
        Source.new
      end
    end

    class AttrAccessorMetaNode < Node
      def initialize(raw_node, lenv)
        super(raw_node, lenv)
        @args = []
        raw_node.arguments.arguments.each do |raw_arg|
          @args << raw_arg.value.to_sym if raw_arg.type == :symbol_node
        end
        # TODO: error for non-LIT
        # TODO: fine-grained hover
      end

      attr_reader :args

      def attrs = { args: }

      def mname_code_range(name)
        idx = @args.index(name.to_sym) # TODO: support string args
        node = @raw_node.arguments.arguments[idx].location
        TypeProf::CodeRange.from_node(node)
      end

      def define0(genv)
        @args.map do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.add_def(self)
          mod
        end
      end

      def define_copy(genv)
        @args.map do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.add_def(self)
          mod.remove_def(@prev_node)
          mod
        end
        super(genv)
      end

      def undefine0(genv)
        @args.each do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.remove_def(self)
        end
      end

      def install0(genv)
        @args.zip(@static_ret) do |arg, ive|
          ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, :"@#{ arg }")
          e_ret = Vertex.new(self)
          ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])

          vtx = Vertex.new(self)
          @changes.add_edge(genv, vtx, ive.vtx)
          f_args = FormalArguments.new([vtx], [], nil, [], [], [], nil, nil)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, :"#{ arg }=", f_args, [ret_box])
        end
        Source.new
      end

post_positionals(= []) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 64
      def post_positionals = []
      def rest_positionals = nil
      def req_keywords = []
      def opt_keywords = []
      def rest_keywords = nil

      def mname_code_range(name)
        idx = @args.index(name.to_sym) # TODO: support string args
        node = @raw_node.arguments.arguments[idx].location
        TypeProf::CodeRange.from_node(node)
      end

      def install0(genv)
        @args.each do |arg|
          ivar_name = :"@#{ arg }"
          ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, ivar_name)
          e_ret = Vertex.new(self)
          ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])
        end
        Source.new
      end
    end

    class AttrAccessorMetaNode < Node
      def initialize(raw_node, lenv)
        super(raw_node, lenv)
        @args = []
        raw_node.arguments.arguments.each do |raw_arg|
          @args << raw_arg.value.to_sym if raw_arg.type == :symbol_node
        end
        # TODO: error for non-LIT
        # TODO: fine-grained hover
      end

      attr_reader :args

      def attrs = { args: }

      def mname_code_range(name)
        idx = @args.index(name.to_sym) # TODO: support string args
        node = @raw_node.arguments.arguments[idx].location
        TypeProf::CodeRange.from_node(node)
      end

      def define0(genv)
        @args.map do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.add_def(self)
          mod
        end
      end

      def define_copy(genv)
        @args.map do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.add_def(self)
          mod.remove_def(@prev_node)
          mod
        end
        super(genv)
      end

      def undefine0(genv)
        @args.each do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.remove_def(self)
        end
      end

      def install0(genv)
        @args.zip(@static_ret) do |arg, ive|
          ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, :"@#{ arg }")
          e_ret = Vertex.new(self)
          ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])

          vtx = Vertex.new(self)
          @changes.add_edge(genv, vtx, ive.vtx)
          f_args = FormalArguments.new([vtx], [], nil, [], [], [], nil, nil)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, :"#{ arg }=", f_args, [ret_box])
        end
        Source.new
      end

req_keywords(= []) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 66
        def req_keywords = []
        def opt_keywords = []
        def rest_keywords = nil

        def mname_code_range(name)
          idx = @args.index(name.to_sym) # TODO: support string args
          node = @raw_node.arguments.arguments[idx].location
          TypeProf::CodeRange.from_node(node)
        end

        def install0(genv)
          @args.each do |arg|
            ivar_name = :"@#{ arg }"
            ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, ivar_name)
            e_ret = Vertex.new(self)
            ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
            @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])
          end
          Source.new
        end
      end

      class AttrAccessorMetaNode < Node
        def initialize(raw_node, lenv)
          super(raw_node, lenv)
          @args = []
          raw_node.arguments.arguments.each do |raw_arg|
            @args << raw_arg.value.to_sym if raw_arg.type == :symbol_node
          end
          # TODO: error for non-LIT
          # TODO: fine-grained hover
        end

        attr_reader :args

        def attrs = { args: }

        def mname_code_range(name)
          idx = @args.index(name.to_sym) # TODO: support string args
          node = @raw_node.arguments.arguments[idx].location
          TypeProf::CodeRange.from_node(node)
        end

        def define0(genv)
          @args.map do |arg|
            mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
            mod.add_def(self)
            mod
          end
        end

        def define_copy(genv)
          @args.map do |arg|
            mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
            mod.add_def(self)
            mod.remove_def(@prev_node)
            mod
          end
          super(genv)
        end

        def undefine0(genv)
          @args.each do |arg|
            mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
            mod.remove_def(self)
          end
        end

        def install0(genv)
          @args.zip(@static_ret) do |arg, ive|
            ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, :"@#{ arg }")
            e_ret = Vertex.new(self)
            ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
            @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])

            vtx = Vertex.new(self)
            @changes.add_edge(genv, vtx, ive.vtx)
            f_args = FormalArguments.new([vtx], [], nil, [], [], [], nil, nil)
            @changes.add_method_def_box(genv, @lenv.cref.cpath, false, :"#{ arg }=", f_args, [ret_box])
          end
          Source.new
        end
      end
    end

req_positionals(= []) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 62
      def req_positionals = []
      def opt_positionals = []
      def post_positionals = []
      def rest_positionals = nil
      def req_keywords = []
      def opt_keywords = []
      def rest_keywords = nil

      def mname_code_range(name)
        idx = @args.index(name.to_sym) # TODO: support string args
        node = @raw_node.arguments.arguments[idx].location
        TypeProf::CodeRange.from_node(node)
      end

      def install0(genv)
        @args.each do |arg|
          ivar_name = :"@#{ arg }"
          ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, ivar_name)
          e_ret = Vertex.new(self)
          ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])
        end
        Source.new
      end
    end

    class AttrAccessorMetaNode < Node
      def initialize(raw_node, lenv)
        super(raw_node, lenv)
        @args = []
        raw_node.arguments.arguments.each do |raw_arg|
          @args << raw_arg.value.to_sym if raw_arg.type == :symbol_node
        end
        # TODO: error for non-LIT
        # TODO: fine-grained hover
      end

      attr_reader :args

      def attrs = { args: }

      def mname_code_range(name)
        idx = @args.index(name.to_sym) # TODO: support string args
        node = @raw_node.arguments.arguments[idx].location
        TypeProf::CodeRange.from_node(node)
      end

      def define0(genv)
        @args.map do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.add_def(self)
          mod
        end
      end

      def define_copy(genv)
        @args.map do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.add_def(self)
          mod.remove_def(@prev_node)
          mod
        end
        super(genv)
      end

      def undefine0(genv)
        @args.each do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.remove_def(self)
        end
      end

      def install0(genv)
        @args.zip(@static_ret) do |arg, ive|
          ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, :"@#{ arg }")
          e_ret = Vertex.new(self)
          ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])

          vtx = Vertex.new(self)
          @changes.add_edge(genv, vtx, ive.vtx)
          f_args = FormalArguments.new([vtx], [], nil, [], [], [], nil, nil)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, :"#{ arg }=", f_args, [ret_box])
        end
        Source.new

rest_keywords(= nil) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 68
      def rest_keywords = nil

      def mname_code_range(name)
        idx = @args.index(name.to_sym) # TODO: support string args
        node = @raw_node.arguments.arguments[idx].location
        TypeProf::CodeRange.from_node(node)
      end

      def install0(genv)
        @args.each do |arg|
          ivar_name = :"@#{ arg }"
          ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, ivar_name)
          e_ret = Vertex.new(self)
          ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])
        end
        Source.new
      end
    end

rest_positionals(= nil) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/ast/meta.rb, line 65
      def rest_positionals = nil
      def req_keywords = []
      def opt_keywords = []
      def rest_keywords = nil

      def mname_code_range(name)
        idx = @args.index(name.to_sym) # TODO: support string args
        node = @raw_node.arguments.arguments[idx].location
        TypeProf::CodeRange.from_node(node)
      end

      def install0(genv)
        @args.each do |arg|
          ivar_name = :"@#{ arg }"
          ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, ivar_name)
          e_ret = Vertex.new(self)
          ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])
        end
        Source.new
      end
    end

    class AttrAccessorMetaNode < Node
      def initialize(raw_node, lenv)
        super(raw_node, lenv)
        @args = []
        raw_node.arguments.arguments.each do |raw_arg|
          @args << raw_arg.value.to_sym if raw_arg.type == :symbol_node
        end
        # TODO: error for non-LIT
        # TODO: fine-grained hover
      end

      attr_reader :args

      def attrs = { args: }

      def mname_code_range(name)
        idx = @args.index(name.to_sym) # TODO: support string args
        node = @raw_node.arguments.arguments[idx].location
        TypeProf::CodeRange.from_node(node)
      end

      def define0(genv)
        @args.map do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.add_def(self)
          mod
        end
      end

      def define_copy(genv)
        @args.map do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.add_def(self)
          mod.remove_def(@prev_node)
          mod
        end
        super(genv)
      end

      def undefine0(genv)
        @args.each do |arg|
          mod = genv.resolve_ivar(lenv.cref.cpath, false, :"@#{ arg }")
          mod.remove_def(self)
        end
      end

      def install0(genv)
        @args.zip(@static_ret) do |arg, ive|
          ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, :"@#{ arg }")
          e_ret = Vertex.new(self)
          ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])

          vtx = Vertex.new(self)
          @changes.add_edge(genv, vtx, ive.vtx)
          f_args = FormalArguments.new([vtx], [], nil, [], [], [], nil, nil)
          @changes.add_method_def_box(genv, @lenv.cref.cpath, false, :"#{ arg }=", f_args, [ret_box])
        end
        Source.new
      end
    end