Use a throwing default setter in v8 emitter.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/oliverb-javascript-v8@13815 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a82e0a6e8f
commit
91fc0ff205
2 changed files with 22 additions and 2 deletions
|
|
@ -43,4 +43,20 @@ void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol, v8
|
|||
obj->SetAccessor(v8::String::NewSymbol(symbol), getter, setter);
|
||||
}
|
||||
|
||||
void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
|
||||
{
|
||||
char buffer[256];
|
||||
char msg[512];
|
||||
int res;
|
||||
|
||||
property->WriteUtf8(buffer, 256);
|
||||
res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
|
||||
|
||||
if(res<0) {
|
||||
SWIG_exception(SWIG_ERROR, "Tried to write read-only variable.");
|
||||
} else {
|
||||
SWIG_exception(SWIG_ERROR, msg);
|
||||
}
|
||||
}
|
||||
|
||||
%} // v8_helper_functions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue