Ignore:
Timestamp:
Jul 14, 2006, 10:41:10 AM (19 years ago)
Author:
ggaren
Message:

Reviewed by Beth.


Moved JSCheckScriptSyntax, JSEvaluateScript, and JSGarbageCollect into
JSBase.h/.cpp. They don't belong in the value-specific or context-specific
files because they're not part of the value or context implementations.

  • API/JSBase.h:
  • API/JSContextRef.cpp: (JSContextGetGlobalObject):
  • API/JSContextRef.h:
  • API/JSValueRef.cpp: (JSValueUnprotect):
  • API/JSValueRef.h:
  • JavaScriptCore.xcodeproj/project.pbxproj:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSContextRef.cpp

    r15404 r15428  
    6262    return toRef(exec->dynamicInterpreter()->globalObject());
    6363}
    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 NULL
    73     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 (';') statement
    85     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.