Module: RBS::Trace::Helpers

Included in:
Builder, File
Defined in:
lib/rbs/trace/helpers.rb

Instance Method Summary collapse

Instance Method Details

#new_class_decl(name:) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rbs/trace/helpers.rb', line 20

def new_class_decl(name:)
  AST::Declarations::Class.new(
    name:,
    type_params: [],
    super_class: nil,
    members: [],
    annotations: [],
    location: nil,
    comment: nil
  )
end

#new_method_definition(name:, kind:) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/rbs/trace/helpers.rb', line 33

def new_method_definition(name:, kind:)
  AST::Members::MethodDefinition.new(
    name:,
    kind:,
    overloads: [],
    annotations: [],
    location: nil,
    comment: nil,
    overloading: false,
    visibility: nil
  )
end

#new_module_decl(name:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rbs/trace/helpers.rb', line 7

def new_module_decl(name:)
  AST::Declarations::Module.new(
    name:,
    type_params: [],
    self_types: [],
    members: [],
    annotations: [],
    location: nil,
    comment: nil
  )
end

#type_boolObject



57
58
59
# File 'lib/rbs/trace/helpers.rb', line 57

def type_bool
  @type_bool ||= Types::Bases::Bool.new(location: nil)
end

#type_nilObject



52
53
54
# File 'lib/rbs/trace/helpers.rb', line 52

def type_nil
  @type_nil ||= Types::Bases::Nil.new(location: nil)
end

#type_untypedObject



62
63
64
# File 'lib/rbs/trace/helpers.rb', line 62

def type_untyped
  @type_untyped ||= Types::Bases::Any.new(location: nil)
end

#type_voidObject



47
48
49
# File 'lib/rbs/trace/helpers.rb', line 47

def type_void
  @type_void = Types::Bases::Void.new(location: nil)
end