Skip to content

Commit

Permalink
refactor(shader-ast): update imports
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Sep 6, 2020
1 parent 8c888c0 commit 643376a
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/shader-ast-glsl/src/target.ts
@@ -1,3 +1,4 @@
import type { Fn } from "@thi.ng/api";
import { isBoolean, isNumber } from "@thi.ng/checks";
import { unsupported } from "@thi.ng/errors";
import {
Expand All @@ -13,7 +14,6 @@ import {
Type,
} from "@thi.ng/shader-ast";
import { GLSLOpts, GLSLTarget, GLSLVersion } from "./api";
import type { Fn } from "@thi.ng/api";

const RE_SEMI = /[};]$/;

Expand Down
4 changes: 2 additions & 2 deletions packages/shader-ast-js/src/target.ts
@@ -1,3 +1,4 @@
import type { Fn } from "@thi.ng/api";
import { isBoolean, isNumber } from "@thi.ng/checks";
import { unsupported } from "@thi.ng/errors";
import {
Expand All @@ -15,9 +16,8 @@ import {
Sym,
Term,
} from "@thi.ng/shader-ast";
import { JS_DEFAULT_ENV } from "./env";
import type { Fn } from "@thi.ng/api";
import type { JSTarget } from "./api";
import { JS_DEFAULT_ENV } from "./env";

const CMP_OPS: Partial<Record<Operator, string>> = {
"!": "not",
Expand Down
2 changes: 1 addition & 1 deletion packages/shader-ast-stdlib/src/color/porter-duff.ts
@@ -1,3 +1,4 @@
import type { Fn2 } from "@thi.ng/api";
import {
$w,
add,
Expand All @@ -12,7 +13,6 @@ import {
Vec4Sym,
} from "@thi.ng/shader-ast";
import { clamp01 } from "../math/clamp";
import type { Fn2 } from "@thi.ng/api";

const coeff = (
f: Fn2<FloatTerm, FloatTerm, FloatTerm>,
Expand Down
2 changes: 1 addition & 1 deletion packages/shader-ast-stdlib/src/math/additive.ts
@@ -1,3 +1,4 @@
import type { Fn } from "@thi.ng/api";
import {
add,
assign,
Expand All @@ -16,7 +17,6 @@ import {
sym,
Term,
} from "@thi.ng/shader-ast";
import type { Fn } from "@thi.ng/api";

/**
* Higher order function. Takes an AST type ID, a single-arg scalar
Expand Down
4 changes: 2 additions & 2 deletions packages/shader-ast/src/ast/controlflow.ts
@@ -1,6 +1,5 @@
import { decl, scope } from "./scope";
import type { FnBody1 } from "../api/function";
import type { Fn } from "@thi.ng/api";
import type { FnBody1 } from "../api/function";
import type {
Branch,
ControlFlow,
Expand All @@ -12,6 +11,7 @@ import type {
} from "../api/nodes";
import type { BoolTerm } from "../api/terms";
import type { Type } from "../api/types";
import { decl, scope } from "./scope";

export const ifThen = (
test: BoolTerm,
Expand Down
2 changes: 1 addition & 1 deletion packages/shader-ast/src/ast/indexed.ts
@@ -1,5 +1,4 @@
import { isNumber } from "@thi.ng/checks";
import { int } from "./lit";
import type { Index, Sym } from "../api/nodes";
import type { UintTerm } from "../api/terms";
import type {
Expand All @@ -8,6 +7,7 @@ import type {
MatIndexTypeMap,
NumericI,
} from "../api/types";
import { int } from "./lit";

export const index = <T extends Indexable>(
val: Sym<T>,
Expand Down
2 changes: 1 addition & 1 deletion packages/shader-ast/src/ast/item.ts
@@ -1,8 +1,8 @@
import { bool, float, int, uint, vec2, vec3, vec4 } from "./lit";
import type { IObjectOf } from "@thi.ng/api";
import type { Term } from "../api/nodes";
import type { FloatTerm } from "../api/terms";
import type { Int, IVec, Prim, Type, UVec } from "../api/types";
import { bool, float, int, uint, vec2, vec3, vec4 } from "./lit";

/**
* Returns base type for given term. Used for array ops.
Expand Down
2 changes: 1 addition & 1 deletion packages/shader-ast/src/ast/sym.ts
@@ -1,10 +1,10 @@
import { assert } from "@thi.ng/api";
import { isString } from "@thi.ng/checks";
import { illegalArgs } from "@thi.ng/errors";
import { gensym } from "./idgen";
import type { Lit, Sym, Term } from "../api/nodes";
import type { SymOpts } from "../api/syms";
import type { ArrayTypeMap, Type } from "../api/types";
import { gensym } from "./idgen";

export function sym<T extends Type>(init: Term<T>): Sym<T>;
export function sym<T extends Type>(type: T): Sym<T>;
Expand Down
2 changes: 1 addition & 1 deletion packages/shader-ast/src/builtin/bvec.ts
@@ -1,6 +1,6 @@
import { builtinCall } from "../ast/function";
import type { FnCall, Term } from "../api/nodes";
import type { BVec } from "../api/types";
import { builtinCall } from "../ast/function";

const $bvec = (t: string) => <any>("bvec" + t[t.length - 1]);

Expand Down
4 changes: 2 additions & 2 deletions packages/shader-ast/src/builtin/math.ts
@@ -1,5 +1,3 @@
import { builtinCall } from "../ast/function";
import { matchingBoolType, matchingPrimFor } from "../ast/item";
import type { FnCall, Sym, Term } from "../api/nodes";
import type {
BoolTerm,
Expand All @@ -20,6 +18,8 @@ import type {
Vec4Term,
} from "../api/terms";
import type { Mat, Prim, Vec } from "../api/types";
import { builtinCall } from "../ast/function";
import { matchingBoolType, matchingPrimFor } from "../ast/item";

const primOp1 = (name: string) => <T extends Prim>(a: Term<T>) =>
builtinCall(name, a.type, a);
Expand Down
6 changes: 3 additions & 3 deletions packages/shader-ast/src/builtin/texture.ts
@@ -1,7 +1,4 @@
import { illegalArgs } from "@thi.ng/errors";
import { isVec } from "../ast/checks";
import { builtinCall } from "../ast/function";
import { FLOAT0, INT0 } from "../ast/lit";
import type { FnCall, Sym, Term } from "../api/nodes";
import type {
FloatTerm,
Expand All @@ -22,6 +19,9 @@ import type {
Vec4Term,
} from "../api/terms";
import type { IVec, Prim, Sampler, Vec } from "../api/types";
import { isVec } from "../ast/checks";
import { builtinCall } from "../ast/function";
import { FLOAT0, INT0 } from "../ast/lit";

const texRetType = (sampler: Term<Sampler>) => {
const t = sampler.type[0];
Expand Down
4 changes: 2 additions & 2 deletions packages/shader-ast/src/optimize.ts
@@ -1,10 +1,10 @@
import { NO_OP } from "@thi.ng/api";
import { DEFAULT, defmulti } from "@thi.ng/defmulti";
import type { Lit, Op1, Op2, Term } from "./api/nodes";
import type { Operator } from "./api/ops";
import { isLitNumeric } from "./ast/checks";
import { lit } from "./ast/lit";
import { allChildren, walk } from "./ast/scope";
import type { Lit, Op1, Op2, Term } from "./api/nodes";
import type { Operator } from "./api/ops";

const replaceNode = (node: any, next: any) => {
for (let k in node) {
Expand Down
2 changes: 1 addition & 1 deletion packages/shader-ast/src/target.ts
@@ -1,6 +1,6 @@
import type { Fn } from "@thi.ng/api";
import { DEFAULT, defmulti } from "@thi.ng/defmulti";
import { unsupported } from "@thi.ng/errors";
import type { Fn } from "@thi.ng/api";
import type { Term } from "./api/nodes";
import type { TargetImpl } from "./api/target";

Expand Down

0 comments on commit 643376a

Please sign in to comment.