Changeset 21027 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp
- Timestamp:
- Apr 23, 2007, 1:38:46 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/nodes.cpp
r20500 r21027 3 3 * Copyright (C) 1999-2002 Harri Porten ([email protected]) 4 4 * Copyright (C) 2001 Peter Kelly ([email protected]) 5 * Copyright (C) 2003 Apple Computer, Inc.5 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 55 55 #define KJS_CHECKEXCEPTION \ 56 56 if (exec->hadException()) { \ 57 setExceptionDetailsIfNeeded(exec); \58 57 JSValue *ex = exec->exception(); \ 59 58 exec->clearException(); \ 60 debugExceptionIfNeeded(exec, ex); \59 handleException(exec, ex); \ 61 60 return Completion(Throw, ex); \ 62 61 } \ … … 66 65 #define KJS_CHECKEXCEPTIONVALUE \ 67 66 if (exec->hadException()) { \ 68 setExceptionDetailsIfNeeded(exec); \ 69 debugExceptionIfNeeded(exec, exec->exception()); \ 67 handleException(exec); \ 70 68 return jsUndefined(); \ 71 69 } \ … … 75 73 #define KJS_CHECKEXCEPTIONLIST \ 76 74 if (exec->hadException()) { \ 77 setExceptionDetailsIfNeeded(exec); \ 78 debugExceptionIfNeeded(exec, exec->exception()); \ 75 handleException(exec); \ 79 76 return List(); \ 80 77 } \ … … 222 219 } 223 220 221 JSValue *Node::throwError(ExecState* exec, ErrorType e, const char* msg, const char* string) 222 { 223 UString message = msg; 224 substitute(message, string); 225 return KJS::throwError(exec, e, message, lineNo(), currentSourceId(exec), currentSourceURL(exec)); 226 } 227 224 228 JSValue *Node::throwError(ExecState *exec, ErrorType e, const char *msg, JSValue *v, Node *expr) 225 229 { … … 269 273 } 270 274 271 void Node::setExceptionDetailsIfNeeded(ExecState *exec) 272 { 273 JSValue *exceptionValue = exec->exception(); 275 void Node::handleException(ExecState* exec) 276 { 277 handleException(exec, exec->exception()); 278 } 279 280 void Node::handleException(ExecState* exec, JSValue* exceptionValue) 281 { 274 282 if (exceptionValue->isObject()) { 275 JSObject *exception = static_cast<JSObject*>(exceptionValue);283 JSObject* exception = static_cast<JSObject*>(exceptionValue); 276 284 if (!exception->hasProperty(exec, "line") && !exception->hasProperty(exec, "sourceURL")) { 277 285 exception->put(exec, "line", jsNumber(m_line)); … … 279 287 } 280 288 } 281 }282 283 void Node::debugExceptionIfNeeded(ExecState* exec, JSValue* exceptionValue)284 {285 289 Debugger* dbg = exec->dynamicInterpreter()->debugger(); 286 290 if (dbg && !dbg->hasHandledException(exec, exceptionValue)) { … … 874 878 } 875 879 880 // ------------------------------ PostfixErrorNode ----------------------------------- 881 882 JSValue* PostfixErrorNode::evaluate(ExecState* exec) 883 { 884 throwError(exec, ReferenceError, "Postfix %s operator applied to value that is not a reference.", 885 m_oper == OpPlusPlus ? "++" : "--"); 886 handleException(exec); 887 return jsUndefined(); 888 } 889 890 // ------------------------------ DeleteResolveNode ----------------------------------- 891 876 892 // ECMA 11.4.1 877 893 878 // ------------------------------ DeleteResolveNode -----------------------------------879 894 JSValue *DeleteResolveNode::evaluate(ExecState *exec) 880 895 { … … 901 916 902 917 // ------------------------------ DeleteBracketNode ----------------------------------- 918 903 919 JSValue *DeleteBracketNode::evaluate(ExecState *exec) 904 920 { … … 1108 1124 1109 1125 return n2; 1126 } 1127 1128 // ------------------------------ PrefixErrorNode ----------------------------------- 1129 1130 JSValue* PrefixErrorNode::evaluate(ExecState* exec) 1131 { 1132 throwError(exec, ReferenceError, "Prefix %s operator applied to value that is not a reference.", 1133 m_oper == OpPlusPlus ? "++" : "--"); 1134 handleException(exec); 1135 return jsUndefined(); 1110 1136 } 1111 1137 … … 1467 1493 } 1468 1494 1495 // ------------------------------ AssignErrorNode ----------------------------------- 1496 1497 JSValue* AssignErrorNode::evaluate(ExecState* exec) 1498 { 1499 throwError(exec, ReferenceError, "Left side of assignment is not a reference."); 1500 handleException(exec); 1501 return jsUndefined(); 1502 } 1503 1469 1504 // ------------------------------ AssignBracketNode ----------------------------------- 1470 1505 … … 2289 2324 KJS_CHECKEXCEPTION 2290 2325 2291 debugExceptionIfNeeded(exec, v); 2292 2326 handleException(exec, v); 2293 2327 return Completion(Throw, v); 2294 2328 }
Note:
See TracChangeset
for help on using the changeset viewer.