summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin KIN-FOO2011-10-19 10:07:26 (EDT)
committerKevin KIN-FOO2011-10-20 04:43:03 (EDT)
commit60ab82c1f23e82ddd7a2baa1540e8688f67268e9 (patch)
treed059118ab7d5af7fd9c0299481d266ce8d5f13de
parent8cac8609ed15ff3f88ea8d94ba9259b478fa4c09 (diff)
downloadorg.eclipse.koneki.ldt-60ab82c1f23e82ddd7a2baa1540e8688f67268e9.zip
org.eclipse.koneki.ldt-60ab82c1f23e82ddd7a2baa1540e8688f67268e9.tar.gz
org.eclipse.koneki.ldt-60ab82c1f23e82ddd7a2baa1540e8688f67268e9.tar.bz2
bug 361432: Parser did not handle `Id keys in `Pairs. Adding appropriate unit test. Removing some warnings.
-rw-r--r--plugins/org.eclipse.koneki.ldt.parser/src/org/eclipse/koneki/ldt/internal/parser/DLTKObjectFactory.java9
-rwxr-xr-xtests/org.eclipse.koneki.ldt.parser.tests/src/org/eclipse/koneki/ldt/parser/internal/tests/TestExpressions.java2
2 files changed, 7 insertions, 4 deletions
diff --git a/plugins/org.eclipse.koneki.ldt.parser/src/org/eclipse/koneki/ldt/internal/parser/DLTKObjectFactory.java b/plugins/org.eclipse.koneki.ldt.parser/src/org/eclipse/koneki/ldt/internal/parser/DLTKObjectFactory.java
index 744a7da..3588df3 100644
--- a/plugins/org.eclipse.koneki.ldt.parser/src/org/eclipse/koneki/ldt/internal/parser/DLTKObjectFactory.java
+++ b/plugins/org.eclipse.koneki.ldt.parser/src/org/eclipse/koneki/ldt/internal/parser/DLTKObjectFactory.java
@@ -258,11 +258,12 @@ public final class DLTKObjectFactory {
new NamedJavaFunction() {
@Override
public int invoke(LuaState l) {
- Literal ref = l.checkJavaObject(1, Literal.class);
- if (ref != null) {
- l.pushJavaObject(new Pair(ref, l.checkJavaObject(2, Statement.class)));
+ final Expression left = l.checkJavaObject(1, Expression.class);
+ final Statement right = l.checkJavaObject(2, Statement.class);
+ if (left instanceof Literal) {
+ l.pushJavaObject(new Pair((Literal) left, right));
} else {
- l.pushJavaObject(new Pair(l.checkJavaObject(1, SimpleReference.class), l.checkJavaObject(2, Statement.class)));
+ l.pushJavaObject(new Pair((SimpleReference) left, right));
}
return 1;
}
diff --git a/tests/org.eclipse.koneki.ldt.parser.tests/src/org/eclipse/koneki/ldt/parser/internal/tests/TestExpressions.java b/tests/org.eclipse.koneki.ldt.parser.tests/src/org/eclipse/koneki/ldt/parser/internal/tests/TestExpressions.java
index 700f066..6c1fccb 100755
--- a/tests/org.eclipse.koneki.ldt.parser.tests/src/org/eclipse/koneki/ldt/parser/internal/tests/TestExpressions.java
+++ b/tests/org.eclipse.koneki.ldt.parser.tests/src/org/eclipse/koneki/ldt/parser/internal/tests/TestExpressions.java
@@ -145,6 +145,8 @@ public class TestExpressions extends TestCase {
public void testPair() {
module = parse("dic = {[1] = 'one', two = 2}"); //$NON-NLS-1$
assertFalse("Pair is not recognized.", module.isEmpty()); //$NON-NLS-1$
+ module = parse("local subpath = 'path' local i = {[subpath] = value}"); //$NON-NLS-1$
+ assertFalse("Pair with identifier key is not recognized.", module.isEmpty()); //$NON-NLS-1$
}
/**