Class: Rsense::Server::Command::Graph

Inherits:
Java::org.cx4a.rsense.typing::Graph
  • Object
show all
Defined in:
lib/rsense/server/command/graph.rb

Constant Summary collapse

RuntimeHelper =
Rsense::Server::Command::RuntimeHelper

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGraph

Returns a new instance of Graph.



25
26
27
28
# File 'lib/rsense/server/command/graph.rb', line 25

def initialize
  super
  @context = self.runtime.getContext
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



23
24
25
# File 'lib/rsense/server/command/graph.rb', line 23

def context
  @context
end

Instance Method Details

#createFreeSingleTypeVertex(type) ⇒ Object



75
76
77
78
79
# File 'lib/rsense/server/command/graph.rb', line 75

def createFreeSingleTypeVertex(type)
  vertex = createFreeVertex()
  vertex.addType(type)
  return vertex
end

#createFreeVertex(typeSet = nil) ⇒ Object



81
82
83
84
85
86
87
# File 'lib/rsense/server/command/graph.rb', line 81

def createFreeVertex(typeSet=nil)
  if typeSet
    return Rsense::Server::Command::Vertex.new(nil, typeSet)
  else
    return Rsense::Server::Command::Vertex.new
  end
end

#visitClassNode(node) ⇒ Object



51
52
53
54
55
56
# File 'lib/rsense/server/command/graph.rb', line 51

def visitClassNode(node)
  cpath = node.getCPath()
  name = cpath.getName()
  RuntimeHelper.getNamespace(self, cpath)
  super
end

#visitColon2Node(node) ⇒ Object



46
47
48
49
# File 'lib/rsense/server/command/graph.rb', line 46

def visitColon2Node(node)
  target = RuntimeHelper.getNamespace(self, node)
  super
end

#visitDefnNode(node) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/rsense/server/command/graph.rb', line 30

def visitDefnNode(node)
  name = node.getName()
  if name.match(/new/)
    return Java::org.cx4a.rsense.typing.vertex::Vertex::EMPTY
  end
  super
end

#visitDefsNode(node) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/rsense/server/command/graph.rb', line 38

def visitDefsNode(node)
  name = node.getName()
  if name.match(/new/)
    return Java::org.cx4a.rsense.typing.vertex::Vertex::EMPTY
  end
  super
end

#visitFCallNode(node) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/rsense/server/command/graph.rb', line 58

def visitFCallNode(node)
  if node.name.match(/filter!/)
    if node.getArgs && node.getArgs.getNodeType == Java::org.jrubyparser.ast::NodeType::BLOCKPASSNODE
      block_pass = node.getArgs()
      argVertices = RuntimeHelper.setupCallArgs(self, block_pass.getArgs())
      block = RuntimeHelper.setupCallBlock(self, block_pass)
    else
      argVertices = RuntimeHelper.setupCallArgs(self, node.getArgs())
      block = RuntimeHelper.setupCallBlock(self, node.getIter())
    end
    vertex = Java::org.cx4a.rsense.typing.vertex::CallVertex.new(node, createFreeSingleTypeVertex(context.getFrameSelf()), argVertices, block)
    vertex.setPrivateVisibility(true)
    return RuntimeHelper.call(self, vertex)
  end
  super
end