зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1751851 - [devtools] Migrate all ast selectors to a selector module. r=bomsy
Differential Revision: https://phabricator.services.mozilla.com/D136854
This commit is contained in:
Родитель
f92cb088f2
Коммит
b44cd5b678
|
@ -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 { getSymbols } from "../../../reducers/ast";
|
||||
import { getSymbols } from "../../../selectors/ast";
|
||||
import {
|
||||
actions,
|
||||
selectors,
|
||||
|
|
|
@ -58,42 +58,4 @@ function update(state = initialASTState(), action) {
|
|||
}
|
||||
}
|
||||
|
||||
// NOTE: we'd like to have the app state fully typed
|
||||
// https://github.com/firefox-devtools/debugger/blob/master/src/reducers/sources.js#L179-L185
|
||||
|
||||
export function getSymbols(state, source) {
|
||||
if (!source) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return state.ast.symbols[source.id] || null;
|
||||
}
|
||||
|
||||
export function hasSymbols(state, source) {
|
||||
const symbols = getSymbols(state, source);
|
||||
|
||||
if (!symbols) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !symbols.loading;
|
||||
}
|
||||
|
||||
export function isSymbolsLoading(state, source) {
|
||||
const symbols = getSymbols(state, source);
|
||||
if (!symbols) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return symbols.loading;
|
||||
}
|
||||
|
||||
export function getInScopeLines(state, location) {
|
||||
return state.ast.inScopeLines[makeBreakpointId(location)];
|
||||
}
|
||||
|
||||
export function hasInScopeLines(state, location) {
|
||||
return !!getInScopeLines(state, location);
|
||||
}
|
||||
|
||||
export default update;
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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 { makeBreakpointId } from "../utils/breakpoint";
|
||||
|
||||
export function getSymbols(state, source) {
|
||||
if (!source) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return state.ast.symbols[source.id] || null;
|
||||
}
|
||||
|
||||
export function hasSymbols(state, source) {
|
||||
const symbols = getSymbols(state, source);
|
||||
|
||||
if (!symbols) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !symbols.loading;
|
||||
}
|
||||
|
||||
export function isSymbolsLoading(state, source) {
|
||||
const symbols = getSymbols(state, source);
|
||||
if (!symbols) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return symbols.loading;
|
||||
}
|
||||
|
||||
export function getInScopeLines(state, location) {
|
||||
return state.ast.inScopeLines[makeBreakpointId(location)];
|
||||
}
|
||||
|
||||
export function hasInScopeLines(state, location) {
|
||||
return !!getInScopeLines(state, location);
|
||||
}
|
|
@ -12,7 +12,6 @@ export * from "../reducers/breakpoints";
|
|||
export * from "../reducers/pending-breakpoints";
|
||||
export * from "../reducers/ui";
|
||||
export * from "../reducers/file-search";
|
||||
export * from "../reducers/ast";
|
||||
export * from "../reducers/project-text-search";
|
||||
export * from "../reducers/source-tree";
|
||||
export * from "../reducers/preview";
|
||||
|
@ -31,6 +30,7 @@ export {
|
|||
getQuickOpenType,
|
||||
} from "../reducers/quick-open";
|
||||
|
||||
export * from "./ast";
|
||||
export {
|
||||
getClosestBreakpoint,
|
||||
getBreakpointAtLocation,
|
||||
|
|
|
@ -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 { getInScopeLines } from "../reducers/ast";
|
||||
import { getInScopeLines } from "./ast";
|
||||
import { getVisibleSelectedFrame } from "./pause";
|
||||
|
||||
// Checks if a line is considered in scope
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
DIRS += []
|
||||
|
||||
CompiledModules(
|
||||
"ast.js",
|
||||
"breakpointAtLocation.js",
|
||||
"breakpoints.js",
|
||||
"breakpointSources.js",
|
||||
|
|
Загрузка…
Ссылка в новой задаче