Bug 1523528 - [release 122] Rename makeLocationId to makeBreakpointId (#7826). r=dwalsh

This commit is contained in:
Brian Hackett 2019-01-30 14:18:39 -05:00 committed by Jason Laster
parent 627fc09297
commit fe9922db96
9 changed files with 26 additions and 27 deletions

View File

@ -12,7 +12,7 @@ import {
createBreakpoint,
getASTLocation,
assertLocation,
makeLocationId,
makeBreakpointId,
makeSourceActorLocation
} from "../../utils/breakpoint";
import { PROMISE } from "../utils/middleware/promise";
@ -98,7 +98,7 @@ async function addBreakpointPromise(getState, client, sourceMaps, breakpoint) {
const text = getTextAtPosition(generatedSource, newGeneratedLocation);
const newBreakpoint = {
id: makeLocationId(generatedLocation),
id: makeBreakpointId(generatedLocation),
disabled: false,
loading: false,
options: breakpoint.options,

View File

@ -27,7 +27,7 @@ import {
makeSource
} from "../../../utils/test-head";
import { makeLocationId } from "../../../utils/breakpoint";
import { makeBreakpointId } from "../../../utils/breakpoint";
jest.mock("../../../utils/breakpoint/astBreakpointLocation", () => ({
findScopeByName: jest.fn(),
@ -43,7 +43,7 @@ function setBreakpoint(location, condition) {
const actualLocation = { ...location, line: location.line };
return Promise.resolve({
id: makeLocationId(location),
id: makeBreakpointId(location),
actualLocation,
condition
});

View File

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import { makeLocationId } from "../../../utils/breakpoint";
import { makeBreakpointId } from "../../../utils/breakpoint";
function createSource(name) {
name = name.replace(/\..*$/, "");
@ -58,7 +58,7 @@ function generateCorrectingThreadClient(offset = 0) {
const actualLocation = { ...location, line: location.line + offset };
return Promise.resolve({
id: makeLocationId(location),
id: makeBreakpointId(location),
actualLocation,
condition
});

View File

@ -7,7 +7,7 @@ import React, { Component } from "react";
import Breakpoint from "./Breakpoint";
import { getSelectedSource, getFirstVisibleBreakpoints } from "../../selectors";
import { makeLocationId } from "../../utils/breakpoint";
import { makeBreakpointId } from "../../utils/breakpoint";
import { connect } from "../../utils/connect";
import { breakpointItemActions } from "./menus/breakpoints";
import { editorItemActions } from "./menus/editor";
@ -43,7 +43,7 @@ class Breakpoints extends Component<Props> {
{breakpoints.map(bp => {
return (
<Breakpoint
key={makeLocationId(bp.location)}
key={makeBreakpointId(bp.location)}
breakpoint={bp}
selectedSource={selectedSource}
editor={editor}

View File

@ -9,7 +9,7 @@ import "./ColumnBreakpoints.css";
import { getSelectedSource, visibleColumnBreakpoints } from "../../selectors";
import { connect } from "../../utils/connect";
import { makeLocationId } from "../../utils/breakpoint";
import { makeBreakpointId } from "../../utils/breakpoint";
import { breakpointItemActions } from "./menus/breakpoints";
import type { BreakpointItemActions } from "./menus/breakpoints";
@ -41,7 +41,7 @@ class ColumnBreakpoints extends Component {
editor.codeMirror.operation(() => {
breakpoints = columnBreakpoints.map(breakpoint => (
<ColumnBreakpoint
key={makeLocationId(breakpoint.location)}
key={makeBreakpointId(breakpoint.location)}
columnBreakpoint={breakpoint}
editor={editor}
source={selectedSource}

View File

@ -18,7 +18,7 @@ import { getDisplayPath } from "../../../utils/source";
import { getSelectedLocation } from "../../../utils/source-maps";
import {
makeLocationId,
makeBreakpointId,
sortSelectedBreakpoints
} from "../../../utils/breakpoint";
@ -101,7 +101,7 @@ class Breakpoints extends Component<Props> {
breakpoint={breakpoint}
source={source}
selectedSource={selectedSource}
key={makeLocationId(
key={makeBreakpointId(
getSelectedLocation(breakpoint, selectedSource)
)}
/>

View File

@ -12,7 +12,7 @@
import { isGeneratedId } from "devtools-source-map";
import { isEqual } from "lodash";
import { makeLocationId } from "../utils/breakpoint";
import { makeBreakpointId } from "../utils/breakpoint";
import type {
XHRBreakpoint,
@ -179,7 +179,7 @@ function unsetBreakpoint(state, locationId) {
function addBreakpoint(state, action): BreakpointsState {
if (action.status === "start" && action.breakpoint) {
const { breakpoint } = action;
const locationId = makeLocationId(breakpoint.location);
const locationId = makeBreakpointId(breakpoint.location);
return setBreakpoint(state, locationId, breakpoint);
}
@ -191,7 +191,7 @@ function addBreakpoint(state, action): BreakpointsState {
// Remove the optimistic update
if (action.status === "error" && action.breakpoint) {
const locationId = makeLocationId(action.breakpoint.location);
const locationId = makeBreakpointId(action.breakpoint.location);
return unsetBreakpoint(state, locationId);
}
@ -206,20 +206,20 @@ function syncBreakpoint(state, data): BreakpointsState {
...state,
breakpoints: { ...state.breakpoints }
};
delete state.breakpoints[makeLocationId(previousLocation)];
delete state.breakpoints[makeBreakpointId(previousLocation)];
}
if (!breakpoint) {
return state;
}
const locationId = makeLocationId(breakpoint.location);
const locationId = makeBreakpointId(breakpoint.location);
return setBreakpoint(state, locationId, breakpoint);
}
function updateBreakpoint(state, action): BreakpointsState {
const { breakpoint } = action;
const locationId = makeLocationId(breakpoint.location);
const locationId = makeBreakpointId(breakpoint.location);
return setBreakpoint(state, locationId, breakpoint);
}
@ -230,7 +230,7 @@ function updateAllBreakpoints(state, action): BreakpointsState {
breakpoints: { ...state.breakpoints }
};
breakpoints.forEach(breakpoint => {
const locationId = makeLocationId(breakpoint.location);
const locationId = makeBreakpointId(breakpoint.location);
state.breakpoints[locationId] = breakpoint;
});
return state;
@ -239,7 +239,7 @@ function updateAllBreakpoints(state, action): BreakpointsState {
function remapBreakpoints(state, action): BreakpointsState {
const breakpoints = action.breakpoints.reduce(
(updatedBreakpoints, breakpoint) => {
const locationId = makeLocationId(breakpoint.location);
const locationId = makeBreakpointId(breakpoint.location);
return { ...updatedBreakpoints, [locationId]: breakpoint };
},
{}
@ -250,7 +250,7 @@ function remapBreakpoints(state, action): BreakpointsState {
function removeBreakpoint(state, action): BreakpointsState {
const { breakpoint } = action;
const id = makeLocationId(breakpoint.location);
const id = makeBreakpointId(breakpoint.location);
return unsetBreakpoint(state, id);
}
@ -280,7 +280,7 @@ export function getBreakpoint(
location: SourceLocation
): ?Breakpoint {
const breakpoints = getBreakpointsMap(state);
return breakpoints[makeLocationId(location)];
return breakpoints[makeBreakpointId(location)];
}
export function getBreakpointsDisabled(state: OuterState): boolean {

View File

@ -10,7 +10,7 @@ import { createSelector } from "reselect";
import { getViewport, getSelectedSource } from "../selectors";
import { getVisibleBreakpoints } from "./visibleBreakpoints";
import { getVisiblePausePoints } from "./visiblePausePoints";
import { makeLocationId } from "../utils/breakpoint";
import { makeBreakpointId } from "../utils/breakpoint";
import type { Selector, PausePoint } from "../reducers/types";
import type {
@ -118,7 +118,7 @@ export function getColumnBreakpoints(
// 4. Only show one column breakpoint per generated location
columnBreakpoints = sortedUniqBy(columnBreakpoints, ({ generatedLocation }) =>
makeLocationId(generatedLocation)
makeBreakpointId(generatedLocation)
);
// 5. Check that there is atleast one other possible breakpoint on the line

View File

@ -48,8 +48,7 @@ export function locationMoved(
}
// The ID for a Breakpoint is derived from its location in its Source.
// FIXME rename this to makeBreakpointId.
export function makeLocationId(location: SourceLocation) {
export function makeBreakpointId(location: SourceLocation) {
const { sourceId, line, column } = location;
const columnString = column || "";
return `${sourceId}:${line}:${columnString}`;
@ -164,7 +163,7 @@ export function createBreakpoint(
index: 0
};
const properties = {
id: makeLocationId(location),
id: makeBreakpointId(location),
options: {
condition: condition || null,
logValue: logValue || null,