From 5d776802ce9eb8c274e9194211d282be3c2666e8 Mon Sep 17 00:00:00 2001 From: Richard Peach <38696279+rpeach-sag@users.noreply.github.com> Date: Wed, 12 Dec 2018 22:38:59 +0100 Subject: [PATCH] #27 Fixing bug with field access --- src/lambdas/internals/Expression.mon | 1 + test/tests/FieldAccess/Input/test.mon | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/lambdas/internals/Expression.mon b/src/lambdas/internals/Expression.mon index 6a35e5a..d5fa4fb 100644 --- a/src/lambdas/internals/Expression.mon +++ b/src/lambdas/internals/Expression.mon @@ -678,6 +678,7 @@ event ExpressionCompiler { expression := expression.substring(0, i - objectName.length()) + actionPointerName + extraSpace + expression.substring(j + 1, expression.length()); i := i - objectName.length() + actionPointerName.length() - 1 + extraSpace.length(); + break; } } j := j + 1; diff --git a/test/tests/FieldAccess/Input/test.mon b/test/tests/FieldAccess/Input/test.mon index 611edcf..343eb1b 100644 --- a/test/tests/FieldAccess/Input/test.mon +++ b/test/tests/FieldAccess/Input/test.mon @@ -14,6 +14,8 @@ monitor Test { .addTest("x => x[1234]", [ {1234:1}], 1, "Dictionary integer key field access") .addTest("x => x[1]", [[1,2,3]], 2, "Sequence value access") + + .addTest("xyz => xyz[0] / xyz[1]", [[5,2]], 2.5, "Sequence value access") .run(); } }