Don't conflict with V8's Script class

Closes GH-203.
This commit is contained in:
Ryan Dahl committed 2011-03-30 10:06:25 -07:00
1 parent 4cc0a0878f
commit 75db1995b6
4 files changed
+12 -9

No files matched your search

+5 -2
View File
@@ -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());
}