Debian Codegraph @

rhino/src/org/mozilla/javascript/Function.java

raw symbols SCIP
1 /* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 // API class
8
9 package org.mozilla.javascript;
10
11 /**
12 * This is interface that all functions in JavaScript must implement.
13 * The interface provides for calling functions and constructors.
14 *
15 * @see org.mozilla.javascript.Scriptable
16 * @author Norris Boyd
17 */
18
19 public interface Function extends Scriptable, Callable
20 {
21 /**
22 * Call the function.
23 *
24 * Note that the array of arguments is not guaranteed to have
25 * length greater than 0.
26 *
27 * @param cx the current Context for this thread
28 * @param scope the scope to execute the function relative to. This is
29 * set to the value returned by getParentScope() except
30 * when the function is called from a closure.
31 * @param thisObj the JavaScript <code>this</code> object
32 * @param args the array of arguments
33 * @return the result of the call
34 */
35 public Object call(Context cx, Scriptable scope, Scriptable thisObj,
36 Object[] args);
37
38 /**
39 * Call the function as a constructor.
40 *
41 * This method is invoked by the runtime in order to satisfy a use
42 * of the JavaScript <code>new</code> operator. This method is
43 * expected to create a new object and return it.
44 *
45 * @param cx the current Context for this thread
46 * @param scope an enclosing scope of the caller except
47 * when the function is called from a closure.
48 * @param args the array of arguments
49 * @return the allocated object
50 */
51 public Scriptable construct(Context cx, Scriptable scope, Object[] args);
52 }