mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-07 12:32:52 +00:00
refactor(wgsl-in): specify more closure ret. types in parsing
This resolves ambiguity that will be introduced in the subsequent commit that adds `impl From<ConflictingDiagnosticRuleError> for naga::Error`.
This commit is contained in:
parent
5e68a63151
commit
44b8e38fd8
@ -1244,7 +1244,7 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
|
||||
.arguments
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, arg)| {
|
||||
.map(|(i, arg)| -> Result<_, Error<'_>> {
|
||||
let ty = self.resolve_ast_type(arg.ty, ctx)?;
|
||||
let expr = expressions
|
||||
.append(crate::Expression::FunctionArgument(i as u32), arg.name.span);
|
||||
@ -1263,7 +1263,7 @@ impl<'source, 'temp> Lowerer<'source, 'temp> {
|
||||
let result = f
|
||||
.result
|
||||
.as_ref()
|
||||
.map(|res| {
|
||||
.map(|res| -> Result<_, Error<'_>> {
|
||||
let ty = self.resolve_ast_type(res.ty, ctx)?;
|
||||
Ok(crate::FunctionResult {
|
||||
ty,
|
||||
|
@ -1907,10 +1907,8 @@ impl Parser {
|
||||
let _ = lexer.next();
|
||||
let mut body = ast::Block::default();
|
||||
|
||||
let (condition, span) = lexer.capture_span(|lexer| {
|
||||
let condition = self.general_expression(lexer, ctx)?;
|
||||
Ok(condition)
|
||||
})?;
|
||||
let (condition, span) =
|
||||
lexer.capture_span(|lexer| self.general_expression(lexer, ctx))?;
|
||||
let mut reject = ast::Block::default();
|
||||
reject.stmts.push(ast::Statement {
|
||||
kind: ast::StatementKind::Break,
|
||||
@ -1966,11 +1964,12 @@ impl Parser {
|
||||
|
||||
let mut body = ast::Block::default();
|
||||
if !lexer.skip(Token::Separator(';')) {
|
||||
let (condition, span) = lexer.capture_span(|lexer| {
|
||||
let condition = self.general_expression(lexer, ctx)?;
|
||||
lexer.expect(Token::Separator(';'))?;
|
||||
Ok(condition)
|
||||
})?;
|
||||
let (condition, span) =
|
||||
lexer.capture_span(|lexer| -> Result<_, Error<'_>> {
|
||||
let condition = self.general_expression(lexer, ctx)?;
|
||||
lexer.expect(Token::Separator(';'))?;
|
||||
Ok(condition)
|
||||
})?;
|
||||
let mut reject = ast::Block::default();
|
||||
reject.stmts.push(ast::Statement {
|
||||
kind: ast::StatementKind::Break,
|
||||
|
Loading…
Reference in New Issue
Block a user