Ignore:
Timestamp:
Oct 13, 2010, 7:44:14 AM (15 years ago)
Author:
Nikolas Zimmermann
Message:

2010-10-13 Nikolas Zimmermann <[email protected]>

Reviewed by Dirk Schulze.

Add wtf/text/StringConcatenate
https://bugs.webkit.org/show_bug.cgi?id=47584

Move runtime/StringConcatenate.h to wtf/text, make it work for Strings too.
Add a special runtime/UStringConcatenate.h class that inherits from StringConcatenate, and extends it for use with UString.
Exactly the same design that has been followed while refactoring StringBuilder.

The UString variants can all be removed as soon as WTF::String & JSC::UString converge.

  • GNUmakefile.am: Add wtf/text/StringConcatenate.h and runtime/UStringConcatenate.h.
  • JavaScriptCore.gypi: Ditto.
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
  • JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
  • JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
  • bytecode/CodeBlock.cpp: s/makeString/makeUString/ (JSC::escapeQuotes): (JSC::valueToSourceString): (JSC::constantName): (JSC::idName): (JSC::CodeBlock::registerName): (JSC::regexpToSourceString): (JSC::regexpName):
  • bytecompiler/NodesCodegen.cpp: Ditto. (JSC::substitute):
  • profiler/Profiler.cpp: Ditto. (JSC::Profiler::createCallIdentifier):
  • runtime/ExceptionHelpers.cpp: Ditto. (JSC::createUndefinedVariableError): (JSC::createErrorMessage): (JSC::createInvalidParamError):
  • runtime/FunctionConstructor.cpp: Ditto. (JSC::constructFunction):
  • runtime/FunctionPrototype.cpp: Ditto. (JSC::insertSemicolonIfNeeded):
  • runtime/JSONObject.cpp: Ditto. (JSC::Stringifier::indent):
  • runtime/JSStringBuilder.h: (JSC::jsMakeNontrivialString):
  • runtime/RegExpConstructor.cpp: Ditto. (JSC::constructRegExp):
  • runtime/RegExpObject.cpp: Ditto. (JSC::RegExpObject::match):
  • runtime/RegExpPrototype.cpp: Ditto. (JSC::regExpProtoFuncCompile):
  • runtime/StringConcatenate.h: Removed.
  • runtime/UStringConcatenate.h: Added. Only contains the StringTypeAdapter<JSC::UString> code and the makeUString variants, the rest lives in wtf/text/StringConcatenate.h (JSC::makeUString):
  • wtf/text/StringConcatenate.h: Copied from runtime/StringConcatenate.h. (WTF::makeString):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/ExceptionHelpers.cpp

    r66150 r69663  
    3737#include "Interpreter.h"
    3838#include "Nodes.h"
    39 #include "StringConcatenate.h"
     39#include "UStringConcatenate.h"
    4040
    4141namespace JSC {
     
    9191    int divotPoint = 0;
    9292    int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
    93     UString message(makeString("Can't find variable: ", ident.ustring()));
     93    UString message(makeUString("Can't find variable: ", ident.ustring()));
    9494    JSObject* exception = addErrorInfo(exec, createReferenceError(exec, message), line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset);
    9595    return exception;
     
    9999{
    100100    if (!expressionStop || expressionStart > codeBlock->source()->length())
    101         return makeString(value.toString(exec), " is ", error);
     101        return makeUString(value.toString(exec), " is ", error);
    102102    if (expressionStart < expressionStop)
    103         return makeString("Result of expression '", codeBlock->source()->getRange(expressionStart, expressionStop), "' [", value.toString(exec), "] is ", error, ".");
     103        return makeUString("Result of expression '", codeBlock->source()->getRange(expressionStart, expressionStop), "' [", value.toString(exec), "] is ", error, ".");
    104104
    105105    // No range information, so give a few characters of context
     
    118118    while (stop > expressionStart && isStrWhiteSpace(data[stop]))
    119119        stop--;
    120     return makeString("Result of expression near '...", codeBlock->source()->getRange(start, stop), "...' [", value.toString(exec), "] is ", error, ".");
     120    return makeUString("Result of expression near '...", codeBlock->source()->getRange(start, stop), "...' [", value.toString(exec), "] is ", error, ".");
    121121}
    122122
     
    127127    int divotPoint = 0;
    128128    int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
    129     UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint, divotPoint + endOffset, value, makeString("not a valid argument for '", op, "'"));
     129    UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint, divotPoint + endOffset, value, makeUString("not a valid argument for '", op, "'"));
    130130    JSObject* exception = addErrorInfo(exec, createTypeError(exec, errorMessage), line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset);
    131131    return exception;
Note: See TracChangeset for help on using the changeset viewer.