aboutsummaryrefslogtreecommitdiff
path: root/src/checker/expr.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-09-12 15:10:15 +0100
committerGinger Bill <bill@gingerbill.org>2016-09-12 15:10:15 +0100
commitd4ba6b546632b3174533a2d099031362f74085e9 (patch)
tree3d8e1db3d89993e0a2db5af05c49a27fbb053c6e /src/checker/expr.cpp
parent9ff4a8b5ab1edaa333180b8206a734787cdfb9f1 (diff)
Slice and substring bounds checking
Diffstat (limited to 'src/checker/expr.cpp')
-rw-r--r--src/checker/expr.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/checker/expr.cpp b/src/checker/expr.cpp
index 86c864e0e..9d83cca69 100644
--- a/src/checker/expr.cpp
+++ b/src/checker/expr.cpp
@@ -3347,6 +3347,9 @@ ExprKind check__expr_base(Checker *c, Operand *o, AstNode *node, Type *type_hint
if (o->mode == Addressing_Constant) {
max_count = o->value.value_string.len;
}
+ if (se->max != NULL) {
+ error(&c->error_collector, ast_node_token(se->max), "Max (3rd) index not needed in substring expression");
+ }
o->type = t_string;
}
break;