mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 20:08:02 +00:00
Don't conflict with V8's Script class
Closes GH-203.
This commit is contained in:
parent
4cc0a0878f
commit
75db1995b6
@ -20,7 +20,7 @@
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
var NativeModule = require('native_module');
|
||||
var Script = process.binding('evals').Script;
|
||||
var Script = process.binding('evals').NodeScript;
|
||||
var runInThisContext = Script.runInThisContext;
|
||||
var runInNewContext = Script.runInNewContext;
|
||||
var assert = require('assert').ok;
|
||||
|
10
lib/vm.js
10
lib/vm.js
@ -21,12 +21,12 @@
|
||||
|
||||
var binding = process.binding('evals');
|
||||
|
||||
exports.Script = binding.Script;
|
||||
exports.Script = binding.NodeScript;
|
||||
exports.createScript = function(code, ctx, name) {
|
||||
return new exports.Script(code, ctx, name);
|
||||
};
|
||||
|
||||
exports.createContext = binding.Script.createContext;
|
||||
exports.runInContext = binding.Script.runInContext;
|
||||
exports.runInThisContext = binding.Script.runInThisContext;
|
||||
exports.runInNewContext = binding.Script.runInNewContext;
|
||||
exports.createContext = binding.NodeScript.createContext;
|
||||
exports.runInContext = binding.NodeScript.runInContext;
|
||||
exports.runInThisContext = binding.NodeScript.runInThisContext;
|
||||
exports.runInNewContext = binding.NodeScript.runInNewContext;
|
||||
|
@ -349,7 +349,7 @@
|
||||
// core modules found in lib/*.js. All core modules are compiled into the
|
||||
// node binary, so they can be loaded faster.
|
||||
|
||||
var Script = process.binding('evals').Script;
|
||||
var Script = process.binding('evals').NodeScript;
|
||||
var runInThisContext = Script.runInThisContext;
|
||||
|
||||
function NativeModule(id) {
|
||||
|
@ -150,7 +150,10 @@ void WrappedScript::Initialize(Handle<Object> target) {
|
||||
Local<FunctionTemplate> t = FunctionTemplate::New(WrappedScript::New);
|
||||
constructor_template = Persistent<FunctionTemplate>::New(t);
|
||||
constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
|
||||
constructor_template->SetClassName(String::NewSymbol("Script"));
|
||||
// Note: We use 'NodeScript' instead of 'Script' so that we do not
|
||||
// conflict with V8's Script class defined in v8/src/messages.js
|
||||
// See GH-203 https://github.com/joyent/node/issues/203
|
||||
constructor_template->SetClassName(String::NewSymbol("NodeScript"));
|
||||
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor_template,
|
||||
"createContext",
|
||||
@ -184,7 +187,7 @@ void WrappedScript::Initialize(Handle<Object> target) {
|
||||
"runInNewContext",
|
||||
WrappedScript::CompileRunInNewContext);
|
||||
|
||||
target->Set(String::NewSymbol("Script"),
|
||||
target->Set(String::NewSymbol("NodeScript"),
|
||||
constructor_template->GetFunction());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user