Changeset 15428 in webkit for trunk/JavaScriptCore/API/JSContextRef.cpp
- Timestamp:
- Jul 14, 2006, 10:41:10 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSContextRef.cpp
r15404 r15428 62 62 return toRef(exec->dynamicInterpreter()->globalObject()); 63 63 } 64 65 JSValueRef JSEvaluateScript(JSContextRef context, JSStringRef script, JSObjectRef thisObject, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception)66 {67 JSLock lock;68 ExecState* exec = toJS(context);69 JSObject* jsThisObject = toJS(thisObject);70 UString::Rep* scriptRep = toJS(script);71 UString::Rep* sourceURLRep = toJS(sourceURL);72 // Interpreter::evaluate sets "this" to the global object if it is NULL73 Completion completion = exec->dynamicInterpreter()->evaluate(UString(sourceURLRep), startingLineNumber, UString(scriptRep), jsThisObject);74 75 if (completion.complType() == Throw) {76 if (exception)77 *exception = toRef(completion.value());78 return 0;79 }80 81 if (completion.value())82 return toRef(completion.value());83 84 // happens, for example, when the only statement is an empty (';') statement85 return toRef(jsUndefined());86 }87 88 bool JSCheckScriptSyntax(JSContextRef context, JSStringRef script, JSStringRef sourceURL, int startingLineNumber, JSValueRef* exception)89 {90 JSLock lock;91 92 ExecState* exec = toJS(context);93 UString::Rep* scriptRep = toJS(script);94 UString::Rep* sourceURLRep = toJS(sourceURL);95 Completion completion = exec->dynamicInterpreter()->checkSyntax(UString(sourceURLRep), startingLineNumber, UString(scriptRep));96 if (completion.complType() == Throw) {97 if (exception)98 *exception = toRef(completion.value());99 return false;100 }101 102 return true;103 }
Note:
See TracChangeset
for help on using the changeset viewer.