Skip to content
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

Add strict mode #40

Open
clickingbuttons opened this issue Oct 25, 2023 · 2 comments
Open

Add strict mode #40

clickingbuttons opened this issue Oct 25, 2023 · 2 comments

Comments

@clickingbuttons
Copy link

Currently invalid syntax will silently fail. I'd like an error returned or an exception thrown instead of the results up until the invalid syntax.

Example:

import wgsl_reflect from "@feng3d/wgsl_reflect";
const { WgslReflect } = wgsl_reflect;

const reflect = new WgslReflect(`
const valid_not_skipped: u32 = 0u;
some invalid syntax;
const valid_but_skipped: u32 = 0u;
`);
console.log(reflect);
/*
_WgslReflect2 {
  structs: [],
  overrides: [],
  uniforms: [],
  storages: [],
  textures: [],
  samplers: [],
  functions: [],
  aliases: [],
  ast: [
    Const {
      name: 'valid_not_skipped',
      type: [Type],
      storage: '',
      access: '',
      value: [LiteralExpr],
      attributes: null
    }
  ],
  entry: EntryFunctions { vertex: [], fragment: [], compute: [] }
}
*/
@brendan-duncan
Copy link
Owner

I'll look into adding better error exceptions.

@greggman
Copy link
Contributor

For me, I just compile with WebGPU, if it fails then don't call wgsl_reflect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants