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

Unified Diff: pkg/analyzer/lib/src/generated/constant.dart

Issue 1809013003: Move DartObject into the public API (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/member.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/constant.dart
diff --git a/pkg/analyzer/lib/src/generated/constant.dart b/pkg/analyzer/lib/src/generated/constant.dart
index 0f1d7e945fa53f412e2b14798d7c4dbf48d42480..3e480ee0b6f76562da69712f434fc14403d1e6c2 100644
--- a/pkg/analyzer/lib/src/generated/constant.dart
+++ b/pkg/analyzer/lib/src/generated/constant.dart
@@ -9,6 +9,7 @@ import 'dart:collection';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
+import 'package:analyzer/dart/constant/value.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
@@ -30,6 +31,8 @@ import 'package:analyzer/src/generated/utilities_dart.dart' show ParameterKind;
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer/src/task/dart.dart';
+export 'package:analyzer/dart/constant/value.dart';
+
ConstructorElementImpl _getConstructorImpl(ConstructorElement constructor) {
while (constructor is ConstructorMember) {
constructor = (constructor as ConstructorMember).baseElement;
@@ -1992,146 +1995,6 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
}
/**
- * A representation of the value of a compile-time constant expression.
- *
- * Note that, unlike the mirrors system, the object being represented does *not*
- * exist. This interface allows static analysis tools to determine something
- * about the state of the object that would exist if the code that creates the
- * object were executed, but none of the code being analyzed is actually
- * executed.
- */
-abstract class DartObject {
- /**
- * Return `true` if the value of the object being represented is known.
- *
- * This method will return `false` if
- * * the value being represented is the value of a declared variable (a
- * variable whose value is provided at run-time using a `-D` command-line
- * option), or
- * * the value is a function.
- *
- * The result of this method does not imply anything about the state of
- * object representations returned by the method [getField], those that are
- * elements of the list returned by [toListValue], or the keys or values in
- * the map returned by [toMapValue]. For example, a representation of a list
- * can return `true` even if one or more of the elements of that list would
- * return `false`.
- */
- bool get hasKnownValue;
-
- /**
- * Return `true` if the object being represented represents the value 'null'.
- */
- bool get isNull;
-
- /**
- * Return a representation of the type of the object being represented.
- *
- * For values resulting from the invocation of a 'const' constructor, this
- * will be a representation of the run-time type of the object.
- *
- * For values resulting from a literal expression, this will be a
- * representation of the static type of the value -- `int` for integer
- * literals, `List` for list literals, etc. -- even when the static type is an
- * abstract type (such as `List`) and hence will never be the run-time type of
- * the represented object.
- *
- * For values resulting from any other kind of expression, this will be a
- * representation of the result of evaluating the expression.
- *
- * Return `null` if the expression cannot be evaluated, either because it is
- * not a valid constant expression or because one or more of the values used
- * in the expression does not have a known value.
- *
- * This method can return a representation of the type, even if this object
- * would return `false` from [hasKnownValue].
- */
- ParameterizedType get type;
-
- /**
- * Return a representation of the value of the field with the given [name].
- *
- * Return `null` if either the object being represented does not have a field
- * with the given name or if the implementation of the class of the object is
- * invalid, making it impossible to determine that value of the field.
- *
- * Note that, unlike the mirrors API, this method does *not* invoke a getter;
- * it simply returns a representation of the known state of a field.
- */
- DartObject getField(String name);
-
- /**
- * Return a boolean corresponding to the value of the object being
- * represented, or `null` if
- * * this object is not of type 'bool',
- * * the value of the object being represented is not known, or
- * * the value of the object being represented is `null`.
- */
- bool toBoolValue();
-
- /**
- * Return a double corresponding to the value of the object being represented,
- * or `null`
- * if
- * * this object is not of type 'double',
- * * the value of the object being represented is not known, or
- * * the value of the object being represented is `null`.
- */
- double toDoubleValue();
-
- /**
- * Return an integer corresponding to the value of the object being
- * represented, or `null` if
- * * this object is not of type 'int',
- * * the value of the object being represented is not known, or
- * * the value of the object being represented is `null`.
- */
- int toIntValue();
-
- /**
- * Return a list corresponding to the value of the object being represented,
- * or `null` if
- * * this object is not of type 'List', or
- * * the value of the object being represented is `null`.
- */
- List<DartObject> toListValue();
-
- /**
- * Return a map corresponding to the value of the object being represented, or
- * `null` if
- * * this object is not of type 'Map', or
- * * the value of the object being represented is `null`.
- */
- Map<DartObject, DartObject> toMapValue();
-
- /**
- * Return a string corresponding to the value of the object being represented,
- * or `null` if
- * * this object is not of type 'String',
- * * the value of the object being represented is not known, or
- * * the value of the object being represented is `null`.
- */
- String toStringValue();
-
- /**
- * Return a string corresponding to the value of the object being represented,
- * or `null` if
- * * this object is not of type 'Symbol', or
- * * the value of the object being represented is `null`.
- * (We return the string
- */
- String toSymbolValue();
-
- /**
- * Return the representation of the type corresponding to the value of the
- * object being represented, or `null` if
- * * this object is not of type 'Type', or
- * * the value of the object being represented is `null`.
- */
- DartType toTypeValue();
-}
-
-/**
* A utility class that contains methods for manipulating instances of a Dart
* class and for collecting errors during evaluation.
*/
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/member.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698