| Index: packages/analyzer/test/generated/all_the_rest_test.dart
|
| diff --git a/packages/analyzer/test/generated/all_the_rest_test.dart b/packages/analyzer/test/generated/all_the_rest_test.dart
|
| index cabe5d7d50f1bd90c5cd8693df4d6d0febed1e62..25c34650ac60a763244c2b619fa664f213b8480a 100644
|
| --- a/packages/analyzer/test/generated/all_the_rest_test.dart
|
| +++ b/packages/analyzer/test/generated/all_the_rest_test.dart
|
| @@ -609,7 +609,7 @@ class ConstantEvaluatorTest extends ResolverTestCase {
|
| expect(result.isValid, isTrue);
|
| DartObject value = result.value;
|
| expect(value.type.name, "double");
|
| - expect(value.doubleValue.isInfinite, isTrue);
|
| + expect(value.toDoubleValue().isInfinite, isTrue);
|
| }
|
|
|
| void test_divide_int_int() {
|
| @@ -825,7 +825,7 @@ class ConstantEvaluatorTest extends ResolverTestCase {
|
| EvaluationResult result = _getExpressionValue(contents);
|
| DartObject value = result.value;
|
| expect(value.type.name, "bool");
|
| - expect(value.boolValue, expectedValue);
|
| + expect(value.toBoolValue(), expectedValue);
|
| }
|
|
|
| void _assertValue2(double expectedValue, String contents) {
|
| @@ -833,7 +833,7 @@ class ConstantEvaluatorTest extends ResolverTestCase {
|
| expect(result.isValid, isTrue);
|
| DartObject value = result.value;
|
| expect(value.type.name, "double");
|
| - expect(value.doubleValue, expectedValue);
|
| + expect(value.toDoubleValue(), expectedValue);
|
| }
|
|
|
| void _assertValue3(int expectedValue, String contents) {
|
| @@ -841,7 +841,7 @@ class ConstantEvaluatorTest extends ResolverTestCase {
|
| expect(result.isValid, isTrue);
|
| DartObject value = result.value;
|
| expect(value.type.name, "int");
|
| - expect(value.intValue, expectedValue);
|
| + expect(value.toIntValue(), expectedValue);
|
| }
|
|
|
| void _assertValue4(String expectedValue, String contents) {
|
| @@ -851,7 +851,7 @@ class ConstantEvaluatorTest extends ResolverTestCase {
|
| ParameterizedType type = value.type;
|
| expect(type, isNotNull);
|
| expect(type.name, "String");
|
| - expect(value.stringValue, expectedValue);
|
| + expect(value.toStringValue(), expectedValue);
|
| }
|
|
|
| EvaluationResult _getExpressionValue(String contents) {
|
| @@ -2165,7 +2165,7 @@ const A a = const A();
|
| Map<String, DartObjectImpl> fields, String fieldName, int expectedValue) {
|
| DartObjectImpl field = fields[fieldName];
|
| expect(field.type.name, "int");
|
| - expect(field.intValue, expectedValue);
|
| + expect(field.toIntValue(), expectedValue);
|
| }
|
|
|
| void _assertNullField(Map<String, DartObjectImpl> fields, String fieldName) {
|
| @@ -2198,7 +2198,7 @@ const A a = const A();
|
| expect(result.value, isNotNull);
|
| DartObjectImpl value = result.value;
|
| expect(value.type, typeProvider.boolType);
|
| - bool boolValue = value.boolValue;
|
| + bool boolValue = value.toBoolValue();
|
| expect(boolValue, isNotNull);
|
| return boolValue;
|
| }
|
| @@ -2207,7 +2207,7 @@ const A a = const A();
|
| expect(result.value, isNotNull);
|
| DartObjectImpl value = result.value;
|
| expect(value.type, typeProvider.intType);
|
| - return value.intValue;
|
| + return value.toIntValue();
|
| }
|
|
|
| void _assertValidNull(EvaluationResultImpl result) {
|
| @@ -2527,7 +2527,7 @@ const b = 3;''');
|
| void _assertValue(int expectedValue, DartObjectImpl result) {
|
| expect(result, isNotNull);
|
| expect(result.type.name, "int");
|
| - expect(result.intValue, expectedValue);
|
| + expect(result.toIntValue(), expectedValue);
|
| }
|
|
|
| NonExistingSource _dummySource() {
|
| @@ -3140,84 +3140,84 @@ class DartObjectImplTest extends EngineTestCase {
|
| _assertGreaterThanOrEqual(_boolValue(null), _intValue(null), _intValue(2));
|
| }
|
|
|
| - void test_hasExactValue_bool_false() {
|
| - expect(_boolValue(false).hasExactValue, isTrue);
|
| + void test_hasKnownValue_bool_false() {
|
| + expect(_boolValue(false).hasKnownValue, isTrue);
|
| }
|
|
|
| - void test_hasExactValue_bool_true() {
|
| - expect(_boolValue(true).hasExactValue, isTrue);
|
| + void test_hasKnownValue_bool_true() {
|
| + expect(_boolValue(true).hasKnownValue, isTrue);
|
| }
|
|
|
| - void test_hasExactValue_bool_unknown() {
|
| - expect(_boolValue(null).hasExactValue, isTrue);
|
| + void test_hasKnownValue_bool_unknown() {
|
| + expect(_boolValue(null).hasKnownValue, isFalse);
|
| }
|
|
|
| - void test_hasExactValue_double_known() {
|
| - expect(_doubleValue(2.3).hasExactValue, isTrue);
|
| + void test_hasKnownValue_double_known() {
|
| + expect(_doubleValue(2.3).hasKnownValue, isTrue);
|
| }
|
|
|
| - void test_hasExactValue_double_unknown() {
|
| - expect(_doubleValue(null).hasExactValue, isTrue);
|
| + void test_hasKnownValue_double_unknown() {
|
| + expect(_doubleValue(null).hasKnownValue, isFalse);
|
| }
|
|
|
| - void test_hasExactValue_dynamic() {
|
| - expect(_dynamicValue().hasExactValue, isFalse);
|
| + void test_hasKnownValue_dynamic() {
|
| + expect(_dynamicValue().hasKnownValue, isTrue);
|
| }
|
|
|
| - void test_hasExactValue_int_known() {
|
| - expect(_intValue(23).hasExactValue, isTrue);
|
| + void test_hasKnownValue_int_known() {
|
| + expect(_intValue(23).hasKnownValue, isTrue);
|
| }
|
|
|
| - void test_hasExactValue_int_unknown() {
|
| - expect(_intValue(null).hasExactValue, isTrue);
|
| + void test_hasKnownValue_int_unknown() {
|
| + expect(_intValue(null).hasKnownValue, isFalse);
|
| }
|
|
|
| - void test_hasExactValue_list_empty() {
|
| - expect(_listValue().hasExactValue, isTrue);
|
| + void test_hasKnownValue_list_empty() {
|
| + expect(_listValue().hasKnownValue, isTrue);
|
| }
|
|
|
| - void test_hasExactValue_list_invalid() {
|
| - expect(_dynamicValue().hasExactValue, isFalse);
|
| + void test_hasKnownValue_list_invalidElement() {
|
| + expect(_listValue([_dynamicValue]).hasKnownValue, isTrue);
|
| }
|
|
|
| - void test_hasExactValue_list_valid() {
|
| - expect(_listValue([_intValue(23)]).hasExactValue, isTrue);
|
| + void test_hasKnownValue_list_valid() {
|
| + expect(_listValue([_intValue(23)]).hasKnownValue, isTrue);
|
| }
|
|
|
| - void test_hasExactValue_map_empty() {
|
| - expect(_mapValue().hasExactValue, isTrue);
|
| + void test_hasKnownValue_map_empty() {
|
| + expect(_mapValue().hasKnownValue, isTrue);
|
| }
|
|
|
| - void test_hasExactValue_map_invalidKey() {
|
| - expect(_mapValue([_dynamicValue(), _stringValue("value")]).hasExactValue,
|
| - isFalse);
|
| + void test_hasKnownValue_map_invalidKey() {
|
| + expect(_mapValue([_dynamicValue(), _stringValue("value")]).hasKnownValue,
|
| + isTrue);
|
| }
|
|
|
| - void test_hasExactValue_map_invalidValue() {
|
| - expect(_mapValue([_stringValue("key"), _dynamicValue()]).hasExactValue,
|
| - isFalse);
|
| + void test_hasKnownValue_map_invalidValue() {
|
| + expect(_mapValue([_stringValue("key"), _dynamicValue()]).hasKnownValue,
|
| + isTrue);
|
| }
|
|
|
| - void test_hasExactValue_map_valid() {
|
| + void test_hasKnownValue_map_valid() {
|
| expect(
|
| - _mapValue([_stringValue("key"), _stringValue("value")]).hasExactValue,
|
| + _mapValue([_stringValue("key"), _stringValue("value")]).hasKnownValue,
|
| isTrue);
|
| }
|
|
|
| - void test_hasExactValue_null() {
|
| - expect(_nullValue().hasExactValue, isTrue);
|
| + void test_hasKnownValue_null() {
|
| + expect(_nullValue().hasKnownValue, isTrue);
|
| }
|
|
|
| - void test_hasExactValue_num() {
|
| - expect(_numValue().hasExactValue, isFalse);
|
| + void test_hasKnownValue_num() {
|
| + expect(_numValue().hasKnownValue, isFalse);
|
| }
|
|
|
| - void test_hasExactValue_string_known() {
|
| - expect(_stringValue("twenty-three").hasExactValue, isTrue);
|
| + void test_hasKnownValue_string_known() {
|
| + expect(_stringValue("twenty-three").hasKnownValue, isTrue);
|
| }
|
|
|
| - void test_hasExactValue_string_unknown() {
|
| - expect(_stringValue(null).hasExactValue, isTrue);
|
| + void test_hasKnownValue_string_unknown() {
|
| + expect(_stringValue(null).hasKnownValue, isFalse);
|
| }
|
|
|
| void test_identical_bool_false() {
|
| @@ -4774,7 +4774,7 @@ class DeclaredVariablesTest extends EngineTestCase {
|
| variables.define(variableName, "false");
|
| DartObject object = variables.getBool(typeProvider, variableName);
|
| expect(object, isNotNull);
|
| - expect(object.boolValue, false);
|
| + expect(object.toBoolValue(), false);
|
| }
|
|
|
| void test_getBool_invalid() {
|
| @@ -4793,7 +4793,7 @@ class DeclaredVariablesTest extends EngineTestCase {
|
| variables.define(variableName, "true");
|
| DartObject object = variables.getBool(typeProvider, variableName);
|
| expect(object, isNotNull);
|
| - expect(object.boolValue, true);
|
| + expect(object.toBoolValue(), true);
|
| }
|
|
|
| void test_getBool_undefined() {
|
| @@ -4828,7 +4828,7 @@ class DeclaredVariablesTest extends EngineTestCase {
|
| variables.define(variableName, "23");
|
| DartObject object = variables.getInt(typeProvider, variableName);
|
| expect(object, isNotNull);
|
| - expect(object.intValue, 23);
|
| + expect(object.toIntValue(), 23);
|
| }
|
|
|
| void test_getString_defined() {
|
| @@ -4839,7 +4839,7 @@ class DeclaredVariablesTest extends EngineTestCase {
|
| variables.define(variableName, value);
|
| DartObject object = variables.getString(typeProvider, variableName);
|
| expect(object, isNotNull);
|
| - expect(object.stringValue, value);
|
| + expect(object.toStringValue(), value);
|
| }
|
|
|
| void test_getString_undefined() {
|
| @@ -6673,6 +6673,34 @@ class ElementBuilderTest extends EngineTestCase {
|
| expect(variable.setter, isNull);
|
| }
|
|
|
| + void test_visitVariableDeclaration_top_docRange() {
|
| + // final a, b;
|
| + ElementHolder holder = new ElementHolder();
|
| + ElementBuilder builder = new ElementBuilder(holder);
|
| + VariableDeclaration variableDeclaration1 =
|
| + AstFactory.variableDeclaration('a');
|
| + VariableDeclaration variableDeclaration2 =
|
| + AstFactory.variableDeclaration('b');
|
| + TopLevelVariableDeclaration topLevelVariableDeclaration = AstFactory
|
| + .topLevelVariableDeclaration(
|
| + Keyword.FINAL, null, [variableDeclaration1, variableDeclaration2]);
|
| + topLevelVariableDeclaration.documentationComment = AstFactory
|
| + .documentationComment(
|
| + [TokenFactory.tokenFromString('/// aaa')..offset = 50], []);
|
| +
|
| + topLevelVariableDeclaration.accept(builder);
|
| + List<TopLevelVariableElement> variables = holder.topLevelVariables;
|
| + expect(variables, hasLength(2));
|
| +
|
| + TopLevelVariableElement variable1 = variables[0];
|
| + expect(variable1, isNotNull);
|
| + _assertHasDocRange(variable1, 50, 7);
|
| +
|
| + TopLevelVariableElement variable2 = variables[1];
|
| + expect(variable2, isNotNull);
|
| + _assertHasDocRange(variable2, 50, 7);
|
| + }
|
| +
|
| void test_visitVariableDeclaration_top_final() {
|
| // final v;
|
| ElementHolder holder = new ElementHolder();
|
| @@ -8944,7 +8972,7 @@ class SDKLibrariesReaderTest extends EngineTestCase {
|
| final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
|
| 'first' : const LibraryInfo(
|
| 'first/first.dart',
|
| - category: 'First',
|
| + categories: 'Client',
|
| documented: true,
|
| platforms: VM_PLATFORM,
|
| dart2jsPath: 'first/first_dart2js.dart'),
|
| @@ -8953,7 +8981,7 @@ final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
|
| expect(libraryMap.size(), 1);
|
| SdkLibrary first = libraryMap.getLibrary("dart:first");
|
| expect(first, isNotNull);
|
| - expect(first.category, "First");
|
| + expect(first.category, "Client");
|
| expect(first.path, "first/first_dart2js.dart");
|
| expect(first.shortName, "dart:first");
|
| expect(first.isDart2JsLibrary, false);
|
| @@ -8976,13 +9004,13 @@ final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
|
| final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
|
| 'first' : const LibraryInfo(
|
| 'first/first.dart',
|
| - category: 'First',
|
| + categories: 'Client',
|
| documented: true,
|
| platforms: VM_PLATFORM),
|
|
|
| 'second' : const LibraryInfo(
|
| 'second/second.dart',
|
| - category: 'Second',
|
| + categories: 'Server',
|
| documented: false,
|
| implementation: true,
|
| platforms: 0),
|
| @@ -8991,7 +9019,7 @@ final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
|
| expect(libraryMap.size(), 2);
|
| SdkLibrary first = libraryMap.getLibrary("dart:first");
|
| expect(first, isNotNull);
|
| - expect(first.category, "First");
|
| + expect(first.category, "Client");
|
| expect(first.path, "first/first.dart");
|
| expect(first.shortName, "dart:first");
|
| expect(first.isDart2JsLibrary, false);
|
| @@ -9000,7 +9028,7 @@ final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
|
| expect(first.isVmLibrary, true);
|
| SdkLibrary second = libraryMap.getLibrary("dart:second");
|
| expect(second, isNotNull);
|
| - expect(second.category, "Second");
|
| + expect(second.category, "Server");
|
| expect(second.path, "second/second.dart");
|
| expect(second.shortName, "dart:second");
|
| expect(second.isDart2JsLibrary, false);
|
|
|