Skip to content

Commit e47bb8e

Browse files
giacomocavalierilpil
authored andcommitted
Choose better name for expression generator
1 parent c86ecba commit e47bb8e

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

compiler-core/src/javascript/decision.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ impl<'generator, 'module, 'a> LetPrinter<'generator, 'module, 'a> {
362362
else {
363363
// In case we never reach a body, we know that this let assert will
364364
// always throw an exception!
365-
self.variables.expression_generator.statement_always_throws = true;
365+
self.variables.expression_generator.let_assert_always_panics = true;
366366
return self.assignment_no_match(subject);
367367
};
368368

compiler-core/src/javascript/expression.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,11 @@ pub(crate) struct Generator<'module, 'ast> {
118118
///
119119
statement_level: Vec<Document<'ast>>,
120120

121-
/// This will be true if we've generated a statement that is guaranteed to
122-
/// throw. This means we can stop code generation for all following statements
121+
/// This will be true if we've generated a `let assert` statement that we know
122+
/// is guaranteed to throw.
123+
/// This means we can stop code generation for all the following statements
123124
/// in the same block!
124-
pub statement_always_throws: bool,
125+
pub let_assert_always_panics: bool,
125126
}
126127

127128
impl<'module, 'a> Generator<'module, 'a> {
@@ -160,7 +161,7 @@ impl<'module, 'a> Generator<'module, 'a> {
160161
function_position: Position::Tail,
161162
scope_position: Position::Tail,
162163
statement_level: Vec::new(),
163-
statement_always_throws: false,
164+
let_assert_always_panics: false,
164165
}
165166
}
166167

@@ -773,8 +774,8 @@ impl<'module, 'a> Generator<'module, 'a> {
773774

774775
// If we've generated code for a statement that always throws, we
775776
// can skip code generation for all the following ones.
776-
if self.statement_always_throws {
777-
self.statement_always_throws = false;
777+
if self.let_assert_always_panics {
778+
self.let_assert_always_panics = false;
778779
break;
779780
}
780781
}

0 commit comments

Comments
 (0)