Skip to content

Commit 2d63f9d

Browse files
author
Sam Ritchie
authored
fix warnings (#25)
1 parent fe42b3f commit 2d63f9d

9 files changed

Lines changed: 16 additions & 35 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "shadergraph",
3-
"version": "2.1.1",
3+
"version": "2.1.2",
44
"description": "GLSL linker",
55
"repository": {
66
"type": "git",

src/factory/factory.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export class Factory {
219219
}
220220

221221
// Make subgraph and connect to tail
222-
_isolate(sub, main) {
222+
_isolate(sub, _main) {
223223
if (sub.nodes.length) {
224224
let block;
225225
const subgraph = this._subgraph(sub);
@@ -239,7 +239,7 @@ export class Factory {
239239
}
240240

241241
// Convert to callback and connect to tail
242-
_callback(sub, main) {
242+
_callback(sub, _main) {
243243
if (sub.nodes.length) {
244244
let block;
245245
const subgraph = this._subgraph(sub);

src/glsl/compile.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212
export const compile = function (program) {
13-
const { ast, code, signatures } = program;
13+
const { code, signatures } = program;
1414

1515
// Prepare list of placeholders
1616
const placeholders = replaced(signatures);
@@ -21,17 +21,6 @@ export const compile = function (program) {
2121
return [signatures, assembler];
2222
};
2323

24-
// #####
25-
26-
const tick = function () {
27-
const now = +new Date();
28-
return function (label) {
29-
const delta = +new Date() - now;
30-
console.log(label, delta + " ms");
31-
return delta;
32-
};
33-
};
34-
3524
var replaced = function (signatures) {
3625
const out = {};
3726
const s = (sig) => (out[sig.name] = true);
@@ -70,7 +59,7 @@ var string_compiler = function (code, placeholders) {
7059

7160
// Strip comments
7261
code = code.replace(/\/\/[^\n]*/g, "");
73-
code = code.replace(/\/\*([^*]|\*[^\/])*\*\//g, "");
62+
code = code.replace(/\/\*([^*]|\*[^/])*\*\//g, "");
7463

7564
// Strip all preprocessor commands (lazy)
7665
//code = code.replace /^#[^\n]*/mg, ''

src/glsl/decl.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import { Vector2 } from "three/src/math/Vector2.js";
1111
import { Vector3 } from "three/src/math/Vector3.js";
12-
import { Vector4 } from "three/src/math/Vector3.js";
12+
import { Vector4 } from "three/src/math/Vector4.js";
1313
import { Matrix3 } from "three/src/math/Matrix3.js";
1414
import { Matrix4 } from "three/src/math/Matrix4.js";
1515

@@ -37,7 +37,6 @@ decl.external = function (node) {
3737
let c = node.children;
3838

3939
let storage = get(c[1]);
40-
const struct = get(c[3]);
4140
const type = get(c[4]);
4241
const list = c[5];
4342

@@ -74,7 +73,6 @@ decl.function = function (node) {
7473
// console.log 'function', node
7574

7675
const storage = get(c[1]);
77-
const struct = get(c[3]);
7876
const type = get(c[4]);
7977
const func = c[5];
8078
const ident = get(func.children[0]);
@@ -229,15 +227,14 @@ class Definition {
229227
}
230228

231229
copy(name, meta) {
232-
let def;
233-
return (def = new Definition(
230+
return new Definition(
234231
name != null ? name : this.name,
235232
this.type,
236233
this.spec,
237234
this.param,
238235
this.value,
239236
this.inout,
240237
meta
241-
));
238+
);
242239
}
243240
}

src/glsl/generate.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export function same(a, b) {
8989
export function call(lookup, dangling, entry, signature, body) {
9090
const args = [];
9191
let ret = "";
92-
const rets = 1;
9392

9493
for (let arg of Array.from(signature)) {
9594
var id, shadow;
@@ -99,7 +98,6 @@ export function call(lookup, dangling, entry, signature, body) {
9998
let other = null;
10099
let meta = null;
101100
let omit = false;
102-
const { inout } = arg;
103101

104102
const isReturn = name === $.RETURN_ARG;
105103

@@ -178,7 +176,6 @@ export function build(body, calls) {
178176
// Check if we're only calling one snippet with identical signature
179177
// and not building void main();
180178
if (calls && calls.length === 1 && entry !== "main") {
181-
const a = body;
182179
const b = calls[0].module;
183180

184181
if (same(body.signature, b.main.signature)) {
@@ -304,7 +301,8 @@ export const link = (link, out) => {
304301

305302
// Build wrapper function for the calling side
306303
const outer = body();
307-
const wrapper = call(_lookup, _dangling, entry, external.signature, outer);
304+
call(_lookup, _dangling, entry, external.signature, outer);
305+
308306
outer.calls = inner.calls;
309307
outer.entry = name;
310308

@@ -317,7 +315,7 @@ export function defuse(code) {
317315
// Don't try this at home kids
318316
const re =
319317
/([A-Za-z0-9_]+\s+)?[A-Za-z0-9_]+\s+[A-Za-z0-9_]+\s*\([^)]*\)\s*;\s*/gm;
320-
const strip = (code) => code.replace(re, (m) => "");
318+
const strip = (code) => code.replace(re, (_m) => "");
321319

322320
// Split into scopes by braces
323321
const blocks = code.split(/(?=[{}])/g);
@@ -366,7 +364,7 @@ export function dedupe(code) {
366364
const map = {};
367365
const re =
368366
/((attribute|uniform|varying)\s+)[A-Za-z0-9_]+\s+([A-Za-z0-9_]+)\s*(\[[^\]]*\]\s*)?;\s*/gm;
369-
return code.replace(re, function (m, qual, type, name, struct) {
367+
return code.replace(re, function (m, qual, type, name, _struct) {
370368
if (map[name]) {
371369
return "";
372370
}

src/graph/node.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class Node {
1616
static initClass() {
1717
this.index = 0;
1818
}
19-
static id(name) {
19+
static id(_name) {
2020
return ++Node.index;
2121
}
2222

@@ -176,7 +176,7 @@ export class Node {
176176
}
177177

178178
// Disconnect entire node
179-
disconnect(node) {
179+
disconnect(_node) {
180180
let outlet;
181181
for (outlet of Array.from(this.inputs)) {
182182
outlet.disconnect();
@@ -233,7 +233,6 @@ export class Node {
233233
// Remove outlet object from node.
234234
_remove(outlet) {
235235
const key = this._key(outlet);
236-
const { inout } = outlet;
237236

238237
// Sanity checks
239238
if (outlet.node !== this) {

src/visualize/markup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ var _activate = function (el) {
6060
popup.parentNode.classList.add("shadergraph-has-code");
6161
return popup.parentNode.addEventListener(
6262
"click",
63-
(event) =>
63+
(_event) =>
6464
(popup.style.display = {
6565
block: "none",
6666
none: "block",

src/visualize/serialize.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// Dump graph for debug/visualization purposes
99
import * as Block from "../block";
1010

11-
const isCallback = (outlet) => outlet.type[0] === "(";
12-
1311
export var serialize = function (graph) {
1412
const nodes = [];
1513
const links = [];

0 commit comments

Comments
 (0)