Class: CustomElementsManifestParser::Nodes::VariableDeclaration

Inherits:
BaseStruct
  • Object
show all
Includes:
Mixins::HasParentModule, Structs::DeclarableNodeStruct, Structs::PropertyLikeStruct
Defined in:
lib/custom_elements_manifest_parser/nodes/variable_declaration.rb

Overview

Documents a variable

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixins::HasParentModule

#parent_module

Instance Attribute Details

#kind"variable"

Returns:

  • ("variable")


24
# File 'lib/custom_elements_manifest_parser/nodes/variable_declaration.rb', line 24

attribute :kind, Types.Value("variable")

#sourceNodes::SourceReference?

Returns:

  • (Nodes::SourceReference, nil)


28
# File 'lib/custom_elements_manifest_parser/nodes/variable_declaration.rb', line 28

attribute :source, Types::Nominal::Any.optional.meta(required: false)

Class Method Details

.kind"variable"

Returns:

  • ("variable")


20
# File 'lib/custom_elements_manifest_parser/nodes/variable_declaration.rb', line 20

def self.kind; "variable"; end

Instance Method Details

#visit(parser:) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/custom_elements_manifest_parser/nodes/variable_declaration.rb', line 30

def visit(parser:)
  hash = {}
  hash[:source] = parser.data_types[:source].new(source).visit(parser: parser) unless source.nil?

  hash = hash.merge(
    Structs::DeclarableNodeStruct.build_hash(parser: parser, struct: self),
    Structs::PropertyLikeStruct.build_hash(parser: parser, struct: self),
  )

  new(hash)
end