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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/DartObjectImpl.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/DartObjectImpl.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/DartObjectImpl.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/DartObjectImpl.java
index 7138576ce442331ca6f63de09feec9feb3409619..778fd9a0708c4ef01a52860d8db07b5190a6c4bf 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/DartObjectImpl.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/object/DartObjectImpl.java
@@ -64,6 +64,8 @@ public class DartObjectImpl implements DartObject {
return new DartObjectImpl(typeProvider.getDoubleType(), result);
} else if (result instanceof NumState) {
return new DartObjectImpl(typeProvider.getNumType(), result);
+ } else if (result instanceof StringState) {
+ return new DartObjectImpl(typeProvider.getStringType(), result);
}
// We should never get here.
throw new IllegalStateException("add returned a " + result.getClass().getName());
@@ -536,6 +538,17 @@ public class DartObjectImpl implements DartObject {
}
/**
+ * Return the result of invoking the 'length' getter on this object.
+ *
+ * @param typeProvider the type provider used to find known types
+ * @return the result of invoking the 'length' getter on this object
+ * @throws EvaluationException if the operator is not appropriate for an object of this kind
+ */
+ public DartObjectImpl stringLength(TypeProvider typeProvider) throws EvaluationException {
+ return new DartObjectImpl(typeProvider.getIntType(), state.stringLength());
+ }
+
+ /**
* Return the result of invoking the '*' operator on this object with the given argument.
*
* @param typeProvider the type provider used to find known types

Powered by Google App Engine
This is Rietveld 408576698