Ignore:
Timestamp:
Dec 9, 2016, 2:04:14 PM (8 years ago)
Author:
[email protected]
Message:

TextPosition and OrdinalNumber should be more like idiomatic numbers
https://bugs.webkit.org/show_bug.cgi?id=165678

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

Adopt default constructor.

  • API/JSBase.cpp:

(JSEvaluateScript):
(JSCheckScriptSyntax):

  • API/JSObjectRef.cpp:

(JSObjectMakeFunction):

  • API/JSScriptRef.cpp:

(OpaqueJSScript::OpaqueJSScript):

  • jsc.cpp:

(functionCheckModuleSyntax):

  • parser/SourceCode.h:

(JSC::makeSource):

  • parser/SourceProvider.h:

(JSC::StringSourceProvider::create):
(JSC::WebAssemblySourceProvider::WebAssemblySourceProvider):

  • runtime/FunctionConstructor.cpp:

(JSC::constructFunction):

  • runtime/ModuleLoaderPrototype.cpp:

(JSC::moduleLoaderPrototypeParseModule):

Source/WebCore:

  • bindings/js/CachedScriptSourceProvider.h:

(WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):

  • bindings/js/JSEventListener.h:

(WebCore::JSEventListener::sourcePosition):

  • bindings/js/JSLazyEventListener.cpp:

(WebCore::JSLazyEventListener::JSLazyEventListener):

  • bindings/js/ScriptController.cpp:

(WebCore::ScriptController::eventHandlerPosition):

  • bindings/js/ScriptSourceCode.h:

(WebCore::ScriptSourceCode::ScriptSourceCode):

  • css/CSSStyleSheet.cpp:

(WebCore::CSSStyleSheet::create):

  • dom/ScriptElement.h:
  • html/parser/HTMLTreeBuilder.cpp:

(WebCore::uninitializedPositionValue1):

  • inspector/InspectorStyleSheet.cpp:

(WebCore::InspectorStyleSheet::buildObjectForStyleSheetInfo): Adopt
default construtor.

  • xml/XMLErrors.cpp:

(WebCore::XMLErrors::XMLErrors):
(WebCore::XMLErrors::handleError):

  • xml/XMLErrors.h: Use std::optional instead of belowRangePosition()

because in-band signaling is harder to reason about.

  • xml/parser/XMLDocumentParserLibxml2.cpp:

(WebCore::XMLDocumentParser::textPosition): Adopt default constructor.

Source/WebKit/win:

Adopt default constructor.

  • Plugins/PluginPackage.cpp:

(WebCore::makeSource):

Source/WTF:

  • wtf/text/TextPosition.h:

(WTF::TextPosition::minimumPosition): Deleted. Just use the default
constructor. Other numbers use their default constructors to mean zero.

Any time you need a comment that says "used as a default value", that's
a pretty good indicator that it should be the default constructor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSBase.cpp

    r208306 r209627  
    6363    // evaluate sets "this" to the global object if it is NULL
    6464    JSGlobalObject* globalObject = exec->vmEntryGlobalObject();
    65     SourceCode source = makeSource(script->string(), sourceURL ? sourceURL->string() : String(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first()));
     65    SourceCode source = makeSource(script->string(), sourceURL ? sourceURL->string() : String(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber()));
    6666
    6767    NakedPtr<Exception> evaluationException;
     
    100100    startingLineNumber = std::max(1, startingLineNumber);
    101101
    102     SourceCode source = makeSource(script->string(), sourceURL ? sourceURL->string() : String(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber::first()));
     102    SourceCode source = makeSource(script->string(), sourceURL ? sourceURL->string() : String(), TextPosition(OrdinalNumber::fromOneBasedInt(startingLineNumber), OrdinalNumber()));
    103103   
    104104    JSValue syntaxException;
Note: See TracChangeset for help on using the changeset viewer.