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

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

Instance Attribute Details

#aliasesObject (readonly)

Returns the value of attribute aliases.



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

def aliases
  @aliases
end

#builtinObject

Returns the value of attribute builtin.



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

def builtin
  @builtin
end

#declsObject (readonly)

Returns the value of attribute decls.



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

def decls
  @decls
end

#defsObject (readonly)

Returns the value of attribute defs.



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

def defs
  @defs
end

#method_call_boxesObject (readonly)

Returns the value of attribute method_call_boxes.



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

def method_call_boxes
  @method_call_boxes
end

Instance Method Details

#add_alias(node, old_mid) ⇒ Object



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

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

#add_decl(decl) ⇒ Object



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

def add_decl(decl)
  @decls << decl
end

#add_def(mdef) ⇒ Object



22
23
24
25
# File 'lib/typeprof/core/env/method_entity.rb', line 22

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

#add_run_all_mdefs(genv) ⇒ Object



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

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

#add_run_all_method_call_boxes(genv) ⇒ Object



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

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

#exist?Boolean

Returns:

  • (Boolean)


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

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

#remove_alias(node) ⇒ Object



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

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

#remove_decl(decl) ⇒ Object



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

def remove_decl(decl)
  @decls.delete(decl) || raise
end

#remove_def(mdef) ⇒ Object



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

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