public Object eval()

in src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java [138:156]


    public Object eval(Reader scriptReader, ScriptContext scriptContext) throws ScriptException {
        String scriptName = getScriptName(scriptReader);
        Reader reader = wrapReaderIfEspScript(scriptReader, scriptName);
        if (!(scriptReader instanceof ScriptNameAware)) {
            if (NO_SCRIPT_NAME.equals(scriptName)) {
                String script = (String) scriptContext.getBindings(ScriptContext.ENGINE_SCOPE).get(ScriptEngine.FILENAME);
                if (script != null) {
                    for (String extension : getFactory().getExtensions()) {
                        if (script.endsWith(extension)) {
                            scriptName = script;
                            reader = new ScriptNameAwareReader(reader, scriptName);
                            break;
                        }
                    }
                }
            }
        }
        return compile(reader).eval(scriptContext);
    }