Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/StringState.java

Issue 581773002: Implement new constant expressions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/StringState.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/StringState.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/StringState.java
index 02c3750410a8b6efa454cf215c74585dc65e02be..2767eda9f9d4fc483c449ebdf7f2eb9d326911af 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/StringState.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/StringState.java
@@ -15,6 +15,8 @@ package com.google.dart.engine.internal.object;
import com.google.dart.engine.utilities.general.ObjectUtilities;
+import java.math.BigInteger;
+
/**
* Instances of the class {@code StringState} represent the state of an object representing a
* string.
@@ -116,6 +118,14 @@ public class StringState extends InstanceState {
}
@Override
+ public IntState stringLength() throws EvaluationException {
+ if (value == null) {
+ return IntState.UNKNOWN_VALUE;
+ }
+ return new IntState(BigInteger.valueOf(value.length()));
+ }
+
+ @Override
public String toString() {
return value == null ? "-unknown-" : "'" + value + "'";
}

Powered by Google App Engine
This is Rietveld 408576698