Class: Tapioca::Dsl::Compiler

Inherits:
Object
  • Object
show all
Extended by:
T::Generic, T::Helpers, T::Sig, Runtime::Reflection
Includes:
RBIHelper, Runtime::Reflection
Defined in:
lib/tapioca/dsl/compiler.rb

Constant Summary collapse

ConstantType =
type_member { { upper: Module } }

Constants included from Runtime::Reflection

Runtime::Reflection::ANCESTORS_METHOD, Runtime::Reflection::CLASS_METHOD, Runtime::Reflection::CONSTANTS_METHOD, Runtime::Reflection::EQUAL_METHOD, Runtime::Reflection::METHOD_METHOD, Runtime::Reflection::NAME_METHOD, Runtime::Reflection::OBJECT_ID_METHOD, Runtime::Reflection::PRIVATE_INSTANCE_METHODS_METHOD, Runtime::Reflection::PROTECTED_INSTANCE_METHODS_METHOD, Runtime::Reflection::PUBLIC_INSTANCE_METHODS_METHOD, Runtime::Reflection::REQUIRED_FROM_LABELS, Runtime::Reflection::SINGLETON_CLASS_METHOD, Runtime::Reflection::SUPERCLASS_METHOD

Constants included from SorbetHelper

SorbetHelper::FEATURE_REQUIREMENTS, SorbetHelper::SORBET_BIN, SorbetHelper::SORBET_EXE_PATH_ENV_VAR, SorbetHelper::SORBET_GEM_SPEC, SorbetHelper::SORBET_PAYLOAD_URL

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from T::Generic::TypeStoragePatch

#[], #type_member, #type_template

Methods included from Runtime::Reflection

ancestors_of, are_equal?, attached_class_of, class_of, constantize, constants_of, descendants_of, inherited_ancestors_of, method_of, name_of, name_of_type, object_id_of, private_instance_methods_of, protected_instance_methods_of, public_instance_methods_of, qualified_name_of, resolve_loc, signature_of, singleton_class_of, superclass_of

Methods included from RBIHelper

#create_block_param, #create_kw_opt_param, #create_kw_param, #create_kw_rest_param, #create_opt_param, #create_param, #create_rest_param, #create_typed_param, #sanitize_signature_types, serialize_type_variable, #valid_method_name?, #valid_parameter_name?

Methods included from SorbetHelper

#sorbet, #sorbet_path, #sorbet_supports?

Constructor Details

#initialize(pipeline, root, constant) ⇒ Compiler

Returns a new instance of Compiler.



26
27
28
29
30
31
# File 'lib/tapioca/dsl/compiler.rb', line 26

def initialize(pipeline, root, constant)
  @pipeline = pipeline
  @root = root
  @constant = constant
  @errors = T.let([], T::Array[String])
end

Instance Attribute Details

#constant ⇒ Object (readonly)

Returns the value of attribute constant.



20
21
22
# File 'lib/tapioca/dsl/compiler.rb', line 20

def constant
  @constant
end

#root ⇒ Object (readonly)

Returns the value of attribute root.



23
24
25
# File 'lib/tapioca/dsl/compiler.rb', line 23

def root
  @root
end

Class Method Details

.gather_constants ⇒ Object



47
# File 'lib/tapioca/dsl/compiler.rb', line 47

def self.gather_constants; end

.handles?(constant) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/tapioca/dsl/compiler.rb', line 34

def self.handles?(constant)
  processable_constants.include?(constant)
end

.processable_constants ⇒ Object



50
51
52
53
54
55
# File 'lib/tapioca/dsl/compiler.rb', line 50

def self.processable_constants
  @processable_constants ||= T.let(
    T::Set[Module].new(gather_constants).compare_by_identity,
    T.nilable(T::Set[Module])
  )
end

Instance Method Details

#add_error(error) ⇒ Object



59
60
61
# File 'lib/tapioca/dsl/compiler.rb', line 59

def add_error(error)
  @pipeline.add_error(error)
end

#compiler_enabled?(compiler_name) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/tapioca/dsl/compiler.rb', line 39

def compiler_enabled?(compiler_name)
  @pipeline.compiler_enabled?(compiler_name)
end

#decorate ⇒ Object



44
# File 'lib/tapioca/dsl/compiler.rb', line 44

def decorate; end