Class: CustomElementsManifestParser::Nodes::FunctionDeclaration

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

Overview

Documents a function

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixins::HasParentModule

#parent_module

Instance Attribute Details

#kind"function"

Returns:

  • ("function")


23
# File 'lib/custom_elements_manifest_parser/nodes/function_declaration.rb', line 23

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

#sourceSourceReference?

Returns:

  • (SourceReference, nil)


27
# File 'lib/custom_elements_manifest_parser/nodes/function_declaration.rb', line 27

attribute :source, Types::Strict::String.optional.meta(required: false)

Class Method Details

.kind"function"

Returns:

  • ("function")


19
# File 'lib/custom_elements_manifest_parser/nodes/function_declaration.rb', line 19

def self.kind; "function"; end

Instance Method Details

#visit(parser:) ⇒ Object



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

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::FunctionLikeStruct.build_hash(parser: parser, struct: self)
  )
  new(hash)
end