-
-
Notifications
You must be signed in to change notification settings - Fork 63
impr: console and Math method reference checks
#2438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e1fcd1e
Handle Math again
aleksanderkatan dac5887
Handle console.log again
aleksanderkatan b9406d9
Rename math to jsPolyfills
aleksanderkatan 36731a6
nits
aleksanderkatan 040da23
Add a fix for mock handling
aleksanderkatan d8e176a
Add detached method tests
aleksanderkatan c9f1496
Update snapshots
aleksanderkatan 0cba6fd
Bind console to op
aleksanderkatan c29291f
Update error message
aleksanderkatan 4c1e06e
Better error messages
aleksanderkatan 197c203
Merge branch 'main' into impr/method-reference-checks
aleksanderkatan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import type { AnyFn } from '../core/function/fnTypes.ts'; | ||
| import { f32 } from '../data/numeric.ts'; | ||
| import { | ||
| abs, | ||
| acos, | ||
| acosh, | ||
| asin, | ||
| asinh, | ||
| atan, | ||
| atan2, | ||
| atanh, | ||
| ceil, | ||
| cos, | ||
| cosh, | ||
| countLeadingZeros, | ||
| exp, | ||
| floor, | ||
| log, | ||
| log2, | ||
| max, | ||
| min, | ||
| pow, | ||
| sign, | ||
| sin, | ||
| sinh, | ||
| sqrt, | ||
| tan, | ||
| tanh, | ||
| trunc, | ||
| } from '../std/numeric.ts'; | ||
| import type { DualFn } from '../types.ts'; | ||
|
|
||
| export const mathToStd = new Map<AnyFn, DualFn<AnyFn>>([ | ||
| // -- one to one Math to WGSL correlation -- | ||
| [Math.abs, abs], | ||
| [Math.acos, acos], | ||
| [Math.acosh, acosh], | ||
| [Math.asin, asin], | ||
| [Math.asinh, asinh], | ||
| [Math.atan, atan], | ||
| [Math.atan2, atan2], | ||
| [Math.atanh, atanh], | ||
| [Math.ceil, ceil], | ||
| [Math.cos, cos], | ||
| [Math.cosh, cosh], | ||
| [Math.exp, exp], | ||
| [Math.floor, floor], | ||
| [Math.fround, f32 as DualFn<AnyFn>], | ||
| [Math.clz32, countLeadingZeros], | ||
| [Math.trunc, trunc], | ||
| [Math.log, log], | ||
| [Math.log2, log2], | ||
| [Math.pow, pow], | ||
| [Math.sign, sign], | ||
| [Math.sin, sin], | ||
| [Math.sinh, sinh], | ||
| [Math.sqrt, sqrt], | ||
| [Math.tan, tan], | ||
| [Math.tanh, tanh], | ||
| // -- varying in Math and two arg in WGSL, but we support varying in std -- | ||
| [Math.max, max], | ||
| [Math.min, min], | ||
| // -- possible if we extend std -- | ||
| // [Math.cbrt, ???], | ||
| // [Math.log10, ???], | ||
| // [Math.log1p, ???], | ||
| // [Math.f16round, ???], | ||
| // [Math.hypot, ???], | ||
| // [Math.expm1, ???], | ||
| // -- skipped -- | ||
| // [Math.random, ???], | ||
| // [Math.imul, ???], | ||
| // [Math.round, ???], // round(2.5) is 3 in JS and 2 in WGSL | ||
| ]); | ||
|
|
||
| // deferring the array creation lets us handle console mocks | ||
| export const supportedLogOps = () => | ||
| [console.log, console.debug, console.info, console.warn, console.error, console.clear] as const; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.