Skip to content

Commit

Permalink
[Truffle] Implemented BasicObject#instance_exec.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed Mar 15, 2015
1 parent c5f856b commit db81738
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/basicobject/instance_exec_tags.txt

This file was deleted.

Expand Up @@ -221,6 +221,24 @@ public Object instanceEval(VirtualFrame frame, Object receiver, UndefinedPlaceho

}

@CoreMethod(names = "instance_exec", needsBlock = true, argumentsAsArray = true)
public abstract static class InstanceExecNode extends YieldingCoreMethodNode {

public InstanceExecNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public InstanceExecNode(InstanceExecNode prev) {
super(prev);
}

@Specialization
public Object instanceExec(VirtualFrame frame, Object receiver, Object[] arguments, RubyProc block) {
return yieldWithModifiedSelf(frame, block, receiver, arguments);
}

}

@CoreMethod(names = "method_missing", needsBlock = true, argumentsAsArray = true, visibility = Visibility.PRIVATE)
public abstract static class MethodMissingNode extends CoreMethodNode {

Expand Down
Expand Up @@ -49,4 +49,8 @@ public boolean yieldIsTruthy(VirtualFrame frame, RubyProc block, Object... argum
return booleanCast(frame, yield(frame, block, arguments));
}

public Object yieldWithModifiedSelf(VirtualFrame frame, RubyProc block, Object self, Object... arguments) {
return dispatchNode.dispatchWithModifiedSelf(frame, block, self, arguments);
}

}
8 changes: 0 additions & 8 deletions truffle/src/main/ruby/core/shims.rb
Expand Up @@ -135,14 +135,6 @@ def _offset_to_milliseconds

ENV['TZ'] = 'UTC'

class BasicObject

def instance_exec(*args)
# TODO (nirvdrum 06-Mar-15) Properly implement this. The stub is just to get the specs even loading.
end

end

class Method

def to_proc
Expand Down

0 comments on commit db81738

Please sign in to comment.