Sha256: e14bde0a49bc6e77ff75065e5acb2e611aa829d3fbb7f0db06f7b0330b5cbbc6

Contents?: true

Size: 914 Bytes

Versions: 4

Compression:

Stored size: 914 Bytes

Contents

module Yoda
  module AST
    class RootVnode < Vnode
      include Namespace

      # @return [Parser::AST::Node]
      attr_reader :node

      # @param node [Parser::AST::Node]
      # @param comment_by_node [Hash{Parser::AST::Node => Array<Parser::Source::Comment>}]
      def initialize(node, comments_by_node: {})
        @node = node
        @comments_by_node = comments_by_node
      end

      # @return [nil]
      def parent
        nil
      end

      # @return [Symbol]
      def type
        :root
      end

      # @return [Vnode]
      def content
        @content ||= wrap_child(node)
      end

      # @return [Array<Vnode>]
      def children
        [content]
      end

      # @return [String]
      def identifier
        "#{type}:#{source_map.expression}"
      end
      
      # @return [Parser::Source::Map, nil]
      def source_map
        node.location
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yoda-language-server-0.10.1 lib/yoda/ast/root_vnode.rb
yoda-language-server-0.10.0 lib/yoda/ast/root_vnode.rb
yoda-language-server-0.9.0 lib/yoda/ast/root_vnode.rb
yoda-language-server-0.8.0 lib/yoda/ast/root_vnode.rb