Commit 45669e9b authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[turbolizer] Add semicolons consistently after statements

Change-Id: I8e147bcb5d1e0b8e16874f0593a8ce4338dfc201
Notry: true
Bug: v8:7327
Reviewed-on: https://chromium-review.googlesource.com/c/1405319
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58760}
parent a6356ac6
......@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { Source, SourceResolver, sourcePositionToStringKey } from "../src/source-resolver"
import { SelectionBroker } from "../src/selection-broker"
import { View } from "../src/view"
import { MySelection } from "../src/selection"
import { ViewElements } from "../src/util"
import { Source, SourceResolver, sourcePositionToStringKey } from "../src/source-resolver";
import { SelectionBroker } from "../src/selection-broker";
import { View } from "../src/view";
import { MySelection } from "../src/selection";
import { ViewElements } from "../src/util";
import { SelectionHandler } from "./selection-handler";
export enum CodeMode {
MAIN_SOURCE = "main function",
INLINED_SOURCE = "inlined function"
};
}
export class CodeView extends View {
broker: SelectionBroker;
......@@ -44,7 +44,7 @@ export class CodeView extends View {
clear: function () {
view.selection.clear();
view.updateSelection();
broker.broadcastClear(this)
broker.broadcastClear(this);
},
select: function (sourcePositions, selected) {
const locations = [];
......@@ -170,7 +170,7 @@ export class CodeView extends View {
} else {
codePre.style.display = "none";
}
}
};
if (sourceText != "") {
codePre.classList.add("linenums");
codePre.textContent = sourceText;
......@@ -191,7 +191,7 @@ export class CodeView extends View {
} else {
view.selectionHandler.clear();
}
}
};
const base: number = source.startPosition;
let current = 0;
......@@ -239,21 +239,21 @@ export class CodeView extends View {
const replacementNode = textnode.splitText(splitLength);
const span = document.createElement('span');
span.setAttribute("scriptOffset", sourcePosition.scriptOffset);
span.classList.add("source-position")
span.classList.add("source-position");
const marker = document.createElement('span');
marker.classList.add("marker")
marker.classList.add("marker");
span.appendChild(marker);
const inlining = this.sourceResolver.getInliningForPosition(sourcePosition);
if (inlining != undefined && view.showAdditionalInliningPosition) {
const sourceName = this.sourceResolver.getSourceName(inlining.sourceId);
const inliningMarker = document.createElement('span');
inliningMarker.classList.add("inlining-marker")
inliningMarker.setAttribute("data-descr", `${sourceName} was inlined here`)
inliningMarker.classList.add("inlining-marker");
inliningMarker.setAttribute("data-descr", `${sourceName} was inlined here`);
span.appendChild(inliningMarker);
}
span.onclick = function (e) {
e.stopPropagation();
view.onSelectSourcePosition(sourcePosition, !e.shiftKey)
view.onSelectSourcePosition(sourcePosition, !e.shiftKey);
};
view.addHtmlElementToSourcePosition(sourcePosition, span);
textnode.parentNode.insertBefore(span, replacementNode);
......@@ -266,7 +266,7 @@ export class CodeView extends View {
lineNumberElement.classList.add("line-number");
lineNumberElement.dataset.lineNumber = `${lineNumber}`;
lineNumberElement.innerText = `${lineNumber}`;
lineElement.insertBefore(lineNumberElement, lineElement.firstChild)
lineElement.insertBefore(lineNumberElement, lineElement.firstChild);
// Don't add lines to source positions of not in backwardsCompatibility mode.
if (this.source.backwardsCompatibility === true) {
for (const sourcePosition of this.sourceResolver.linetoSourcePositions(lineNumber - 1)) {
......
......@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { PROF_COLS, UNICODE_BLOCK } from "../src/constants"
import { SelectionBroker } from "../src/selection-broker"
import { TextView } from "../src/text-view"
import { PROF_COLS, UNICODE_BLOCK } from "../src/constants";
import { SelectionBroker } from "../src/selection-broker";
import { TextView } from "../src/text-view";
import { MySelection } from "./selection";
import { anyToString, interpolate } from "./util";
import { InstructionSelectionHandler } from "./selection-handler";
......@@ -14,7 +14,7 @@ const toolboxHTML = `<div id="disassembly-toolbox">
<input id="show-instruction-address" type="checkbox" name="instruction-address">Show addresses</input>
<input id="show-instruction-binary" type="checkbox" name="instruction-binary">Show binary literal</input>
</form>
</div>`
</div>`;
export class DisassemblyView extends TextView {
SOURCE_POSITION_HEADER_REGEX: any;
......@@ -52,9 +52,9 @@ export class DisassemblyView extends TextView {
const offsetElement = document.createElement("SPAN");
offsetElement.innerText = matches.groups["offset"];
fragment.appendChild(addressElement);
fragment.appendChild(document.createTextNode(matches.groups["addressSpace"]))
fragment.appendChild(document.createTextNode(matches.groups["addressSpace"]));
fragment.appendChild(offsetElement);
fragment.appendChild(document.createTextNode(matches.groups["offsetSpace"]))
fragment.appendChild(document.createTextNode(matches.groups["offsetSpace"]));
fragment.classList.add('tag');
if (!Number.isNaN(offset)) {
......@@ -79,10 +79,10 @@ export class DisassemblyView extends TextView {
fragment.innerHTML = text;
const replacer = (match, hexOffset) => {
const offset = Number.parseInt(hexOffset, 16);
const keyOffset = view.sourceResolver.getKeyPcOffset(offset)
return `<span class="tag linkable-text" data-pc-offset="${keyOffset}">${match}</span>`
}
const html = text.replace(/<.0?x?([0-9a-fA-F]+)>/g, replacer)
const keyOffset = view.sourceResolver.getKeyPcOffset(offset);
return `<span class="tag linkable-text" data-pc-offset="${keyOffset}">${match}</span>`;
};
const html = text.replace(/<.0?x?([0-9a-fA-F]+)>/g, replacer);
fragment.innerHTML = html;
}
};
......@@ -139,7 +139,7 @@ export class DisassemblyView extends TextView {
const offset = Number.parseInt(offsetAsString, 10);
if ((typeof offsetAsString) != "undefined" && !Number.isNaN(offset)) {
view.offsetSelection.select([offset], true);
const nodes = view.sourceResolver.nodesForPCOffset(offset)[0]
const nodes = view.sourceResolver.nodesForPCOffset(offset)[0];
if (nodes.length > 0) {
e.stopPropagation();
if (!e.shiftKey) {
......@@ -151,7 +151,7 @@ export class DisassemblyView extends TextView {
}
}
return undefined;
}
};
view.divNode.addEventListener('click', linkHandler);
const linkHandlerBlock = e => {
......@@ -162,8 +162,8 @@ export class DisassemblyView extends TextView {
view.selectionHandler.clear();
}
view.blockSelectionHandler.select([blockId], true);
};
}
};
view.divNode.addEventListener('click', linkHandlerBlock);
this.offsetSelection = new MySelection(anyToString);
......@@ -192,9 +192,9 @@ export class DisassemblyView extends TextView {
this.instructionSelectionHandler = instructionSelectionHandler;
broker.addInstructionHandler(instructionSelectionHandler);
const toolbox = document.createElement("div")
const toolbox = document.createElement("div");
toolbox.id = "toolbox-anchor";
toolbox.innerHTML = toolboxHTML
toolbox.innerHTML = toolboxHTML;
view.divNode.insertBefore(toolbox, view.divNode.firstChild);
const instructionAddressInput: HTMLInputElement = view.divNode.querySelector("#show-instruction-address");
const lastShowInstructionAddress = window.sessionStorage.getItem("show-instruction-address");
......@@ -226,11 +226,11 @@ export class DisassemblyView extends TextView {
let keyPcOffsets = this.sourceResolver.nodesToKeyPcOffsets(this.selection.selectedKeys());
if (this.offsetSelection) {
for (const key of this.offsetSelection.selectedKeys()) {
keyPcOffsets.push(Number(key))
keyPcOffsets.push(Number(key));
}
}
for (const keyPcOffset of keyPcOffsets) {
const elementsToSelect = this.divNode.querySelectorAll(`[data-pc-offset='${keyPcOffset}']`)
const elementsToSelect = this.divNode.querySelectorAll(`[data-pc-offset='${keyPcOffset}']`);
for (const el of elementsToSelect) {
el.classList.toggle("selected", true);
}
......@@ -281,11 +281,11 @@ export class DisassemblyView extends TextView {
}
initializeContent(data, rememberedSelection) {
console.time("disassembly-view")
console.time("disassembly-view");
super.initializeContent(data, rememberedSelection);
this.showInstructionAddressHandler();
this.showInstructionBinaryHandler();
console.timeEnd("disassembly-view")
console.timeEnd("disassembly-view");
}
// Shorten decimals and remove trailing zeroes for readability.
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { GNode, DEFAULT_NODE_BUBBLE_RADIUS } from "../src/node"
import { GNode, DEFAULT_NODE_BUBBLE_RADIUS } from "../src/node";
import { Graph } from "./graph";
export const MINIMUM_EDGE_SEPARATION = 20;
......@@ -26,11 +26,11 @@ export class Edge {
stringID() {
return this.source.id + "," + this.index + "," + this.target.id;
};
}
isVisible() {
return this.visible && this.source.visible && this.target.visible;
};
}
getInputHorizontalPosition(graph: Graph, showTypes: boolean) {
if (this.backEdgeNumber > 0) {
......@@ -48,7 +48,7 @@ export class Edge {
var inputOffset = MINIMUM_EDGE_SEPARATION * (index + 1);
return (target.x < source.x)
? (target.x + target.getTotalNodeWidth() + inputOffset)
: (target.x - inputOffset)
: (target.x - inputOffset);
}
}
......
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { MAX_RANK_SENTINEL } from "../src/constants"
import { MINIMUM_EDGE_SEPARATION, Edge } from "../src/edge"
import { NODE_INPUT_WIDTH, MINIMUM_NODE_OUTPUT_APPROACH, DEFAULT_NODE_BUBBLE_RADIUS, GNode } from "../src/node"
import { MAX_RANK_SENTINEL } from "../src/constants";
import { MINIMUM_EDGE_SEPARATION, Edge } from "../src/edge";
import { NODE_INPUT_WIDTH, MINIMUM_NODE_OUTPUT_APPROACH, DEFAULT_NODE_BUBBLE_RADIUS, GNode } from "../src/node";
import { Graph } from "./graph";
const DEFAULT_NODE_ROW_SEPARATION = 130
const DEFAULT_NODE_ROW_SEPARATION = 130;
const traceLayout = false;
function newGraphOccupation(graph: Graph) {
......@@ -29,7 +29,7 @@ function newGraphOccupation(graph: Graph) {
}
function slotToLeftPosition(slot: number) {
return slot * NODE_INPUT_WIDTH
return slot * NODE_INPUT_WIDTH;
}
function findSpace(pos: number, width: number, direction: number) {
......@@ -45,9 +45,9 @@ function newGraphOccupation(graph: Graph) {
currentScanSlot = currentSlot + (mod ? -1 : 1) * (slotsChecked >> 1);
if (!isSlotFilled[slotToIndex(currentScanSlot)]) {
if (mod) {
if (direction <= 0)--widthSlotsRemainingLeft
if (direction <= 0) --widthSlotsRemainingLeft;
} else {
if (direction >= 0)--widthSlotsRemainingRight
if (direction >= 0) --widthSlotsRemainingRight;
}
if (widthSlotsRemainingLeft == 0 ||
widthSlotsRemainingRight == 0 ||
......@@ -169,7 +169,7 @@ function newGraphOccupation(graph: Graph) {
direction = 0;
}
return [direction, pos];
}
};
const width = node.getTotalNodeWidth();
const margin = MINIMUM_EDGE_SEPARATION;
const paddedWidth = width + 2 * margin;
......@@ -233,7 +233,7 @@ function newGraphOccupation(graph: Graph) {
}
console.log(s);
}
}
};
return occupation;
}
......@@ -248,7 +248,7 @@ export function layoutNodeGraph(graph: Graph, showTypes: boolean): void {
for (const n of graph.nodes()) {
endNodesHasNoOutputs[n.id] = true;
startNodesHasNoInputs[n.id] = true;
};
}
graph.forEachEdge((e: Edge) => {
endNodesHasNoOutputs[e.source.id] = false;
startNodesHasNoInputs[e.target.id] = false;
......@@ -271,7 +271,7 @@ export function layoutNodeGraph(graph: Graph, showTypes: boolean): void {
n.rank = 0;
n.visitOrderWithinRank = 0;
n.outputApproach = MINIMUM_NODE_OUTPUT_APPROACH;
};
}
if (traceLayout) {
console.log(`layoutGraph init ${performance.now() - start}`);
......@@ -382,7 +382,7 @@ export function layoutNodeGraph(graph: Graph, showTypes: boolean): void {
rankSets[n.rank].push(n);
}
}
};
}
// Iterate backwards from highest to lowest rank, placing nodes so that they
// spread out from the "center" as much as possible while still being
......@@ -403,7 +403,7 @@ export function layoutNodeGraph(graph: Graph, showTypes: boolean): void {
let placedCount = 0;
rankSet = rankSet.sort((a: GNode, b: GNode) => {
if (a.visitOrderWithinRank < b.visitOrderWithinRank) {
return -1
return -1;
} else if (a.visitOrderWithinRank == b.visitOrderWithinRank) {
return 0;
} else {
......@@ -419,7 +419,7 @@ export function layoutNodeGraph(graph: Graph, showTypes: boolean): void {
console.log("Node " + nodeToPlace.id + " is placed between [" + nodeToPlace.x + ", " + (nodeToPlace.x + nodeToPlace.getTotalNodeWidth()) + ")");
}
const staggeredFlooredI = Math.floor(placedCount++ % 3);
const delta = MINIMUM_EDGE_SEPARATION * staggeredFlooredI
const delta = MINIMUM_EDGE_SEPARATION * staggeredFlooredI;
nodeToPlace.outputApproach += delta;
} else {
nodeToPlace.x = 0;
......
......@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as d3 from "d3"
import { layoutNodeGraph } from "../src/graph-layout"
import { GNode, nodeToStr } from "../src/node"
import { NODE_INPUT_WIDTH } from "../src/node"
import { DEFAULT_NODE_BUBBLE_RADIUS } from "../src/node"
import { Edge, edgeToStr } from "../src/edge"
import { View, PhaseView } from "../src/view"
import { MySelection } from "../src/selection"
import { partial } from "../src/util"
import * as d3 from "d3";
import { layoutNodeGraph } from "../src/graph-layout";
import { GNode, nodeToStr } from "../src/node";
import { NODE_INPUT_WIDTH } from "../src/node";
import { DEFAULT_NODE_BUBBLE_RADIUS } from "../src/node";
import { Edge, edgeToStr } from "../src/edge";
import { View, PhaseView } from "../src/view";
import { MySelection } from "../src/selection";
import { partial } from "../src/util";
import { NodeSelectionHandler, ClearableHandler } from "./selection-handler";
import { Graph } from "./graph";
import { SelectionBroker } from "./selection-broker";
......@@ -23,9 +23,9 @@ interface GraphState {
showTypes: boolean;
selection: MySelection;
mouseDownNode: any;
justDragged: boolean,
justScaleTransGraph: boolean,
hideDead: boolean
justDragged: boolean;
justScaleTransGraph: boolean;
hideDead: boolean;
}
export class GraphView extends View implements PhaseView {
......@@ -59,7 +59,7 @@ export class GraphView extends View implements PhaseView {
const svg = this.divElement.append("svg")
.attr('version', '2.0')
.attr("width", "100%")
.attr("height", "100%")
.attr("height", "100%");
svg.on("click", function (d) {
view.selectionHandler.clear();
});
......@@ -68,7 +68,7 @@ export class GraphView extends View implements PhaseView {
svg
.attr("focusable", false)
.on("focus", e => {})
.on("keydown", e => { view.svgKeyDown(); })
.on("keydown", e => { view.svgKeyDown(); });
view.svg = svg;
......@@ -119,7 +119,7 @@ export class GraphView extends View implements PhaseView {
e.visible = e.visible || view.state.selection.isSelected(e.target);
});
}
};
}
view.updateGraphVisibility();
},
brokeredClear: function () {
......@@ -249,12 +249,12 @@ export class GraphView extends View implements PhaseView {
deleteContent() {
for (const n of this.graph.nodes()) {
n.visible = false;
};
}
this.graph.forEachEdge((e: Edge) => {
e.visible = false;
});
this.updateGraphVisibility();
};
}
createGraph(data, rememberedSelection) {
this.graph = new Graph(data);
......@@ -263,7 +263,7 @@ export class GraphView extends View implements PhaseView {
if (rememberedSelection != undefined && rememberedSelection.has(nodeToStringKey(n))) {
n.visible = true;
}
};
}
this.graph.forEachEdge((e: Edge) => {
e.visible = e.type == 'control' && e.source.visible && e.target.visible;
});
......@@ -357,7 +357,7 @@ export class GraphView extends View implements PhaseView {
showAllAction(view: GraphView) {
for (const n of view.graph.nodes()) {
n.visible = !view.state.hideDead || n.isLive();
};
}
view.graph.forEachEdge((e: Edge) => {
e.visible = e.source.visible || e.target.visible;
});
......@@ -378,7 +378,7 @@ export class GraphView extends View implements PhaseView {
n.visible = false;
this.state.selection.select([n], false);
}
};
}
this.updateGraphVisibility();
}
......@@ -387,7 +387,7 @@ export class GraphView extends View implements PhaseView {
if (!view.state.selection.isSelected(n)) {
n.visible = false;
}
};
}
view.updateGraphVisibility();
}
......@@ -396,7 +396,7 @@ export class GraphView extends View implements PhaseView {
if (view.state.selection.isSelected(n)) {
n.visible = false;
}
};
}
view.selectionHandler.clear();
}
......@@ -455,7 +455,7 @@ export class GraphView extends View implements PhaseView {
}
view.updateGraphVisibility();
}
}
};
let eventHandled = true; // unless the below switch defaults
switch (d3.event.keyCode) {
......@@ -663,7 +663,7 @@ export class GraphView extends View implements PhaseView {
view.selectionHandler.select([d], undefined);
d3.event.stopPropagation();
})
.call(view.drag)
.call(view.drag);
newGs.append("rect")
.attr("rx", 10)
......@@ -673,7 +673,7 @@ export class GraphView extends View implements PhaseView {
})
.attr('height', function (d) {
return d.getNodeHeight(view.state.showTypes);
})
});
function appendInputAndOutputBubbles(g, d) {
for (let i = 0; i < d.inputs.length; ++i) {
......@@ -744,7 +744,7 @@ export class GraphView extends View implements PhaseView {
.append("title")
.text(function (l) {
return d.getTitle();
})
});
if (d.nodeLabel.type != undefined) {
d3.select(this).append("text")
.classed("label", true)
......@@ -759,7 +759,7 @@ export class GraphView extends View implements PhaseView {
.append("title")
.text(function (l) {
return d.getType();
})
});
}
});
......@@ -807,8 +807,8 @@ export class GraphView extends View implements PhaseView {
onresize() {
const trans = d3.zoomTransform(this.svg.node());
const ctrans = this.panZoom.constrain()(trans, this.getSvgExtent(), this.panZoom.translateExtent())
this.panZoom.transform(this.svg, ctrans)
const ctrans = this.panZoom.constrain()(trans, this.getSvgExtent(), this.panZoom.translateExtent());
this.panZoom.transform(this.svg, ctrans);
}
toggleTypes() {
......@@ -860,6 +860,6 @@ export class GraphView extends View implements PhaseView {
this.panZoom.scaleTo(this.svg, 0);
this.panZoom.translateTo(this.svg,
this.graph.minGraphX + this.graph.width / 2,
this.graph.minGraphY + this.graph.height / 2)
this.graph.minGraphY + this.graph.height / 2);
}
}
......@@ -52,9 +52,9 @@ export class GraphMultiView extends View {
const view = this;
view.sourceResolver = sourceResolver;
view.selectionBroker = selectionBroker;
const toolbox = document.createElement("div")
const toolbox = document.createElement("div");
toolbox.className = "toolbox-anchor";
toolbox.innerHTML = toolboxHTML
toolbox.innerHTML = toolboxHTML;
view.divNode.appendChild(toolbox);
const searchInput = toolbox.querySelector("#search-input") as HTMLInputElement;
searchInput.addEventListener("keyup", e => {
......@@ -88,7 +88,7 @@ export class GraphMultiView extends View {
this.selectMenu.onchange = function (this: HTMLSelectElement) {
window.sessionStorage.setItem("lastSelectedPhase", this.selectedIndex.toString());
view.displayPhase(view.sourceResolver.getPhase(this.selectedIndex));
}
};
}
show(data, rememberedSelection) {
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { MINIMUM_EDGE_SEPARATION, Edge } from "../src/edge"
import { MINIMUM_EDGE_SEPARATION, Edge } from "../src/edge";
import { NodeLabel } from "./node-label";
import { MAX_RANK_SENTINEL } from "./constants";
import { alignUp, measureText } from "./util";
......@@ -149,7 +149,7 @@ export class GNode {
}
getInputApproach(index) {
return this.y - MINIMUM_NODE_INPUT_APPROACH -
(index % 4) * MINIMUM_EDGE_SEPARATION - DEFAULT_NODE_BUBBLE_RADIUS
(index % 4) * MINIMUM_EDGE_SEPARATION - DEFAULT_NODE_BUBBLE_RADIUS;
}
getNodeHeight(showTypes: boolean): number {
if (showTypes) {
......@@ -175,6 +175,6 @@ export class GNode {
((this.nodeLabel.opcode == "Phi" || this.nodeLabel.opcode == "EffectPhi" || this.nodeLabel.opcode == "InductionVariablePhi") &&
this.inputs[this.inputs.length - 1].source.nodeLabel.opcode == "Loop");
}
};
}
export const nodeToStr = (n: GNode) => "N" + n.id;
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as d3 from "d3"
import * as C from "../src/constants"
import * as d3 from "d3";
import * as C from "../src/constants";
class Snapper {
resizer: Resizer;
......@@ -104,7 +104,7 @@ export class Resizer {
constructor(panesUpdatedCallback: () => void, deadWidth: number) {
let resizer = this;
resizer.panesUpdatedCallback = panesUpdatedCallback;
resizer.deadWidth = deadWidth
resizer.deadWidth = deadWidth;
resizer.left = document.getElementById(C.SOURCE_PANE_ID);
resizer.middle = document.getElementById(C.INTERMEDIATE_PANE_ID);
resizer.right = document.getElementById(C.GENERATED_PANE_ID);
......@@ -152,7 +152,7 @@ export class Resizer {
})
.on('end', function () {
if (!resizer.isRightSnapped()) {
console.log(`disassembly-pane-width ${resizer.sepRight}`)
console.log(`disassembly-pane-width ${resizer.sepRight}`);
window.sessionStorage.setItem("disassembly-pane-width", `${resizer.sepRight / resizer.clientWidth}`);
}
resizer.resizerRight.classed("dragged", false);
......
......@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { Schedule, SourceResolver } from "../src/source-resolver"
import { PhaseView } from "../src/view"
import { TextView } from "../src/text-view"
import { Schedule, SourceResolver } from "../src/source-resolver";
import { PhaseView } from "../src/view";
import { TextView } from "../src/text-view";
export class ScheduleView extends TextView implements PhaseView {
schedule: Schedule;
......@@ -38,7 +38,7 @@ export class ScheduleView extends TextView implements PhaseView {
initializeContent(data, rememberedSelection) {
this.divNode.innerHTML = '';
this.schedule = data.schedule
this.schedule = data.schedule;
this.addBlocks(data.schedule.blocks);
this.attachSelection(rememberedSelection);
}
......@@ -53,7 +53,7 @@ export class ScheduleView extends TextView implements PhaseView {
const view = this;
function createElement(tag: string, cls: string, content?: string) {
const el = document.createElement(tag);
el.className = cls
el.className = cls;
if (content != undefined) el.innerHTML = content;
return el;
}
......@@ -79,7 +79,7 @@ export class ScheduleView extends TextView implements PhaseView {
`This usually means that this node was folded into another node; ` +
`the highlighted machine code is a guess.`];
}
return ["", `This not is not in the final schedule.`]
return ["", `This not is not in the final schedule.`];
}
function createElementForNode(node) {
......@@ -126,7 +126,7 @@ export class ScheduleView extends TextView implements PhaseView {
const [start, end] = view.sourceResolver.getInstructionRangeForBlock(block.id);
const instrMarker = createElement("div", "instr-marker com", "&#8857;");
instrMarker.setAttribute("title", `Instructions range for this block is [${start}, ${end})`)
instrMarker.setAttribute("title", `Instructions range for this block is [${start}, ${end})`);
instrMarker.onclick = mkBlockLinkHandler(block.id);
scheduleBlock.appendChild(instrMarker);
......@@ -164,7 +164,7 @@ export class ScheduleView extends TextView implements PhaseView {
}
lineString(node) {
return `${node.id}: ${node.label}(${node.inputs.join(", ")})`
return `${node.id}: ${node.label}(${node.inputs.join(", ")})`;
}
searchInputAction(searchBar, e) {
......@@ -178,7 +178,7 @@ export class ScheduleView extends TextView implements PhaseView {
for (const node of this.schedule.nodes) {
if (node === undefined) continue;
if (reg.exec(this.lineString(node)) != null) {
select.push(node.id)
select.push(node.id);
}
}
this.selectionHandler.select(select, true);
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { SourceResolver, sourcePositionValid } from "../src/source-resolver"
import { ClearableHandler, SelectionHandler, NodeSelectionHandler, BlockSelectionHandler, InstructionSelectionHandler } from "../src/selection-handler"
import { SourceResolver, sourcePositionValid } from "../src/source-resolver";
import { ClearableHandler, SelectionHandler, NodeSelectionHandler, BlockSelectionHandler, InstructionSelectionHandler } from "../src/selection-handler";
export class SelectionBroker {
sourceResolver: SourceResolver;
......@@ -20,7 +20,7 @@ export class SelectionBroker {
this.blockHandlers = [];
this.instructionHandlers = [];
this.sourceResolver = sourceResolver;
};
}
addSourcePositionHandler(handler: SelectionHandler & ClearableHandler) {
this.allHandlers.push(handler);
......
......@@ -10,22 +10,22 @@ export interface SelectionHandler {
clear(): void;
select(nodeIds: any, selected: any): void;
brokeredSourcePositionSelect(sourcePositions: any, selected: any): void;
};
}
export interface NodeSelectionHandler {
clear(): void;
select(nodeIds: any, selected: any): void;
brokeredNodeSelect(nodeIds: any, selected: any): void;
};
}
export interface BlockSelectionHandler {
clear(): void;
select(nodeIds: any, selected: any): void;
brokeredBlockSelect(blockIds: any, selected: any): void;
};
}
export interface InstructionSelectionHandler {
clear(): void;
select(instructionIds: any, selected: any): void;
brokeredInstructionSelect(instructionIds: any, selected: any): void;
};
}
......@@ -58,5 +58,5 @@ export class MySelection {
return result;
}
[Symbol.iterator]() { return this.selection.values() }
[Symbol.iterator]() { return this.selection.values(); }
}
......@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { Sequence } from "../src/source-resolver"
import { isIterable } from "../src/util"
import { PhaseView } from "../src/view"
import { TextView } from "../src/text-view"
import { Sequence } from "../src/source-resolver";
import { isIterable } from "../src/util";
import { PhaseView } from "../src/view";
import { TextView } from "../src/text-view";
export class SequenceView extends TextView implements PhaseView {
sequence: Sequence;
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { sortUnique, anyToString } from "../src/util"
import { sortUnique, anyToString } from "../src/util";
import { NodeLabel } from "./node-label";
function sourcePositionLe(a, b) {
......@@ -183,7 +183,7 @@ export class SourceResolver {
alternativeMap[nodeId] = { scriptOffset: scriptOffset, inliningId: -1 };
}
map = alternativeMap;
};
}
for (const [nodeId, sourcePosition] of Object.entries<SourcePosition>(map)) {
if (sourcePosition == undefined) {
......@@ -253,7 +253,7 @@ export class SourceResolver {
addInliningPositions(sourcePosition: AnyPosition, locations: Array<SourcePosition>) {
let inlining = this.inliningsMap.get(sourcePositionToStringKey(sourcePosition));
if (!inlining) return;
let sourceId = inlining.sourceId
let sourceId = inlining.sourceId;
const source = this.sources[sourceId];
for (const sp of source.sourcePositions) {
locations.push(sp);
......@@ -280,7 +280,7 @@ export class SourceResolver {
}
const list = this.sources[sourceId].sourcePositions;
for (let i = 0; i < list.length; i++) {
const sourcePosition = list[i]
const sourcePosition = list[i];
const position = sourcePosition.scriptOffset;
const nextPosition = list[Math.min(i + 1, list.length - 1)].scriptOffset;
if ((position <= scriptOffset && scriptOffset < nextPosition)) {
......@@ -324,7 +324,7 @@ export class SourceResolver {
recordOrigins(phase: GraphPhase) {
if (phase.type != "graph") return;
for (const node of phase.data.nodes) {
phase.highestNodeId = Math.max(phase.highestNodeId, node.id)
phase.highestNodeId = Math.max(phase.highestNodeId, node.id);
if (node.origin != undefined &&
node.origin.bytecodePosition != undefined) {
const position = { bytecodePosition: node.origin.bytecodePosition };
......@@ -411,7 +411,7 @@ export class SourceResolver {
for (const node of nodes) {
const range = this.nodeIdToInstructionRange[node];
if (!range) continue;
offsets = offsets.concat(this.instructionRangeToKeyPcOffsets(range))
offsets = offsets.concat(this.instructionRangeToKeyPcOffsets(range));
}
return offsets;
}
......@@ -495,7 +495,7 @@ export class SourceResolver {
}
repairPhaseId(anyPhaseId) {
return Math.max(0, Math.min(anyPhaseId | 0, this.phases.length - 1))
return Math.max(0, Math.min(anyPhaseId | 0, this.phases.length - 1));
}
getPhase(phaseId: number) {
......
export class Tabs {
container: HTMLElement
container: HTMLElement;
tabBar: HTMLElement;
nextTabId: number;
mkTabBar(container: HTMLElement) {
container.classList.add("nav-tabs-container")
container.classList.add("nav-tabs-container");
this.tabBar = document.createElement("ul");
this.tabBar.id = `tab-bar-${container.id}`;
this.tabBar.className = "nav-tabs";
......@@ -16,7 +16,7 @@ export class Tabs {
const defaultDiv = document.createElement("div");
defaultDiv.className = "tab-content tab-default";
defaultDiv.id = `tab-content-${container.id}-default`;
container.insertBefore(defaultDiv, container.firstChild)
container.insertBefore(defaultDiv, container.firstChild);
container.insertBefore(this.tabBar, container.firstChild);
}
......
......@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { View } from "../src/view"
import { anyToString, ViewElements, isIterable } from "../src/util"
import { MySelection } from "../src/selection"
import { View } from "../src/view";
import { anyToString, ViewElements, isIterable } from "../src/util";
import { MySelection } from "../src/selection";
import { SourceResolver } from "./source-resolver";
import { SelectionBroker } from "./selection-broker";
import { NodeSelectionHandler, BlockSelectionHandler } from "./selection-handler";
......@@ -136,7 +136,7 @@ export abstract class TextView extends View {
element.classList.toggle("selected", isSelected);
}
}
const elementsToSelect = view.divNode.querySelectorAll(`[data-pc-offset]`)
const elementsToSelect = view.divNode.querySelectorAll(`[data-pc-offset]`);
for (const el of elementsToSelect) {
el.classList.toggle("selected", false);
}
......
......@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as d3 from "d3"
import { SourceResolver } from "../src/source-resolver"
import { SelectionBroker } from "../src/selection-broker"
import { DisassemblyView } from "../src/disassembly-view"
import { GraphMultiView } from "../src/graphmultiview"
import { CodeMode, CodeView } from "../src/code-view"
import { Tabs } from "../src/tabs"
import { Resizer } from "../src/resizer"
import * as C from "../src/constants"
import * as d3 from "d3";
import { SourceResolver } from "../src/source-resolver";
import { SelectionBroker } from "../src/selection-broker";
import { DisassemblyView } from "../src/disassembly-view";
import { GraphMultiView } from "../src/graphmultiview";
import { CodeMode, CodeView } from "../src/code-view";
import { Tabs } from "../src/tabs";
import { Resizer } from "../src/resizer";
import * as C from "../src/constants";
window.onload = function () {
var multiview = null;
......@@ -41,7 +41,7 @@ window.onload = function () {
const jsonObj = JSON.parse(txtRes);
let fnc = null
let fnc = null;
// Backwards compatibility.
if (typeof jsonObj.function == 'string') {
fnc = {
......@@ -58,13 +58,13 @@ window.onload = function () {
sourceResolver.setInlinings(jsonObj.inlinings);
sourceResolver.setSourceLineToBytecodePosition(jsonObj.sourceLineToBytecodePosition);
sourceResolver.setSources(jsonObj.sources, fnc)
sourceResolver.setSources(jsonObj.sources, fnc);
sourceResolver.setNodePositionMap(jsonObj.nodePositions);
sourceResolver.parsePhases(jsonObj.phases);
const sourceTabsContainer = document.getElementById(C.SOURCE_PANE_ID);
const sourceTabs = new Tabs(sourceTabsContainer);
const [sourceTab, sourceContainer] = sourceTabs.addTabAndContent("Source")
const [sourceTab, sourceContainer] = sourceTabs.addTabAndContent("Source");
sourceContainer.classList.add("viewpane", "scrollable");
sourceTabs.activateTab(sourceTab);
sourceTabs.addTab("&#x2b;").classList.add("open-tab");
......@@ -80,7 +80,7 @@ window.onload = function () {
const disassemblyTabsContainer = document.getElementById(C.GENERATED_PANE_ID);
const disassemblyTabs = new Tabs(disassemblyTabsContainer);
const [disassemblyTab, disassemblyContainer] = disassemblyTabs.addTabAndContent("Disassembly")
const [disassemblyTab, disassemblyContainer] = disassemblyTabs.addTabAndContent("Disassembly");
disassemblyContainer.classList.add("viewpane", "scrollable");
disassemblyTabs.activateTab(disassemblyTab);
disassemblyTabs.addTab("&#x2b;").classList.add("open-tab");
......
......@@ -32,7 +32,7 @@ export class ViewElements {
if (!doConsider) return;
const newScrollTop = computeScrollTop(this.container, element);
if (isNaN(newScrollTop)) {
console.log("NOO")
console.log("NOO");
}
if (this.scrollTop === undefined) {
this.scrollTop = newScrollTop;
......@@ -63,7 +63,7 @@ export function sortUnique<T>(arr: Array<T>, f: (a: T, b: T) => number, equal: (
export function partial(f: any, ...arguments1: Array<any>) {
return function (this: any, ...arguments2: Array<any>) {
f.apply(this, [...arguments1, ...arguments2]);
}
};
}
export function isIterable(obj: any): obj is Iterable<any> {
......
......@@ -13,7 +13,7 @@
}],
"ordered-imports": false,
"array-type": [true, "generic"],
"semicolon": false,
"semicolon": true,
"member-access": false,
"object-literal-shorthand": false,
"object-literal-key-quotes": [true, "as-needed"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment