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
6
7
8
9
10
# File 'lib/typeprof/core/env/method_entity.rb', line 3

def initialize
  @builtin = nil
  @decls = Set[]
  @overloading_decls = Set[]
  @defs = Set[]
  @aliases = {}
  @method_call_boxes = Set[]
end

Instance Attribute Details

#aliasesObject (readonly)

Returns the value of attribute aliases.



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

def aliases
  @aliases
end

#builtinObject

Returns the value of attribute builtin.



13
14
15
# File 'lib/typeprof/core/env/method_entity.rb', line 13

def builtin
  @builtin
end

#declsObject (readonly)

Returns the value of attribute decls.



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

def decls
  @decls
end

#defsObject (readonly)

Returns the value of attribute defs.



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

def defs
  @defs
end

#method_call_boxesObject (readonly)

Returns the value of attribute method_call_boxes.



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

def method_call_boxes
  @method_call_boxes
end

Instance Method Details

#add_alias(node, old_mid) ⇒ Object



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

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

#add_decl(decl) ⇒ Object



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

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

#add_def(mdef) ⇒ Object



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

def add_def(mdef)
  @defs << mdef
  self
end

#add_run_all_mdefs(genv) ⇒ Object



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

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

#add_run_all_method_call_boxes(genv) ⇒ Object



58
59
60
61
62
# File 'lib/typeprof/core/env/method_entity.rb', line 58

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

#exist?Boolean

Returns:

  • (Boolean)


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

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

#remove_alias(node) ⇒ Object



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

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

#remove_decl(decl) ⇒ Object



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

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

#remove_def(mdef) ⇒ Object



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

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