@@ -886,7 +886,7 @@ void FunctionEmitter::PushGuard(const std::string& guard_name, uint32_t end_id)
886886 auto * cond = builder_.Expr (Source{}, guard_name);
887887 auto * builder = AddStatementBuilder<IfStatementBuilder>(cond);
888888
889- PushNewStatementBlock (top.GetConstruct (), end_id, [= ](const StatementList& stmts) {
889+ PushNewStatementBlock (top.GetConstruct (), end_id, [builder, this ](const StatementList& stmts) {
890890 builder->body = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
891891 });
892892}
@@ -898,7 +898,7 @@ void FunctionEmitter::PushTrueGuard(uint32_t end_id) {
898898 auto * cond = MakeTrue (Source{});
899899 auto * builder = AddStatementBuilder<IfStatementBuilder>(cond);
900900
901- PushNewStatementBlock (top.GetConstruct (), end_id, [= ](const StatementList& stmts) {
901+ PushNewStatementBlock (top.GetConstruct (), end_id, [builder, this ](const StatementList& stmts) {
902902 builder->body = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
903903 });
904904}
@@ -2927,7 +2927,7 @@ bool FunctionEmitter::EmitIfStart(const BlockInfo& block_info) {
29272927 // But make sure we do it in the right order.
29282928 auto push_else = [this , builder, else_end, construct, false_is_break, false_is_continue] {
29292929 // Push the else clause onto the stack first.
2930- PushNewStatementBlock (construct, else_end, [= ](const StatementList& stmts) {
2930+ PushNewStatementBlock (construct, else_end, [builder, this ](const StatementList& stmts) {
29312931 // Only set the else-clause if there are statements to fill it.
29322932 if (!stmts.IsEmpty ()) {
29332933 // The "else" consists of the statement list from the top of
@@ -2978,7 +2978,7 @@ bool FunctionEmitter::EmitIfStart(const BlockInfo& block_info) {
29782978 }
29792979
29802980 // Push the then clause onto the stack.
2981- PushNewStatementBlock (construct, then_end, [= ](const StatementList& stmts) {
2981+ PushNewStatementBlock (construct, then_end, [builder, this ](const StatementList& stmts) {
29822982 builder->body = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
29832983 });
29842984 if (true_is_break) {
@@ -3091,10 +3091,11 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) {
30913091 // for the case, and fill the case clause once the block is generated.
30923092 auto case_idx = swch->cases .Length ();
30933093 swch->cases .Push (nullptr );
3094- PushNewStatementBlock (construct, end_id, [=](const StatementList& stmts) {
3095- auto * body = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
3096- swch->cases [case_idx] = create<ast::CaseStatement>(Source{}, selectors, body);
3097- });
3094+ PushNewStatementBlock (
3095+ construct, end_id, [swch, case_idx, selectors, this ](const StatementList& stmts) {
3096+ auto * body = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
3097+ swch->cases [case_idx] = create<ast::CaseStatement>(Source{}, selectors, body);
3098+ });
30983099
30993100 if (i == 0 ) {
31003101 break ;
@@ -3106,9 +3107,10 @@ bool FunctionEmitter::EmitSwitchStart(const BlockInfo& block_info) {
31063107
31073108bool FunctionEmitter::EmitLoopStart (const Construct* construct) {
31083109 auto * builder = AddStatementBuilder<LoopStatementBuilder>();
3109- PushNewStatementBlock (construct, construct->end_id , [=](const StatementList& stmts) {
3110- builder->body = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
3111- });
3110+ PushNewStatementBlock (
3111+ construct, construct->end_id , [builder, this ](const StatementList& stmts) {
3112+ builder->body = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
3113+ });
31123114 return success ();
31133115}
31143116
@@ -3121,7 +3123,7 @@ bool FunctionEmitter::EmitContinuingStart(const Construct* construct) {
31213123 return Fail () << " internal error: starting continue construct, "
31223124 " expected loop on top of stack" ;
31233125 }
3124- PushNewStatementBlock (construct, construct->end_id , [= ](const StatementList& stmts) {
3126+ PushNewStatementBlock (construct, construct->end_id , [loop, this ](const StatementList& stmts) {
31253127 loop->continuing = create<ast::BlockStatement>(Source{}, stmts, tint::Empty);
31263128 });
31273129
0 commit comments