mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +00:00
analyzer: Remove unused enumElement testing function
Found while looking at call sites to TypeSystemImpl, which I am changing for generic function types as type arguments. Change-Id: I6c47f7cdcbe3b2f7051a77484ed904af8bfc67dc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185960 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
parent
96ae7b357e
commit
7718eb1163
1 changed files with 0 additions and 75 deletions
|
@ -2,22 +2,17 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:analyzer/dart/analysis/features.dart';
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/nullability_suffix.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
import 'package:analyzer/dart/element/type_provider.dart';
|
||||
import 'package:analyzer/src/dart/analysis/experiments.dart';
|
||||
import 'package:analyzer/src/dart/analysis/session.dart';
|
||||
import 'package:analyzer/src/dart/element/element.dart';
|
||||
import 'package:analyzer/src/dart/element/type.dart';
|
||||
import 'package:analyzer/src/dart/element/type_system.dart';
|
||||
import 'package:analyzer/src/dart/resolver/variance.dart';
|
||||
import 'package:analyzer/src/generated/constant.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
|
||||
|
@ -137,76 +132,6 @@ class ElementFactory {
|
|||
[List<DartType> argumentTypes = const []]) =>
|
||||
constructorElement(definingClass, name, false, argumentTypes);
|
||||
|
||||
@deprecated
|
||||
static EnumElementImpl enumElement(TypeProvider typeProvider, String enumName,
|
||||
[List<String> constantNames = const []]) {
|
||||
var typeSystem = TypeSystemImpl(
|
||||
implicitCasts: false,
|
||||
isNonNullableByDefault: false,
|
||||
strictInference: false,
|
||||
typeProvider: typeProvider,
|
||||
);
|
||||
//
|
||||
// Build the enum.
|
||||
//
|
||||
EnumElementImpl enumElement = EnumElementImpl(enumName, -1);
|
||||
var enumType = enumElement.instantiate(
|
||||
typeArguments: const [],
|
||||
nullabilitySuffix: NullabilitySuffix.star,
|
||||
) as InterfaceTypeImpl;
|
||||
//
|
||||
// Populate the fields.
|
||||
//
|
||||
List<FieldElement> fields = <FieldElement>[];
|
||||
InterfaceType intType = typeProvider.intType;
|
||||
InterfaceType stringType = typeProvider.stringType;
|
||||
String indexFieldName = "index";
|
||||
FieldElementImpl indexField = FieldElementImpl(indexFieldName, -1);
|
||||
indexField.isFinal = true;
|
||||
indexField.type = intType;
|
||||
fields.add(indexField);
|
||||
String nameFieldName = "_name";
|
||||
FieldElementImpl nameField = FieldElementImpl(nameFieldName, -1);
|
||||
nameField.isFinal = true;
|
||||
nameField.type = stringType;
|
||||
fields.add(nameField);
|
||||
FieldElementImpl valuesField = FieldElementImpl("values", -1);
|
||||
valuesField.isStatic = true;
|
||||
valuesField.isConst = true;
|
||||
valuesField.type = typeProvider.listType2(enumType);
|
||||
fields.add(valuesField);
|
||||
//
|
||||
// Build the enum constants.
|
||||
//
|
||||
{
|
||||
int constantCount = constantNames.length;
|
||||
for (int i = 0; i < constantCount; i++) {
|
||||
String constantName = constantNames[i];
|
||||
FieldElementImpl constantElement =
|
||||
ConstFieldElementImpl(constantName, -1);
|
||||
constantElement.isStatic = true;
|
||||
constantElement.isConst = true;
|
||||
constantElement.type = enumType;
|
||||
Map<String, DartObjectImpl> fieldMap =
|
||||
HashMap<String, DartObjectImpl>();
|
||||
fieldMap[indexFieldName] =
|
||||
DartObjectImpl(typeSystem, intType, IntState(i));
|
||||
fieldMap[nameFieldName] =
|
||||
DartObjectImpl(typeSystem, stringType, StringState(constantName));
|
||||
DartObjectImpl value =
|
||||
DartObjectImpl(typeSystem, enumType, GenericState(fieldMap));
|
||||
constantElement.evaluationResult = EvaluationResultImpl(value);
|
||||
fields.add(constantElement);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Finish building the enum.
|
||||
//
|
||||
enumElement.fields = fields;
|
||||
// Client code isn't allowed to invoke the constructor, so we do not model it.
|
||||
return enumElement;
|
||||
}
|
||||
|
||||
static ExportElementImpl exportFor(LibraryElement exportedLibrary,
|
||||
[List<NamespaceCombinator> combinators = const <NamespaceCombinator>[]]) {
|
||||
ExportElementImpl spec = ExportElementImpl(-1);
|
||||
|
|
Loading…
Reference in a new issue