diff truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/PolyglotEngine.java @ 22436:46a6d3eb790c

Adopt TCK and Polyglot after changes to execute and invoke message
author Matthias Grimmer <grimmer@ssw.jku.at>
date Mon, 30 Nov 2015 10:24:00 +0100
parents 086776aa7548
children 07f3efb4e321 92e99d8e236c
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/PolyglotEngine.java	Thu Nov 26 14:22:48 2015 +0100
+++ b/truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/PolyglotEngine.java	Mon Nov 30 10:24:00 2015 +0100
@@ -667,7 +667,23 @@
          *         <code>null</code>
          * @throws IOException signals problem during execution
          */
+        @Deprecated
         public Value invoke(final Object thiz, final Object... args) throws IOException {
+            return execute(args);
+        }
+
+        /**
+         * Executes the symbol. If the symbol represents a function, then it should be invoked with
+         * provided arguments. If the symbol represents a field, then first argument (if provided)
+         * should set the value to the field; the return value should be the actual value of the
+         * field when the <code>invoke</code> method returns.
+         *
+         * @param args arguments to pass when invoking the symbol
+         * @return symbol wrapper around the value returned by invoking the symbol, never
+         *         <code>null</code>
+         * @throws IOException signals problem during execution
+         */
+        public Value execute(final Object... args) throws IOException {
             get();
             ComputeInExecutor<Object> invokeCompute = new ComputeInExecutor<Object>(executor) {
                 @SuppressWarnings("try")
@@ -675,16 +691,6 @@
                 protected Object compute() throws IOException {
                     try (final Closeable c = SPI.executionStart(PolyglotEngine.this, -1, debugger, null)) {
                         List<Object> arr = new ArrayList<>();
-                        if (thiz == null) {
-                            if (language[0] != null) {
-                                Object global = SPI.languageGlobal(SPI.findLanguage(PolyglotEngine.this, language[0].getClass()));
-                                if (global != null) {
-                                    arr.add(global);
-                                }
-                            }
-                        } else {
-                            arr.add(thiz);
-                        }
                         arr.addAll(Arrays.asList(args));
                         for (;;) {
                             try {