summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWooyoung Cho2013-08-02 14:52:35 (EDT)
committerChris2013-08-14 13:34:59 (EDT)
commitb481d826ce4a1dd6c9b45b5892d54b0e11c45283 (patch)
tree5a02dd525c85571939d2762093b15c688f95d0b9
parent90c2977e67c89b74ec3bd4a081b89defb7ba43fd (diff)
downloadwebtools.jsdt.core-b481d826ce4a1dd6c9b45b5892d54b0e11c45283.zip
webtools.jsdt.core-b481d826ce4a1dd6c9b45b5892d54b0e11c45283.tar.gz
webtools.jsdt.core-b481d826ce4a1dd6c9b45b5892d54b0e11c45283.tar.bz2
Bugzilla 377241.
-rw-r--r--bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/ast/ArrayReference.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/ast/ArrayReference.java b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/ast/ArrayReference.java
index f18bba6..fb55d92 100644
--- a/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/ast/ArrayReference.java
+++ b/bundles/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/ast/ArrayReference.java
@@ -12,12 +12,15 @@ package org.eclipse.wst.jsdt.internal.compiler.ast;
import org.eclipse.wst.jsdt.core.ast.IASTNode;
import org.eclipse.wst.jsdt.core.ast.IArrayReference;
+import org.eclipse.wst.jsdt.core.compiler.CharOperation;
import org.eclipse.wst.jsdt.internal.compiler.ASTVisitor;
import org.eclipse.wst.jsdt.internal.compiler.flow.FlowContext;
import org.eclipse.wst.jsdt.internal.compiler.flow.FlowInfo;
import org.eclipse.wst.jsdt.internal.compiler.impl.Constant;
import org.eclipse.wst.jsdt.internal.compiler.lookup.ArrayBinding;
import org.eclipse.wst.jsdt.internal.compiler.lookup.BlockScope;
+import org.eclipse.wst.jsdt.internal.compiler.lookup.FieldBinding;
+import org.eclipse.wst.jsdt.internal.compiler.lookup.SourceTypeBinding;
import org.eclipse.wst.jsdt.internal.compiler.lookup.TypeBinding;
public class ArrayReference extends Reference implements IArrayReference {
@@ -80,6 +83,18 @@ public FlowInfo analyseCode(
if (arrayType.isArrayType()) {
TypeBinding elementType = ((ArrayBinding) arrayType).elementsType();
this.resolvedType = elementType;
+ } else if (arrayType instanceof SourceTypeBinding) {
+ this.resolvedType = TypeBinding.UNKNOWN;
+ FieldBinding[] fields = ((SourceTypeBinding) arrayType).fields();
+ if (position instanceof StringLiteral) {
+ char[] positionSource = ((StringLiteral) position).source;
+ for (int idx = 0; idx < fields.length; idx++) {
+ if (CharOperation.equals(positionSource, fields[idx].name)) {
+ this.resolvedType = fields[idx].type;
+ break;
+ }
+ }
+ }
} else {
// scope.problemReporter().referenceMustBeArrayTypeAt(arrayType, this);
this.resolvedType=TypeBinding.UNKNOWN;