Commit a6356ac6 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[turbolizer] Enable more tslint checks

 - Ban T[] array syntax
 - Format arrow function arguments consistently

Bug: v8:7327
Notry: true
Change-Id: I072a352ec9009948392a6bb5dd4381d4993af7be
Reviewed-on: https://chromium-review.googlesource.com/c/1405317
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58759}
parent 843535b8
......@@ -260,12 +260,6 @@
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.18.tgz",
"integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ=="
},
"@types/semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz",
"integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==",
"dev": true
},
"JSONStream": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz",
......@@ -298,12 +292,14 @@
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"dev": true
},
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": {
"color-convert": "^1.9.0"
}
......@@ -318,6 +314,7 @@
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"requires": {
"sprintf-js": "~1.0.2"
}
......@@ -389,6 +386,7 @@
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
"integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
"dev": true,
"requires": {
"chalk": "^1.1.3",
"esutils": "^2.0.2",
......@@ -398,12 +396,14 @@
"ansi-styles": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
"dev": true
},
"chalk": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
"ansi-styles": "^2.2.1",
"escape-string-regexp": "^1.0.2",
......@@ -415,14 +415,16 @@
"supports-color": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc="
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
"dev": true
}
}
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
"basic-auth": {
"version": "1.1.0",
......@@ -440,6 +442,7 @@
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -512,6 +515,7 @@
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",
"integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
......@@ -556,6 +560,7 @@
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dev": true,
"requires": {
"color-name": "1.1.3"
}
......@@ -563,7 +568,8 @@
"color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"dev": true
},
"command-line-args": {
"version": "5.0.2",
......@@ -620,12 +626,6 @@
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag=="
},
"commandpost": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/commandpost/-/commandpost-1.4.0.tgz",
"integrity": "sha512-aE2Y4MTFJ870NuB/+2z1cXBhSBBzRydVVjzhFC4gtenEhpnj15yu0qptWGJsO9YGrcPZ3ezX8AWb1VA391MKpQ==",
"dev": true
},
"common-log-format": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/common-log-format/-/common-log-format-0.1.4.tgz",
......@@ -644,7 +644,8 @@
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"content-disposition": {
"version": "0.5.2",
......@@ -1008,35 +1009,8 @@
"diff": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA=="
},
"editorconfig": {
"version": "0.15.2",
"resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.2.tgz",
"integrity": "sha512-GWjSI19PVJAM9IZRGOS+YKI8LN+/sjkSjNyvxL5ucqP9/IqtYNXBaQ/6c/hkPNYQHyOHra2KoXZI/JVpuqwmcQ==",
"dev": true,
"requires": {
"@types/node": "^10.11.7",
"@types/semver": "^5.5.0",
"commander": "^2.19.0",
"lru-cache": "^4.1.3",
"semver": "^5.6.0",
"sigmund": "^1.0.1"
},
"dependencies": {
"commander": {
"version": "2.19.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz",
"integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==",
"dev": true
},
"semver": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz",
"integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==",
"dev": true
}
}
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
"dev": true
},
"ee-first": {
"version": "1.1.1",
......@@ -1059,12 +1033,14 @@
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
},
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
},
"estree-walker": {
"version": "0.5.2",
......@@ -1074,7 +1050,8 @@
"esutils": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs="
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
"dev": true
},
"etag": {
"version": "1.8.1",
......@@ -1165,7 +1142,8 @@
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
"get-func-name": {
"version": "2.0.0",
......@@ -1177,6 +1155,7 @@
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
......@@ -1218,6 +1197,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -1225,7 +1205,8 @@
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"he": {
"version": "1.1.1",
......@@ -1274,6 +1255,7 @@
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
......@@ -1282,7 +1264,8 @@
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
"dev": true
},
"is-buffer": {
"version": "1.1.6",
......@@ -1371,12 +1354,14 @@
"js-tokens": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls="
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
"dev": true
},
"js-yaml": {
"version": "3.12.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz",
"integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
......@@ -1751,16 +1736,6 @@
"integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=",
"dev": true
},
"lru-cache": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz",
"integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==",
"dev": true,
"requires": {
"pseudomap": "^1.0.2",
"yallist": "^2.1.2"
}
},
"lws": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/lws/-/lws-1.3.0.tgz",
......@@ -2023,6 +1998,7 @@
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -2176,6 +2152,7 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"requires": {
"wrappy": "1"
}
......@@ -2215,7 +2192,8 @@
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true
},
"path-parse": {
"version": "1.0.5",
......@@ -2245,12 +2223,6 @@
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
"dev": true
},
"pseudomap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=",
"dev": true
},
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
......@@ -2460,7 +2432,8 @@
"semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA=="
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
"dev": true
},
"serve-index-75lb": {
"version": "2.0.1",
......@@ -2506,12 +2479,6 @@
"integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==",
"dev": true
},
"sigmund": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
"integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=",
"dev": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
......@@ -2531,7 +2498,8 @@
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true
},
"statuses": {
"version": "1.5.0",
......@@ -2627,6 +2595,7 @@
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -2642,6 +2611,7 @@
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
......@@ -2764,6 +2734,7 @@
"version": "5.12.0",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.12.0.tgz",
"integrity": "sha512-CKEcH1MHUBhoV43SA/Jmy1l24HJJgI0eyLbBNSRyFlsQvb9v6Zdq+Nz2vEOH00nC5SUx4SneJ59PZUS/ARcokQ==",
"dev": true,
"requires": {
"babel-code-frame": "^6.22.0",
"builtin-modules": "^1.1.1",
......@@ -2782,7 +2753,8 @@
"builtin-modules": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8="
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
"dev": true
}
}
},
......@@ -2790,6 +2762,7 @@
"version": "2.29.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
"dev": true,
"requires": {
"tslib": "^1.8.1"
}
......@@ -2816,16 +2789,6 @@
"integrity": "sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg==",
"dev": true
},
"typescript-formatter": {
"version": "7.2.2",
"resolved": "https://registry.npmjs.org/typescript-formatter/-/typescript-formatter-7.2.2.tgz",
"integrity": "sha512-V7vfI9XArVhriOTYHPzMU2WUnm5IMdu9X/CPxs8mIMGxmTBFpDABlbkBka64PZJ9/xgQeRpK8KzzAG4MPzxBDQ==",
"dev": true,
"requires": {
"commandpost": "^1.0.0",
"editorconfig": "^0.15.0"
}
},
"typical": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/typical/-/typical-3.0.0.tgz",
......@@ -2888,7 +2851,8 @@
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
},
"ws": {
"version": "5.2.2",
......@@ -2899,12 +2863,6 @@
"async-limiter": "~1.0.0"
}
},
"yallist": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=",
"dev": true
},
"ylru": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ylru/-/ylru-1.2.1.tgz",
......
......@@ -6,9 +6,9 @@
"build": "rollup -c",
"watch": "rollup -c -w",
"deploy": "./deploy.sh",
"format": "tsfmt -r",
"test": "ts-mocha -p tsconfig.test.json test/**/*-test.ts",
"dev-server": "ws"
"dev-server": "ws",
"presubmit": "tslint --project ./tslint.json --fix"
},
"author": "The V8 team",
"license": "MIT",
......@@ -17,8 +17,7 @@
"d3": "^5.7.0",
"rollup": "^0.68.2",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-typescript2": "^0.18.1",
"tslint": "^5.12.0"
"rollup-plugin-typescript2": "^0.18.1"
},
"repository": {
"type": "git",
......@@ -30,6 +29,6 @@
"mocha": "^5.2.0",
"ts-mocha": "^2.0.0",
"typescript": "^3.2.2",
"typescript-formatter": "^7.2.2"
"tslint": "^5.12.0"
}
}
......@@ -18,10 +18,10 @@ const toolboxHTML = `<div id="disassembly-toolbox">
export class DisassemblyView extends TextView {
SOURCE_POSITION_HEADER_REGEX: any;
addr_event_counts: any;
total_event_counts: any;
max_event_counts: any;
pos_lines: Array<any>;
addrEventCounts: any;
totalEventCounts: any;
maxEventCounts: any;
posLines: Array<any>;
instructionSelectionHandler: InstructionSelectionHandler;
offsetSelection: MySelection;
showInstructionAddressHandler: () => void;
......@@ -77,7 +77,7 @@ export class DisassemblyView extends TextView {
let OPCODE_ARGS = {
associateData: function (text, fragment) {
fragment.innerHTML = text;
const replacer = (match, hexOffset, stringOffset, string) => {
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>`
......@@ -154,7 +154,7 @@ export class DisassemblyView extends TextView {
}
view.divNode.addEventListener('click', linkHandler);
const linkHandlerBlock = (e) => {
const linkHandlerBlock = e => {
const blockId = e.target.dataset.blockId;
if (typeof blockId != "undefined" && !Number.isNaN(blockId)) {
e.stopPropagation();
......@@ -239,21 +239,21 @@ export class DisassemblyView extends TextView {
initializeCode(sourceText, sourcePosition: number = 0) {
let view = this;
view.addr_event_counts = null;
view.total_event_counts = null;
view.max_event_counts = null;
view.pos_lines = new Array();
view.addrEventCounts = null;
view.totalEventCounts = null;
view.maxEventCounts = null;
view.posLines = new Array();
// Comment lines for line 0 include sourcePosition already, only need to
// add sourcePosition for lines > 0.
view.pos_lines[0] = sourcePosition;
view.posLines[0] = sourcePosition;
if (sourceText && sourceText != "") {
let base = sourcePosition;
let current = 0;
let source_lines = sourceText.split("\n");
for (let i = 1; i < source_lines.length; i++) {
let sourceLines = sourceText.split("\n");
for (let i = 1; i < sourceLines.length; i++) {
// Add 1 for newline character that is split off.
current += source_lines[i - 1].length + 1;
view.pos_lines[i] = base + current;
current += sourceLines[i - 1].length + 1;
view.posLines[i] = base + current;
}
}
}
......@@ -261,20 +261,22 @@ export class DisassemblyView extends TextView {
initializePerfProfile(eventCounts) {
let view = this;
if (eventCounts !== undefined) {
view.addr_event_counts = eventCounts;
view.addrEventCounts = eventCounts;
view.total_event_counts = {};
view.max_event_counts = {};
for (let ev_name in view.addr_event_counts) {
let keys = Object.keys(view.addr_event_counts[ev_name]);
let values = keys.map(key => view.addr_event_counts[ev_name][key]);
view.total_event_counts[ev_name] = values.reduce((a, b) => a + b);
view.max_event_counts[ev_name] = values.reduce((a, b) => Math.max(a, b));
view.totalEventCounts = {};
view.maxEventCounts = {};
for (let evName in view.addrEventCounts) {
if (view.addrEventCounts.hasOwnProperty(evName)) {
let keys = Object.keys(view.addrEventCounts[evName]);
let values = keys.map(key => view.addrEventCounts[evName][key]);
view.totalEventCounts[evName] = values.reduce((a, b) => a + b);
view.maxEventCounts[evName] = values.reduce((a, b) => Math.max(a, b));
}
}
} else {
view.addr_event_counts = null;
view.total_event_counts = null;
view.max_event_counts = null;
view.addrEventCounts = null;
view.totalEventCounts = null;
view.maxEventCounts = null;
}
}
......@@ -296,16 +298,17 @@ export class DisassemblyView extends TextView {
let fragments = super.processLine(line);
// Add profiling data per instruction if available.
if (view.total_event_counts) {
if (view.totalEventCounts) {
let matches = /^(0x[0-9a-fA-F]+)\s+\d+\s+[0-9a-fA-F]+/.exec(line);
if (matches) {
let newFragments = [];
for (let event in view.addr_event_counts) {
let count = view.addr_event_counts[event][matches[1]];
for (let event in view.addrEventCounts) {
if (!view.addrEventCounts.hasOwnProperty(event)) continue;
let count = view.addrEventCounts[event][matches[1]];
let str = " ";
let css_cls = "prof";
let cssCls = "prof";
if (count !== undefined) {
let perc = count / view.total_event_counts[event] * 100;
let perc = count / view.totalEventCounts[event] * 100;
let col = { r: 255, g: 255, b: 255 };
for (let i = 0; i < PROF_COLS.length; i++) {
......@@ -328,13 +331,13 @@ export class DisassemblyView extends TextView {
str = UNICODE_BLOCK;
let fragment = view.createFragment(str, css_cls);
let fragment = view.createFragment(str, cssCls);
fragment.title = event + ": " + view.humanize(perc) + " (" + count + ")";
fragment.style.color = "rgb(" + col.r + ", " + col.g + ", " + col.b + ")";
newFragments.push(fragment);
} else {
newFragments.push(view.createFragment(str, css_cls));
newFragments.push(view.createFragment(str, cssCls));
}
}
fragments = newFragments.concat(fragments);
......
......@@ -39,11 +39,11 @@ export class Edge {
var source = this.source;
var target = this.target;
var index = this.index;
var input_x = target.x + target.getInputX(index);
var inputX = target.x + target.getInputX(index);
var inputApproach = target.getInputApproach(this.index);
var outputApproach = source.getOutputApproach(showTypes);
if (inputApproach > outputApproach) {
return input_x;
return inputX;
} else {
var inputOffset = MINIMUM_EDGE_SEPARATION * (index + 1);
return (target.x < source.x)
......@@ -55,20 +55,20 @@ export class Edge {
generatePath(graph: Graph, showTypes: boolean) {
var target = this.target;
var source = this.source;
var input_x = target.x + target.getInputX(this.index);
var inputX = target.x + target.getInputX(this.index);
var arrowheadHeight = 7;
var input_y = target.y - 2 * DEFAULT_NODE_BUBBLE_RADIUS - arrowheadHeight;
var output_x = source.x + source.getOutputX();
var output_y = source.y + source.getNodeHeight(showTypes) + DEFAULT_NODE_BUBBLE_RADIUS;
var inputY = target.y - 2 * DEFAULT_NODE_BUBBLE_RADIUS - arrowheadHeight;
var outputX = source.x + source.getOutputX();
var outputY = source.y + source.getNodeHeight(showTypes) + DEFAULT_NODE_BUBBLE_RADIUS;
var inputApproach = target.getInputApproach(this.index);
var outputApproach = source.getOutputApproach(showTypes);
var horizontalPos = this.getInputHorizontalPosition(graph, showTypes);
var result = "M" + output_x + "," + output_y +
"L" + output_x + "," + outputApproach +
var result = "M" + outputX + "," + outputY +
"L" + outputX + "," + outputApproach +
"L" + horizontalPos + "," + outputApproach;
if (horizontalPos != input_x) {
if (horizontalPos != inputX) {
result += "L" + horizontalPos + "," + inputApproach;
} else {
if (inputApproach < outputApproach) {
......@@ -76,8 +76,8 @@ export class Edge {
}
}
result += "L" + input_x + "," + inputApproach +
"L" + input_x + "," + input_y;
result += "L" + inputX + "," + inputApproach +
"L" + inputX + "," + inputY;
return result;
}
......
......@@ -15,7 +15,7 @@ import { NodeSelectionHandler, ClearableHandler } from "./selection-handler";
import { Graph } from "./graph";
import { SelectionBroker } from "./selection-broker";
function nodeToStringKey(n) {
function nodeToStringKey(n: GNode) {
return "" + n.id;
}
......@@ -67,8 +67,8 @@ export class GraphView extends View implements PhaseView {
// to be important even if it does nothing.
svg
.attr("focusable", false)
.on("focus", (e) => { })
.on("keydown", (e) => { view.svgKeyDown(); })
.on("focus", e => {})
.on("keydown", e => { view.svgKeyDown(); })
view.svg = svg;
......@@ -103,7 +103,7 @@ export class GraphView extends View implements PhaseView {
},
brokeredNodeSelect: function (locations, selected: boolean) {
if (!view.graph) return;
let selection = view.graph.nodes((n) => {
let selection = view.graph.nodes(n => {
return locations.has(nodeToStringKey(n))
&& (!view.state.hideDead || n.isLive());
});
......@@ -112,10 +112,10 @@ export class GraphView extends View implements PhaseView {
for (const n of view.graph.nodes()) {
if (view.state.selection.isSelected(n)) {
n.visible = true;
n.inputs.forEach((e) => {
n.inputs.forEach(e => {
e.visible = e.visible || view.state.selection.isSelected(e.source);
});
n.outputs.forEach((e) => {
n.outputs.forEach(e => {
e.visible = e.visible || view.state.selection.isSelected(e.target);
});
}
......@@ -330,7 +330,7 @@ export class GraphView extends View implements PhaseView {
attachSelection(s) {
if (!(s instanceof Set)) return;
this.selectionHandler.clear();
const selected = [...this.graph.nodes((n) =>
const selected = [...this.graph.nodes(n =>
s.has(this.state.selection.stringKey(n)) && (!this.state.hideDead || n.isLive()))];
this.selectionHandler.select(selected, true);
}
......@@ -343,7 +343,7 @@ export class GraphView extends View implements PhaseView {
if (!d3.event.shiftKey) {
this.state.selection.clear();
}
const allVisibleNodes = [...this.graph.nodes((n) => n.visible)];
const allVisibleNodes = [...this.graph.nodes(n => n.visible)];
this.state.selection.select(allVisibleNodes, true);
this.updateGraphVisibility();
}
......@@ -423,7 +423,7 @@ export class GraphView extends View implements PhaseView {
reg.exec(n.nodeLabel.opcode) != null);
};
const selection = [...this.graph.nodes((n) => {
const selection = [...this.graph.nodes(n => {
if ((e.ctrlKey || n.visible) && filterFunction(n)) {
if (e.ctrlKey) n.visible = true;
return true;
......@@ -614,7 +614,7 @@ export class GraphView extends View implements PhaseView {
const newAndOldEdges = newEdges.merge(selEdges);
newAndOldEdges.classed('hidden', (e) => !e.isVisible());
newAndOldEdges.classed('hidden', e => !e.isVisible());
// select existing nodes
const filteredNodes = [...graph.nodes(n => n.visible)];
......@@ -658,7 +658,7 @@ export class GraphView extends View implements PhaseView {
visibleNodes.data(adjNodes, nodeToStr).attr('relToHover', "none");
view.updateGraphVisibility();
})
.on("click", (d) => {
.on("click", d => {
if (!d3.event.shiftKey) view.selectionHandler.clear();
view.selectionHandler.select([d], undefined);
d3.event.stopPropagation();
......@@ -821,7 +821,10 @@ export class GraphView extends View implements PhaseView {
viewSelection() {
const view = this;
var minX, maxX, minY, maxY;
var minX;
var maxX;
var minY;
var maxY;
let hasSelection = false;
view.visibleNodes.selectAll<SVGGElement, GNode>("g").each(function (n) {
if (view.state.selection.isSelected(n)) {
......@@ -836,12 +839,11 @@ export class GraphView extends View implements PhaseView {
});
if (hasSelection) {
view.viewGraphRegion(minX - NODE_INPUT_WIDTH, minY - 60,
maxX + NODE_INPUT_WIDTH, maxY + 60,
true);
maxX + NODE_INPUT_WIDTH, maxY + 60);
}
}
viewGraphRegion(minX, minY, maxX, maxY, transition) {
viewGraphRegion(minX, minY, maxX, maxY) {
const [width, height] = this.getSvgViewDimensions();
const dx = maxX - minX;
const dy = maxY - minY;
......
......@@ -22,8 +22,8 @@ export class Graph {
this.width = 1;
this.height = 1;
data.nodes.forEach((json_node: any) => {
this.nodeMap[json_node.id] = new GNode(json_node.nodeLabel);
data.nodes.forEach((jsonNode: any) => {
this.nodeMap[jsonNode.id] = new GNode(jsonNode.nodeLabel);
});
data.edges.forEach((e: any) => {
......
......@@ -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 { GraphView } from "../src/graph-view"
import { ScheduleView } from "../src/schedule-view"
import { SequenceView } from "../src/sequence-view"
import { SourceResolver } from "../src/source-resolver"
import { SelectionBroker } from "../src/selection-broker"
import { View, PhaseView } from "../src/view"
import { GraphView } from "../src/graph-view";
import { ScheduleView } from "../src/schedule-view";
import { SequenceView } from "../src/sequence-view";
import { SourceResolver } from "../src/source-resolver";
import { SelectionBroker } from "../src/selection-broker";
import { View, PhaseView } from "../src/view";
const multiviewID = "multiview";
......@@ -29,7 +29,7 @@ const toolboxHTML = `
<select id="display-selector">
<option disabled selected>(please open a file)</option>
</select>
</div>`
</div>`;
export class GraphMultiView extends View {
sourceResolver: SourceResolver;
......@@ -41,8 +41,8 @@ export class GraphMultiView extends View {
currentPhaseView: View & PhaseView;
createViewElement() {
const pane = document.createElement('div');
pane.setAttribute('id', multiviewID);
const pane = document.createElement("div");
pane.setAttribute("id", multiviewID);
pane.className = "viewpane";
return pane;
}
......@@ -59,7 +59,7 @@ export class GraphMultiView extends View {
const searchInput = toolbox.querySelector("#search-input") as HTMLInputElement;
searchInput.addEventListener("keyup", e => {
if (!view.currentPhaseView) return;
view.currentPhaseView.searchInputAction(searchInput, e)
view.currentPhaseView.searchInputAction(searchInput, e);
});
view.divNode.addEventListener("keyup", (e: KeyboardEvent) => {
if (e.keyCode == 191) { // keyCode == '/'
......@@ -67,17 +67,16 @@ export class GraphMultiView extends View {
}
});
searchInput.setAttribute("value", window.sessionStorage.getItem("lastSearch") || "");
this.graph = new GraphView(this.divNode, selectionBroker,
(phaseName) => view.displayPhaseByName(phaseName));
this.graph = new GraphView(this.divNode, selectionBroker, phaseName => view.displayPhaseByName(phaseName));
this.schedule = new ScheduleView(this.divNode, selectionBroker);
this.sequence = new SequenceView(this.divNode, selectionBroker);
this.selectMenu = toolbox.querySelector('#display-selector') as HTMLSelectElement;
this.selectMenu = toolbox.querySelector("#display-selector") as HTMLSelectElement;
}
initializeSelect() {
const view = this;
view.selectMenu.innerHTML = '';
view.sourceResolver.forEachPhase((phase) => {
view.selectMenu.innerHTML = "";
view.sourceResolver.forEachPhase(phase => {
const optionElement = document.createElement("option");
let maxNodeId = "";
if (phase.type == "graph" && phase.highestNodeId != 0) {
......@@ -104,11 +103,11 @@ export class GraphMultiView extends View {
initializeContent() { }
displayPhase(phase) {
if (phase.type == 'graph') {
if (phase.type == "graph") {
this.displayPhaseView(this.graph, phase.data);
} else if (phase.type == 'schedule') {
} else if (phase.type == "schedule") {
this.displayPhaseView(this.schedule, phase);
} else if (phase.type == 'sequence') {
} else if (phase.type == "sequence") {
this.displayPhaseView(this.sequence, phase);
}
}
......
......@@ -98,12 +98,12 @@ export class GNode {
return this.nodeLabel.type;
}
getDisplayType() {
var type_string = this.nodeLabel.type;
if (type_string == undefined) return "";
if (type_string.length > 24) {
type_string = type_string.substr(0, 25) + "...";
var typeString = this.nodeLabel.type;
if (typeString == undefined) return "";
if (typeString.length > 24) {
typeString = typeString.substr(0, 25) + "...";
}
return type_string;
return typeString;
}
deepestInputRank() {
var deepestRank = 0;
......
......@@ -34,9 +34,9 @@ class Snapper {
this.setDisassemblyExpanded(this.getLastExpandedState("disassembly", false));
}
getLastExpandedState(type: string, default_state: boolean): boolean {
getLastExpandedState(type: string, defaultState: boolean): boolean {
var state = window.sessionStorage.getItem("expandedState-" + type);
if (state === null) return default_state;
if (state === null) return defaultState;
return state === 'true';
}
......@@ -51,11 +51,11 @@ class Snapper {
const resizer = this.resizer;
this.sourceExpandUpdate(newState);
if (newState) {
resizer.sep_left = resizer.sep_left_snap;
resizer.sep_left_snap = 0;
resizer.sepLeft = resizer.sepLeftSnap;
resizer.sepLeftSnap = 0;
} else {
resizer.sep_left_snap = resizer.sep_left;
resizer.sep_left = 0;
resizer.sepLeftSnap = resizer.sepLeft;
resizer.sepLeft = 0;
}
}
......@@ -70,94 +70,94 @@ class Snapper {
const resizer = this.resizer;
this.disassemblyExpandUpdate(newState);
if (newState) {
resizer.sep_right = resizer.sep_right_snap;
resizer.sep_right_snap = resizer.client_width;
resizer.sepRight = resizer.sepRightSnap;
resizer.sepRightSnap = resizer.clientWidth;
} else {
resizer.sep_right_snap = resizer.sep_right;
resizer.sep_right = resizer.client_width;
resizer.sepRightSnap = resizer.sepRight;
resizer.sepRight = resizer.clientWidth;
}
}
panesUpdated(): void {
this.sourceExpandUpdate(this.resizer.sep_left > this.resizer.dead_width);
this.disassemblyExpandUpdate(this.resizer.sep_right <
(this.resizer.client_width - this.resizer.dead_width));
this.sourceExpandUpdate(this.resizer.sepLeft > this.resizer.deadWidth);
this.disassemblyExpandUpdate(this.resizer.sepRight <
(this.resizer.clientWidth - this.resizer.deadWidth));
}
}
export class Resizer {
snapper: Snapper;
dead_width: number;
client_width: number;
deadWidth: number;
clientWidth: number;
left: HTMLElement;
right: HTMLElement;
middle: HTMLElement;
sep_left: number;
sep_right: number;
sep_left_snap: number;
sep_right_snap: number;
sep_width_offset: number;
panes_updated_callback: () => void;
resizer_right: d3.Selection<HTMLDivElement, any, any, any>;
resizer_left: d3.Selection<HTMLDivElement, any, any, any>;
constructor(panes_updated_callback: () => void, dead_width: number) {
sepLeft: number;
sepRight: number;
sepLeftSnap: number;
sepRightSnap: number;
sepWidthOffset: number;
panesUpdatedCallback: () => void;
resizerRight: d3.Selection<HTMLDivElement, any, any, any>;
resizerLeft: d3.Selection<HTMLDivElement, any, any, any>;
constructor(panesUpdatedCallback: () => void, deadWidth: number) {
let resizer = this;
resizer.panes_updated_callback = panes_updated_callback;
resizer.dead_width = dead_width
resizer.panesUpdatedCallback = panesUpdatedCallback;
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);
resizer.resizer_left = d3.select('#resizer-left');
resizer.resizer_right = d3.select('#resizer-right');
resizer.sep_left_snap = 0;
resizer.sep_right_snap = 0;
resizer.resizerLeft = d3.select('#resizer-left');
resizer.resizerRight = d3.select('#resizer-right');
resizer.sepLeftSnap = 0;
resizer.sepRightSnap = 0;
// Offset to prevent resizers from sliding slightly over one another.
resizer.sep_width_offset = 7;
resizer.sepWidthOffset = 7;
this.updateWidths();
let dragResizeLeft = d3.drag()
.on('drag', function () {
let x = d3.mouse(this.parentElement)[0];
resizer.sep_left = Math.min(Math.max(0, x), resizer.sep_right - resizer.sep_width_offset);
resizer.sepLeft = Math.min(Math.max(0, x), resizer.sepRight - resizer.sepWidthOffset);
resizer.updatePanes();
})
.on('start', function () {
resizer.resizer_left.classed("dragged", true);
resizer.resizerLeft.classed("dragged", true);
let x = d3.mouse(this.parentElement)[0];
if (x > dead_width) {
resizer.sep_left_snap = resizer.sep_left;
if (x > deadWidth) {
resizer.sepLeftSnap = resizer.sepLeft;
}
})
.on('end', function () {
if (!resizer.isRightSnapped()) {
window.sessionStorage.setItem("source-pane-width", `${resizer.sep_left / resizer.client_width}`);
window.sessionStorage.setItem("source-pane-width", `${resizer.sepLeft / resizer.clientWidth}`);
}
resizer.resizer_left.classed("dragged", false);
resizer.resizerLeft.classed("dragged", false);
});
resizer.resizer_left.call(dragResizeLeft);
resizer.resizerLeft.call(dragResizeLeft);
let dragResizeRight = d3.drag()
.on('drag', function () {
let x = d3.mouse(this.parentElement)[0];
resizer.sep_right = Math.max(resizer.sep_left + resizer.sep_width_offset, Math.min(x, resizer.client_width));
resizer.sepRight = Math.max(resizer.sepLeft + resizer.sepWidthOffset, Math.min(x, resizer.clientWidth));
resizer.updatePanes();
})
.on('start', function () {
resizer.resizer_right.classed("dragged", true);
resizer.resizerRight.classed("dragged", true);
let x = d3.mouse(this.parentElement)[0];
if (x < (resizer.client_width - dead_width)) {
resizer.sep_right_snap = resizer.sep_right;
if (x < (resizer.clientWidth - deadWidth)) {
resizer.sepRightSnap = resizer.sepRight;
}
})
.on('end', function () {
if (!resizer.isRightSnapped()) {
console.log(`disassembly-pane-width ${resizer.sep_right}`)
window.sessionStorage.setItem("disassembly-pane-width", `${resizer.sep_right / resizer.client_width}`);
console.log(`disassembly-pane-width ${resizer.sepRight}`)
window.sessionStorage.setItem("disassembly-pane-width", `${resizer.sepRight / resizer.clientWidth}`);
}
resizer.resizer_right.classed("dragged", false);
resizer.resizerRight.classed("dragged", false);
});
resizer.resizer_right.call(dragResizeRight);
resizer.resizerRight.call(dragResizeRight);
window.onresize = function () {
resizer.updateWidths();
resizer.updatePanes();
......@@ -167,33 +167,33 @@ export class Resizer {
}
isLeftSnapped() {
return this.sep_left === 0;
return this.sepLeft === 0;
}
isRightSnapped() {
return this.sep_right >= this.client_width - 1;
return this.sepRight >= this.clientWidth - 1;
}
updatePanes() {
let left_snapped = this.isLeftSnapped();
let right_snapped = this.isRightSnapped();
this.resizer_left.classed("snapped", left_snapped);
this.resizer_right.classed("snapped", right_snapped);
this.left.style.width = this.sep_left + 'px';
this.middle.style.width = (this.sep_right - this.sep_left) + 'px';
this.right.style.width = (this.client_width - this.sep_right) + 'px';
this.resizer_left.style('left', this.sep_left + 'px');
this.resizer_right.style('right', (this.client_width - this.sep_right - 1) + 'px');
let leftSnapped = this.isLeftSnapped();
let rightSnapped = this.isRightSnapped();
this.resizerLeft.classed("snapped", leftSnapped);
this.resizerRight.classed("snapped", rightSnapped);
this.left.style.width = this.sepLeft + 'px';
this.middle.style.width = (this.sepRight - this.sepLeft) + 'px';
this.right.style.width = (this.clientWidth - this.sepRight) + 'px';
this.resizerLeft.style('left', this.sepLeft + 'px');
this.resizerRight.style('right', (this.clientWidth - this.sepRight - 1) + 'px');
this.snapper.panesUpdated();
this.panes_updated_callback();
this.panesUpdatedCallback();
}
updateWidths() {
this.client_width = document.body.getBoundingClientRect().width;
const sep_left = window.sessionStorage.getItem("source-pane-width");
this.sep_left = this.client_width * (sep_left ? Number.parseFloat(sep_left) : (1 / 3));
const sep_right = window.sessionStorage.getItem("disassembly-pane-width");
this.sep_right = this.client_width * (sep_right ? Number.parseFloat(sep_right) : (2 / 3));
this.clientWidth = document.body.getBoundingClientRect().width;
const sepLeft = window.sessionStorage.getItem("source-pane-width");
this.sepLeft = this.clientWidth * (sepLeft ? Number.parseFloat(sepLeft) : (1 / 3));
const sepRight = window.sessionStorage.getItem("disassembly-pane-width");
this.sepRight = this.clientWidth * (sepRight ? Number.parseFloat(sepRight) : (2 / 3));
}
}
......@@ -92,21 +92,21 @@ export class ScheduleView extends TextView implements PhaseView {
instrMarker.onclick = mkNodeLinkHandler(node.id);
nodeEl.appendChild(instrMarker);
const node_id = createElement("div", "node-id tag clickable", node.id);
node_id.onclick = mkNodeLinkHandler(node.id);
view.addHtmlElementForNodeId(node.id, node_id);
nodeEl.appendChild(node_id);
const node_label = createElement("div", "node-label", node.label);
nodeEl.appendChild(node_label);
const nodeId = createElement("div", "node-id tag clickable", node.id);
nodeId.onclick = mkNodeLinkHandler(node.id);
view.addHtmlElementForNodeId(node.id, nodeId);
nodeEl.appendChild(nodeId);
const nodeLabel = createElement("div", "node-label", node.label);
nodeEl.appendChild(nodeLabel);
if (node.inputs.length > 0) {
const node_parameters = createElement("div", "parameter-list comma-sep-list");
const nodeParameters = createElement("div", "parameter-list comma-sep-list");
for (const param of node.inputs) {
const paramEl = createElement("div", "parameter tag clickable", param);
node_parameters.appendChild(paramEl);
nodeParameters.appendChild(paramEl);
paramEl.onclick = mkNodeLinkHandler(param);
view.addHtmlElementForNodeId(param, paramEl);
}
nodeEl.appendChild(node_parameters);
nodeEl.appendChild(nodeParameters);
}
return nodeEl;
......@@ -122,38 +122,38 @@ export class ScheduleView extends TextView implements PhaseView {
};
}
const schedule_block = createElement("div", "schedule-block");
const scheduleBlock = createElement("div", "schedule-block");
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.onclick = mkBlockLinkHandler(block.id);
schedule_block.appendChild(instrMarker);
scheduleBlock.appendChild(instrMarker);
const block_id = createElement("div", "block-id com clickable", block.id);
block_id.onclick = mkBlockLinkHandler(block.id);
schedule_block.appendChild(block_id);
const block_pred = createElement("div", "predecessor-list block-list comma-sep-list");
const blockId = createElement("div", "block-id com clickable", block.id);
blockId.onclick = mkBlockLinkHandler(block.id);
scheduleBlock.appendChild(blockId);
const blockPred = createElement("div", "predecessor-list block-list comma-sep-list");
for (const pred of block.pred) {
const predEl = createElement("div", "block-id com clickable", pred);
predEl.onclick = mkBlockLinkHandler(pred);
block_pred.appendChild(predEl);
blockPred.appendChild(predEl);
}
if (block.pred.length) schedule_block.appendChild(block_pred);
if (block.pred.length) scheduleBlock.appendChild(blockPred);
const nodes = createElement("div", "nodes");
for (const node of block.nodes) {
nodes.appendChild(createElementForNode(node));
}
schedule_block.appendChild(nodes);
const block_succ = createElement("div", "successor-list block-list comma-sep-list");
scheduleBlock.appendChild(nodes);
const blockSucc = createElement("div", "successor-list block-list comma-sep-list");
for (const succ of block.succ) {
const succEl = createElement("div", "block-id com clickable", succ);
succEl.onclick = mkBlockLinkHandler(succ);
block_succ.appendChild(succEl);
blockSucc.appendChild(succEl);
}
if (block.succ.length) schedule_block.appendChild(block_succ);
this.addHtmlElementForBlockId(block.id, schedule_block);
return schedule_block;
if (block.succ.length) scheduleBlock.appendChild(blockSucc);
this.addHtmlElementForBlockId(block.id, scheduleBlock);
return scheduleBlock;
}
addBlocks(blocks) {
......
......@@ -49,7 +49,7 @@ export class SelectionBroker {
}
broadcastSourcePositionSelect(from, sourcePositions, selected) {
sourcePositions = sourcePositions.filter((l) => {
sourcePositions = sourcePositions.filter(l => {
if (!sourcePositionValid(l)) {
console.log("Warning: invalid source position");
return false;
......
......@@ -2,14 +2,14 @@
// 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;
search_info: Array<any>;
searchInfo: Array<any>;
createViewElement() {
const pane = document.createElement('div');
......@@ -39,7 +39,7 @@ export class SequenceView extends TextView implements PhaseView {
initializeContent(data, rememberedSelection) {
this.divNode.innerHTML = '';
this.sequence = data.sequence;
this.search_info = [];
this.searchInfo = [];
this.divNode.addEventListener('click', (e: MouseEvent) => {
if (!(e.target instanceof HTMLElement)) return;
const instructionId = Number.parseInt(e.target.dataset.instructionId, 10);
......@@ -82,25 +82,25 @@ export class SequenceView extends TextView implements PhaseView {
return mkLinkHandler(text, view.selectionHandler);
}
function elementForOperand(operand, search_info) {
function elementForOperand(operand, searchInfo) {
var text = operand.text;
const operandEl = createElement("div", ["parameter", "tag", "clickable", operand.type], text);
if (operand.tooltip) {
operandEl.setAttribute("title", operand.tooltip);
}
operandEl.onclick = mkOperandLinkHandler(text);
search_info.push(text);
searchInfo.push(text);
view.addHtmlElementForNodeId(text, operandEl);
return operandEl;
}
function elementForInstruction(instruction, search_info) {
function elementForInstruction(instruction, searchInfo) {
const instNodeEl = createElement("div", "instruction-node");
const inst_id = createElement("div", "instruction-id", instruction.id);
inst_id.classList.add("clickable");
inst_id.dataset.instructionId = instruction.id;
instNodeEl.appendChild(inst_id);
const instId = createElement("div", "instruction-id", instruction.id);
instId.classList.add("clickable");
instId.dataset.instructionId = instruction.id;
instNodeEl.appendChild(instId);
const instContentsEl = createElement("div", "instruction-contents");
instNodeEl.appendChild(instContentsEl);
......@@ -112,11 +112,11 @@ export class SequenceView extends TextView implements PhaseView {
const moves = createElement("div", ["comma-sep-list", "gap-move"]);
for (const move of gap) {
const moveEl = createElement("div", "move");
const destinationEl = elementForOperand(move[0], search_info);
const destinationEl = elementForOperand(move[0], searchInfo);
moveEl.appendChild(destinationEl);
const assignEl = createElement("div", "assign", "=");
moveEl.appendChild(assignEl);
const sourceEl = elementForOperand(move[1], search_info);
const sourceEl = elementForOperand(move[1], searchInfo);
moveEl.appendChild(sourceEl);
moves.appendChild(moveEl);
}
......@@ -129,7 +129,7 @@ export class SequenceView extends TextView implements PhaseView {
if (instruction.outputs.length > 0) {
const outputs = createElement("div", ["comma-sep-list", "input-output-list"]);
for (const output of instruction.outputs) {
const outputEl = elementForOperand(output, search_info);
const outputEl = elementForOperand(output, searchInfo);
outputs.appendChild(outputEl);
}
instEl.appendChild(outputs);
......@@ -138,15 +138,15 @@ export class SequenceView extends TextView implements PhaseView {
}
var text = instruction.opcode + instruction.flags;
const inst_label = createElement("div", "node-label", text);
search_info.push(text);
view.addHtmlElementForNodeId(text, inst_label);
instEl.appendChild(inst_label);
const instLabel = createElement("div", "node-label", text);
searchInfo.push(text);
view.addHtmlElementForNodeId(text, instLabel);
instEl.appendChild(instLabel);
if (instruction.inputs.length > 0) {
const inputs = createElement("div", ["comma-sep-list", "input-output-list"]);
for (const input of instruction.inputs) {
const inputEl = elementForOperand(input, search_info);
const inputEl = elementForOperand(input, searchInfo);
inputs.appendChild(inputEl);
}
instEl.appendChild(inputs);
......@@ -155,7 +155,7 @@ export class SequenceView extends TextView implements PhaseView {
if (instruction.temps.length > 0) {
const temps = createElement("div", ["comma-sep-list", "input-output-list", "temps"]);
for (const temp of instruction.temps) {
const tempEl = elementForOperand(temp, search_info);
const tempEl = elementForOperand(temp, searchInfo);
temps.appendChild(tempEl);
}
instEl.appendChild(temps);
......@@ -164,20 +164,20 @@ export class SequenceView extends TextView implements PhaseView {
return instNodeEl;
}
const sequence_block = createElement("div", "schedule-block");
const sequenceBlock = createElement("div", "schedule-block");
const block_id = createElement("div", ["block-id", "com", "clickable"], block.id);
block_id.onclick = mkBlockLinkHandler(block.id);
sequence_block.appendChild(block_id);
const block_pred = createElement("div", ["predecessor-list", "block-list", "comma-sep-list"]);
const blockId = createElement("div", ["block-id", "com", "clickable"], block.id);
blockId.onclick = mkBlockLinkHandler(block.id);
sequenceBlock.appendChild(blockId);
const blockPred = createElement("div", ["predecessor-list", "block-list", "comma-sep-list"]);
for (const pred of block.predecessors) {
const predEl = createElement("div", ["block-id", "com", "clickable"], pred);
predEl.onclick = mkBlockLinkHandler(pred);
block_pred.appendChild(predEl);
blockPred.appendChild(predEl);
}
if (block.predecessors.length > 0) sequence_block.appendChild(block_pred);
if (block.predecessors.length > 0) sequenceBlock.appendChild(blockPred);
const phis = createElement("div", "phis");
sequence_block.appendChild(phis);
sequenceBlock.appendChild(phis);
const phiLabel = createElement("div", "phi-label", "phi:");
phis.appendChild(phiLabel);
......@@ -189,7 +189,7 @@ export class SequenceView extends TextView implements PhaseView {
const phiEl = createElement("div", "phi");
phiContents.appendChild(phiEl);
const outputEl = elementForOperand(phi.output, this.search_info);
const outputEl = elementForOperand(phi.output, this.searchInfo);
phiEl.appendChild(outputEl);
const assignEl = createElement("div", "assign", "=");
......@@ -203,18 +203,18 @@ export class SequenceView extends TextView implements PhaseView {
const instructions = createElement("div", "instructions");
for (const instruction of block.instructions) {
instructions.appendChild(elementForInstruction(instruction, this.search_info));
instructions.appendChild(elementForInstruction(instruction, this.searchInfo));
}
sequence_block.appendChild(instructions);
const block_succ = createElement("div", ["successor-list", "block-list", "comma-sep-list"]);
sequenceBlock.appendChild(instructions);
const blockSucc = createElement("div", ["successor-list", "block-list", "comma-sep-list"]);
for (const succ of block.successors) {
const succEl = createElement("div", ["block-id", "com", "clickable"], succ);
succEl.onclick = mkBlockLinkHandler(succ);
block_succ.appendChild(succEl);
blockSucc.appendChild(succEl);
}
if (block.successors.length > 0) sequence_block.appendChild(block_succ);
this.addHtmlElementForBlockId(block.id, sequence_block);
return sequence_block;
if (block.successors.length > 0) sequenceBlock.appendChild(blockSucc);
this.addHtmlElementForBlockId(block.id, sequenceBlock);
return sequenceBlock;
}
addBlocks(blocks) {
......@@ -232,7 +232,7 @@ export class SequenceView extends TextView implements PhaseView {
const select = [];
window.sessionStorage.setItem("lastSearch", query);
const reg = new RegExp(query);
for (const item of this.search_info) {
for (const item of this.searchInfo) {
if (reg.exec(item) != null) {
select.push(item);
}
......
......@@ -235,7 +235,7 @@ export class SourceResolver {
return sourcePositionArray;
}
forEachSource(f: (value: Source, index: number, array: Source[]) => void) {
forEachSource(f: (value: Source, index: number, array: Array<Source>) => void) {
this.sources.forEach(f);
}
......@@ -294,8 +294,7 @@ export class SourceResolver {
if (!this.sources[sourceId]) return [];
const res = [];
const list = this.sources[sourceId].sourcePositions;
for (let i = 0; i < list.length; i++) {
const sourcePosition = list[i]
for (const sourcePosition of list) {
if (start <= sourcePosition.scriptOffset && sourcePosition.scriptOffset < end) {
res.push(sourcePosition);
}
......@@ -507,7 +506,7 @@ export class SourceResolver {
return this.phaseNames.get(phaseName);
}
forEachPhase(f: (value: Phase, index: number, array: Phase[]) => void) {
forEachPhase(f: (value: Phase, index: number, array: Array<Phase>) => void) {
this.phases.forEach(f);
}
......@@ -534,12 +533,12 @@ export class SourceResolver {
}
parseSchedule(phase) {
function createNode(state, match) {
function createNode(state: any, match) {
let inputs = [];
if (match.groups.args) {
const nodeIdsString = match.groups.args.replace(/\s/g, '');
const nodeIdStrings = nodeIdsString.split(',');
inputs = nodeIdStrings.map((n) => Number.parseInt(n, 10));
inputs = nodeIdStrings.map(n => Number.parseInt(n, 10));
}
const node = {
id: Number.parseInt(match.groups.id, 10),
......@@ -549,7 +548,7 @@ export class SourceResolver {
if (match.groups.blocks) {
const nodeIdsString = match.groups.blocks.replace(/\s/g, '').replace(/B/g, '');
const nodeIdStrings = nodeIdsString.split(',');
const successors = nodeIdStrings.map((n) => Number.parseInt(n, 10));
const successors = nodeIdStrings.map(n => Number.parseInt(n, 10));
state.currentBlock.succ = successors;
}
state.nodes[node.id] = node;
......@@ -560,7 +559,7 @@ export class SourceResolver {
if (match.groups.in) {
const blockIdsString = match.groups.in.replace(/\s/g, '').replace(/B/g, '');
const blockIdStrings = blockIdsString.split(',');
predecessors = blockIdStrings.map((n) => Number.parseInt(n, 10));
predecessors = blockIdStrings.map(n => Number.parseInt(n, 10));
}
const block = {
id: Number.parseInt(match.groups.id, 10),
......
......@@ -59,7 +59,7 @@ export abstract class TextView extends View {
};
this.selectionHandler = selectionHandler;
broker.addNodeHandler(selectionHandler);
view.divNode.addEventListener('click', (e) => {
view.divNode.addEventListener('click', e => {
if (!e.shiftKey) {
view.selectionHandler.clear();
}
......
......@@ -31,7 +31,7 @@ window.onload = function () {
txtRes += '{"name":"disassembly","type":"disassembly","data":""}]}';
}
try {
sourceViews.forEach((sv) => sv.hide());
sourceViews.forEach(sv => sv.hide());
if (multiview) multiview.hide();
multiview = null;
if (disassemblyView) disassemblyView.hide();
......@@ -72,7 +72,7 @@ window.onload = function () {
sourceView.show(null, null);
sourceViews.push(sourceView);
sourceResolver.forEachSource((source) => {
sourceResolver.forEachSource(source => {
let sourceView = new CodeView(sourceContainer, selectionBroker, sourceResolver, source, CodeMode.INLINED_SOURCE);
sourceView.show(null, null);
sourceViews.push(sourceView);
......
......@@ -60,8 +60,8 @@ export function sortUnique<T>(arr: Array<T>, f: (a: T, b: T) => number, equal: (
}
// Partial application without binding the receiver
export function partial(f: any, ...arguments1: any[]) {
return function (this: any, ...arguments2: any[]) {
export function partial(f: any, ...arguments1: Array<any>) {
return function (this: any, ...arguments2: Array<any>) {
f.apply(this, [...arguments1, ...arguments2]);
}
}
......
......@@ -19,7 +19,7 @@ export abstract class View {
return false;
}
show(data, rememberedSelection): void {
show(data: any, rememberedSelection: Selection): void {
this.initializeContent(data, rememberedSelection);
this.container.appendChild(this.divNode);
}
......
......@@ -12,7 +12,7 @@
"limit": 80
}],
"ordered-imports": false,
"array-type": [false, "generic"],
"array-type": [true, "generic"],
"semicolon": false,
"member-access": false,
"object-literal-shorthand": false,
......@@ -27,7 +27,7 @@
"trailing-comma": false,
"member-ordering": false,
"no-string-literal": false,
"arrow-parens": false,
"arrow-parens": [true, "ban-single-arg-parens"],
"no-console": false,
"interface-name": false,
"no-bitwise": false,
......
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