Skip to content

Commit 06a73da

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored and
Devtools-frontend LUCI CQ
committed
[cleanup] Fix Types in RemoteObject
Removes unnesisery type casting, `internal` suffix. No type code changes marked by comments Bug: none Change-Id: Ia7397d76c64ab9c319dda8b586478f077e8edaa2 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6439211 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org> Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
1 parent 0908f5b commit 06a73da

File tree

13 files changed

+155
-164
lines changed

13 files changed

+155
-164
lines changed

extensions/cxx_debugging/src/CustomFormatters.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,13 @@ export class CXXValue implements Value, LazyObject {
346346
if (this.type.hasValue && this.type.arraySize === 0) {
347347
const formatter = CustomFormatters.get(this.type);
348348
if (!formatter) {
349-
const type = 'undefined' as Chrome.DevTools.RemoteObjectType;
349+
const type = 'undefined';
350350
const description = '<not displayable>';
351351
return {type, description, hasChildren: false};
352352
}
353353

354354
if (this.location === undefined || (!this.data && this.location === 0xffffffff)) {
355-
const type = 'undefined' as Chrome.DevTools.RemoteObjectType;
355+
const type = 'undefined';
356356
const description = '<optimized out>';
357357
return {type, description, hasChildren: false};
358358
}
@@ -369,7 +369,7 @@ export class CXXValue implements Value, LazyObject {
369369
}
370370
}
371371

372-
const type = (this.type.arraySize > 0 ? 'array' : 'object') as Chrome.DevTools.RemoteObjectType;
372+
const type = this.type.arraySize > 0 ? 'array' : 'object';
373373
const {objectId} = this;
374374
return {
375375
type,

extensions/cxx_debugging/tests/TestUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function relativePathname(url: URL, base: URL): string {
6767

6868
export function nonNull<T>(value: T|null|undefined): T {
6969
assert.exists(value);
70-
return value as T;
70+
return value;
7171
}
7272

7373
export function remoteObject(value: Chrome.DevTools.RemoteObject|Chrome.DevTools.ForeignObject|null):
@@ -226,7 +226,7 @@ export class TestValue implements Value {
226226
if (typeof member === 'number' || !member.includes('.')) {
227227
return this.members[member];
228228
}
229-
let value = this as Value;
229+
let value: Value = this;
230230
for (const prop of member.split('.')) {
231231
value = value.$(prop);
232232
}

front_end/core/i18n/DevToolsLocale.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class DevToolsLocale {
6060
}
6161

6262
forceFallbackLocale(): void {
63-
// Locale is 'readonly', this is the only case where we want to forceably
63+
// Locale is 'readonly', this is the only case where we want to forcibly
6464
// overwrite the locale.
6565
(this.locale as unknown) = 'en-US';
6666
}

front_end/core/sdk/DOMModel.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ export class DOMNode {
405405
return null;
406406
}
407407

408-
let current: (DOMNode|null) = (this as DOMNode | null);
408+
let current: DOMNode|null = this;
409409
while (current && !current.isShadowRoot()) {
410410
current = current.parentNode;
411411
}
@@ -603,7 +603,7 @@ export class DOMNode {
603603
}
604604

605605
const path = [];
606-
let node: (DOMNode|null) = (this as DOMNode | null);
606+
let node: (DOMNode|null) = this;
607607
while (node) {
608608
const key = getNodeKey(node);
609609
if (key === null) {
@@ -838,22 +838,22 @@ export class DOMNode {
838838
}
839839

840840
this.#markers.delete(name);
841-
for (let node: (DOMNode|null) = (this as DOMNode | null); node; node = node.parentNode) {
841+
for (let node: (DOMNode|null) = this; node; node = node.parentNode) {
842842
--node.#subtreeMarkerCount;
843843
}
844-
for (let node: (DOMNode|null) = (this as DOMNode | null); node; node = node.parentNode) {
844+
for (let node: (DOMNode|null) = this; node; node = node.parentNode) {
845845
this.#domModelInternal.dispatchEventToListeners(Events.MarkersChanged, node);
846846
}
847847
return;
848848
}
849849

850850
if (this.parentNode && !this.#markers.has(name)) {
851-
for (let node: (DOMNode|null) = (this as DOMNode | null); node; node = node.parentNode) {
851+
for (let node: (DOMNode|null) = this; node; node = node.parentNode) {
852852
++node.#subtreeMarkerCount;
853853
}
854854
}
855855
this.#markers.set(name, value);
856-
for (let node: (DOMNode|null) = (this as DOMNode | null); node; node = node.parentNode) {
856+
for (let node: (DOMNode|null) = this; node; node = node.parentNode) {
857857
this.#domModelInternal.dispatchEventToListeners(Events.MarkersChanged, node);
858858
}
859859
}
@@ -888,7 +888,7 @@ export class DOMNode {
888888
if (!url) {
889889
return url as Platform.DevToolsPath.UrlString;
890890
}
891-
for (let frameOwnerCandidate: (DOMNode|null) = (this as DOMNode | null); frameOwnerCandidate;
891+
for (let frameOwnerCandidate: (DOMNode|null) = this; frameOwnerCandidate;
892892
frameOwnerCandidate = frameOwnerCandidate.parentNode) {
893893
if (frameOwnerCandidate instanceof DOMDocument && frameOwnerCandidate.baseURL) {
894894
return Common.ParsedURL.ParsedURL.completeURL(frameOwnerCandidate.baseURL, url);
@@ -941,7 +941,7 @@ export class DOMNode {
941941
}
942942

943943
enclosingElementOrSelf(): DOMNode|null {
944-
let node: DOMNode|null|(DOMNode | null) = (this as DOMNode | null);
944+
let node: DOMNode|null = this;
945945
if (node && node.nodeType() === Node.TEXT_NODE && node.parentNode) {
946946
node = node.parentNode;
947947
}

0 commit comments

Comments
 (0)