Class: Steep::TypeInference::TypeEnvBuilder::Command::ImportInstanceVariableAnnotations

Inherits:
AnnotationsBase
  • Object
show all
Defined in:
lib/steep/type_inference/type_env_builder.rb

Instance Attribute Summary

Attributes inherited from AnnotationsBase

#annotations

Instance Method Summary collapse

Methods inherited from AnnotationsBase

#initialize

Constructor Details

This class inherits a constructor from Steep::TypeInference::TypeEnvBuilder::Command::AnnotationsBase

Instance Method Details

#call(env) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
# File 'lib/steep/type_inference/type_env_builder.rb', line 65

def call(env)
  ivar_types = annotations.ivar_type_annotations.transform_values do |annotation|
    annotations.absolute_type(annotation.type) || annotation.type
  end

  if @merge
    env.merge(instance_variable_types: ivar_types)
  else
    env.update(instance_variable_types: ivar_types)
  end
end

#merge!(merge = true) ⇒ Object



77
78
79
80
# File 'lib/steep/type_inference/type_env_builder.rb', line 77

def merge!(merge = true)
  @merge = merge
  self
end