Skip to content
Snippets Groups Projects
Commit 46c1c281 authored by Mick Jordan's avatar Mick Jordan
Browse files

add InfixEmulationFunctions for, e.g, `[`

parent da962ac9
Branches
No related tags found
No related merge requests found
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.truffle.r.nodes.builtin.base;
import com.oracle.truffle.api.dsl.*;
import com.oracle.truffle.r.nodes.access.array.read.*;
import com.oracle.truffle.r.nodes.builtin.*;
import com.oracle.truffle.r.runtime.*;
/**
* Work-around builtins for infix operators that FastR (currently) does not define as functions.
* These definitions create the illusion that the definitions exist, even if they are not actually
* bound to anything useful.
*
* N.B. These could be implemented by delegating to the equivalent nodes, e.g.
* {@link AccessArrayNode}.
*/
public class InfixEmulationFunctions {
public abstract static class ErrorAdapter extends RBuiltinNode {
protected RError nyi() throws RError {
throw RError.nyi(getEncapsulatingSourceSection(), "");
}
}
@RBuiltin(name = "[", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x", "i"})
public abstract static class AccessArrayNodeBuiltin extends ErrorAdapter {
@SuppressWarnings("unused")
@Specialization
protected Object doIt(Object x, Object i) {
throw nyi();
}
}
@RBuiltin(name = "[[", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x", "i"})
public abstract static class AccessArrayNodeSubsetBuiltin extends ErrorAdapter {
@SuppressWarnings("unused")
@Specialization
protected Object doIt(Object x, Object i) {
throw nyi();
}
}
@RBuiltin(name = "[<-", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x", "i"})
public abstract static class UpdateArrayNodeBuiltin extends ErrorAdapter {
@SuppressWarnings("unused")
@Specialization
protected Object doIt(Object x, Object i) {
throw nyi();
}
}
@RBuiltin(name = "[[<-", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x", "i"})
public abstract static class UpdateArrayNodeSubsetBuiltin extends ErrorAdapter {
@SuppressWarnings("unused")
@Specialization
protected Object doIt(Object x, Object i) {
throw nyi();
}
}
@RBuiltin(name = "$", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x", "i"})
public abstract static class AccessFieldNodeBuiltin extends ErrorAdapter {
@SuppressWarnings("unused")
@Specialization
protected Object doIt(Object x, Object i) {
throw nyi();
}
}
@RBuiltin(name = "$<-", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x", "i"})
public abstract static class UpdateFieldNodeBuiltin extends ErrorAdapter {
@SuppressWarnings("unused")
@Specialization
protected Object doIt(Object x, Object i) {
throw nyi();
}
}
@RBuiltin(name = "{", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"})
public abstract static class BraceNodeBuiltin extends ErrorAdapter {
@SuppressWarnings("unused")
@Specialization
protected Object doIt(Object x) {
throw nyi();
}
}
@RBuiltin(name = "(", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"})
public abstract static class ParenNodeBuiltin extends ErrorAdapter {
@SuppressWarnings("unused")
@Specialization
protected Object doIt(Object x) {
throw nyi();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment