Skip to content

Commit

Permalink
don't trust entry! (enz-pixi#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnlow committed Dec 27, 2023
1 parent c2b31a8 commit c651517
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions src/util/visit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,18 @@ export class Visitor {
blockToExpression(block: Block | number | string): Expression {
if (typeof block == "number")
return block.toString() as Expression

if (!Number.isNaN(Number(block)))
return Number(block).toString() as Expression

if (typeof block == "string")
return stringExpr(block)

if (!block)
return "" as Expression

if (block.type == "number")
return block.params[0]!.toString() as Expression

if (block.type == "text") {
return stringExpr(String(block.params[0] as string | number))
}
if (block.type == "number" || block.type == "text")
return this.blockToExpression(block.params[0]!)

if (
block.type.startsWith("stringParam_")
Expand Down
4 changes: 2 additions & 2 deletions test/fib.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions test/proj1.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/proj2.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c651517

Please sign in to comment.