Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mame committed May 1, 2024
1 parent 1c156bb commit 4e47d03
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/typeprof/core/ast/sig_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def attrs = { type_params:, block_required: }

class SigTyNode < Node
def covariant_vertex(genv, changes, subst)
vtx = changes.new_vertex(genv, self, subst)
vtx = changes.new_vertex(genv, self)
covariant_vertex0(genv, changes, vtx, subst)
vtx
end
Expand Down
5 changes: 3 additions & 2 deletions lib/typeprof/core/graph/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ def initialize(target)
@new_depended_superclasses = []
end

attr_reader :sites, :diagnostics, :covariant_types
attr_reader :sites, :diagnostics

def new_vertex(genv, sig_type_node, subst)
def new_vertex(genv, sig_type_node)
# This is used to avoid duplicated vertex generation for the same sig node
@covariant_types[sig_type_node] ||= Vertex.new("rbs_type", sig_type_node)
end

Expand Down
8 changes: 4 additions & 4 deletions lib/typeprof/core/graph/vertex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def on_type_added(genv, src_var, added_types)
def on_type_removed(genv, src_var, removed_types)
end

def new_vertex(genv, show_name, node)
nvtx = Vertex.new(show_name, node)
def new_vertex(genv, show_name, origin)
nvtx = Vertex.new(show_name, origin)
add_edge(genv, nvtx)
nvtx
end
Expand Down Expand Up @@ -191,8 +191,8 @@ def on_type_removed(genv, src_var, removed_types)
end
end

def new_vertex(genv, show_name, node)
nvtx = Vertex.new(show_name, node)
def new_vertex(genv, show_name, origin)
nvtx = Vertex.new(show_name, origin)
add_edge(genv, nvtx)
nvtx
end
Expand Down

0 comments on commit 4e47d03

Please sign in to comment.