compiler: allow to use += on strings

This commit is contained in:
Evgenii Stratonikov 2020-08-23 13:12:10 +03:00
parent fd7af77895
commit 59367c96d1
3 changed files with 24 additions and 11 deletions

View file

@ -18,12 +18,12 @@ func TestConvertToken(t *testing.T) {
}
testCases := []testCase{
{"ADD (string)",
{"ADD (number)",
token.ADD,
opcode.ADD,
types.Typ[types.Int],
},
{"ADD (number)",
{"ADD (string)",
token.ADD,
opcode.CAT,
types.Typ[types.String],
@ -48,10 +48,15 @@ func TestConvertToken(t *testing.T) {
opcode.MOD,
nil,
},
{"ADD_ASSIGN",
{"ADD_ASSIGN (number)",
token.ADD_ASSIGN,
opcode.ADD,
nil,
types.Typ[types.Int],
},
{"ADD_ASSIGN (string)",
token.ADD_ASSIGN,
opcode.CAT,
types.Typ[types.String],
},
{"SUB_ASSIGN",
token.SUB_ASSIGN,