Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Finish the inspect/pretty_print->awesome_print transform.

  • Loading branch information...
commit eb85404e17416e7a66766667c93fa24c750f1ef8 1 parent 656c823
@whitequark authored
View
2  lib/furnace/ssa/basic_block.rb
@@ -154,7 +154,7 @@ def awesome_print(p=AwesomePrinter.new)
p.newline
end
- def inspect_as_value(p=AwesomePrinter.new)
+ def awesome_print_as_value(p=AwesomePrinter.new)
p.keyword('label').
name(name)
end
View
2  lib/furnace/ssa/constant.rb
@@ -30,7 +30,7 @@ def ==(other)
end
end
- def inspect_as_value(p=AwesomePrinter.new)
+ def awesome_print_as_value(p=AwesomePrinter.new)
type.awesome_print(p)
p.text @value.inspect
p
View
2  lib/furnace/ssa/event_stream.rb
@@ -67,7 +67,7 @@ def update_instruction(insn)
operands = dump_all(insn.operands)
end
- params = insn.pretty_parameters(printer).to_s
+ params = insn.awesome_print_parameters(printer).to_s
emit("update_instruction",
name: insn.name,
View
12 lib/furnace/ssa/instruction.rb
@@ -91,13 +91,13 @@ def awesome_print(p=AwesomePrinter.new)
p.keyword(opcode)
- pretty_parameters(p)
- pretty_operands(p)
+ awesome_print_parameters(p)
+ awesome_print_operands(p)
p
end
- def inspect_as_value(p=AwesomePrinter.new)
+ def awesome_print_as_value(p=AwesomePrinter.new)
if type == Type::Bottom.new
p.nest(type)
else
@@ -105,14 +105,14 @@ def inspect_as_value(p=AwesomePrinter.new)
end
end
- def pretty_parameters(p=AwesomePrinter.new)
+ def awesome_print_parameters(p=AwesomePrinter.new)
p
end
- def pretty_operands(p=AwesomePrinter.new)
+ def awesome_print_operands(p=AwesomePrinter.new)
if @operands
p.collection('', ', ', '', @operands) do |operand|
- operand.inspect_as_value(p)
+ operand.awesome_print_as_value(p)
end
else
p.text('<DETACHED>')
View
4 lib/furnace/ssa/instructions/phi.rb
@@ -29,11 +29,11 @@ def translate_operands(map)
protected
- def pretty_operands(p)
+ def awesome_print_operands(p)
@operands.each_with_index do |(basic_block, value), index|
p.name basic_block.name
p.text '=>'
- value.inspect_as_value p
+ value.awesome_print_as_value p
p.append ',' if index < @operands.count - 1
end
View
2  lib/furnace/ssa/named_value.rb
@@ -32,7 +32,7 @@ def detach
@function = nil
end
- def inspect_as_value(p=AwesomePrinter.new)
+ def awesome_print_as_value(p=AwesomePrinter.new)
p.name(@name)
end
View
4 lib/furnace/ssa/value.rb
@@ -52,10 +52,10 @@ def ==(other)
end
def awesome_print(p=AwesomePrinter.new)
- inspect_as_value(p)
+ awesome_print_as_value(p)
end
- def inspect_as_value(p=AwesomePrinter.new)
+ def awesome_print_as_value(p=AwesomePrinter.new)
p.text inspect
end
end
View
12 test/test_ssa.rb
@@ -339,23 +339,23 @@ def insn_binary(left, right)
dup = DupInsn.new([SSA::Constant.new(Integer, 1)])
dup.basic_block = @basic_block
dup.awesome_print.should =~ /\^Integer %\d+ = dup \^Integer 1/
- dup.inspect_as_value.should =~ /^%\d+/
+ dup.awesome_print_as_value.should =~ /^%\d+/
concat = TupleConcatInsn.new(
[SSA::Constant.new(Array, [1]), SSA::Constant.new(Array, [2,3])])
concat.basic_block = @basic_block
concat.awesome_print.should =~ /\^Array %\d+ = tuple_concat \^Array \[1\], \^Array \[2, 3\]/
- concat.inspect_as_value.should =~ /^%\d+/
+ concat.awesome_print_as_value.should =~ /^%\d+/
zero_arity = BindingInsn.new
zero_arity.basic_block = @basic_block
zero_arity.awesome_print.should =~ /\^Binding %\d+ = binding/
- zero_arity.inspect_as_value.should =~ /^%\d+/
+ zero_arity.awesome_print_as_value.should =~ /^%\d+/
zero_all = TestScope::NestedInsn.new
zero_all.basic_block = @basic_block
zero_all.awesome_print.should == 'nested'
- zero_all.inspect_as_value.should == 'bottom'
+ zero_all.awesome_print_as_value.should == 'bottom'
end
describe SSA::GenericInstruction do
@@ -515,7 +515,7 @@ def i.exits?; true; end
end
it 'inspects as value' do
- @basic_block.inspect_as_value.should == 'label %1'
+ @basic_block.awesome_print_as_value.should == 'label %1'
end
it 'is constant' do
@@ -667,7 +667,7 @@ def i.exits?; true; end
SSA::Constant.new(SSA::Function, @function.name)
@function.name = 'foo'
- @function.to_value.inspect_as_value.should ==
+ @function.to_value.awesome_print_as_value.should ==
'function "foo"'
end
Please sign in to comment.
Something went wrong with that request. Please try again.