diff options
| author | gingerBill <bill@gingerbill.org> | 2020-11-16 15:18:25 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-11-16 15:18:25 +0000 |
| commit | ca4b0527e80bda39aa677f013415eff0c62f433d (patch) | |
| tree | 94220a881bd41166485a733b1f3735cebb967619 /src/check_stmt.cpp | |
| parent | adf6c85fd3130ed22e98f2cf5b7f88079f056488 (diff) | |
Minimize memory usage for AST nodes by using Slice<T> rather than Array<T> when the parameter doesn't need to grow
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 4cafa8df5..ad72256c3 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -15,7 +15,7 @@ bool is_divigering_stmt(Ast *stmt) { return t->kind == Type_Proc && t->Proc.diverging; } -void check_stmt_list(CheckerContext *ctx, Array<Ast *> const &stmts, u32 flags) { +void check_stmt_list(CheckerContext *ctx, Slice<Ast *> const &stmts, u32 flags) { if (stmts.count == 0) { return; } @@ -78,7 +78,7 @@ void check_stmt_list(CheckerContext *ctx, Array<Ast *> const &stmts, u32 flags) } } -bool check_is_terminating_list(Array<Ast *> const &stmts, String const &label) { +bool check_is_terminating_list(Slice<Ast *> const &stmts, String const &label) { // Iterate backwards for (isize n = stmts.count-1; n >= 0; n--) { Ast *stmt = stmts[n]; @@ -96,7 +96,7 @@ bool check_is_terminating_list(Array<Ast *> const &stmts, String const &label) { return false; } -bool check_has_break_list(Array<Ast *> const &stmts, String const &label, bool implicit) { +bool check_has_break_list(Slice<Ast *> const &stmts, String const &label, bool implicit) { for_array(i, stmts) { Ast *stmt = stmts[i]; if (check_has_break(stmt, label, implicit)) { |