commit 8ccfbe5a4e50be29afa2466901fdf8b6c25469f2
parent 0fbc603267f4d2795fbd5592da1465528ed2d768
Author: m21c <ho*******@gmail.com>
Date: Tue, 20 Jul 2021 22:32:40 +0200
minor clean-up
Diffstat:
| M | aria.c | | | 18 | +++++++++--------- |
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/aria.c b/aria.c
@@ -1944,7 +1944,9 @@ stmtlist(Source *source, int indent, EnvKind envkind) {
if (getkind(source) == ';') {
gettok(source, false);
- /* NOTE(m21c): used for REPL */
+ /* NOTE(m21c): used for REPL. it allows having
+ * semicolons on line-endings and nultiple
+ * adjacent semecolons in REPL-mode. */
if (getkind(source) == ';' || getkind(source) == '\n') {
/* TODO(m21c): output an error-message if not in REPL-mode */
}
@@ -1956,17 +1958,16 @@ stmtlist(Source *source, int indent, EnvKind envkind) {
if (tail && source->lastkind != '\n' && source->lastkind != ';')
error(getloc(source), "expected line delimiter");
- if (!env) {
+ if (!env &&
+ (envkind != SFUNCTION || !source->currenv ||
+ source->currenv->kind != SPARAMLIST))
+ {
/* NOTE(m21c): if there is already a
* paramlist-environment and we want a
* function-environment, we just use
* paramlist as our function-environment.
- * Else, push a new environment */
- if (envkind != SFUNCTION || !source->currenv ||
- source->currenv->kind != SPARAMLIST)
- {
- env = pushenv(source, envkind);
- }
+ * Else, we push a new environment */
+ env = pushenv(source, envkind);
}
stmt = exprlist(source, false, NULL);
@@ -2007,7 +2008,6 @@ atom(Source *source, int flags) {
Node *lhs = NULL, *savedis = source->lastis;
Type *ty;
int indent;
- /* int flags; */
/* unary 'is'-operator */
if (getkind(source) == KIS) {