Skip to content

Commit 3995324

Browse files
committed
Check TrufflePrimitive is called syntactically
1 parent 4403cbc commit 3995324

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

spec/truffle/graal/assert_constant_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
describe "TrufflePrimitive.assert_compilation_constant" do
1212

1313
it "raises a RuntimeError when called dynamically" do
14-
-> { Truffle::Graal.send(:assert_constant, 14 + 2) }.should raise_error(RuntimeError)
14+
-> { tp = TrufflePrimitive; tp.assert_constant(14 + 2) }.should raise_error(RuntimeError)
1515
end
1616

1717
guard -> { !TruffleRuby.jit? } do

spec/truffle/graal/assert_not_compiled_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
describe "TrufflePrimitive.assert_not_compiled" do
1212

1313
it "raises a RuntimeError when called dynamically" do
14-
-> { Truffle::Graal.send(:assert_not_compiled) }.should raise_error(RuntimeError)
14+
-> { tp = TrufflePrimitive; tp.assert_not_compiled }.should raise_error(RuntimeError)
1515
end
1616

1717
guard -> { !TruffleRuby.jit? } do

src/main/java/org/truffleruby/core/CoreLibrary.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,6 +1520,7 @@ public DynamicObject getStructClass() {
15201520
"/core/truffle/string_operations.rb",
15211521
"/core/truffle/backward.rb",
15221522
"/core/truffle/truffleruby.rb",
1523+
"/core/truffle/truffle_primitive.rb",
15231524
"/core/splitter.rb",
15241525
"/core/stat.rb",
15251526
"/core/io.rb",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. This
4+
# code is released under a tri EPL/GPL/LGPL license. You can use it,
5+
# redistribute it and/or modify it under the terms of the:
6+
#
7+
# Eclipse Public License version 2.0, or
8+
# GNU General Public License version 2, or
9+
# GNU Lesser General Public License version 2.1.
10+
11+
module TrufflePrimitive
12+
13+
def self.method_missing(name, *args, &block)
14+
raise "TrufflePrimitive.#{name} has to be called syntactically."
15+
end
16+
17+
end

0 commit comments

Comments
 (0)