Evaluates a script in a global context Workarounds based on findings by Jim Driscoll http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
15125
function( data ) {
		if ( data && rnotwhite.test( data ) ) {
			// We use execScript on Internet Explorer
			// We use an anonymous function so that context is window
			// rather than jQuery in Firefox
			( window.execScript || function( data ) {
				window[ "eval" ].call( window, data );
			} )( data );
		}
	}
401472
function checkForGlobal(node) {
				var scope = context.getScope(),
					parserOptions = context.parserOptions,
					ecmaFeatures = parserOptions.ecmaFeatures || {};

				// Nodejs env or modules has a special scope.
				if (ecmaFeatures.globalReturn || node.sourceType === "module") {
					findVariablesInScope(scope.childScopes[0]);
				} else {
					findVariablesInScope(scope);
				}
			}
1189250
function() {

		var result = null;

		// in production - wrap evaluation into try/catch block
		if (Lava.schema.DEBUG) {

			result = this._evaluator();

		} else {

			try {

				result = this._evaluator();

			} catch (e) {

				Lava.logException(e);

			}

		}

		return result;

	}
1134980
function () {
                    var i, len;

                    // eval scripts.
                    if (data.scripts && data.scripts.length) {
                        for (i = 0, len = data.scripts.length; i < len; i++) {
                            Util.globalEval(data.scripts[i]);
                        }
                    }

                    callback && callback(data);
                }
8978
def evaluate(self, script):
        
        if WEBENGINE:
            return self.dom.runJavaScript("{}".format(script))
        else:
            return self.dom.evaluateJavaScript("{}".format(script))
1223404
def eval(self, code, mode="single"):
        """"""
        if isinstance(code, string_types):
            if PY2 and isinstance(code, text_type):  # noqa
                code = UTF8_COOKIE + code.encode("utf-8")
            code = compile(code, "<interactive>", mode)
        return eval(code, self.globals, self.locals)
1220694
def evaluate_expression(dbg, frame, expression, is_exec):
    '''
    '''
    if frame is None:
        return

    # Not using frame.f_globals because of https://sourceforge.net/tracker2/?func=detail&aid=2541355&group_id=85796&atid=577329
    # (Names not resolved in generator expression in method)
    # See message: http://mail.python.org/pipermail/python-list/2009-January/526522.html
    updated_globals = {}
    updated_globals.update(frame.f_globals)
    updated_globals.update(frame.f_locals)  # locals later because it has precedence over the actual globals

    try:
        expression = str(expression.replace('@LINE@', '\n'))

        if is_exec:
            try:
                # try to make it an eval (if it is an eval we can print it, otherwise we'll exec it and
                # it will have whatever the user actually did)
                compiled = compile(expression, '<string>', 'eval')
            except:
                Exec(expression, updated_globals, frame.f_locals)
                pydevd_save_locals.save_locals(frame)
            else:
                result = eval(compiled, updated_globals, frame.f_locals)
                if result is not None:  # Only print if it's not None (as python does)
                    sys.stdout.write('%s\n' % (result,))
            return

        else:
            return eval_in_context(expression, updated_globals, frame.f_locals)
    finally:
        # Should not be kept alive if an exception happens and this frame is kept in the stack.
        del updated_globals
        del frame
560185
function execute(req, res) {
  ScriptManager.eval(req, res, '' + req.args[0], req.args.slice(1));
}
1371348
protected boolean evaluateCondition( String script, Log log )
        throws EnforcerRuleException
    {
        Boolean evaluation = Boolean.FALSE;
        try
        {
            evaluation = (Boolean) bsh.eval( script );
            log.debug( "Echo evaluating : " + evaluation );
        }
        catch ( EvalError ex )
        {
            throw new EnforcerRuleException( "Couldn't evaluate condition: " + script, ex );
        }
        return evaluation.booleanValue();
    }
1148890
function(url) {
  var done = _onImportScript(url)
  loadScript(
    url,
    function runScript(err, code) {
      if (err) return done(err)
      executeNormal(code, url, done)
    }
  )
}
1186621
def evaluate(self, global_state: GlobalState, post=False) -> List[GlobalState]:
        
        # Generalize some ops
        log.debug("Evaluating {}".format(self.op_code))
        op = self.op_code.lower()
        if self.op_code.startswith("PUSH"):
            op = "push"
        elif self.op_code.startswith("DUP"):
            op = "dup"
        elif self.op_code.startswith("SWAP"):
            op = "swap"
        elif self.op_code.startswith("LOG"):
            op = "log"

        instruction_mutator = (
            getattr(self, op + "_", None)
            if not post
            else getattr(self, op + "_" + "post", None)
        )

        if instruction_mutator is None:
            raise NotImplementedError

        if self.iprof is None:
            result = instruction_mutator(global_state)
        else:
            start_time = datetime.now()
            result = instruction_mutator(global_state)
            end_time = datetime.now()
            self.iprof.record(op, start_time, end_time)

        return result
582276
def eval_script(self, expr):
    
    ret = self.conn.issue_command("Evaluate", expr)
    return json.loads("[%s]" % ret)[0]
367576
public static void main(String[] args)
    {
        Context cx = Context.enter();
        try {
            // Set version to JavaScript1.2 so that we get object-literal style
            // printing instead of "[object Object]"
            cx.setLanguageVersion(Context.VERSION_1_2);

            // Initialize the standard objects (Object, Function, etc.)
            // This must be done before scripts can be executed.
            Scriptable scope = cx.initStandardObjects();

            // Now we can evaluate a script. Let's create a new object
            // using the object literal notation.
            Object result = cx.evaluateString(scope, "obj = {a:1, b:['x','y']}",
                                              "MySource", 1, null);

            Scriptable obj = (Scriptable) scope.get("obj", scope);

            // Should print "obj == result" (Since the result of an assignment
            // expression is the value that was assigned)
            System.out.println("obj " + (obj == result ? "==" : "!=") +
                               " result");

            // Should print "obj.a == 1"
            System.out.println("obj.a == " + obj.get("a", obj));

            Scriptable b = (Scriptable) obj.get("b", obj);

            // Should print "obj.b[0] == x"
            System.out.println("obj.b[0] == " + b.get(0, b));

            // Should print "obj.b[1] == y"
            System.out.println("obj.b[1] == " + b.get(1, b));

            // Should print {a:1, b:["x", "y"]}
            Function fn = (Function) ScriptableObject.getProperty(obj, "toString");
            System.out.println(fn.call(cx, scope, obj, new Object[0]));
        } finally {
            Context.exit();
        }
    }
185579
public Object eval( String statements ) throws EvalError {
        Interpreter.debug("eval(String): ", statements);
        return eval(statements, globalNameSpace);
    }
523283
function getImportGlobalsSrc(ignore) {
    var key,
        value,
        src = "",
        globalObj = typeof global === "undefined"? window: global;

    ignore = ignore || [];
    // global itself can't be overridden because it's the only reference to our real global objects
    ignore.push("global");
    // ignore 'module', 'exports' and 'require' on the global scope, because otherwise our code would
    // shadow the module-internal variables
    // @see https://github.com/jhnns/rewire-webpack/pull/6
    ignore.push("module", "exports", "require");

    for (key in globalObj) { /* jshint forin: false */
        if (ignore.indexOf(key) !== -1) {
            continue;
        }
        value = globalObj[key];

        // key may be an invalid variable name (e.g. 'a-b')
        try {
          eval("var " + key + ";");
          src += "var " + key + " = global." + key + "; ";
        } catch(e) {}
    }

    return src;
}
1189943
def _eval_script(redis, script_id, *keys, **kwargs):
    
    args = kwargs.pop('args', ())
    if kwargs:
        raise TypeError("Unexpected keyword arguments %s" % kwargs.keys())
    try:
        return redis.evalsha(SCRIPTS[script_id], len(keys), *keys + args)
    except NoScriptError:
        logger.info("%s not cached.", SCRIPTS[script_id + 2])
        return redis.eval(SCRIPTS[script_id + 1], len(keys), *keys + args)
754714
public Object eval(Bindings bindings) throws ScriptException {
        if (this.compiledScript == null) {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("No compiled script available, invoking ScriptEngine.eval(String, Bindings) for script:\n" + this.script);
            }

            return this.scriptEngine.eval(this.script, bindings);
        }

        try {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Compiled script available, invoking CompiledScript.eval(Bindings) for script:\n" + this.script);
            }

            return evalCompiledScriptWithBindingsMethod.invoke(this.compiledScript, bindings);
        }
        catch (Exception e) {
            if (e instanceof ScriptException) {
                throw (ScriptException)e;
            }
            
            throw new ScriptException(e);
        }
    }