- int startOffset = 0;
- int endOffset = 0;
- int divotPoint = 0;
- int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
-
- // We're in a "new" expression, so we need to skip over the "new.." part
- int startPoint = divotPoint - (startOffset ? startOffset - 4 : 0); // -4 for "new "
- const UChar* data = codeBlock->source()->data();
- while (startPoint < divotPoint && isStrWhiteSpace(data[startPoint]))
- startPoint++;
-
- UString errorMessage = createErrorMessage(exec, codeBlock, line, startPoint, divotPoint, value, "not a constructor");
- JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL());
- exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
- exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
+ UString errorMessage = makeUString("'", value.toString(exec), "' is not a function");
+ JSObject* exception = createTypeError(exec, errorMessage);
+ ASSERT(exception->isErrorInstance());
+ static_cast<ErrorInstance*>(exception)->setAppendSourceToMessage();