Skip to content

Commit

Permalink
Merge pull request #100 from yui-knk/refactor_digraph
Browse files Browse the repository at this point in the history
Make sure `z` to be not nil
  • Loading branch information
yui-knk authored Sep 14, 2023
2 parents 3b010f7 + 5e57393 commit 08fa2b5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lib/lrama/digraph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ def traverse(x)
end

if @h[x] == d
while true do
z = @stack.pop
while (z = @stack.pop) do
@h[z] = Float::INFINITY
break if z == x
@result[z] = @result[x] # F (Top of S) = F x
Expand Down
2 changes: 1 addition & 1 deletion rbs_collection.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sources:
- type: git
name: ruby/gem_rbs_collection
revision: b42e4de88058603a34446942143b3ac197b9685c
revision: 95ad664324500c9eec78569b45da98c65a27a511
remote: https://github.com/ruby/gem_rbs_collection.git
repo_dir: gems
path: ".gem_rbs_collection"
Expand Down
6 changes: 3 additions & 3 deletions sig/lrama/digraph.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ module Lrama
# S in the paper
@stack: Array[Integer]
# N in the paper
@h: Hash[Integer?, (Integer|Float)?]
@h: Hash[Integer, (Integer|Float)?]
# F in the paper
@result: Hash[Integer?, Integer]
@result: Hash[Integer, Integer]

def compute: () -> Hash[Integer?, Integer]
def compute: () -> Hash[Integer, Integer]

private

Expand Down

0 comments on commit 08fa2b5

Please sign in to comment.