Index: src/js/messages.js |
diff --git a/src/js/messages.js b/src/js/messages.js |
index b80ef86c5c9b2ad4429fc3d42bfb557f39ef0fc6..f8cb967cdd064238ebbe75bf50edc2be168271f6 100644 |
--- a/src/js/messages.js |
+++ b/src/js/messages.js |
@@ -570,69 +570,90 @@ function CallSite(receiver, fun, pos, strict_mode) { |
SET_PRIVATE(this, callSiteStrictSymbol, TO_BOOLEAN(strict_mode)); |
} |
+function CheckCallSite(obj, name) { |
+ if (!IS_RECEIVER(obj) || !HAS_PRIVATE(obj, callSiteFunctionSymbol)) { |
+ throw MakeTypeError(kCallSiteMethod, name); |
+ } |
+} |
+ |
function CallSiteGetThis() { |
+ CheckCallSite(this, "getThis"); |
return GET_PRIVATE(this, callSiteStrictSymbol) |
? UNDEFINED : GET_PRIVATE(this, callSiteReceiverSymbol); |
} |
function CallSiteGetFunction() { |
+ CheckCallSite(this, "getFunction"); |
return GET_PRIVATE(this, callSiteStrictSymbol) |
? UNDEFINED : GET_PRIVATE(this, callSiteFunctionSymbol); |
} |
function CallSiteGetPosition() { |
+ CheckCallSite(this, "getPosition"); |
return GET_PRIVATE(this, callSitePositionSymbol); |
} |
function CallSiteGetTypeName() { |
+ CheckCallSite(this, "getTypeName"); |
return GetTypeName(GET_PRIVATE(this, callSiteReceiverSymbol), false); |
} |
function CallSiteIsToplevel() { |
+ CheckCallSite(this, "isTopLevel"); |
return %CallSiteIsToplevelRT(this); |
} |
function CallSiteIsEval() { |
+ CheckCallSite(this, "isEval"); |
return %CallSiteIsEvalRT(this); |
} |
function CallSiteGetEvalOrigin() { |
+ CheckCallSite(this, "getEvalOrigin"); |
var script = %FunctionGetScript(GET_PRIVATE(this, callSiteFunctionSymbol)); |
return FormatEvalOrigin(script); |
} |
function CallSiteGetScriptNameOrSourceURL() { |
+ CheckCallSite(this, "getScriptNameOrSourceURL"); |
return %CallSiteGetScriptNameOrSourceUrlRT(this); |
} |
function CallSiteGetFunctionName() { |
// See if the function knows its own name |
+ CheckCallSite(this, "getFunctionName"); |
return %CallSiteGetFunctionNameRT(this); |
} |
function CallSiteGetMethodName() { |
// See if we can find a unique property on the receiver that holds |
// this function. |
+ CheckCallSite(this, "getMethodName"); |
return %CallSiteGetMethodNameRT(this); |
} |
function CallSiteGetFileName() { |
+ CheckCallSite(this, "getFileName"); |
return %CallSiteGetFileNameRT(this); |
} |
function CallSiteGetLineNumber() { |
+ CheckCallSite(this, "getLineNumber"); |
return %CallSiteGetLineNumberRT(this); |
} |
function CallSiteGetColumnNumber() { |
+ CheckCallSite(this, "getColumnNumber"); |
return %CallSiteGetColumnNumberRT(this); |
} |
function CallSiteIsNative() { |
+ CheckCallSite(this, "isNative"); |
return %CallSiteIsNativeRT(this); |
} |
function CallSiteIsConstructor() { |
+ CheckCallSite(this, "isConstructor"); |
return %CallSiteIsConstructorRT(this); |
} |