Skip to content

Commit

Permalink
[Truffle] Implement just enough of Rational and Complex for language …
Browse files Browse the repository at this point in the history
…specs.
  • Loading branch information
eregon committed Dec 3, 2014
1 parent 5ea7533 commit f66d751
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
Expand Up @@ -658,6 +658,14 @@ private RubyNode translateCPath(SourceSection sourceSection, org.jruby.ast.Colon
}
}

@Override
public RubyNode visitComplexNode(ComplexNode node) {
final SourceSection sourceSection = translate(node.getPosition());

// TODO: implement Complex
return node.getNumber().accept(this);
}

@Override
public RubyNode visitConstDeclNode(org.jruby.ast.ConstDeclNode node) {
final SourceSection sourceSection = translate(node.getPosition());
Expand Down Expand Up @@ -1834,6 +1842,14 @@ public RubyNode visitPostExeNode(PostExeNode node) {
return node.getBodyNode().accept(this);
}

@Override
public RubyNode visitRationalNode(RationalNode node) {
final SourceSection sourceSection = translate(node.getPosition());

// TODO: implement Rational
return new FixnumLiteralNode.LongFixnumLiteralNode(context, sourceSection, node.getNumerator());
}

@Override
public RubyNode visitRedoNode(org.jruby.ast.RedoNode node) {
return new RedoNode(context, translate(node.getPosition()));
Expand Down
9 changes: 9 additions & 0 deletions core/src/main/ruby/jruby/truffle/core/kernel.rb
Expand Up @@ -33,6 +33,15 @@ def puts(*args)
end
end

# Minimal support for language specs
def Rational(numerator, denominator)
numerator
end

def Complex(real, imaginary)
imaginary
end

end

def STDOUT.internal_encoding
Expand Down
10 changes: 0 additions & 10 deletions spec/truffle/tags/language/numbers_tags.txt

This file was deleted.

0 comments on commit f66d751

Please sign in to comment.