зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1862692 - Part 20: Stop using 0-origin column number types. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D193033
This commit is contained in:
Родитель
61c8357c98
Коммит
cf99b67c05
|
@ -20,7 +20,7 @@
|
|||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "js/Array.h" // JS::GetArrayLength
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin
|
||||
#include "js/CompilationAndEvaluation.h"
|
||||
#include "js/CompileOptions.h" // JS::CompileOptions, JS::OwningCompileOptions, JS::DecodeOptions, JS::OwningDecodeOptions, JS::DelazificationOption
|
||||
#include "js/ContextOptions.h" // JS::ContextOptionsRef
|
||||
|
@ -2331,8 +2331,8 @@ nsresult ScriptLoader::FillCompileOptionsForRequest(
|
|||
if (aRequest->GetScriptLoadContext()->mIsInline &&
|
||||
aRequest->GetScriptLoadContext()->GetParserCreated() ==
|
||||
FROM_PARSER_NETWORK) {
|
||||
aOptions->setColumn(JS::ColumnNumberOneOrigin(JS::ColumnNumberZeroOrigin(
|
||||
aRequest->GetScriptLoadContext()->mColumnNo)));
|
||||
aOptions->setColumn(JS::ColumnNumberOneOrigin::fromZeroOrigin(
|
||||
aRequest->GetScriptLoadContext()->mColumnNo));
|
||||
}
|
||||
aOptions->setIsRunOnce(true);
|
||||
aOptions->setNoScriptRval(true);
|
||||
|
|
|
@ -379,6 +379,10 @@ struct LimitedColumnNumberOneOrigin
|
|||
const ColumnNumberWithOrigin<1, 0>& value) {
|
||||
return fromUnlimited(value.oneOriginValue());
|
||||
}
|
||||
|
||||
static LimitedColumnNumberOneOrigin fromZeroOrigin(uint32_t value) {
|
||||
return LimitedColumnNumberOneOrigin(value + 1);
|
||||
}
|
||||
};
|
||||
|
||||
// Column number in 0-origin.
|
||||
|
@ -428,6 +432,10 @@ struct ColumnNumberOneOrigin : public detail::ColumnNumberWithOrigin<1> {
|
|||
: Base(other.oneOriginValue()) {}
|
||||
explicit ColumnNumberOneOrigin(const LimitedColumnNumberOneOrigin& other)
|
||||
: Base(other.oneOriginValue()) {}
|
||||
|
||||
static ColumnNumberOneOrigin fromZeroOrigin(uint32_t value) {
|
||||
return ColumnNumberOneOrigin(value + 1);
|
||||
}
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
#include "jsapi.h" // JS_NewPlainObject, JS_WrapValue
|
||||
#include "js/CharacterEncoding.h" // JS_EncodeStringToUTF8
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin
|
||||
#include "js/CompileOptions.h" // JS::CompileOptions
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin
|
||||
#include "js/CompileOptions.h" // JS::CompileOptions
|
||||
#include "js/Conversions.h" // JS::ToBoolean, JS::ToString, JS::ToUint32, JS::ToInt32
|
||||
#include "js/PropertyAndElement.h" // JS_GetProperty, JS_DefineProperty
|
||||
#include "js/PropertyDescriptor.h" // JSPROP_ENUMERATE
|
||||
|
@ -86,7 +86,7 @@ bool js::ParseCompileOptions(JSContext* cx, JS::CompileOptions& options,
|
|||
if (!JS::ToInt32(cx, v, &c)) {
|
||||
return false;
|
||||
}
|
||||
options.setColumn(JS::ColumnNumberOneOrigin(JS::ColumnNumberZeroOrigin(c)));
|
||||
options.setColumn(JS::ColumnNumberOneOrigin::fromZeroOrigin(c));
|
||||
}
|
||||
|
||||
if (!JS_GetProperty(cx, opts, "sourceIsLazy", &v)) {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "debugger/Script.h" // for DebuggerScript
|
||||
#include "debugger/Source.h" // for DebuggerSource
|
||||
#include "gc/Tracer.h" // for TraceManuallyBarrieredCrossCompartmentEdge
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberZeroOrigin, JS::ColumnNumberOneOrigin
|
||||
#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin
|
||||
#include "js/CompilationAndEvaluation.h" // for Compile
|
||||
#include "js/Conversions.h" // for ToObject
|
||||
#include "js/experimental/JitInfo.h" // for JSJitInfo
|
||||
|
@ -1268,7 +1268,7 @@ bool DebuggerObject::CallData::createSource() {
|
|||
JS::CompileOptions compileOptions(cx);
|
||||
compileOptions.lineno = startLine;
|
||||
compileOptions.column =
|
||||
JS::ColumnNumberOneOrigin(JS::ColumnNumberZeroOrigin(startColumn));
|
||||
JS::ColumnNumberOneOrigin::fromZeroOrigin(startColumn);
|
||||
|
||||
if (!JS::StringHasLatin1Chars(url)) {
|
||||
JS_ReportErrorASCII(cx, "URL must be a narrow string");
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "gc/Zone.h" // for Zone
|
||||
#include "gc/ZoneAllocator.h" // for AddCellMemory
|
||||
#include "js/CallArgs.h" // for CallArgs, CallArgsFromVp
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberZeroOrigin, JS::LimitedColumnNumberOneOrigin, JS::WasmFunctionIndex
|
||||
#include "js/ColumnNumber.h" // JS::LimitedColumnNumberOneOrigin, JS::WasmFunctionIndex
|
||||
#include "js/friend/ErrorMessages.h" // for GetErrorMessage, JSMSG_*
|
||||
#include "js/GCVariant.h" // for GCVariant
|
||||
#include "js/HeapAPI.h" // for GCCellPtr
|
||||
|
@ -731,8 +731,7 @@ class DebuggerScript::GetPossibleBreakpointsMatcher {
|
|||
if (!parseIntValueImpl(value, &tmp)) {
|
||||
return false;
|
||||
}
|
||||
*result = JS::LimitedColumnNumberOneOrigin(
|
||||
JS::LimitedColumnNumberZeroOrigin(tmp));
|
||||
*result = JS::LimitedColumnNumberOneOrigin::fromZeroOrigin(tmp);
|
||||
return true;
|
||||
}
|
||||
bool parseSizeTValue(HandleValue value, size_t* result) {
|
||||
|
@ -952,8 +951,7 @@ class DebuggerScript::GetPossibleBreakpointsMatcher {
|
|||
// part also needs to be rewritten to directly pass the
|
||||
// "1 in 1-origin" (bug 1863878).
|
||||
JS::LimitedColumnNumberOneOrigin column =
|
||||
JS::LimitedColumnNumberOneOrigin(
|
||||
JS::LimitedColumnNumberZeroOrigin(offsets[i].column));
|
||||
JS::LimitedColumnNumberOneOrigin::fromZeroOrigin(offsets[i].column);
|
||||
size_t offset = offsets[i].offset;
|
||||
if (!maybeAppendEntry(offset, lineno, column, true)) {
|
||||
return false;
|
||||
|
@ -1910,8 +1908,7 @@ class DebuggerScript::GetAllColumnOffsetsMatcher {
|
|||
uint32_t lineno = offsets[i].lineno;
|
||||
// See the comment in GetPossibleBreakpointsMatcher::parseQuery.
|
||||
JS::LimitedColumnNumberOneOrigin column =
|
||||
JS::LimitedColumnNumberOneOrigin(
|
||||
JS::LimitedColumnNumberZeroOrigin(offsets[i].column));
|
||||
JS::LimitedColumnNumberOneOrigin::fromZeroOrigin(offsets[i].column);
|
||||
size_t offset = offsets[i].offset;
|
||||
if (!appendColumnOffsetEntry(lineno, column, offset)) {
|
||||
return false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче