aboutsummaryrefslogtreecommitdiffstats
path: root/awkgram.y
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2020-05-06 20:55:07 +0300
committerArnold D. Robbins <arnold@skeeve.com>2020-05-06 20:55:07 +0300
commit1b79c13f8aa4c93ea727b1d42b30f3838faeaedf (patch)
tree97ee08fd0c99777fb1e9a78ca8a3a6bd3e017e94 /awkgram.y
parent2a1b7457e8c878650352cf4925872c59d07a5fa2 (diff)
downloadegawk-1b79c13f8aa4c93ea727b1d42b30f3838faeaedf.tar.gz
egawk-1b79c13f8aa4c93ea727b1d42b30f3838faeaedf.tar.bz2
egawk-1b79c13f8aa4c93ea727b1d42b30f3838faeaedf.zip
Add lint check for string + string.
Diffstat (limited to 'awkgram.y')
-rw-r--r--awkgram.y8
1 files changed, 7 insertions, 1 deletions
diff --git a/awkgram.y b/awkgram.y
index 00333ea0..281d0ef8 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -5429,7 +5429,7 @@ dumpintlstr2(const char *str1, size_t len1, const char *str2, size_t len2)
static INSTRUCTION *
mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION *op)
{
- INSTRUCTION *ip1,*ip2;
+ INSTRUCTION *ip1,*ip2, *lint_plus;
AWKNUM res;
ip2 = s2->nexti;
@@ -5508,6 +5508,8 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION *op)
op->opcode = Op_mod_i;
break;
case Op_plus:
+ if (do_lint)
+ goto regular;
op->opcode = Op_plus_i;
break;
case Op_minus:
@@ -5530,6 +5532,10 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION *op)
regular:
/* append lists s1, s2 and add `op' bytecode */
(void) list_merge(s1, s2);
+ if (do_lint && op->opcode == Op_plus) {
+ lint_plus = instruction(Op_lint_plus);
+ (void) list_append(s1, lint_plus);
+ }
return list_append(s1, op);
}