Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2013-02-01 07:15:24 +0000
committerSergey Prigogin2013-02-05 18:09:29 +0000
commitc3470476a050c262c51cf28011485ce7c57e4b38 (patch)
tree7dc7f6366afed45390cd20916b83157210472970 /lrparser
parent96fbfd6f00aae9416d20dc2e5d3198efdac7784c (diff)
downloadorg.eclipse.cdt-c3470476a050c262c51cf28011485ce7c57e4b38.tar.gz
org.eclipse.cdt-c3470476a050c262c51cf28011485ce7c57e4b38.tar.xz
org.eclipse.cdt-c3470476a050c262c51cf28011485ce7c57e4b38.zip
Bug 389009 - Enumerator with dependent value
Change-Id: I4fc077870419bccd6dce15c33a0d455e8379d7e0 Reviewed-on: https://git.eclipse.org/r/10092 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Diffstat (limited to 'lrparser')
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Enumeration.java34
1 files changed, 3 insertions, 31 deletions
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Enumeration.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Enumeration.java
index ee66990962..84d603e782 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Enumeration.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/bindings/C99Enumeration.java
@@ -21,9 +21,9 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
-import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.internal.core.dom.Linkage;
import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
import org.eclipse.core.runtime.PlatformObject;
@SuppressWarnings("restriction")
@@ -114,38 +114,10 @@ public class C99Enumeration extends PlatformObject implements IC99Binding, IEnum
}
public long getMinValue() {
- long minValue = Long.MAX_VALUE;
- IEnumerator[] enumerators = getEnumerators();
- for (IEnumerator enumerator : enumerators) {
- IValue value = enumerator.getValue();
- if (value != null) {
- Long val = value.numericalValue();
- if (val != null) {
- long v = val.longValue();
- if (v < minValue) {
- minValue = v;
- }
- }
- }
- }
- return minValue;
+ return SemanticUtil.computeMinValue(this);
}
public long getMaxValue() {
- long maxValue = Long.MIN_VALUE;
- IEnumerator[] enumerators = getEnumerators();
- for (IEnumerator enumerator : enumerators) {
- IValue value = enumerator.getValue();
- if (value != null) {
- Long val = value.numericalValue();
- if (val != null) {
- long v = val.longValue();
- if (v > maxValue) {
- maxValue = v;
- }
- }
- }
- }
- return maxValue;
+ return SemanticUtil.computeMaxValue(this);
}
}

Back to the top