Class: TypeProf::Core::MethodEntity

Inherits:
Object
  • Object
show all
Defined in:
lib/typeprof/core/env/method_entity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMethodEntity

Returns a new instance of MethodEntity.



3
4
5
# File 'lib/typeprof/core/env/method_entity.rb', line 3

def initialize
  @builtin = nil
end

Instance Attribute Details

#builtinObject

Returns the value of attribute builtin.



7
8
9
# File 'lib/typeprof/core/env/method_entity.rb', line 7

def builtin
  @builtin
end

Instance Method Details

#add_alias(node, old_mid) ⇒ Object



41
42
43
# File 'lib/typeprof/core/env/method_entity.rb', line 41

def add_alias(node, old_mid)
  aliases[node] = old_mid
end

#add_decl(decl) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/typeprof/core/env/method_entity.rb', line 16

def add_decl(decl)
  if decl.overloading
    overloading_decls << decl
  else
    decls << decl
  end
end

#add_def(mdef) ⇒ Object



32
33
34
35
# File 'lib/typeprof/core/env/method_entity.rb', line 32

def add_def(mdef)
  defs << mdef
  self
end

#add_run_all_mdefs(genv) ⇒ Object



53
54
55
56
57
58
# File 'lib/typeprof/core/env/method_entity.rb', line 53

def add_run_all_mdefs(genv)
  return unless @defs
  @defs.each do |mdef|
    genv.add_run(mdef)
  end
end

#add_run_all_method_call_boxes(genv) ⇒ Object



60
61
62
63
64
65
# File 'lib/typeprof/core/env/method_entity.rb', line 60

def add_run_all_method_call_boxes(genv)
  return unless @method_call_boxes
  @method_call_boxes.each do |box|
    genv.add_run(box)
  end
end

#aliasesObject



11
# File 'lib/typeprof/core/env/method_entity.rb', line 11

def aliases = @aliases ||= {}

#declsObject



9
# File 'lib/typeprof/core/env/method_entity.rb', line 9

def decls = @decls ||= Set.empty

#defsObject



10
# File 'lib/typeprof/core/env/method_entity.rb', line 10

def defs = @defs ||= Set.empty

#exist?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/typeprof/core/env/method_entity.rb', line 49

def exist?
  @builtin || (@decls && !@decls.empty?) || (@defs && !@defs.empty?)
end

#method_call_boxesObject



12
# File 'lib/typeprof/core/env/method_entity.rb', line 12

def method_call_boxes = @method_call_boxes ||= Set.empty

#remove_alias(node) ⇒ Object



45
46
47
# File 'lib/typeprof/core/env/method_entity.rb', line 45

def remove_alias(node)
  aliases.delete(node) || raise
end

#remove_decl(decl) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/typeprof/core/env/method_entity.rb', line 24

def remove_decl(decl)
  if decl.overloading
    overloading_decls.delete(decl) || raise
  else
    decls.delete(decl) || raise
  end
end

#remove_def(mdef) ⇒ Object



37
38
39
# File 'lib/typeprof/core/env/method_entity.rb', line 37

def remove_def(mdef)
  defs.delete(mdef) || raise
end