Version 2.12.0-46.0.dev
Merge commit '9f6ea5b6f6dde168a8190034ae301d3c12980802' into 'dev'
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 7ca094c..a6a5a4e 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -630,11 +630,6 @@
/// ML completion is enabled if this is non-null.
String completionModelFolder;
- /// Return `true` if the new relevance computations should be used when
- /// computing code completion suggestions.
- // TODO: This flag is no longer used.
- bool useNewRelevance = true;
-
/// The set of enabled features.
FeatureSet featureSet = FeatureSet();
}
diff --git a/pkg/analysis_server/lib/src/cider/completion.dart b/pkg/analysis_server/lib/src/cider/completion.dart
index 7864fa2..9c33f83 100644
--- a/pkg/analysis_server/lib/src/cider/completion.dart
+++ b/pkg/analysis_server/lib/src/cider/completion.dart
@@ -77,7 +77,6 @@
var completionRequest = CompletionRequestImpl(
resolvedUnit,
offset,
- false,
CompletionPerformance(),
);
var dartdocDirectiveInfo = DartdocDirectiveInfo();
diff --git a/pkg/analysis_server/lib/src/domain_completion.dart b/pkg/analysis_server/lib/src/domain_completion.dart
index 7ba35cd..4ee4034 100644
--- a/pkg/analysis_server/lib/src/domain_completion.dart
+++ b/pkg/analysis_server/lib/src/domain_completion.dart
@@ -312,8 +312,8 @@
recordRequest(performance, file, resolvedUnit.content, offset);
}
- var completionRequest = CompletionRequestImpl(
- resolvedUnit, offset, server.options.useNewRelevance, performance);
+ var completionRequest =
+ CompletionRequestImpl(resolvedUnit, offset, performance);
var completionId = (_nextCompletionId++).toString();
diff --git a/pkg/analysis_server/lib/src/domains/execution/completion.dart b/pkg/analysis_server/lib/src/domains/execution/completion.dart
index 454be82..12a49cd 100644
--- a/pkg/analysis_server/lib/src/domains/execution/completion.dart
+++ b/pkg/analysis_server/lib/src/domains/execution/completion.dart
@@ -85,7 +85,6 @@
var request = CompletionRequestImpl(
targetResult,
targetOffset,
- false,
CompletionPerformance(),
);
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart
index e9d0fcd..88c5e97 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart
@@ -189,8 +189,8 @@
server.performanceStats.completion.add(performance);
return await performance.runRequestOperation((perf) async {
- final completionRequest = CompletionRequestImpl(
- unit, offset, server.options.useNewRelevance, performance);
+ final completionRequest =
+ CompletionRequestImpl(unit, offset, performance);
final directiveInfo =
server.getDartdocDirectiveInfoFor(completionRequest.result);
final dartCompletionRequest = await DartCompletionRequestImpl.from(
diff --git a/pkg/analysis_server/lib/src/provisional/completion/completion_core.dart b/pkg/analysis_server/lib/src/provisional/completion/completion_core.dart
index 06e7ddb..88b348e 100644
--- a/pkg/analysis_server/lib/src/provisional/completion/completion_core.dart
+++ b/pkg/analysis_server/lib/src/provisional/completion/completion_core.dart
@@ -46,10 +46,6 @@
/// requested, or `null` if the content could not be accessed.
String get sourceContents;
- /// Return `true` if the new relevance computations should be used when
- /// computing code completion suggestions.
- bool get useNewRelevance;
-
/// Throw [AbortCompletion] if the completion request has been aborted.
void checkAborted();
}
diff --git a/pkg/analysis_server/lib/src/services/completion/completion_core.dart b/pkg/analysis_server/lib/src/services/completion/completion_core.dart
index a84b968..4141b3b 100644
--- a/pkg/analysis_server/lib/src/services/completion/completion_core.dart
+++ b/pkg/analysis_server/lib/src/services/completion/completion_core.dart
@@ -16,9 +16,6 @@
@override
final int offset;
- @override
- bool useNewRelevance;
-
/// The offset of the start of the text to be replaced.
/// This will be different than the [offset] used to request the completion
/// suggestions if there was a portion of an identifier before the original
@@ -39,8 +36,7 @@
/// Initialize a newly created completion request based on the given
/// arguments.
- CompletionRequestImpl(
- this.result, this.offset, this.useNewRelevance, this.performance)
+ CompletionRequestImpl(this.result, this.offset, this.performance)
: replacementOffset = offset,
replacementLength = 0;
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/common_usage_sorter.dart b/pkg/analysis_server/lib/src/services/completion/dart/common_usage_sorter.dart
deleted file mode 100644
index d553529..0000000
--- a/pkg/analysis_server/lib/src/services/completion/dart/common_usage_sorter.dart
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// 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.
-
-library services.completion.dart.sorter.common;
-
-import 'package:analysis_server/src/protocol_server.dart' as protocol;
-import 'package:analysis_server/src/protocol_server.dart'
- show CompletionSuggestion, CompletionSuggestionKind;
-import 'package:analysis_server/src/provisional/completion/completion_core.dart';
-import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
-import 'package:analysis_server/src/services/completion/dart/contribution_sorter.dart';
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/visitor.dart';
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/src/dart/ast/ast.dart';
-import 'package:analyzer_plugin/src/utilities/completion/completion_target.dart';
-
-part 'common_usage_sorter.g.dart';
-
-/// A computer for adjusting the relevance of completions computed by others
-/// based upon common Dart usage patterns. This is a long-lived object
-/// that should not maintain state between calls to it's [sort] method.
-class CommonUsageSorter implements DartContributionSorter {
- /// A map of <library>.<classname> to an ordered list of method names,
- /// field names, getter names, and named constructors.
- /// The names are ordered from most relevant to least relevant.
- /// Names not listed are considered equally less relevant than those listed.
- final Map<String, List<String>> selectorRelevance;
-
- CommonUsageSorter([this.selectorRelevance = defaultSelectorRelevance]);
-
- @override
- Future sort(DartCompletionRequest request,
- Iterable<CompletionSuggestion> suggestions) {
- _update(request, suggestions);
- return Future.value();
- }
-
- CompletionTarget _getCompletionTarget(CompletionRequest request) =>
- CompletionTarget.forOffset(request.result.unit, request.offset);
-
- /// Adjusts the relevance based on the given completion context.
- /// The compilation unit and completion node
- /// in the given completion context may not be resolved.
- void _update(
- CompletionRequest request, Iterable<CompletionSuggestion> suggestions) {
- var target = _getCompletionTarget(request);
- if (target != null) {
- var visitor = _BestTypeVisitor(target.entity);
- var typeElem = target.containingNode.accept(visitor);
- if (typeElem != null) {
- var libElem = typeElem.library;
- if (libElem != null) {
- _updateInvocationRelevance(typeElem.name, libElem, suggestions);
- }
- }
- }
- }
-
- /// Adjusts the relevance of all method suggestions based upon the given
- /// target type and library.
- void _updateInvocationRelevance(String typeName, LibraryElement libElem,
- Iterable<CompletionSuggestion> suggestions) {
- var selectors = selectorRelevance['${libElem.name}.$typeName'];
- if (selectors != null) {
- for (var suggestion in suggestions) {
- var element = suggestion.element;
- if (element != null &&
- (element.kind == protocol.ElementKind.CONSTRUCTOR ||
- element.kind == protocol.ElementKind.FIELD ||
- element.kind == protocol.ElementKind.GETTER ||
- element.kind == protocol.ElementKind.METHOD ||
- element.kind == protocol.ElementKind.SETTER) &&
- suggestion.kind == CompletionSuggestionKind.INVOCATION &&
- suggestion.declaringType == typeName) {
- var index = selectors.indexOf(suggestion.completion);
- if (index != -1) {
- suggestion.relevance = DART_RELEVANCE_COMMON_USAGE - index;
- }
- }
- }
- }
- }
-}
-
-/// An [AstVisitor] used to determine the best defining type of a node.
-class _BestTypeVisitor extends UnifyingAstVisitor<Element> {
- /// The entity which the completed text will replace (or which will be
- /// displaced once the completed text is inserted). This may be an AstNode or
- /// a Token, or it may be `null` if the cursor is after all tokens in the
- /// file. See field of the same name in [CompletionTarget].
- final Object entity;
-
- _BestTypeVisitor(this.entity);
-
- @override
- Element visitConstructorName(ConstructorName node) {
- return node.period != null && node.name == entity
- ? node.type?.type?.element
- : null;
- }
-
- @override
- Element visitNamedExpression(NamedExpression node) {
- var parent = node.parent;
- if (parent is ArgumentListImpl) {
- var params = parent.correspondingStaticParameters;
- if (params != null) {
- var index = parent.arguments.indexOf(node);
- return params[index]?.type?.element;
- }
- }
- return super.visitNamedExpression(node);
- }
-
- @override
- Element visitNode(AstNode node) {
- return null;
- }
-
- @override
- Element visitPrefixedIdentifier(PrefixedIdentifier node) {
- if (node.identifier == entity) {
- var type = node.prefix.staticType;
- if (type is InterfaceType) {
- return type.element;
- }
- return node.prefix.staticElement;
- }
- return null;
- }
-
- @override
- Element visitPropertyAccess(PropertyAccess node) =>
- node.propertyName == entity ? node.realTarget?.staticType?.element : null;
-}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/common_usage_sorter.g.dart b/pkg/analysis_server/lib/src/services/completion/dart/common_usage_sorter.g.dart
deleted file mode 100644
index fad6b92..0000000
--- a/pkg/analysis_server/lib/src/services/completion/dart/common_usage_sorter.g.dart
+++ /dev/null
@@ -1,3873 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// 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.
-
-part of services.completion.dart.sorter.common;
-
-// Auto-generated, please do not edit.
-
-/// A map of <library>.<classname> to an ordered list of method names,
-/// field names, getter names, and named constructors.
-/// The names are ordered from most relevant to least relevant.
-/// Names not listed are considered equally less relevant than those listed.
-const Map<String, List<String>> defaultSelectorRelevance = {
- 'dart.core.Comparable': [
- 'compareTo',
- 'compare',
- ],
- 'dart.math.Random': [
- 'nextInt',
- 'nextDouble',
- 'nextBool',
- ],
- 'dart.core.List': [
- 'add',
- 'map',
- 'length',
- 'removeLast',
- 'addAll',
- 'join',
- 'forEach',
- 'contains',
- 'removeAt',
- 'where',
- 'last',
- 'clear',
- 'setRange',
- 'sort',
- 'insert',
- 'remove',
- 'sublist',
- 'indexOf',
- 'isEmpty',
- 'any',
- 'insertAll',
- 'first',
- 'removeRange',
- 'replaceRange',
- 'take',
- 'getRange',
- 'skip',
- 'toList',
- 'retainWhere',
- 'fillRange',
- 'removeWhere',
- 'expand',
- 'fold',
- 'reversed',
- 'firstWhere',
- 'every',
- 'setAll',
- 'asMap',
- 'isNotEmpty',
- 'lastIndexOf',
- 'singleWhere',
- 'lastWhere',
- 'shuffle',
- 'takeWhile',
- 'iterator',
- 'toString',
- 'toSet',
- 'single',
- 'reduce',
- 'elementAt',
- 'skipWhile',
- 'insertRange',
- 'filter',
- 'push',
- 'mappedBy',
- 'addLast',
- 'some',
- 'slice',
- 'retainMatching',
- 'firstMatching',
- 'removeAll',
- 'retainAll',
- 'removeMatching',
- 'min',
- 'lastMatching',
- 'singleMatching',
- 'max',
- 'get',
- 'toArray',
- 'runtimeType',
- 'reverse',
- 'addd',
- 'asByteArray',
- ],
- 'dart.core.Iterable': [
- 'toList',
- 'map',
- 'join',
- 'toSet',
- 'where',
- 'forEach',
- 'expand',
- 'fold',
- 'every',
- 'any',
- 'contains',
- 'firstWhere',
- 'length',
- 'elementAt',
- 'skipWhile',
- 'reduce',
- 'iterator',
- 'take',
- 'skip',
- 'toString',
- 'singleWhere',
- 'lastWhere',
- 'takeWhile',
- 'isEmpty',
- 'first',
- 'single',
- 'last',
- 'isNotEmpty',
- 'addAll',
- 'indexOf',
- 'add',
- 'sort',
- 'toArray',
- 'mappedBy',
- 'filter',
- ],
- 'dart.core.Set': [
- 'add',
- 'contains',
- 'remove',
- 'addAll',
- 'clear',
- 'difference',
- 'map',
- 'containsAll',
- 'union',
- 'removeWhere',
- 'removeAll',
- 'intersection',
- 'retainAll',
- 'retainWhere',
- 'forEach',
- 'toSet',
- 'every',
- 'lookup',
- 'any',
- 'toString',
- 'toList',
- 'where',
- 'length',
- 'join',
- 'skip',
- 'firstWhere',
- 'isEmpty',
- 'first',
- 'iterator',
- 'singleWhere',
- 'expand',
- 'elementAt',
- 'fold',
- 'reduce',
- 'single',
- 'lastWhere',
- 'isNotEmpty',
- 'take',
- 'takeWhile',
- 'skipWhile',
- 'last',
- 'findBy',
- 'toArray',
- 'filter',
- ],
- 'dart.collection.Queue': [
- 'add',
- 'removeFirst',
- 'clear',
- 'removeLast',
- 'remove',
- 'addAll',
- 'addLast',
- 'addFirst',
- 'removeWhere',
- 'retainWhere',
- 'length',
- 'toList',
- 'where',
- 'contains',
- 'forEach',
- 'map',
- 'isNotEmpty',
- 'first',
- 'isEmpty',
- 'fold',
- 'skip',
- 'any',
- 'elementAt',
- ],
- 'dart.core.Map': [
- 'containsKey',
- 'forEach',
- 'remove',
- 'putIfAbsent',
- 'clear',
- 'addAll',
- 'length',
- 'keys',
- 'values',
- 'containsValue',
- 'toString',
- 'isNotEmpty',
- 'isEmpty',
- 'get',
- 'getKeys',
- 'put',
- 'getValues',
- 'clone',
- 'keySet',
- 'hashCode',
- 'runtimeType',
- ],
- 'dart.core.Iterator': [
- 'moveNext',
- 'current',
- 'next',
- 'hasNext',
- ],
- 'dart.pkg.collection.equality.Equality': [
- 'hash',
- 'equals',
- 'isValidKey',
- ],
- 'dart.pkg.collection.equality.SetEquality': [
- 'equals',
- 'hash',
- ],
- 'dart.pkg.collection.equality.MapEquality': [
- 'equals',
- 'hash',
- ],
- 'dart.pkg.collection.equality.ListEquality': [
- 'equals',
- 'hash',
- ],
- 'dart.pkg.collection.equality.IterableEquality': [
- 'hash',
- 'equals',
- ],
- 'dart.pkg.collection.equality.UnorderedIterableEquality': [
- 'hash',
- 'equals',
- ],
- 'dart.async.StreamSubscription': [
- 'cancel',
- 'pause',
- 'onDone',
- 'resume',
- 'onError',
- 'asFuture',
- 'onData',
- 'isPaused',
- ],
- 'dart.async.StreamController': [
- 'add',
- 'close',
- 'addError',
- 'addStream',
- 'stream',
- 'hasListener',
- 'signalError',
- 'sink',
- 'done',
- ],
- 'dart.async.Stream': [
- 'listen',
- 'transform',
- 'pipe',
- 'first',
- 'toList',
- 'forEach',
- 'firstWhere',
- 'where',
- 'join',
- 'fold',
- 'asyncMap',
- 'map',
- 'isEmpty',
- 'asBroadcastStream',
- 'handleError',
- 'capture',
- 'asyncExpand',
- 'take',
- 'single',
- 'expand',
- 'onFile',
- 'skip',
- 'any',
- 'timeout',
- 'add',
- 'last',
- 'runtimeType',
- 'isBroadcast',
- 'drain',
- 'elementAt',
- 'skipWhile',
- 'distinct',
- 'singleWhere',
- 'lastWhere',
- 'contains',
- 'every',
- 'takeWhile',
- 'emit',
- 'onDir',
- 'onError',
- 'onDone',
- 'onData',
- 'length',
- ],
- 'dart.async.Future': [
- 'then',
- 'catchError',
- 'wait',
- 'whenComplete',
- 'forEach',
- 'asStream',
- 'timeout',
- 'map',
- 'packages',
- 'where',
- 'firstWhere',
- 'chain',
- 'transform',
- 'doWhile',
- 'onError',
- 'onResponse',
- 'onRequest',
- 'handleException',
- ],
- 'dart.core.String': [
- 'substring',
- 'codeUnitAt',
- 'startsWith',
- 'replaceAll',
- 'split',
- 'contains',
- 'indexOf',
- 'toLowerCase',
- 'trim',
- 'length',
- 'endsWith',
- 'lastIndexOf',
- 'compareTo',
- 'isEmpty',
- 'toUpperCase',
- 'replaceFirst',
- 'toString',
- 'replaceAllMapped',
- 'allMatches',
- 'padLeft',
- 'codeUnits',
- 'hashCode',
- 'splitMapJoin',
- 'isNotEmpty',
- 'runes',
- 'charCodeAt',
- 'charCodes',
- 'trimRight',
- 'padRight',
- 'concat',
- 'equalsIgnoreCase',
- 'splitChars',
- 'trimLeft',
- 'matchAsPrefix',
- 'equals',
- 'map',
- 'toLoweCase',
- 'match',
- 'slice',
- 'getBytes',
- 'toCharArray',
- 'runtimeType',
- 'charAt',
- 'valueOf',
- ],
- 'dart.core.StringBuffer': [
- 'write',
- 'toString',
- 'writeln',
- 'writeCharCode',
- 'clear',
- 'writeAll',
- 'add',
- 'addAll',
- 'addCharCode',
- 'isEmpty',
- ],
- 'dart.core.RegExp': [
- 'firstMatch',
- 'hasMatch',
- 'allMatches',
- 'matchAsPrefix',
- 'pattern',
- 'stringMatch',
- 'toString',
- 'exec',
- ],
- 'dart.core.double': [
- 'parse',
- 'toInt',
- 'compareTo',
- 'floor',
- 'toString',
- 'abs',
- 'round',
- 'toStringAsPrecision',
- 'toDouble',
- 'floorToDouble',
- 'ceil',
- 'truncate',
- 'toStringAsFixed',
- 'roundToDouble',
- 'clamp',
- 'isNaN',
- 'isFinite',
- 'toStringAsExponential',
- 'ceilToDouble',
- 'truncateToDouble',
- 'isNan',
- 'isNegative',
- 'isInfinite',
- 'hashCode',
- ],
- 'dart.core.Type': [
- 'toString',
- 'hashCode',
- 'runtimeType',
- ],
- 'dart.mirrors.InstanceMirror': [
- 'reflectee',
- 'getField',
- 'type',
- 'invoke',
- 'setField',
- 'delegate',
- 'function',
- 'then',
- 'apply',
- 'hasReflectee',
- ],
- 'dart.collection.IterableBase': [
- 'iterableToFullString',
- ],
- 'dart.pkg.collection.utils.Pair': [
- 'last',
- ],
- 'dart.collection.Maps': [
- 'mapToString',
- 'length',
- 'putIfAbsent',
- 'clear',
- 'containsKey',
- 'getValues',
- 'forEach',
- 'containsValue',
- 'isNotEmpty',
- 'isEmpty',
- ],
- 'dart.collection.SplayTreeSet': [
- 'add',
- 'addAll',
- 'where',
- ],
- 'dart.core.StackTrace': [
- 'toString',
- 'frames',
- ],
- 'dart.convert.JsonCodec': [
- 'encode',
- 'decode',
- 'fuse',
- ],
- 'dart.mirrors.MirrorSystem': [
- 'getName',
- 'libraries',
- 'findLibrary',
- 'isolate',
- 'dynamicType',
- 'getSymbol',
- 'voidType',
- ],
- 'dart.mirrors.ClassMirror': [
- 'newInstance',
- 'isSubtypeOf',
- 'reflectedType',
- 'qualifiedName',
- 'metadata',
- 'getField',
- 'owner',
- 'declarations',
- 'superclass',
- 'simpleName',
- 'isSubclassOf',
- 'invoke',
- 'instanceMembers',
- 'mixin',
- 'isAbstract',
- 'originalDeclaration',
- 'typeVariables',
- 'setField',
- 'isOriginalDeclaration',
- 'superinterfaces',
- 'isAssignableTo',
- 'owners',
- ],
- 'dart.io.Process': [
- 'start',
- 'runSync',
- 'run',
- 'kill',
- 'exitCode',
- ],
- 'dart.core.int': [
- 'parse',
- 'toDouble',
- 'toString',
- 'toInt',
- 'compareTo',
- 'toRadixString',
- 'abs',
- 'remainder',
- 'toUnsigned',
- 'toSigned',
- 'clamp',
- 'round',
- 'floor',
- 'substr',
- 'ceil',
- 'isEven',
- 'id',
- 'append',
- 'truncate',
- 'hashCode',
- 'toStringAsFixed',
- 'ceilToDouble',
- 'roundToDouble',
- 'floorToDouble',
- 'truncateToDouble',
- 'isNegative',
- 'length',
- 'isNaN',
- 'isInfinite',
- 'runtimeType',
- 'bitLength',
- ],
- 'dart.core.Sink': [
- 'add',
- 'close',
- ],
- 'dart.async.EventSink': [
- 'close',
- 'add',
- 'addError',
- ],
- 'dart.async.Completer': [
- 'complete',
- 'completeError',
- 'future',
- 'isCompleted',
- 'completeException',
- 'then',
- ],
- 'dart.io.FileStat': [
- 'mode',
- 'stat',
- 'type',
- 'statSync',
- 'changed',
- 'modified',
- 'size',
- ],
- 'dart.io.Link': [
- 'existsSync',
- 'createSync',
- 'resolveSymbolicLinksSync',
- 'exists',
- 'delete',
- 'targetSync',
- 'deleteSync',
- 'target',
- 'create',
- 'updateSync',
- ],
- 'dart.io.FileSystemEntityType': [
- 'toString',
- 'NOT_FOUND',
- 'DIRECTORY',
- 'FILE',
- ],
- 'dart.io.Directory': [
- 'existsSync',
- 'list',
- 'listSync',
- 'watch',
- 'path',
- 'exists',
- 'createSync',
- 'create',
- 'deleteSync',
- 'delete',
- 'createTemp',
- 'createTempSync',
- 'renameSync',
- 'parent',
- 'absolute',
- 'stat',
- 'current',
- 'createRecursivelySync',
- 'resolveSymbolicLinksSync',
- 'rename',
- 'statSync',
- ],
- 'dart.io.File': [
- 'existsSync',
- 'readAsStringSync',
- 'openRead',
- 'writeAsStringSync',
- 'readAsString',
- 'openWrite',
- 'lastModifiedSync',
- 'exists',
- 'resolveSymbolicLinksSync',
- 'writeAsString',
- 'path',
- 'resolveSymbolicLinks',
- 'statSync',
- 'deleteSync',
- 'createSync',
- 'delete',
- 'openSync',
- 'parent',
- 'readAsBytesSync',
- 'copy',
- 'open',
- 'absolute',
- 'fullPathSync',
- 'length',
- 'writeAsBytesSync',
- 'lastModified',
- 'writeAsBytes',
- 'readAsLinesSync',
- 'fullPath',
- 'readAsBytes',
- 'copySync',
- 'create',
- 'lengthSync',
- 'readAsLines',
- 'isFileSync',
- 'isFile',
- 'rename',
- 'openOutputStream',
- 'openInputStream',
- 'stat',
- 'renameSync',
- 'watch',
- 'directorySync',
- 'isAbsolute',
- 'directory',
- ],
- 'dart.io.Stdout': [
- 'writeln',
- 'close',
- 'write',
- 'flush',
- 'addStream',
- 'writeString',
- 'add',
- 'writeCharCode',
- 'addString',
- ],
- 'dart.io.IOSink': [
- 'write',
- 'close',
- 'writeln',
- 'flush',
- 'add',
- 'addStream',
- 'writeAll',
- 'writeCharCode',
- 'encoding',
- 'addError',
- 'done',
- ],
- 'dart.mirrors.LibraryMirror': [
- 'uri',
- 'getField',
- 'declarations',
- 'invoke',
- 'topLevelMembers',
- 'setField',
- 'classes',
- 'first',
- ],
- 'dart.core.Match': [
- 'group',
- 'end',
- 'start',
- 'groups',
- 'toString',
- ],
- 'dart.isolate.SendPort': [
- 'send',
- 'call',
- 'hashCode',
- ],
- 'dart.core.DateTime': [
- 'parse',
- 'toIso8601String',
- 'millisecondsSinceEpoch',
- 'difference',
- 'toUtc',
- 'add',
- 'day',
- 'year',
- 'month',
- 'isAfter',
- 'toString',
- 'compareTo',
- 'subtract',
- 'isBefore',
- 'millisecond',
- 'toLocal',
- 'timeZoneName',
- 'timeZoneOffset',
- 'isUtc',
- 'weekday',
- 'isAtSameMomentAs',
- 'second',
- 'hour',
- 'minute',
- 'hashCode',
- 'now',
- 'runtimeType',
- ],
- 'dart.core.Duration': [
- 'inMilliseconds',
- 'toString',
- 'inSeconds',
- 'inMicroseconds',
- 'inHours',
- 'inMinutes',
- 'inDays',
- 'isNegative',
- 'compareTo',
- ],
- 'dart.core.Uri': [
- 'parse',
- 'toString',
- 'toFilePath',
- 'path',
- 'resolve',
- 'decodeComponent',
- 'encodeFull',
- 'decodeQueryComponent',
- 'scheme',
- 'encodeComponent',
- 'resolveUri',
- 'encodeQueryComponent',
- 'query',
- 'decodeFull',
- 'pathSegments',
- 'queryParameters',
- 'origin',
- 'authority',
- 'splitQueryString',
- 'replace',
- 'host',
- 'isAbsolute',
- 'port',
- 'fragment',
- 'hasAuthority',
- 'userInfo',
- 'parseIPv4Address',
- 'parseIPv6Address',
- 'hasQuery',
- 'endsWith',
- 'startsWith',
- ],
- 'dart.typed_data.Uint32List': [
- 'sublist',
- 'setAll',
- 'fillRange',
- 'setRange',
- 'removeRange',
- 'removeLast',
- 'clear',
- 'addAll',
- 'add',
- ],
- 'dart.typed_data.TypedData': [
- 'buffer',
- ],
- 'dart.io.BytesBuilder': [
- 'takeBytes',
- 'addByte',
- 'add',
- 'clear',
- 'toBytes',
- ],
- 'dart.isolate.ReceivePort': [
- 'close',
- 'transform',
- 'listen',
- 'receive',
- 'toSendPort',
- 'takeWhile',
- 'sendPort',
- 'asBroadcastStream',
- ],
- 'dart.convert.Encoding': [
- 'decode',
- 'encode',
- 'getByName',
- 'decodeStream',
- 'name',
- ],
- 'dart.convert.Utf8Codec': [
- 'encode',
- 'decode',
- 'decoder',
- 'decodeStream',
- ],
- 'dart.core.Stopwatch': [
- 'start',
- 'stop',
- 'reset',
- 'elapsedMicroseconds',
- 'elapsedMilliseconds',
- 'elapsed',
- 'elapsedInMs',
- ],
- 'dart.async.ZoneDelegate': [
- 'handleUncaughtError',
- 'registerUnaryCallback',
- 'registerCallback',
- 'registerBinaryCallback',
- 'runBinary',
- 'errorCallback',
- 'scheduleMicrotask',
- 'run',
- 'createTimer',
- ],
- 'dart.async.Zone': [
- 'handleUncaughtError',
- 'run',
- 'fork',
- 'inSameErrorZone',
- 'runGuarded',
- 'bindUnaryCallback',
- 'bindBinaryCallback',
- 'runUnary',
- 'bindCallback',
- 'scheduleMicrotask',
- 'createTimer',
- ],
- 'dart.dom.html.BodyElement': [
- 'innerHtml',
- 'children',
- 'nodes',
- 'append',
- 'style',
- 'onContextMenu',
- 'onMouseDown',
- 'onMouseWheel',
- 'scrollTop',
- 'onMouseUp',
- 'onClick',
- 'scrollLeft',
- 'clientHeight',
- 'clientWidth',
- 'onBlur',
- 'onFocus',
- 'onDoubleClick',
- 'scrollHeight',
- 'onMouseMove',
- 'elements',
- 'createFragment',
- 'classes',
- 'ownerDocument',
- 'query',
- 'onKeyDown',
- 'querySelector',
- 'offsetWidth',
- 'scrollWidth',
- 'offsetHeight',
- 'setInnerHtml',
- 'childNodes',
- 'requestFullscreen',
- 'offsetTop',
- ],
- 'dart.dom.html.Location': [
- 'hash',
- 'search',
- 'reload',
- 'pathname',
- 'toString',
- 'href',
- 'host',
- 'assign',
- 'replace',
- 'protocol',
- 'hostname',
- 'port',
- 'origin',
- ],
- 'dart.convert.HtmlEscape': [
- 'convert',
- ],
- 'dart.dom.html.Window': [
- 'postMessage',
- 'btoa',
- 'lookupPort',
- 'document',
- 'requestAnimationFrame',
- 'alert',
- 'navigator',
- 'devicePixelRatio',
- 'pageYOffset',
- 'pageXOffset',
- 'onAnimationEnd',
- 'innerWidth',
- 'onResize',
- 'getSelection',
- 'cancelAnimationFrame',
- 'animationEndEvent',
- 'innerHeight',
- 'registerPort',
- 'dispatchEvent',
- 'onAnimationStart',
- 'onMouseUp',
- 'onMouseMove',
- 'open',
- 'screen',
- 'indexedDB',
- 'setTimeout',
- 'scrollX',
- 'scrollY',
- 'onScroll',
- 'openDatabase',
- 'confirm',
- 'getContainer',
- 'location',
- 'onKeyUp',
- 'atob',
- 'scrollTo',
- 'localStorage',
- 'scrollBy',
- 'setInterval',
- 'setImmediate',
- 'requestLayoutFrame',
- 'requestFileSystem',
- 'onHashChange',
- 'close',
- 'console',
- 'onError',
- 'onMessage',
- 'animationFrame',
- ],
- 'dart.core.Function': [
- 'apply',
- 'toString',
- 'call',
- 'bind',
- ],
- 'dart.async.Timer': [
- 'cancel',
- 'run',
- ],
- 'dart.dom.html.HeadElement': [
- 'append',
- 'querySelector',
- 'query',
- 'children',
- 'style',
- 'elements',
- 'querySelectorAll',
- 'nodes',
- 'id',
- 'insertBefore',
- 'text',
- ],
- 'dart.dom.html.ElementStream': [
- 'listen',
- 'where',
- 'first',
- 'matches',
- 'forEach',
- 'map',
- ],
- 'dart.dom.html.Element': [
- 'query',
- 'onClick',
- 'innerHtml',
- 'style',
- 'querySelector',
- 'nodes',
- 'children',
- 'remove',
- 'append',
- 'querySelectorAll',
- 'classes',
- 'attributes',
- 'setInnerHtml',
- 'getComputedStyle',
- 'onChange',
- 'parent',
- 'matches',
- 'getBoundingClientRect',
- 'focus',
- 'dispatchEvent',
- 'addEventListener',
- 'insertAllBefore',
- 'clone',
- 'getAttribute',
- 'blur',
- 'createShadowRoot',
- 'contains',
- 'text',
- 'setAttribute',
- 'insertAdjacentElement',
- 'appendText',
- 'scrollIntoView',
- 'shadowRoot',
- 'getNamespacedAttributes',
- 'removeEventListener',
- 'insertBefore',
- 'appendHtml',
- 'click',
- 'offsetWidth',
- 'insertAdjacentHtml',
- 'insertAdjacentText',
- 'getClientRects',
- 'getElementsByClassName',
- 'replaceWith',
- 'scrollByLines',
- 'scrollByPages',
- 'hasChildNodes',
- 'requestFullscreen',
- 'requestPointerLock',
- 'queryAll',
- 'setAttributeNS',
- 'getAttributeNS',
- 'dataset',
- 'offsetHeight',
- 'on',
- 'createFragment',
- 'offsetTo',
- 'getDestinationInsertionPoints',
- 'matchesWithAncestors',
- 'attributeChanged',
- 'onMouseDown',
- 'nextElementSibling',
- 'getRegionFlowRanges',
- 'onContextMenu',
- 'animate',
- 'onTouchStart',
- 'scrollTop',
- 'offsetTop',
- 'onTouchMove',
- 'onTouchEnd',
- 'onMouseWheel',
- 'clientWidth',
- 'scrollLeft',
- 'clientHeight',
- 'isTagSupported',
- 'parentNode',
- 'onMouseUp',
- 'bind',
- 'onKeyDown',
- 'ownerDocument',
- 'unbind',
- 'unbindAll',
- 'init',
- 'createInstance',
- 'render',
- 'update',
- 'onKeyUp',
- 'onMouseMove',
- 'xtag',
- 'offsetLeft',
- 'tabIndex',
- 'client',
- 'requestFullScreen',
- 'getInputContext',
- 'borderEdge',
- 'clearModel',
- 'id',
- 'disabled',
- 'value',
- 'getContext',
- 'lastChild',
- 'firstChild',
- 'nextNode',
- 'innerHTML',
- 'onMouseEnter',
- 'onMouseLeave',
- 'contentEdge',
- 'elements',
- 'matchesSelector',
- 'webkitRequestPointerLock',
- 'tagName',
- 'childNodes',
- 'webkitRequestFullscreen',
- 'webkitRequestFullScreen',
- 'marginEdge',
- 'paddingEdge',
- 'outerHtml',
- 'onMouseOver',
- 'onMouseOut',
- 'onDragEnd',
- 'boolean',
- 'scrollHeight',
- 'hidden',
- 'onDragStart',
- 'onDoubleClick',
- 'nodeType',
- 'hashCode',
- 'onDrag',
- 'onInput',
- 'selectionStart',
- 'selectionEnd',
- 'onDrop',
- 'onDragLeave',
- 'hideOrShowNavigation',
- 'onDragOver',
- 'model',
- 'scrollEvent',
- 'onDragEnter',
- 'previousElementSibling',
- 'className',
- 'namespaceUri',
- 'onSubmit',
- 'selection',
- 'setItemSelected',
- 'runtimeType',
- 'apply',
- 'createBinding',
- 'values',
- 'onBlur',
- 'onTouchCancel',
- 'show',
- 'insertAdjacentHTML',
- 'nodeName',
- 'selected',
- 'contentEditable',
- 'localName',
- 'number',
- 'draggable',
- 'src',
- 'addText',
- 'addHTML',
- 'select',
- 'clear',
- 'str',
- 'clearSelection',
- ],
- 'dart.dom.html.HtmlElement': [
- 'querySelector',
- 'query',
- 'append',
- 'classes',
- 'style',
- 'getComputedStyle',
- 'remove',
- 'getBoundingClientRect',
- 'querySelectorAll',
- 'clone',
- 'attributes',
- 'focus',
- 'tabIndex',
- 'onClick',
- 'parent',
- 'onMouseLeave',
- 'replaceWith',
- 'onContextMenu',
- 'onMouseEnter',
- 'onKeyDown',
- 'blur',
- 'setInnerText',
- 'scrollTop',
- 'appendHtml',
- 'dataset',
- 'lastChild',
- 'onSelectStart',
- 'onDrop',
- 'onDragOver',
- 'onDragLeave',
- 'onDragEnter',
- 'onDragEnd',
- 'onDragStart',
- 'onDrag',
- 'onDoubleClick',
- 'children',
- 'onScroll',
- 'getAttribute',
- 'nodes',
- 'outerHtml',
- 'click',
- 'createShadowRoot',
- ],
- 'dart.dom.html.ElementList': [
- 'forEach',
- 'length',
- 'contains',
- 'last',
- 'style',
- 'addAll',
- 'first',
- 'where',
- 'onMouseLeave',
- 'onMouseEnter',
- 'toList',
- 'some',
- 'onClick',
- 'map',
- 'classes',
- 'indexOf',
- ],
- 'dart.dom.html.HtmlDocument': [
- 'query',
- 'querySelectorAll',
- 'querySelector',
- 'queryAll',
- 'createElement',
- 'body',
- 'title',
- 'createElementUpgrader',
- 'documentElement',
- 'timeline',
- 'onKeyDown',
- 'getElementById',
- 'registerElement',
- 'onClick',
- 'addEventListener',
- 'onMouseUp',
- 'onMouseMove',
- 'activeElement',
- 'createElementNS',
- 'createDocumentFragment',
- 'createRange',
- 'adoptNode',
- 'getElementsByTagName',
- 'onKeyUp',
- 'elementFromPoint',
- 'contains',
- 'getElementsByName',
- 'head',
- 'exitFullscreen',
- 'onMouseWheel',
- 'register',
- ],
- 'dart.collection.LinkedHashMap': [
- 'containsKey',
- 'forEach',
- 'remove',
- 'putIfAbsent',
- 'keys',
- 'length',
- 'clear',
- 'values',
- 'isNotEmpty',
- ],
- 'dart.dom.html.Navigator': [
- 'userAgent',
- 'language',
- 'appVersion',
- 'appName',
- 'geolocation',
- 'vendor',
- 'appCodeName',
- 'dartEnabled',
- 'getUserMedia',
- 'onLine',
- 'platform',
- 'storageQuota',
- ],
- 'dart.dom.html.CssStyleDeclaration': [
- 'display',
- 'width',
- 'height',
- 'top',
- 'setProperty',
- 'left',
- 'position',
- 'zIndex',
- 'cssText',
- 'right',
- 'maxHeight',
- 'visibility',
- 'bottom',
- 'background',
- 'removeProperty',
- 'cursor',
- 'overflow',
- 'getPropertyValue',
- 'opacity',
- 'backgroundColor',
- 'float',
- 'transform',
- 'padding',
- 'border',
- 'borderRadius',
- 'paddingBottom',
- 'transition',
- 'paddingTop',
- 'overflowY',
- 'color',
- 'outline',
- 'backgroundImage',
- 'transformStyle',
- 'pointerEvents',
- 'marginLeft',
- 'textAlign',
- 'backgroundPosition',
- 'boxSizing',
- 'paddingLeft',
- 'backgroundSize',
- 'margin',
- 'fontFamily',
- 'userSelect',
- 'fontSize',
- 'lineHeight',
- 'willChange',
- 'fontWeight',
- 'getProperty',
- 'marginRight',
- 'whiteSpace',
- 'overflowX',
- 'textDecoration',
- 'perspective',
- 'perspectiveOrigin',
- 'appearance',
- 'borderLeftWidth',
- 'paddingRight',
- 'borderColor',
- 'borderBottomWidth',
- 'borderTopWidth',
- 'webkitOverflowScrolling',
- 'borderRightWidth',
- 'marginBottom',
- 'transitionProperty',
- 'transitionTimingFunction',
- 'transitionDuration',
- 'animation',
- 'animationDelay',
- 'animationFillMode',
- 'animationDirection',
- 'animationIterationCount',
- 'animationTimingFunction',
- 'animationDuration',
- 'animationName',
- 'verticalAlign',
- 'marginTop',
- 'boxShadow',
- 'getPropertyPriority',
- 'textStrokeColor',
- 'borderBottom',
- 'font',
- 'supportsProperty',
- 'textShadow',
- 'maxWidth',
- 'minWidth',
- 'minHeight',
- 'outlineColor',
- 'filter',
- 'borderWidth',
- 'animationPlayState',
- 'fontStyle',
- 'borderRight',
- 'borderLeft',
- 'borderTop',
- ],
- 'dart.io.ProcessResult': [
- 'stdout',
- 'exitCode',
- ],
- 'dart.io.FileSystemEvent': [
- 'path',
- 'isDirectory',
- 'type',
- 'MODIFY',
- 'CREATE',
- 'DELETE',
- ],
- 'dart.collection.HashSet': [
- 'add',
- 'contains',
- 'remove',
- 'clear',
- 'addAll',
- 'retainAll',
- 'length',
- 'isEmpty',
- 'toList',
- 'removeAll',
- 'any',
- 'forEach',
- 'map',
- ],
- 'dart.collection.HashMap': [
- 'remove',
- 'containsKey',
- 'forEach',
- 'clear',
- 'keys',
- 'putIfAbsent',
- 'addAll',
- 'values',
- ],
- 'dart.io.FileSystemEntity': [
- 'isDirectorySync',
- 'path',
- 'typeSync',
- 'existsSync',
- 'isDirectory',
- 'identicalSync',
- 'isFileSync',
- 'type',
- 'isFile',
- 'statSync',
- 'deleteSync',
- 'isLinkSync',
- 'parentOf',
- 'renameSync',
- 'isLink',
- 'readAsStringSync',
- 'identical',
- 'rename',
- 'toString',
- 'delete',
- 'exists',
- 'parent',
- 'stat',
- ],
- 'dart.io.OSError': [
- 'errorCode',
- 'toString',
- ],
- 'dart.async.StreamTransformer': [
- 'bind',
- ],
- 'dart.core.Runes': [
- 'toList',
- 'any',
- 'elementAt',
- 'iterator',
- 'single',
- 'first',
- 'forEach',
- 'last',
- ],
- 'dart.core.Object': [
- 'toString',
- 'toJson',
- 'hashCode',
- 'discardListChages',
- 'reverse',
- 'map',
- 'lightDom',
- 'getName',
- 'where',
- 'add',
- 'containsKey',
- 'format',
- 'setTable',
- 'getClass',
- 'getNamespace',
- 'getId',
- 'getCell',
- 'getSize',
- 'setNamespace',
- 'equals',
- 'setColumn',
- 'getColumnName',
- 'getForeignTableName',
- 'setDatabase',
- 'setAttribute',
- 'setId',
- 'getChild',
- 'body',
- 'setPrevious',
- 'getIndex',
- 'getParent',
- 'getChildAt',
- 'getChildCount',
- 'getValue',
- 'getRoot',
- 'POST',
- 'GET',
- 'getPackage',
- 'setSchema',
- 'clone',
- 'getType',
- 'then',
- 'isInheritance',
- 'isVisible',
- 'getDartName',
- 'getPlatform',
- 'setPosition',
- 'setPackage',
- 'requiresTransactionInPostgres',
- 'setAppData',
- 'getSchema',
- 'getBuildProperty',
- 'getPrevious',
- 'getTerminal',
- 'n',
- 'replaceWith',
- 'setChild',
- 'setPlatform',
- 'run',
- 'removeItem',
- 'getAllItems',
- 'bytes',
- 'compareTo',
- 'getAttribute',
- 'setPreviousIndex',
- 'isEmpty',
- 'getEdgeAt',
- 'isVertex',
- 'writeExternal',
- 'isEdge',
- 'getEdgeCount',
- 'isConnectable',
- 'setValue',
- 'isCollapsed',
- 'getStyles',
- 'setRoot',
- 'getStyle',
- 'getGeometry',
- 'noSuchMethod',
- 'contains',
- 'elementAt',
- 'e',
- ],
- 'dart.core.StringSink': [
- 'write',
- 'writeln',
- 'writeCharCode',
- 'toString',
- 'writeAll',
- ],
- 'dart.io.Stdin': [
- 'pipe',
- 'readLineSync',
- 'transform',
- 'listen',
- ],
- 'dart.io.HttpServer': [
- 'bind',
- 'listen',
- 'close',
- 'connectionsInfo',
- 'bindSecure',
- 'address',
- 'port',
- 'idleTimeout',
- 'serverHeader',
- 'autoCompress',
- 'asBroadcastStream',
- 'transform',
- 'addRequestHandler',
- 'listenOn',
- 'on',
- ],
- 'dart.io.HttpResponse': [
- 'close',
- 'write',
- 'statusCode',
- 'headers',
- 'add',
- 'done',
- 'redirect',
- 'addStream',
- 'detachSocket',
- 'reasonPhrase',
- 'writeln',
- 'addError',
- 'writeCharCode',
- 'writeAll',
- 'flush',
- 'toString',
- 'when',
- 'cookies',
- 'contentLength',
- 'addString',
- 'getLogs',
- 'listen',
- 'persistentConnection',
- 'deadline',
- ],
- 'dart.io.HttpRequest': [
- 'listen',
- 'uri',
- 'session',
- 'drain',
- 'transform',
- 'response',
- 'toString',
- 'cookies',
- 'method',
- 'fold',
- 'connectionInfo',
- 'pipe',
- 'asBroadcastStream',
- 'toList',
- 'timeout',
- 'takeWhile',
- 'take',
- 'skipWhile',
- 'singleWhere',
- 'map',
- 'lastWhere',
- 'join',
- 'handleError',
- 'skip',
- 'firstWhere',
- 'expand',
- 'every',
- 'elementAt',
- 'distinct',
- 'asyncMap',
- 'asyncExpand',
- 'any',
- 'toSet',
- 'contains',
- 'where',
- 'reduce',
- 'forEach',
- 'headers',
- 'path',
- ],
- 'dart.collection.SplayTreeMap': [
- 'forEach',
- 'containsKey',
- 'remove',
- 'keys',
- 'values',
- 'firstKeyAfter',
- 'lastKeyBefore',
- 'clear',
- 'length',
- ],
- 'dart.io.HttpClient': [
- 'post',
- 'getUrl',
- 'openUrl',
- 'close',
- 'postUrl',
- 'get',
- 'open',
- 'addCredentials',
- 'patchUrl',
- 'shutdown',
- 'put',
- 'delete',
- 'addProxyCredentials',
- 'findProxyFromEnvironment',
- ],
- 'dart.io.HttpClientRequest': [
- 'close',
- 'add',
- 'write',
- 'addStream',
- 'cookies',
- ],
- 'dart.io.Platform': [
- 'isWindows',
- 'script',
- 'environment',
- 'operatingSystem',
- 'pathSeparator',
- ],
- 'dart.collection.LinkedHashSet': [
- 'add',
- 'map',
- 'contains',
- 'toList',
- 'addAll',
- 'remove',
- ],
- 'dart.io.RandomAccessFile': [
- 'lengthSync',
- 'readIntoSync',
- 'close',
- 'closeSync',
- 'writeStringSync',
- 'writeString',
- 'writeFromSync',
- 'length',
- 'readInto',
- 'read',
- 'readSync',
- 'writeFrom',
- 'readListSync',
- 'flushSync',
- 'positionSync',
- 'setPosition',
- 'writeListSync',
- 'setPositionSync',
- 'unlock',
- 'lock',
- 'unlockSync',
- 'readList',
- 'lockSync',
- 'readByteSync',
- 'position',
- 'writeList',
- 'writeByteSync',
- ],
- 'dart.core.num': [
- 'round',
- 'toDouble',
- 'toInt',
- 'floor',
- 'abs',
- 'toString',
- 'parse',
- 'ceil',
- 'toStringAsFixed',
- 'isNaN',
- 'compareTo',
- 'roundToDouble',
- 'remainder',
- 'hashCode',
- 'clamp',
- 'isInfinite',
- 'isNegative',
- 'truncate',
- 'toStringAsPrecision',
- 'toStringAsExponential',
- 'isFinite',
- 'truncateToDouble',
- 'toRadixString',
- ],
- 'dart.dom.html.HttpRequest': [
- 'send',
- 'open',
- 'getString',
- 'abort',
- 'setRequestHeader',
- 'request',
- 'getAllResponseHeaders',
- 'overrideMimeType',
- 'requestCrossOrigin',
- 'getResponseHeader',
- 'postFormData',
- 'onLoadEnd',
- 'onError',
- 'onLoad',
- 'DONE',
- 'withCredentials',
- 'onReadyStateChange',
- 'onLoadStart',
- ],
- 'dart.dom.html.Event': [
- 'preventDefault',
- 'toString',
- 'stopImmediatePropagation',
- 'stopPropagation',
- 'target',
- 'currentTarget',
- ],
- 'dart.dom.html.FileReader': [
- 'readAsArrayBuffer',
- 'readAsDataUrl',
- 'readAsText',
- 'onError',
- 'onLoadEnd',
- 'result',
- ],
- 'dart.core.Pattern': [
- 'allMatches',
- 'matchAsPrefix',
- 'toString',
- 'firstMatch',
- 'pattern',
- 'codeUnitAt',
- ],
- 'dart.io.ContentType': [
- 'parse',
- 'toString',
- 'charset',
- 'mimeType',
- 'value',
- 'parameters',
- 'subType',
- 'primaryType',
- ],
- 'dart.io.HttpHeaders': [
- 'set',
- 'contentType',
- 'ifModifiedSince',
- 'value',
- 'add',
- 'host',
- 'forEach',
- 'date',
- 'removeAll',
- 'clear',
- 'remove',
- 'noFolding',
- 'contentLength',
- 'port',
- 'expires',
- 'chunkedTransferEncoding',
- 'persistentConnection',
- 'toString',
- 'CONTENT_TYPE',
- 'data',
- ],
- 'dart.typed_data.Uint8List': [
- 'setRange',
- 'sublist',
- 'fillRange',
- 'setAll',
- 'length',
- 'buffer',
- 'toString',
- 'toList',
- 'lastIndexOf',
- 'indexOf',
- 'join',
- 'removeRange',
- 'removeLast',
- 'clear',
- 'addAll',
- 'add',
- ],
- 'dart.async.StreamSink': [
- 'close',
- 'addStream',
- 'add',
- 'addError',
- ],
- 'dart.typed_data.ByteData': [
- 'getUint32',
- 'setUint32',
- 'getUint8',
- 'setUint64',
- 'getInt32',
- 'getUint16',
- 'getUint64',
- 'setUint16',
- 'getInt16',
- 'setInt64',
- 'setInt32',
- 'setInt16',
- 'setFloat64',
- 'getInt64',
- 'setInt8',
- 'getFloat64',
- 'getFloat32',
- 'setFloat32',
- 'getInt8',
- 'setUint8',
- ],
- 'dart.io.HttpClientResponse': [
- 'listen',
- 'toList',
- 'transform',
- 'drain',
- 'fold',
- 'pipe',
- 'detachSocket',
- ],
- 'dart.core.BidirectionalIterator': [
- 'moveNext',
- 'movePrevious',
- ],
- 'dart.mirrors.ClosureMirror': [
- 'invoke',
- 'apply',
- 'function',
- ],
- 'dart.typed_data.Int32x4': [
- 'x',
- 'signMask',
- 'select',
- ],
- 'dart.js.JsObject': [
- 'callMethod',
- 'hasProperty',
- 'toString',
- 'deleteProperty',
- 'instanceof',
- ],
- 'dart.dom.html.Node': [
- 'remove',
- 'ELEMENT_NODE',
- 'insertBefore',
- 'replaceWith',
- 'insertAllBefore',
- 'querySelector',
- 'localName',
- 'text',
- 'append',
- 'setMenubarOrientation',
- 'getElementsByTagName',
- 'getElementsByClassName',
- 'nodes',
- 'parentNode',
- 'getElementById',
- 'firstChild',
- 'parent',
- 'contains',
- 'tagName',
- 'value',
- 'toString',
- 'name',
- 'querySelectorAll',
- 'clone',
- 'attributes',
- 'nextNode',
- 'nodeType',
- 'click',
- 'bind',
- 'outerHtml',
- 'dispatchEvent',
- 'on',
- 'childNodes',
- ],
- 'dart.core.RuneIterator': [
- 'moveNext',
- 'reset',
- ],
- 'dart.mirrors.DeclarationMirror': [
- 'isPrivate',
- 'simpleName',
- 'metadata',
- 'isSubclassOf',
- 'qualifiedName',
- 'parameters',
- 'invoke',
- ],
- 'dart.dom.html.History': [
- 'pushState',
- 'back',
- 'replaceState',
- 'length',
- ],
- 'dart.dom.html.CssClassSet': [
- 'add',
- 'remove',
- 'toggle',
- 'clear',
- 'contains',
- 'addAll',
- 'removeAll',
- 'toString',
- 'firstWhere',
- 'first',
- 'toggleAll',
- 'length',
- 'containsAll',
- ],
- 'dart.dom.html.Document': [
- 'querySelector',
- 'querySelectorAll',
- 'documentElement',
- 'createElement',
- 'title',
- 'body',
- 'removeEventListener',
- 'addEventListener',
- 'getElementsByTagName',
- 'createElementNS',
- 'query',
- 'window',
- 'queryAll',
- ],
- 'dart.mirrors.IsolateMirror': [
- 'rootLibrary',
- ],
- 'dart.mirrors.ObjectMirror': [
- 'invoke',
- 'getField',
- 'setField',
- ],
- 'dart.dom.html.DivElement': [
- 'append',
- 'classes',
- 'style',
- 'setInnerHtml',
- 'remove',
- 'querySelector',
- 'id',
- 'getComputedStyle',
- 'appendText',
- 'text',
- 'querySelectorAll',
- 'onDragEnd',
- 'onDrag',
- 'onDragStart',
- 'draggable',
- 'innerHtml',
- 'insertAdjacentElement',
- 'appendHtml',
- 'className',
- 'children',
- 'focus',
- 'query',
- 'nodes',
- 'createShadowRoot',
- 'clone',
- 'attributes',
- 'queryAll',
- 'click',
- 'onMouseDown',
- 'onClick',
- 'hidden',
- 'addEventListener',
- 'onMouseMove',
- 'scrollIntoView',
- 'onKeyDown',
- 'title',
- 'getBoundingClientRect',
- 'onMouseUp',
- 'dispatchEvent',
- 'insertAdjacentText',
- 'contentEditable',
- 'scrollTop',
- 'scrollByLines',
- 'bind',
- 'insertBefore',
- 'xtag',
- 'insertAdjacentHtml',
- 'matches',
- 'setAttribute',
- 'on',
- 'onKeyUp',
- 'getElementsByClassName',
- ],
- 'dart.dom.html.NodeValidatorBuilder': [
- 'allowNavigation',
- 'allowElement',
- 'allowHtml5',
- 'allowSvg',
- 'allowInlineStyles',
- 'allowTextElements',
- 'allowTemplating',
- 'allowCustomElement',
- 'allowTagExtension',
- 'allowImages',
- ],
- 'dart.dom.html.Console': [
- 'timeEnd',
- 'time',
- 'timeStamp',
- 'warn',
- 'log',
- 'error',
- 'groupEnd',
- 'info',
- 'debug',
- 'groupCollapsed',
- 'group',
- 'dir',
- ],
- 'dart.dom.html.ElementUpgrader': [
- 'upgrade',
- ],
- 'dart.async.StreamIterator': [
- 'moveNext',
- 'cancel',
- ],
- 'dart.io.SystemEncoding': [
- 'decode',
- ],
- 'dart.collection.UnmodifiableListView': [
- 'where',
- 'contains',
- 'any',
- 'length',
- 'join',
- 'firstWhere',
- ],
- 'dart.core.Error': [
- 'safeToString',
- 'toString',
- ],
- 'dart.convert.Utf8Encoder': [
- 'bind',
- 'convert',
- 'startChunkedConversion',
- ],
- 'dart.dom.html.DomImplementation': [
- 'createHtmlDocument',
- ],
- 'dart.dom.html.DocumentFragment': [
- 'querySelectorAll',
- 'append',
- 'clone',
- 'nodes',
- 'children',
- 'setInnerHtml',
- 'querySelector',
- 'queryAll',
- 'query',
- 'remove',
- 'ownerDocument',
- ],
- 'dart.dom.html.ShadowRoot': [
- 'querySelector',
- 'querySelectorAll',
- 'host',
- 'children',
- 'append',
- 'contains',
- 'query',
- 'activeElement',
- 'supported',
- 'nodes',
- 'firstChild',
- 'getElementsByTagName',
- 'text',
- 'innerHtml',
- 'olderShadowRoot',
- ],
- 'dart.mirrors.TypeMirror': [
- 'qualifiedName',
- 'isSubtypeOf',
- 'reflectedType',
- 'newInstance',
- 'isAssignableTo',
- 'simpleName',
- 'typeArguments',
- 'originalDeclaration',
- 'toString',
- 'referent',
- 'hasReflectedType',
- 'isPrivate',
- 'typeVariables',
- 'owner',
- 'invoke',
- 'isOriginalDeclaration',
- ],
- 'dart.io.ServerSocket': [
- 'bind',
- 'close',
- 'listen',
- ],
- 'dart.dom.html.PerformanceNavigation': [
- 'type',
- 'redirectCount',
- ],
- 'dart.dom.html.Performance': [
- 'now',
- 'timing',
- 'navigation',
- ],
- 'dart.dom.html.PerformanceTiming': [
- 'navigationStart',
- ],
- 'dart.typed_data.ByteBuffer': [
- 'asUint8List',
- 'asUint32List',
- 'asInt32List',
- 'asByteData',
- 'asFloat64x2List',
- 'asInt32x4List',
- 'asFloat32x4List',
- 'asFloat64List',
- 'asFloat32List',
- 'asUint64List',
- 'asInt64List',
- 'asUint16List',
- 'asInt16List',
- 'asUint8ClampedList',
- 'asInt8List',
- ],
- 'dart.io.WebSocket': [
- 'add',
- 'listen',
- 'close',
- 'connect',
- 'where',
- 'map',
- 'send',
- ],
- 'dart.convert.JsonEncoder': [
- 'convert',
- 'startChunkedConversion',
- ],
- 'dart.convert.JsonDecoder': [
- 'convert',
- 'startChunkedConversion',
- ],
- 'dart.core.bool': [
- 'toString',
- 'should',
- 'hashCode',
- 'isAssignableFrom',
- 'parse',
- 'containsKey',
- ],
- 'dart.core.FormatException': [
- 'toString',
- ],
- 'dart.dom.html.WindowBase': [
- 'postMessage',
- 'navigator',
- 'close',
- 'alert',
- ],
- 'dart.dom.html.ButtonElement': [
- 'text',
- 'onClick',
- 'classes',
- 'attributes',
- 'style',
- 'append',
- 'type',
- 'setInnerHtml',
- 'children',
- 'onMouseOut',
- 'onMouseOver',
- 'click',
- 'disabled',
- 'dataset',
- 'appendText',
- ],
- 'dart.core.Exception': [
- 'toString',
- 'printStackTrace',
- ],
- 'dart.dom.html.DataTransfer': [
- 'setData',
- 'setDragImage',
- 'types',
- 'effectAllowed',
- 'dropEffect',
- 'getData',
- 'files',
- ],
- 'dart.math.Point': [
- 'x',
- 'y',
- 'distanceTo',
- 'magnitude',
- ],
- 'dart.dom.html.LIElement': [
- 'classes',
- 'append',
- 'style',
- 'text',
- 'querySelector',
- 'innerHtml',
- 'dispatchEvent',
- 'children',
- 'dataset',
- 'className',
- 'nodes',
- 'remove',
- 'value',
- ],
- 'dart.dom.html.CanvasRenderingContext2D': [
- 'lineTo',
- 'beginPath',
- 'fillRect',
- 'moveTo',
- 'stroke',
- 'drawImage',
- 'closePath',
- 'restore',
- 'translate',
- 'save',
- 'scale',
- 'fill',
- 'getImageData',
- 'clearRect',
- 'setTransform',
- 'strokeRect',
- 'rotate',
- 'putImageData',
- 'fillStyle',
- 'arc',
- 'transform',
- 'fillText',
- 'strokeStyle',
- 'createImageData',
- 'createPatternFromImage',
- 'clip',
- 'lineWidth',
- 'drawImageToRect',
- 'strokeText',
- 'font',
- 'rect',
- 'drawImageScaledFromSource',
- 'setFillColorRgb',
- 'createLinearGradient',
- 'bezierCurveTo',
- 'drawImageScaled',
- 'measureText',
- 'setLineDash',
- 'shadowBlur',
- 'shadowOffsetX',
- 'shadowOffsetY',
- 'shadowColor',
- 'quadraticCurveTo',
- 'imageSmoothingEnabled',
- 'textAlign',
- 'createRadialGradient',
- 'textBaseline',
- 'globalAlpha',
- 'lineCap',
- ],
- 'dart.io.HeaderValue': [
- 'parse',
- ],
- 'dart.dom.html.ScriptElement': [
- 'src',
- 'type',
- 'async',
- 'remove',
- 'text',
- ],
- 'dart.dom.html.MouseEvent': [
- 'preventDefault',
- 'stopPropagation',
- 'target',
- 'dataTransfer',
- 'page',
- 'client',
- 'ctrlKey',
- 'stopImmediatePropagation',
- 'metaKey',
- 'shiftKey',
- ],
- 'dart.io.RawSocket': [
- 'write',
- 'listen',
- 'close',
- 'connect',
- 'read',
- 'available',
- 'shutdown',
- 'setOption',
- ],
- 'dart.io.RawSecureSocket': [
- 'secure',
- 'connect',
- 'shutdown',
- 'listen',
- 'secureServer',
- 'write',
- 'read',
- ],
- 'dart.dom.web_sql.SqlDatabase': [
- 'transaction',
- 'supported',
- ],
- 'dart.dom.web_sql.SqlTransaction': [
- 'executeSql',
- ],
- 'dart.dom.web_sql.SqlResultSetRowList': [
- 'length',
- 'elementAt',
- 'isNotEmpty',
- 'item',
- 'forEach',
- ],
- 'dart.convert.AsciiCodec': [
- 'encode',
- 'decode',
- ],
- 'dart.dom.html.EventStreamProvider': [
- 'forTarget',
- 'forElement',
- ],
- 'dart.dom.html.MutationObserver': [
- 'observe',
- 'disconnect',
- 'takeRecords',
- ],
- 'dart.dom.html.UListElement': [
- 'queryAll',
- 'append',
- 'style',
- 'id',
- 'children',
- 'remove',
- 'query',
- 'insertBefore',
- 'classes',
- ],
- 'dart.dom.html.VideoElement': [
- 'canPlayType',
- 'load',
- 'pause',
- 'play',
- 'autoplay',
- 'remove',
- 'src',
- ],
- 'dart.dom.html.MediaError': [
- 'code',
- ],
- 'dart.dom.html.TimeRanges': [
- 'start',
- 'end',
- ],
- 'dart.dom.html.SourceElement': [
- 'remove',
- ],
- 'dart.dom.html.ObjectElement': [
- 'remove',
- 'getAttribute',
- ],
- 'dart.dom.html.OptionElement': [
- 'value',
- 'text',
- 'selected',
- 'label',
- 'appendText',
- ],
- 'dart.dom.html.SpanElement': [
- 'classes',
- 'text',
- 'style',
- 'append',
- 'appendText',
- 'onMouseOut',
- 'onMouseOver',
- 'onClick',
- 'attributes',
- 'remove',
- 'draggable',
- 'id',
- 'outerHtml',
- 'innerHtml',
- 'setAttribute',
- 'querySelector',
- 'scrollIntoView',
- ],
- 'dart.dom.html.Geolocation': [
- 'getCurrentPosition',
- 'watchPosition',
- ],
- 'dart.dom.html.Coordinates': [
- 'accuracy',
- 'longitude',
- 'latitude',
- 'speed',
- 'heading',
- 'altitudeAccuracy',
- 'altitude',
- ],
- 'dart.dom.html.ImageElement': [
- 'remove',
- 'width',
- 'height',
- 'onLoad',
- 'src',
- 'style',
- 'crossOrigin',
- 'classes',
- 'className',
- 'id',
- 'onDragStart',
- ],
- 'dart.mirrors.MethodMirror': [
- 'parameters',
- 'isGetter',
- 'isConstructor',
- 'returnType',
- 'owner',
- 'simpleName',
- 'location',
- 'source',
- 'isStatic',
- ],
- 'dart.dom.html.Storage': [
- 'containsKey',
- 'clear',
- 'remove',
- 'length',
- 'keys',
- 'containsValue',
- ],
- 'dart.convert.ChunkedConversionSink': [
- 'add',
- 'close',
- 'specialI',
- ],
- 'dart.collection.ListQueue': [
- 'add',
- 'removeFirst',
- 'addAll',
- 'addLast',
- 'removeLast',
- 'forEach',
- 'toList',
- 'removeWhere',
- 'addFirst',
- ],
- 'dart.dom.html.CanvasElement': [
- 'getContext',
- 'style',
- 'width',
- 'height',
- 'context2D',
- 'toDataUrl',
- 'getContext3d',
- 'onMouseUp',
- 'onMouseDown',
- 'getBoundingClientRect',
- 'onMouseMove',
- 'onClick',
- 'onMouseOut',
- 'className',
- 'onMouseOver',
- 'setAttribute',
- 'remove',
- 'context2d',
- 'focus',
- ],
- 'dart.dom.html.KeyboardEvent': [
- 'preventDefault',
- 'which',
- 'stopPropagation',
- 'ctrlKey',
- 'keyCode',
- 'stopImmediatePropagation',
- 'metaKey',
- 'altKey',
- 'shiftKey',
- 'getModifierState',
- ],
- 'dart.dom.html.WebSocket': [
- 'send',
- 'close',
- 'onMessage',
- 'onClose',
- 'onError',
- 'onOpen',
- 'readyState',
- 'url',
- 'sendTypedData',
- 'binaryType',
- ],
- 'dart.io.WebSocketTransformer': [
- 'upgrade',
- 'isUpgradeRequest',
- ],
- 'dart.core.Symbol': [
- 'toString',
- 'length',
- ],
- 'dart.js.JsFunction': [
- 'apply',
- ],
- 'dart.io.InternetAddress': [
- 'address',
- 'host',
- 'lookup',
- 'toString',
- 'isLoopback',
- ],
- 'dart.convert.Latin1Codec': [
- 'decode',
- ],
- 'dart.dom.html.ElementEvents': [
- 'click',
- 'load',
- 'change',
- 'keyPress',
- 'drop',
- 'dragOver',
- 'dragEnter',
- 'input',
- 'keyDown',
- 'dragLeave',
- 'dragEnd',
- 'dragStart',
- 'mouseOut',
- 'mouseMove',
- 'keyUp',
- 'loadedMetadata',
- ],
- 'dart.dom.html.TableCellElement': [
- 'setInnerHtml',
- 'style',
- 'append',
- 'text',
- 'insertAdjacentElement',
- 'colSpan',
- 'setAttribute',
- 'innerHtml',
- 'cellIndex',
- ],
- 'dart.dom.html.TableRowElement': [
- 'append',
- 'attributes',
- 'classes',
- 'onClick',
- 'children',
- 'onMouseOut',
- 'onMouseOver',
- 'remove',
- 'insertCell',
- 'cells',
- 'createFragment',
- 'addCell',
- 'query',
- 'outerHtml',
- ],
- 'dart.convert.Converter': [
- 'convert',
- 'startChunkedConversion',
- ],
- 'dart.dom.html.FormData': [
- 'append',
- 'appendBlob',
- ],
- 'dart.io.ProcessException': [
- 'toString',
- ],
- 'dart.dom.html.Text': [
- 'remove',
- 'text',
- 'toString',
- ],
- 'dart.dom.html.AnchorElement': [
- 'href',
- 'text',
- 'onClick',
- 'id',
- 'classes',
- 'append',
- 'dispatchEvent',
- 'replaceWith',
- 'download',
- 'click',
- 'setAttribute',
- 'appendText',
- ],
- 'dart.dom.svg.LineElement': [
- 'setAttribute',
- ],
- 'dart.dom.svg.RectElement': [
- 'setAttribute',
- 'attributes',
- ],
- 'dart.dom.svg.EllipseElement': [
- 'setAttribute',
- ],
- 'dart.dom.svg.PolylineElement': [
- 'attributes',
- ],
- 'dart.dom.svg.CircleElement': [
- 'setAttribute',
- ],
- 'dart.dom.svg.PathElement': [
- 'setAttribute',
- 'createSvgPathSegLinetoAbs',
- 'createSvgPathSegMovetoAbs',
- ],
- 'dart.dom.html.HeadingElement': [
- 'text',
- 'classes',
- 'appendText',
- 'append',
- 'id',
- ],
- 'dart.dom.html.TableElement': [
- 'insertRow',
- 'createFragment',
- 'append',
- 'children',
- 'createTBody',
- 'deleteRow',
- 'addRow',
- 'query',
- 'querySelector',
- ],
- 'dart.io.HttpConnectionInfo': [
- 'remoteAddress',
- 'remotePort',
- 'localPort',
- 'remoteHost',
- ],
- 'dart.dom.html.FormElement': [
- 'append',
- 'submit',
- 'children',
- 'remove',
- ],
- 'dart.io.Cookie': [
- 'value',
- 'toString',
- 'path',
- ],
- 'dart.dom.html.InputElement': [
- 'focus',
- 'select',
- 'value',
- 'remove',
- 'type',
- 'checkValidity',
- 'dataset',
- 'onKeyDown',
- 'setSelectionRange',
- 'dispatchEvent',
- 'selectionStart',
- 'selectionEnd',
- 'setAttribute',
- 'bind',
- 'checked',
- 'attributes',
- 'blur',
- 'setRangeText',
- 'click',
- 'onChange',
- 'placeholder',
- 'id',
- 'onKeyUp',
- 'onBlur',
- 'onKeyPress',
- 'autocomplete',
- 'onPaste',
- 'defaultChecked',
- 'onFocus',
- 'disabled',
- ],
- 'dart.io.Socket': [
- 'close',
- 'connect',
- 'transform',
- 'destroy',
- 'add',
- 'listen',
- 'write',
- 'addStream',
- 'pipe',
- 'address',
- 'read',
- 'writeList',
- 'setOption',
- 'flush',
- 'map',
- 'readList',
- 'available',
- ],
- 'dart.mirrors.ParameterMirror': [
- 'type',
- 'isOptional',
- 'defaultValue',
- ],
- 'dart.convert.Codec': [
- 'fuse',
- 'encode',
- 'decode',
- ],
- 'dart.dom.indexed_db.Database': [
- 'transaction',
- 'createObjectStore',
- 'close',
- ],
- 'dart.dom.indexed_db.Transaction': [
- 'objectStore',
- 'onAbort',
- 'onError',
- 'onComplete',
- ],
- 'dart.dom.indexed_db.ObjectStore': [
- 'put',
- 'delete',
- 'createIndex',
- 'getObject',
- 'index',
- 'openCursor',
- 'clear',
- ],
- 'dart.dom.svg.SvgSvgElement': [
- 'append',
- 'setAttribute',
- 'createFragment',
- 'createSvgPoint',
- 'getScreenCtm',
- 'onMouseUp',
- 'onMouseMove',
- ],
- 'dart.dom.svg.Point': [
- 'matrixTransform',
- ],
- 'dart.dom.svg.Matrix': [
- 'inverse',
- ],
- 'dart.dom.html.WheelEvent': [
- 'preventDefault',
- 'stopPropagation',
- ],
- 'dart.dom.svg.AnimatedRect': [
- 'baseVal',
- ],
- 'dart.dom.html.SelectElement': [
- 'append',
- 'focus',
- 'remove',
- 'classes',
- 'tabIndex',
- 'options',
- 'selectedIndex',
- 'querySelectorAll',
- 'multiple',
- 'value',
- ],
- 'dart.dom.html.LabelElement': [
- 'query',
- 'text',
- 'append',
- 'htmlFor',
- 'style',
- 'appendText',
- 'classes',
- ],
- 'dart.io.HttpSession': [
- 'id',
- 'destroy',
- 'clear',
- 'containsKey',
- 'isNew',
- 'remove',
- 'onTimeout',
- ],
- 'dart.dom.indexed_db.IdbFactory': [
- 'open',
- 'deleteDatabase',
- 'supported',
- 'supportsDatabaseNames',
- 'getDatabaseNames',
- ],
- 'dart.dom.indexed_db.Request': [
- 'result',
- ],
- 'dart.dom.indexed_db.Index': [
- 'openCursor',
- ],
- 'dart.dom.indexed_db.KeyRange': [
- 'upperBound_',
- 'bound_',
- 'lowerBound_',
- 'only_',
- ],
- 'dart.dom.indexed_db.CursorWithValue': [
- 'delete',
- ],
- 'dart.core.NoSuchMethodError': [
- 'toString',
- ],
- 'dart.isolate.Isolate': [
- 'spawn',
- 'spawnUri',
- 'resume',
- 'addOnExitListener',
- 'removeErrorListener',
- 'addErrorListener',
- 'kill',
- 'ping',
- 'pause',
- 'setErrorsFatal',
- ],
- 'dart.dom.html.TemplateElement': [
- 'decorate',
- 'content',
- ],
- 'dart.dom.html.TreeWalker': [
- 'nextNode',
- ],
- 'dart.dom.html.StyleElement': [
- 'remove',
- 'appendText',
- 'text',
- 'sheet',
- 'attributes',
- 'type',
- 'appendHtml',
- 'dataset',
- 'append',
- 'innerHtml',
- ],
- 'dart.dom.html.EventTarget': [
- 'error',
- 'result',
- 'matchesWithAncestors',
- 'nodeName',
- 'matches',
- 'classes',
- 'dispatchEvent',
- 'removeEventListener',
- 'addEventListener',
- 'status',
- 'parent',
- 'value',
- 'hashCode',
- ],
- 'dart.collection_helpers.equality.Equality': [
- 'hash',
- 'equals',
- 'isValidKey',
- ],
- 'dart.collection_helpers.equality.SetEquality': [
- 'hash',
- 'equals',
- ],
- 'dart.collection_helpers.equality.MapEquality': [
- 'hash',
- 'equals',
- ],
- 'dart.collection_helpers.equality.ListEquality': [
- 'hash',
- 'equals',
- ],
- 'dart.collection_helpers.equality.IterableEquality': [
- 'hash',
- 'equals',
- ],
- 'dart.collection_helpers.equality.UnorderedIterableEquality': [
- 'hash',
- 'equals',
- ],
- 'dart.io.SecureSocket': [
- 'initialize',
- 'close',
- 'connect',
- 'listen',
- 'write',
- 'add',
- 'fold',
- 'writeln',
- 'secure',
- 'transform',
- ],
- 'dart.io.HttpDate': [
- 'parse',
- 'format',
- ],
- 'dart.math.Rectangle': [
- 'top',
- 'left',
- 'containsPoint',
- 'height',
- 'width',
- 'topLeft',
- 'intersection',
- 'topRight',
- 'intersects',
- 'containsRectangle',
- 'boundingBox',
- 'snap',
- ],
- 'dart.dom.html.ContentElement': [
- 'getDistributedNodes',
- ],
- 'dart.io.SocketException': [
- 'toString',
- ],
- 'dart.dom.html.TextAreaElement': [
- 'style',
- 'focus',
- 'select',
- 'rows',
- 'attributes',
- 'setSelectionRange',
- 'value',
- 'appendText',
- 'remove',
- ],
- 'dart.dom.html.LinkElement': [
- 'href',
- 'replaceWith',
- 'rel',
- ],
- 'dart.dom.html.ParagraphElement': [
- 'text',
- 'appendHtml',
- 'classes',
- 'addHtml',
- 'hidden',
- ],
- 'dart.typed_data.Int32List': [
- 'setRange',
- 'indexOf',
- 'sublist',
- 'removeRange',
- 'removeLast',
- 'clear',
- 'addAll',
- 'add',
- 'setAll',
- ],
- 'dart.dom.web_gl.RenderingContext': [
- 'ARRAY_BUFFER',
- 'texParameteri',
- 'bindBuffer',
- 'bindFramebuffer',
- 'TEXTURE_2D',
- 'enable',
- 'deleteShader',
- 'getUniformLocation',
- 'bindTexture',
- 'clear',
- 'createTexture',
- 'detachShader',
- 'attachShader',
- 'getAttribLocation',
- 'createBuffer',
- 'enableVertexAttribArray',
- 'vertexAttribPointer',
- 'FLOAT',
- 'STATIC_DRAW',
- 'createShader',
- 'shaderSource',
- 'compileShader',
- 'viewport',
- 'useProgram',
- 'clearColor',
- 'bufferDataTyped',
- 'getShaderParameter',
- 'uniformMatrix4fv',
- 'getShaderInfoLog',
- 'bindRenderbuffer',
- 'deleteTexture',
- 'deleteProgram',
- 'RGBA',
- 'linkProgram',
- 'createProgram',
- 'disableVertexAttribArray',
- 'disable',
- 'getProgramParameter',
- 'blendFunc',
- 'drawArrays',
- 'getProgramInfoLog',
- 'TRIANGLES',
- 'lineWidth',
- 'COMPILE_STATUS',
- 'texImage2DTyped',
- 'NEAREST',
- 'createFramebuffer',
- 'getExtension',
- 'framebufferTexture2D',
- 'framebufferRenderbuffer',
- 'renderbufferStorage',
- 'createRenderbuffer',
- 'ELEMENT_ARRAY_BUFFER',
- 'uniformMatrix3fv',
- 'uniform2f',
- 'UNSIGNED_BYTE',
- 'deleteFramebuffer',
- 'deleteRenderbuffer',
- 'TEXTURE_MIN_FILTER',
- 'TEXTURE_MAG_FILTER',
- 'CLAMP_TO_EDGE',
- 'DEPTH_TEST',
- 'DEPTH_BUFFER_BIT',
- 'texImage2DImage',
- 'COLOR_BUFFER_BIT',
- 'LINK_STATUS',
- 'FRAGMENT_SHADER',
- 'VERTEX_SHADER',
- 'bufferData',
- 'TEXTURE_WRAP_S',
- 'TEXTURE_WRAP_T',
- 'texImage2DCanvas',
- 'LINEAR',
- 'UNSIGNED_SHORT',
- 'texImage2D',
- 'drawElements',
- 'pixelStorei',
- 'colorMask',
- 'depthFunc',
- 'TRIANGLE_STRIP',
- 'activeTexture',
- 'TEXTURE0',
- 'depthMask',
- 'FRAMEBUFFER',
- 'UNPACK_FLIP_Y_WEBGL',
- 'generateMipmap',
- 'uniform1i',
- ],
- 'dart.typed_data.Float32List': [
- 'sublist',
- 'indexOf',
- 'buffer',
- 'setRange',
- 'length',
- ],
- 'dart.dom.html.DirectoryEntry': [
- 'getFile',
- 'createDirectory',
- 'createFile',
- 'createReader',
- 'getDirectory',
- 'removeRecursively',
- 'toUrl',
- 'fullPath',
- 'toString',
- ],
- 'dart.dom.html.Entry': [
- 'moveTo',
- 'isFile',
- 'copyTo',
- 'isDirectory',
- 'fullPath',
- 'name',
- 'remove',
- 'getMetadata',
- 'createWriter',
- 'file',
- 'getParent',
- 'toUrl',
- ],
- 'dart.dom.html.DirectoryReader': [
- 'readEntries',
- ],
- 'dart.dom.html.KeyCode': [
- 'DOWN',
- 'RIGHT',
- 'LEFT',
- 'TAB',
- 'UP',
- 'ESC',
- 'ENTER',
- 'isCharacterKey',
- 'SPACE',
- 'NUM_SOUTH',
- 'NUM_NORTH',
- 'NUM_EAST',
- 'NUM_WEST',
- 'NUM_NORTH_EAST',
- 'NUM_SOUTH_EAST',
- 'R',
- ],
- 'dart.pkg.collection.iterable_zip.IterableZip': [
- 'map',
- 'toList',
- ],
- 'dart.convert.LineSplitter': [
- 'convert',
- ],
- 'dart.dom.html.HttpRequestUpload': [
- 'onProgress',
- 'onError',
- 'onTimeout',
- ],
- 'dart.dom.html.File': [
- 'name',
- 'slice',
- 'readAsBytesSync',
- 'existsSync',
- ],
- 'dart.dom.html.Events': [
- 'error',
- 'message',
- 'load',
- 'hashChange',
- 'popState',
- 'resize',
- 'loadEnd',
- ],
- 'dart.dom.html.Url': [
- 'createObjectUrl',
- 'revokeObjectUrl',
- 'createObjectUrlFromBlob',
- 'createObjectUrlFromStream',
- ],
- 'dart.dom.html.RtcIceCandidate': [
- 'candidate',
- 'sdpMLineIndex',
- ],
- 'dart.dom.html.RtcPeerConnection': [
- 'setLocalDescription',
- 'createDataChannel',
- 'createOffer',
- 'createAnswer',
- ],
- 'dart.io.RawDatagramSocket': [
- 'bind',
- 'close',
- 'receive',
- 'send',
- 'listen',
- ],
- 'dart.pkg.collection.equality.DeepCollectionEquality': [
- 'equals',
- 'hash',
- ],
- 'dart.pkg.collection.priority_queue.PriorityQueue': [
- 'addAll',
- 'contains',
- 'removeFirst',
- 'add',
- 'removeAll',
- ],
- 'dart.convert.StringConversionSink': [
- 'add',
- 'asUtf8Sink',
- 'close',
- 'asStringSink',
- 'addSlice',
- ],
- 'dart.dom.html.ImageData': [
- 'data',
- ],
- 'dart.dom.html.PreElement': [
- 'appendText',
- 'text',
- 'append',
- 'classes',
- ],
- 'dart.dom.html.MediaStream': [
- 'stop',
- ],
- 'dart.dom.html.DomParser': [
- 'parseFromString',
- ],
- 'dart.dom.html.CustomEvent': [
- 'stopImmediatePropagation',
- 'preventDefault',
- 'stopPropagation',
- ],
- 'dart.typed_data.Uint16List': [
- 'buffer',
- 'sublist',
- 'setRange',
- 'removeRange',
- 'removeLast',
- 'clear',
- 'addAll',
- 'add',
- 'length',
- ],
- 'dart.dom.html.CanvasGradient': [
- 'addColorStop',
- ],
- 'dart.dom.html.Notification': [
- 'requestPermission',
- ],
- 'dart.dom.svg.Length': [
- 'value',
- 'valueAsString',
- ],
- 'dart.dom.svg.AnimatedLength': [
- 'baseVal',
- ],
- 'dart.dom.svg.PointList': [
- 'getItem',
- ],
- 'dart.mirrors.SourceLocation': [
- 'line',
- ],
- 'dart.DartGrammarDefinition': [
- 'build',
- ],
- 'dart.dom.html.TextMetrics': [
- 'width',
- ],
- 'dart.dom.html.CssRect': [
- 'width',
- 'height',
- 'top',
- 'left',
- 'topLeft',
- ],
- 'dart.dom.html.KeyboardEventStream': [
- 'onKeyDown',
- ],
- 'dart.dom.html.CssRule': [
- 'selectorText',
- ],
- 'dart.dom.html.CssStyleRule': [
- 'style',
- 'selectorText',
- ],
- 'dart.dom.html.Selection': [
- 'removeAllRanges',
- 'collapse',
- 'getRangeAt',
- ],
- 'dart.dom.html.CheckboxInputElement': [
- 'checked',
- 'attributes',
- 'classes',
- 'value',
- ],
- 'dart.dom.html.TextInputElement': [
- 'classes',
- 'value',
- 'focus',
- 'select',
- 'className',
- 'onKeyDown',
- 'style',
- ],
- 'dart.dom.html.DateInputElement': [
- 'classes',
- ],
- 'dart.dom.html.RangeInputElement': [
- 'style',
- 'attributes',
- 'onChange',
- 'value',
- 'step',
- 'max',
- 'min',
- ],
- 'dart.dom.html.AnimationTimeline': [
- 'play',
- ],
- 'dart.dom.html.AnimationPlayer': [
- 'play',
- ],
- 'dart.dom.html.GlobalEventHandlers': [
- 'clickEvent',
- ],
- 'dart.dom.html.TouchEvent': [
- 'preventDefault',
- 'supported',
- 'stopPropagation',
- ],
- 'dart.dom.html.AudioElement': [
- 'canPlayType',
- 'load',
- 'append',
- 'play',
- 'pause',
- 'remove',
- ],
- 'dart.io.ProcessSignal': [
- 'watch',
- ],
- 'dart.convert.Utf8Decoder': [
- 'convert',
- 'startChunkedConversion',
- ],
- 'dart.dom.html.AnimationEvent': [
- 'preventDefault',
- 'stopImmediatePropagation',
- ],
- 'dart.dom.html.FocusEvent': [
- 'stopImmediatePropagation',
- ],
- 'dart.dom.html.Touch': [
- 'page',
- 'client',
- ],
- 'dart.async.DeferredLibrary': [
- 'load',
- ],
- 'dart.dom.html.TableSectionElement': [
- 'append',
- 'innerHtml',
- 'rows',
- 'createFragment',
- 'addRow',
- ],
- 'dart.mirrors.Mirror': [
- 'methods',
- 'invoke',
- 'type',
- 'delegate',
- 'members',
- ],
- 'dart.core.StateError': [
- 'toString',
- ],
- 'dart.io.FileMode': [
- 'APPEND',
- 'READ',
- 'WRITE',
- ],
- 'dart.dom.html.CssStyleDeclarationBase': [
- 'display',
- 'backgroundColor',
- 'opacity',
- 'borderLeftWidth',
- ],
- 'dart.dom.html.IFrameElement': [
- 'style',
- 'src',
- ],
- 'dart.io.FileSystemException': [
- 'toString',
- ],
- 'dart.dom.html.Screen': [
- 'width',
- 'height',
- 'pixelDepth',
- ],
- 'dart.core.ArgumentError': [
- 'toString',
- ],
- 'dart.dom.html.Blob': [
- 'slice',
- ],
- 'dart.dom.svg.PatternElement': [
- 'setAttribute',
- 'append',
- ],
- 'dart.dom.svg.DefsElement': [
- 'append',
- ],
- 'dart.dom.svg.PathSegList': [
- 'appendItem',
- 'clear',
- 'length',
- 'getItem',
- ],
- 'dart.dom.html.FileList': [
- 'length',
- 'item',
- ],
- 'dart.dom.html.FileError': [
- 'NOT_FOUND_ERR',
- 'code',
- ],
- 'dart.mirrors.VariableMirror': [
- 'type',
- 'isFinal',
- 'isStatic',
- ],
- 'dart.io.HttpStatus': [
- 'NOT_FOUND',
- ],
- 'dart.typed_data.Float64List': [
- 'sublist',
- 'indexOf',
- 'setRange',
- ],
- 'dart.typed_data.Float32x4': [
- 'shuffle',
- 'shuffleMix',
- 'scale',
- 'signMask',
- 'clamp',
- 'withX',
- 'withY',
- 'w',
- 'z',
- 'y',
- 'x',
- ],
- 'dart.pkg.typed_data.typed_buffers.Int32x4Buffer': [
- 'add',
- ],
- 'dart.dom.html.NumberInputElement': [
- 'step',
- 'max',
- 'min',
- 'valueAsNumber',
- ],
- 'dart.dom.html.ValidityState': [
- 'valid',
- ],
- 'dart.dom.html.CssStyleSheet': [
- 'ownerNode',
- 'insertRule',
- 'addRule',
- ],
- 'dart.io.ZLibCodec': [
- 'decode',
- ],
- 'dart.collection.HasNextIterator': [
- 'next',
- ],
- 'dart.isolate.RawReceivePort': [
- 'close',
- ],
- 'dart.mirrors.TypeVariableMirror': [
- 'simpleName',
- 'isSubtypeOf',
- 'isAssignableTo',
- 'owner',
- ],
- 'dart.typed_data.implementation.NativeByteBuffer': [
- 'asFloat64List',
- 'asFloat32List',
- 'asInt32List',
- ],
- 'dart.typed_data.implementation.NativeFloat32x4List': [
- 'length',
- ],
- 'dart.typed_data.implementation.NativeFloat32List': [
- 'sublist',
- ],
- 'dart.typed_data.implementation.NativeInt32x4List': [
- 'length',
- ],
- 'dart.typed_data.implementation.NativeFloat64x2List': [
- 'length',
- ],
- 'dart.typed_data.implementation.NativeFloat64List': [
- 'sublist',
- ],
- 'dart.typed_data.implementation.NativeTypedArray': [
- 'length',
- ],
- 'dart.typed_data.implementation.NativeTypedArrayOfDouble': [
- 'setRange',
- ],
- 'dart.typed_data.implementation.NativeTypedArrayOfInt': [
- 'setRange',
- ],
- 'dart.typed_data.implementation.NativeInt32x4': [
- 'w',
- 'z',
- 'y',
- 'x',
- ],
- 'dart.dom.svg.SvgElement': [
- 'isTagSupported',
- 'clone',
- 'setAttribute',
- 'children',
- 'setInnerHtml',
- 'attributes',
- ],
- 'dart.dom.svg.GElement': [
- 'append',
- 'querySelector',
- 'id',
- ],
- 'dart.dom.html.ProgressEvent': [
- 'toString',
- ],
- 'dart.core.RangeError': [
- 'toString',
- 'checkValidRange',
- 'checkNotNegative',
- 'checkValueInInterval',
- 'checkValidIndex',
- ],
- 'dart.dom.html.TouchList': [
- 'length',
- 'first',
- 'isEmpty',
- 'isNotEmpty',
- ],
- 'dart.dom.html.FieldSetElement': [
- 'append',
- 'querySelector',
- ],
- 'dart.dom.html.ShadowElement': [
- 'getDistributedNodes',
- ],
- 'dart.dom.html.KeyEvent': [
- 'keyCode',
- 'type',
- 'preventDefault',
- ],
- 'dart.dom.html.NodeList': [
- 'length',
- 'add',
- ],
- 'dart.dom.html.DomStringList': [
- 'length',
- ],
- 'dart.dom.html.HtmlCollection': [
- 'length',
- 'forEach',
- 'contains',
- ],
- 'dart.dom.html.Range': [
- 'createContextualFragment',
- 'selectNodeContents',
- 'insertNode',
- 'setEndAfter',
- ],
- 'dart.dom.html.NodeTreeSanitizer': [
- 'sanitizeTree',
- ],
- 'dart.dom.html.MimeTypeArray': [
- 'length',
- ],
- 'dart.dom.html.PluginArray': [
- 'length',
- ],
- 'dart.dom.html.SourceBufferList': [
- 'length',
- ],
- 'dart.dom.html.SpeechGrammarList': [
- 'length',
- ],
- 'dart.dom.html.TextTrackCueList': [
- 'length',
- ],
- 'dart.dom.html.TextTrackList': [
- 'length',
- ],
- 'dart.dom.html.Dimension': [
- 'value',
- 'toString',
- ],
- 'dart.dom.html.UriPolicy': [
- 'allowsUri',
- ],
- 'dart.dom.html.NodeValidator': [
- 'allowsAttribute',
- 'allowsElement',
- ],
- 'dart.dom.html.Worker': [
- 'terminate',
- ],
- 'dart.typed_data.Int16List': [
- 'sublist',
- 'buffer',
- 'contains',
- 'setRange',
- 'removeRange',
- 'removeLast',
- 'clear',
- 'addAll',
- 'add',
- ],
- 'dart.dom.indexed_db.Cursor': [
- 'next',
- ],
- 'dart.dom.svg.LengthList': [
- 'length',
- 'getItem',
- ],
- 'dart.dom.svg.NumberList': [
- 'length',
- 'getItem',
- ],
- 'dart.dom.svg.StringList': [
- 'length',
- 'getItem',
- ],
- 'dart.dom.svg.TransformList': [
- 'length',
- 'getItem',
- ],
- 'dart.js.JsArray': [
- 'length',
- 'addAll',
- 'insert',
- 'removeRange',
- 'removeAt',
- 'add',
- 'setRange',
- 'removeLast',
- ],
- 'dart.dom.html.ApplicationCache': [
- 'swapCache',
- ],
- 'dart.dom.web_audio.AudioContext': [
- 'createBufferSource',
- 'createOscillator',
- 'destination',
- 'createPanner',
- 'createGain',
- ],
- 'dart.dom.html.FileUploadInputElement': [
- 'click',
- ],
- 'dart.dom.html.DomRectReadOnly': [
- 'top',
- 'left',
- 'height',
- 'width',
- ],
- 'dart.typed_data.Int8List': [
- 'sublist',
- 'setRange',
- 'removeRange',
- 'removeLast',
- 'clear',
- 'addAll',
- 'add',
- 'buffer',
- ],
- 'dart.dom.web_audio.AudioBufferSourceNode': [
- 'connectNode',
- 'start',
- 'stop',
- ],
- 'dart.dom.html.FileEntry': [
- 'file',
- 'getParent',
- 'toUrl',
- 'getMetadata',
- ],
- 'dart.dom.html.CustomStream': [
- 'listen',
- ],
- 'dart.dom.html.TrackElement': [
- 'defaultValue',
- ],
- 'dart.dom.web_audio.OscillatorNode': [
- 'connectNode',
- ],
- 'dart.dom.html.StorageQuota': [
- 'queryInfo',
- ],
- 'dart.collection.DoubleLinkedQueue': [
- 'add',
- ],
- 'dart.core.TypeError': [
- 'toString',
- ],
- 'dart.core.AssertionError': [
- 'toString',
- ],
- 'dart.profiler.Metrics': [
- 'register',
- ],
- 'dart.collection.LinkedList': [
- 'remove',
- 'addFirst',
- 'clear',
- 'add',
- ],
- 'dart.typed_data.Uint8ClampedList': [
- 'sublist',
- ],
- 'dart.typed_data.Float64x2': [
- 'y',
- 'x',
- 'withX',
- ],
- 'dart.convert.ByteConversionSink': [
- 'close',
- 'add',
- 'addSlice',
- ],
- 'dart.convert.ClosableStringSink': [
- 'close',
- 'write',
- ],
- 'dart.mirrors.TypedefMirror': [
- 'isSubtypeOf',
- 'isAssignableTo',
- 'referent',
- ],
- 'dart.mirrors.FunctionTypeMirror': [
- 'isSubtypeOf',
- 'isAssignableTo',
- 'returnType',
- 'parameters',
- 'isOriginalDeclaration',
- ],
- 'dart.mirrors.LibraryDependencyMirror': [
- 'metadata',
- ],
- 'dart.test.stream_from_iterable.IterableTest': [
- 'run',
- ],
- 'dart.io.SecureServerSocket': [
- 'bind',
- 'close',
- 'listen',
- ],
- 'dart.io.RawServerSocket': [
- 'bind',
- 'listen',
- 'close',
- ],
- 'dart.typed_data.Uint64List': [
- 'sublist',
- 'setRange',
- 'removeRange',
- 'removeLast',
- 'clear',
- 'addAll',
- 'add',
- ],
- 'dart.typed_data.Int64List': [
- 'sublist',
- 'setRange',
- 'removeRange',
- 'removeLast',
- 'clear',
- 'addAll',
- 'add',
- ],
- 'dart.io.StdioType': [
- 'name',
- ],
- 'dart.io.HttpConnectionsInfo': [
- 'total',
- 'idle',
- 'active',
- ],
- 'dart.io.RawSecureServerSocket': [
- 'bind',
- 'close',
- 'listen',
- ],
- 'dart.io.ServerSocketReference': [
- 'create',
- ],
- 'dart.io.NetworkInterface': [
- 'list',
- ],
- 'dart.io.ZLibDecoder': [
- 'convert',
- ],
- 'dart.io.ZLibEncoder': [
- 'convert',
- ],
- 'dart.pkg.async.results.ValueResult': [
- 'value',
- ],
- 'dart.pkg.async.stream_zip.StreamZip': [
- 'toList',
- ],
- 'dart.pkg.async.results.Result': [
- 'flatten',
- 'release',
- ],
- 'dart.pkg.async.results.ErrorResult': [
- 'stackTrace',
- 'error',
- ],
- 'dart.dom.html.OptGroupElement': [
- 'append',
- ],
- 'dart.dom.html.UnknownElement': [
- 'query',
- ],
- 'dart.dom.web_audio.AudioParam': [
- 'value',
- 'setValueAtTime',
- ],
- 'dart.dom.html.RadioButtonInputElement': [
- 'checked',
- ],
- 'dart.dom.web_audio.BiquadFilterNode': [
- 'connectNode',
- ],
- 'dart.async.StreamConsumer': [
- 'addStream',
- 'close',
- ],
- 'dart.dom.html.FileSystem': [
- 'root',
- ],
- 'dart.dom.html.FileWriter': [
- 'write',
- 'abort',
- ],
- 'dart.dom.html.OutputElement': [
- 'scrollIntoView',
- ],
- 'dart.dom.html.Css': [
- 'supports',
- ],
- 'dart.io.IOException': [
- 'toString',
- ],
- 'dart.dom.html.ButtonInputElement': [
- 'value',
- 'onClick',
- ],
-};
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
index f6dc272..67150b8 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
@@ -10,9 +10,7 @@
import 'package:analysis_server/src/services/completion/completion_performance.dart';
import 'package:analysis_server/src/services/completion/dart/arglist_contributor.dart';
import 'package:analysis_server/src/services/completion/dart/combinator_contributor.dart';
-import 'package:analysis_server/src/services/completion/dart/common_usage_sorter.dart';
import 'package:analysis_server/src/services/completion/dart/completion_ranking.dart';
-import 'package:analysis_server/src/services/completion/dart/contribution_sorter.dart';
import 'package:analysis_server/src/services/completion/dart/extension_member_contributor.dart';
import 'package:analysis_server/src/services/completion/dart/feature_computer.dart';
import 'package:analysis_server/src/services/completion/dart/field_formal_contributor.dart';
@@ -54,10 +52,6 @@
/// [DartCompletionManager] determines if a completion request is Dart specific
/// and forwards those requests to all [DartCompletionContributor]s.
class DartCompletionManager {
- /// The [contributionSorter] is a long-lived object that isn't allowed
- /// to maintain state between calls to [DartContributionSorter#sort(...)].
- static DartContributionSorter contributionSorter = CommonUsageSorter();
-
/// The object used to resolve macros in Dartdoc comments.
final DartdocDirectiveInfo dartdocDirectiveInfo;
@@ -199,10 +193,7 @@
'Failed to rerank completion suggestions',
exception,
stackTrace));
- await contributionSorter.sort(dartRequest, suggestions);
}
- } else if (!request.useNewRelevance) {
- await contributionSorter.sort(dartRequest, suggestions);
}
});
request.checkAborted();
@@ -242,22 +233,19 @@
}
void _addIncludedSuggestionRelevanceTags(DartCompletionRequestImpl request) {
- if (request.useNewRelevance) {
- var location = request.opType.completionLocation;
- if (location != null) {
- var locationTable = elementKindRelevance[location];
- if (locationTable != null) {
- var inConstantContext = request.inConstantContext;
- for (var entry in locationTable.entries) {
- var kind = entry.key.toString();
- var elementBoost = (entry.value.upper * 100).floor();
- includedSuggestionRelevanceTags
- .add(IncludedSuggestionRelevanceTag(kind, elementBoost));
- if (inConstantContext) {
- includedSuggestionRelevanceTags.add(
- IncludedSuggestionRelevanceTag(
- '$kind+const', elementBoost + 100));
- }
+ var location = request.opType.completionLocation;
+ if (location != null) {
+ var locationTable = elementKindRelevance[location];
+ if (locationTable != null) {
+ var inConstantContext = request.inConstantContext;
+ for (var entry in locationTable.entries) {
+ var kind = entry.key.toString();
+ var elementBoost = (entry.value.upper * 100).floor();
+ includedSuggestionRelevanceTags
+ .add(IncludedSuggestionRelevanceTag(kind, elementBoost));
+ if (inConstantContext) {
+ includedSuggestionRelevanceTags.add(IncludedSuggestionRelevanceTag(
+ '$kind+const', elementBoost + 100));
}
}
}
@@ -268,13 +256,10 @@
var element = type.element;
var tag = '${element.librarySource.uri}::${element.name}';
if (element.isEnum) {
- var relevance = request.useNewRelevance
- ? RelevanceBoost.availableEnumConstant
- : DART_RELEVANCE_BOOST_AVAILABLE_ENUM;
includedSuggestionRelevanceTags.add(
IncludedSuggestionRelevanceTag(
tag,
- relevance,
+ RelevanceBoost.availableEnumConstant,
),
);
} else {
@@ -284,13 +269,10 @@
// boost will almost always be ignored because the element boost will
// be bigger. Find a way to use this boost without negating the element
// boost, which is how we get constructors to come before classes.
- var relevance = request.useNewRelevance
- ? RelevanceBoost.availableDeclaration
- : DART_RELEVANCE_BOOST_AVAILABLE_DECLARATION;
includedSuggestionRelevanceTags.add(
IncludedSuggestionRelevanceTag(
tag,
- relevance,
+ RelevanceBoost.availableDeclaration,
),
);
}
@@ -427,9 +409,6 @@
return '';
}
- @override
- bool get useNewRelevance => _originalRequest.useNewRelevance;
-
/// Throw [AbortCompletion] if the completion request has been aborted.
@override
void checkAborted() {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/extension_member_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/extension_member_contributor.dart
index 6779aa9..512f787 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/extension_member_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/extension_member_contributor.dart
@@ -48,12 +48,9 @@
var types = <InterfaceType>[];
ClassElementImpl.collectAllSupertypes(types, extendedType, null);
for (var type in types) {
- double inheritanceDistance;
- if (request.useNewRelevance) {
- inheritanceDistance = memberBuilder.request.featureComputer
- .inheritanceDistanceFeature(
- extendedType.element, type.element);
- }
+ var inheritanceDistance = memberBuilder.request.featureComputer
+ .inheritanceDistanceFeature(
+ extendedType.element, type.element);
_addTypeMembers(type, inheritanceDistance);
}
}
@@ -102,13 +99,11 @@
_resolveExtendedType(containingLibrary, extension, type);
if (extendedType != null && typeSystem.isSubtypeOf(type, extendedType)) {
double inheritanceDistance;
- if (memberBuilder.request.useNewRelevance) {
- if (type is InterfaceType && extendedType is InterfaceType) {
- inheritanceDistance = memberBuilder.request.featureComputer
- .inheritanceDistanceFeature(type.element, extendedType.element);
- } else {
- inheritanceDistance = -1;
- }
+ if (type is InterfaceType && extendedType is InterfaceType) {
+ inheritanceDistance = memberBuilder.request.featureComputer
+ .inheritanceDistanceFeature(type.element, extendedType.element);
+ } else {
+ inheritanceDistance = -1;
}
// TODO(brianwilkerson) We might want to apply the substitution to the
// members of the extension for display purposes.
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
index 3d8234d..4963edb 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
@@ -47,16 +47,8 @@
_KeywordVisitor(this.request, this.builder) : entity = request.target.entity;
- int get defaultKeyword =>
- request.useNewRelevance ? 800 : DART_RELEVANCE_KEYWORD;
-
Token get droppedToken => request.target.droppedToken;
- int get highKeyword => request.useNewRelevance ? 1000 : DART_RELEVANCE_HIGH;
-
- int get lowKeyword =>
- request.useNewRelevance ? 400 : DART_RELEVANCE_KEYWORD - 1;
-
@override
void visitArgumentList(ArgumentList node) {
if (request is DartCompletionRequestImpl) {
@@ -97,9 +89,9 @@
void visitAsExpression(AsExpression node) {
if (identical(entity, node.asOperator) &&
node.expression is ParenthesizedExpression) {
- _addSuggestion(Keyword.ASYNC, relevance: highKeyword);
- _addSuggestion2(ASYNC_STAR, relevance: highKeyword);
- _addSuggestion2(SYNC_STAR, relevance: highKeyword);
+ _addSuggestion(Keyword.ASYNC);
+ _addSuggestion2(ASYNC_STAR);
+ _addSuggestion2(SYNC_STAR);
}
}
@@ -142,7 +134,7 @@
}
_addStatementKeywords(node);
if (node.inCatchClause) {
- _addSuggestion(Keyword.RETHROW, relevance: lowKeyword);
+ _addSuggestion(Keyword.RETHROW);
}
}
@@ -216,19 +208,19 @@
if (previousMember == null || previousMember is Directive) {
if (previousMember == null &&
!node.directives.any((d) => d is LibraryDirective)) {
- _addSuggestions([Keyword.LIBRARY], relevance: highKeyword);
+ _addSuggestions([Keyword.LIBRARY]);
}
- _addSuggestion2(IMPORT_STATEMENT, offset: 8, relevance: highKeyword);
- _addSuggestion2(EXPORT_STATEMENT, offset: 8, relevance: highKeyword);
- _addSuggestion2(PART_STATEMENT, offset: 6, relevance: highKeyword);
+ _addSuggestion2(IMPORT_STATEMENT, offset: 8);
+ _addSuggestion2(EXPORT_STATEMENT, offset: 8);
+ _addSuggestion2(PART_STATEMENT, offset: 6);
}
if (entity == null || entity is Declaration) {
if (previousMember is FunctionDeclaration &&
previousMember.functionExpression is FunctionExpression &&
previousMember.functionExpression.body.isEmpty) {
- _addSuggestion(Keyword.ASYNC, relevance: highKeyword);
- _addSuggestion2(ASYNC_STAR, relevance: highKeyword);
- _addSuggestion2(SYNC_STAR, relevance: highKeyword);
+ _addSuggestion(Keyword.ASYNC);
+ _addSuggestion2(ASYNC_STAR);
+ _addSuggestion2(SYNC_STAR);
}
_addCompilationUnitKeywords();
}
@@ -340,7 +332,7 @@
_addSuggestions(
[Keyword.CONST, Keyword.FALSE, Keyword.NULL, Keyword.TRUE]);
} else {
- _addSuggestion(Keyword.IN, relevance: highKeyword);
+ _addSuggestion(Keyword.IN);
}
}
}
@@ -396,7 +388,7 @@
node is ForPartsWithDeclarations &&
node.variables != null) {
if (_isPreviousTokenSynthetic(entity, TokenType.SEMICOLON)) {
- _addSuggestion(Keyword.IN, relevance: highKeyword);
+ _addSuggestion(Keyword.IN);
}
}
}
@@ -406,7 +398,7 @@
// Actual: for (va^)
// Parsed: for (va^; ;)
if (node.forLoopParts == entity) {
- _addSuggestion(Keyword.VAR, relevance: highKeyword);
+ _addSuggestion(Keyword.VAR);
}
}
@@ -425,10 +417,10 @@
if (entity == node.body) {
var body = node.body;
if (!body.isAsynchronous) {
- _addSuggestion(Keyword.ASYNC, relevance: highKeyword);
+ _addSuggestion(Keyword.ASYNC);
if (body is! ExpressionFunctionBody) {
- _addSuggestion2(ASYNC_STAR, relevance: highKeyword);
- _addSuggestion2(SYNC_STAR, relevance: highKeyword);
+ _addSuggestion2(ASYNC_STAR);
+ _addSuggestion2(SYNC_STAR);
}
}
if (body is EmptyFunctionBody &&
@@ -452,14 +444,14 @@
// analyzer parser
// Actual: if (x i^)
// Parsed: if (x) i^
- _addSuggestion(Keyword.IS, relevance: highKeyword);
+ _addSuggestion(Keyword.IS);
} else if (entity == node.rightParenthesis) {
if (node.condition.endToken.next == droppedToken) {
// fasta parser
// Actual: if (x i^)
// Parsed: if (x)
// where "i" is in the token stream but not part of the AST
- _addSuggestion(Keyword.IS, relevance: highKeyword);
+ _addSuggestion(Keyword.IS);
}
} else if (entity == node.thenStatement || entity == node.elseStatement) {
_addStatementKeywords(node);
@@ -472,7 +464,7 @@
void visitImportDirective(ImportDirective node) {
if (entity == node.asKeyword) {
if (node.deferredKeyword == null) {
- _addSuggestion(Keyword.DEFERRED, relevance: highKeyword);
+ _addSuggestion(Keyword.DEFERRED);
}
}
// Handle degenerate case where import statement does not have a semicolon
@@ -497,7 +489,7 @@
@override
void visitIsExpression(IsExpression node) {
if (entity == node.isOperator) {
- _addSuggestion(Keyword.IS, relevance: highKeyword);
+ _addSuggestion(Keyword.IS);
} else {
_addExpressionKeywords(node);
}
@@ -523,10 +515,10 @@
_addSuggestion2(ASYNC_STAR);
_addSuggestion2(SYNC_STAR);
} else {
- _addSuggestion(Keyword.ASYNC, relevance: highKeyword);
+ _addSuggestion(Keyword.ASYNC);
if (node.body is! ExpressionFunctionBody) {
- _addSuggestion2(ASYNC_STAR, relevance: highKeyword);
- _addSuggestion2(SYNC_STAR, relevance: highKeyword);
+ _addSuggestion2(ASYNC_STAR);
+ _addSuggestion2(SYNC_STAR);
}
}
} else if (entity == node.returnType || entity == node.name) {
@@ -596,7 +588,7 @@
if (next == entity || next == droppedToken) {
// Fasta parses `if (x i^)` as `if (x ^) where the `i` is in the token
// stream but not part of the ParenthesizedExpression.
- _addSuggestion(Keyword.IS, relevance: highKeyword);
+ _addSuggestion(Keyword.IS);
return;
}
}
@@ -655,8 +647,8 @@
_addExpressionKeywords(node);
} else if (entity == node.rightBracket) {
if (node.members.isEmpty) {
- _addSuggestion(Keyword.CASE, relevance: highKeyword);
- _addSuggestion2(DEFAULT_COLON, relevance: highKeyword);
+ _addSuggestion(Keyword.CASE);
+ _addSuggestion2(DEFAULT_COLON);
} else {
_addSuggestion(Keyword.CASE);
_addSuggestion2(DEFAULT_COLON);
@@ -665,8 +657,8 @@
}
if (node.members.contains(entity)) {
if (entity == node.members.first) {
- _addSuggestion(Keyword.CASE, relevance: highKeyword);
- _addSuggestion2(DEFAULT_COLON, relevance: highKeyword);
+ _addSuggestion(Keyword.CASE);
+ _addSuggestion2(DEFAULT_COLON);
} else {
_addSuggestion(Keyword.CASE);
_addSuggestion2(DEFAULT_COLON);
@@ -746,12 +738,12 @@
// Very simplistic suggestion because analyzer will warn if
// the extends / with / implements keywords are out of order
if (node.extendsClause == null) {
- _addSuggestion(Keyword.EXTENDS, relevance: highKeyword);
+ _addSuggestion(Keyword.EXTENDS);
} else if (node.withClause == null) {
- _addSuggestion(Keyword.WITH, relevance: highKeyword);
+ _addSuggestion(Keyword.WITH);
}
if (node.implementsClause == null) {
- _addSuggestion(Keyword.IMPLEMENTS, relevance: highKeyword);
+ _addSuggestion(Keyword.IMPLEMENTS);
}
}
@@ -775,12 +767,12 @@
Keyword.TYPEDEF,
Keyword.VAR,
Keyword.VOID
- ], relevance: highKeyword);
+ ]);
if (request.featureSet.isEnabled(Feature.extension_methods)) {
- _addSuggestion(Keyword.EXTENSION, relevance: highKeyword);
+ _addSuggestion(Keyword.EXTENSION);
}
if (request.featureSet.isEnabled(Feature.non_nullable)) {
- _addSuggestion(Keyword.LATE, relevance: highKeyword);
+ _addSuggestion(Keyword.LATE);
}
}
@@ -820,7 +812,7 @@
void _addExtensionDeclarationKeywords(ExtensionDeclaration node) {
if (node.onKeyword == null || node.onKeyword.isSynthetic) {
- _addSuggestion(Keyword.ON, relevance: highKeyword);
+ _addSuggestion(Keyword.ON);
}
}
@@ -828,19 +820,19 @@
var hasDeferredKeyword = node.deferredKeyword != null;
var hasAsKeyword = node.asKeyword != null;
if (!hasAsKeyword) {
- _addSuggestion(Keyword.AS, relevance: highKeyword);
+ _addSuggestion(Keyword.AS);
}
if (!hasDeferredKeyword) {
if (!hasAsKeyword) {
- _addSuggestion2(DEFERRED_AS, relevance: highKeyword);
+ _addSuggestion2(DEFERRED_AS);
} else if (entity == node.asKeyword) {
- _addSuggestion(Keyword.DEFERRED, relevance: highKeyword);
+ _addSuggestion(Keyword.DEFERRED);
}
}
if (!hasDeferredKeyword || hasAsKeyword) {
if (node.combinators.isEmpty) {
- _addSuggestion(Keyword.SHOW, relevance: highKeyword);
- _addSuggestion(Keyword.HIDE, relevance: highKeyword);
+ _addSuggestion(Keyword.SHOW);
+ _addSuggestion(Keyword.HIDE);
}
}
}
@@ -849,10 +841,10 @@
// Very simplistic suggestion because analyzer will warn if
// the on / implements clauses are out of order
if (node.onClause == null) {
- _addSuggestion(Keyword.ON, relevance: highKeyword);
+ _addSuggestion(Keyword.ON);
}
if (node.implementsClause == null) {
- _addSuggestion(Keyword.IMPLEMENTS, relevance: highKeyword);
+ _addSuggestion(Keyword.IMPLEMENTS);
}
}
@@ -897,18 +889,17 @@
}
}
- void _addSuggestion(Keyword keyword, {int relevance}) {
- _addSuggestion2(keyword.lexeme, relevance: relevance);
+ void _addSuggestion(Keyword keyword) {
+ _addSuggestion2(keyword.lexeme);
}
- void _addSuggestion2(String keyword, {int offset, int relevance}) {
- builder.suggestKeyword(keyword,
- offset: offset, relevance: relevance ?? defaultKeyword);
+ void _addSuggestion2(String keyword, {int offset}) {
+ builder.suggestKeyword(keyword, offset: offset);
}
- void _addSuggestions(List<Keyword> keywords, {int relevance}) {
+ void _addSuggestions(List<Keyword> keywords) {
keywords.forEach((Keyword keyword) {
- _addSuggestion(keyword, relevance: relevance);
+ _addSuggestion(keyword);
});
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
index f638e9a..9bdc9a2 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
@@ -6,7 +6,6 @@
show CompletionSuggestionKind;
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
import 'package:analysis_server/src/services/completion/dart/suggestion_builder.dart';
-import 'package:analysis_server/src/utilities/strings.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
@@ -144,11 +143,8 @@
? CompletionSuggestionKind.IDENTIFIER
: CompletionSuggestionKind.INVOCATION;
for (var type in classElement.allSupertypes) {
- double inheritanceDistance;
- if (request.useNewRelevance) {
- inheritanceDistance = request.featureComputer
- .inheritanceDistanceFeature(classElement, type.element);
- }
+ var inheritanceDistance = request.featureComputer
+ .inheritanceDistanceFeature(classElement, type.element);
_addSuggestionsForType(type, request, inheritanceDistance,
isFunctionalArgument: isFunctionalArgument);
}
@@ -188,10 +184,6 @@
/// The op type associated with the request.
final OpType opType;
- /// A flag indicating whether the suggestions should use the new relevance
- /// scores.
- final bool useNewRelevance;
-
/// A flag indicating whether the target of the request is a function-valued
/// argument in an argument list.
final bool targetIsFunctionalArgument;
@@ -203,44 +195,14 @@
/// clause.
bool inExtendsClause = false;
- /// Only used when [useNewRelevance] is `false`.
- int privateMemberRelevance = DART_RELEVANCE_DEFAULT;
-
_VisibilityTracker visibilityTracker;
_LocalVisitor(this.request, this.builder, this.visibilityTracker,
{@required this.suggestLocalFields})
: assert(visibilityTracker != null),
opType = request.opType,
- useNewRelevance = request.useNewRelevance,
targetIsFunctionalArgument = request.target.isFunctionalArgument(),
- super(request.offset) {
- // Suggestions for inherited members are provided by
- // InheritedReferenceContributor.
- if (!useNewRelevance) {
- // If the user typed an identifier starting with '_' then do not suppress
- // the relevance of private members.
- var data = request.result != null
- ? request.result.content
- : request.sourceContents;
- var offset = request.offset;
- if (data != null && 0 < offset && offset <= data.length) {
- bool isIdentifierChar(int index) {
- var code = data.codeUnitAt(index);
- return isLetterOrDigit(code) || code == CHAR_UNDERSCORE;
- }
-
- if (isIdentifierChar(offset - 1)) {
- while (offset > 0 && isIdentifierChar(offset - 1)) {
- --offset;
- }
- if (data.codeUnitAt(offset) == CHAR_UNDERSCORE) {
- privateMemberRelevance = null;
- }
- }
- }
- }
- }
+ super(request.offset);
TypeProvider get typeProvider => request.libraryElement.typeProvider;
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
index ae57075..a9b34fc 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
@@ -217,47 +217,33 @@
}
} else {
var type = _getPropertyAccessorType(accessor);
- int relevance;
- if (request.useNewRelevance) {
- var featureComputer = request.featureComputer;
- var contextType =
- featureComputer.contextTypeFeature(request.contextType, type);
- var elementKind = _computeElementKind(accessor);
- var hasDeprecated = featureComputer.hasDeprecatedFeature(accessor);
- var isConstant = request.inConstantContext
- ? featureComputer.isConstantFeature(accessor)
- : -1.0;
- var startsWithDollar =
- featureComputer.startsWithDollarFeature(accessor.name);
- var superMatches = featureComputer.superMatchesFeature(
- _containingMemberName, accessor.name);
- relevance = _computeMemberRelevance(
- contextType: contextType,
- elementKind: elementKind,
- hasDeprecated: hasDeprecated,
- inheritanceDistance: inheritanceDistance,
- isConstant: isConstant,
- startsWithDollar: startsWithDollar,
- superMatches: superMatches);
- listener?.computedFeatures(
- contextType: contextType,
- elementKind: elementKind,
- hasDeprecated: hasDeprecated,
- inheritanceDistance: inheritanceDistance,
- startsWithDollar: startsWithDollar,
- superMatches: superMatches);
- } else {
- relevance = accessor.hasOrInheritsDeprecated
- ? DART_RELEVANCE_LOW
- : _computeOldMemberRelevance(accessor);
- if (request.opType.includeReturnValueSuggestions) {
- relevance =
- request.opType.returnValueSuggestionsFilter(type, relevance);
- }
- if (relevance == null) {
- return;
- }
- }
+ var featureComputer = request.featureComputer;
+ var contextType =
+ featureComputer.contextTypeFeature(request.contextType, type);
+ var elementKind = _computeElementKind(accessor);
+ var hasDeprecated = featureComputer.hasDeprecatedFeature(accessor);
+ var isConstant = request.inConstantContext
+ ? featureComputer.isConstantFeature(accessor)
+ : -1.0;
+ var startsWithDollar =
+ featureComputer.startsWithDollarFeature(accessor.name);
+ var superMatches = featureComputer.superMatchesFeature(
+ _containingMemberName, accessor.name);
+ var relevance = _computeMemberRelevance(
+ contextType: contextType,
+ elementKind: elementKind,
+ hasDeprecated: hasDeprecated,
+ inheritanceDistance: inheritanceDistance,
+ isConstant: isConstant,
+ startsWithDollar: startsWithDollar,
+ superMatches: superMatches);
+ listener?.computedFeatures(
+ contextType: contextType,
+ elementKind: elementKind,
+ hasDeprecated: hasDeprecated,
+ inheritanceDistance: inheritanceDistance,
+ startsWithDollar: startsWithDollar,
+ superMatches: superMatches);
_add(_createSuggestion(accessor, relevance: relevance));
}
}
@@ -265,28 +251,17 @@
/// Add a suggestion for a catch [parameter].
void suggestCatchParameter(LocalVariableElement parameter) {
var variableType = parameter.type;
- int relevance;
- if (request.useNewRelevance) {
- var contextType = request.featureComputer
- .contextTypeFeature(request.contextType, variableType);
- var elementKind = _computeElementKind(parameter);
- var isConstant = request.inConstantContext
- ? request.featureComputer.isConstantFeature(parameter)
- : -1.0;
- relevance = toRelevance(
- weightedAverage(
- [contextType, elementKind, isConstant], [1.0, 1.0, 1.0]),
- 800);
- listener?.computedFeatures(contextType: contextType);
- } else {
- relevance = _computeOldMemberRelevance(parameter);
- relevance =
- request.opType.returnValueSuggestionsFilter(variableType, relevance);
- if (relevance == null) {
- return;
- }
- }
-
+ var contextType = request.featureComputer
+ .contextTypeFeature(request.contextType, variableType);
+ var elementKind = _computeElementKind(parameter);
+ var isConstant = request.inConstantContext
+ ? request.featureComputer.isConstantFeature(parameter)
+ : -1.0;
+ var relevance = toRelevance(
+ weightedAverage(
+ [contextType, elementKind, isConstant], [1.0, 1.0, 1.0]),
+ 800);
+ listener?.computedFeatures(contextType: contextType);
_add(_createSuggestion(parameter,
elementKind: protocol.ElementKind.PARAMETER, relevance: relevance));
}
@@ -297,20 +272,8 @@
void suggestClass(ClassElement classElement,
{CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION,
String prefix}) {
- int relevance;
- if (request.useNewRelevance) {
- relevance = _computeTopLevelRelevance(classElement,
- elementType: _instantiateClassElement(classElement));
- } else if (classElement.hasOrInheritsDeprecated) {
- relevance = DART_RELEVANCE_LOW;
- } else {
- relevance = request.opType.typeNameSuggestionsFilter(
- _instantiateClassElement(classElement), DART_RELEVANCE_DEFAULT);
- if (relevance == null) {
- return;
- }
- }
-
+ var relevance = _computeTopLevelRelevance(classElement,
+ elementType: _instantiateClassElement(classElement));
_add(_createSuggestion(classElement,
kind: kind, prefix: prefix, relevance: relevance));
}
@@ -345,7 +308,7 @@
}) {
return CompletionSuggestion(
CompletionSuggestionKind.INVOCATION,
- request.useNewRelevance ? Relevance.closure : DART_RELEVANCE_HIGH,
+ Relevance.closure,
completion,
selectionOffset,
0,
@@ -398,22 +361,9 @@
return null;
}
- int relevance;
var returnType = _instantiateClassElement(enclosingClass);
- if (request.useNewRelevance) {
- relevance =
- _computeTopLevelRelevance(constructor, elementType: returnType);
- } else {
- relevance = constructor.hasOrInheritsDeprecated
- ? DART_RELEVANCE_LOW
- : DART_RELEVANCE_DEFAULT;
- relevance =
- request.opType.returnValueSuggestionsFilter(returnType, relevance);
- if (relevance == null) {
- return;
- }
- }
-
+ var relevance =
+ _computeTopLevelRelevance(constructor, elementType: returnType);
_add(_createSuggestion(constructor,
completion: completion,
kind: kind,
@@ -451,21 +401,8 @@
var enumElement = constant.enclosingElement;
var enumName = enumElement.name;
var completion = '$enumName.$constantName';
-
- int relevance;
- if (request.useNewRelevance) {
- relevance =
- _computeTopLevelRelevance(constant, elementType: constant.type);
- } else if (constant.hasOrInheritsDeprecated) {
- relevance = DART_RELEVANCE_LOW;
- } else {
- relevance = request.opType.returnValueSuggestionsFilter(
- _instantiateClassElement(enumElement), DART_RELEVANCE_DEFAULT);
- if (relevance == null) {
- return;
- }
- }
-
+ var relevance =
+ _computeTopLevelRelevance(constant, elementType: constant.type);
_add(_createSuggestion(constant,
completion: completion, prefix: prefix, relevance: relevance));
}
@@ -476,16 +413,8 @@
void suggestExtension(ExtensionElement extension,
{CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION,
String prefix}) {
- int relevance;
- if (request.useNewRelevance) {
- relevance = _computeTopLevelRelevance(extension,
- elementType: extension.extendedType);
- } else {
- relevance = extension.hasOrInheritsDeprecated
- ? DART_RELEVANCE_LOW
- : DART_RELEVANCE_DEFAULT;
- }
-
+ var relevance = _computeTopLevelRelevance(extension,
+ elementType: extension.extendedType);
_add(_createSuggestion(extension,
kind: kind, prefix: prefix, relevance: relevance));
}
@@ -497,45 +426,32 @@
/// `-1.0` if the field is a static field).
void suggestField(FieldElement field,
{@required double inheritanceDistance}) {
- int relevance;
- if (request.useNewRelevance) {
- var featureComputer = request.featureComputer;
- var contextType =
- featureComputer.contextTypeFeature(request.contextType, field.type);
- var elementKind = _computeElementKind(field);
- var hasDeprecated = featureComputer.hasDeprecatedFeature(field);
- var isConstant = request.inConstantContext
- ? featureComputer.isConstantFeature(field)
- : -1.0;
- var startsWithDollar =
- featureComputer.startsWithDollarFeature(field.name);
- var superMatches = featureComputer.superMatchesFeature(
- _containingMemberName, field.name);
- relevance = _computeMemberRelevance(
- contextType: contextType,
- elementKind: elementKind,
- hasDeprecated: hasDeprecated,
- inheritanceDistance: inheritanceDistance,
- isConstant: isConstant,
- startsWithDollar: startsWithDollar,
- superMatches: superMatches);
- listener?.computedFeatures(
- contextType: contextType,
- elementKind: elementKind,
- hasDeprecated: hasDeprecated,
- inheritanceDistance: inheritanceDistance,
- startsWithDollar: startsWithDollar,
- superMatches: superMatches);
- } else {
- relevance = _computeOldMemberRelevance(field);
- if (request.opType.includeReturnValueSuggestions) {
- relevance =
- request.opType.returnValueSuggestionsFilter(field.type, relevance);
- }
- if (relevance == null) {
- return;
- }
- }
+ var featureComputer = request.featureComputer;
+ var contextType =
+ featureComputer.contextTypeFeature(request.contextType, field.type);
+ var elementKind = _computeElementKind(field);
+ var hasDeprecated = featureComputer.hasDeprecatedFeature(field);
+ var isConstant = request.inConstantContext
+ ? featureComputer.isConstantFeature(field)
+ : -1.0;
+ var startsWithDollar = featureComputer.startsWithDollarFeature(field.name);
+ var superMatches =
+ featureComputer.superMatchesFeature(_containingMemberName, field.name);
+ var relevance = _computeMemberRelevance(
+ contextType: contextType,
+ elementKind: elementKind,
+ hasDeprecated: hasDeprecated,
+ inheritanceDistance: inheritanceDistance,
+ isConstant: isConstant,
+ startsWithDollar: startsWithDollar,
+ superMatches: superMatches);
+ listener?.computedFeatures(
+ contextType: contextType,
+ elementKind: elementKind,
+ hasDeprecated: hasDeprecated,
+ inheritanceDistance: inheritanceDistance,
+ startsWithDollar: startsWithDollar,
+ superMatches: superMatches);
_add(_createSuggestion(field, relevance: relevance));
}
@@ -543,11 +459,7 @@
void suggestFieldFormalParameter(FieldElement field) {
// TODO(brianwilkerson) Add a parameter (`bool includePrefix`) indicating
// whether to include the `this.` prefix in the completion.
- var relevance = request.useNewRelevance
- ? Relevance.fieldFormalParameter
- : DART_RELEVANCE_LOCAL_FIELD;
-
- _add(_createSuggestion(field, relevance: relevance));
+ _add(_createSuggestion(field, relevance: Relevance.fieldFormalParameter));
}
/// Add a suggestion for the `call` method defined on functions.
@@ -561,7 +473,7 @@
returnType: 'void');
_add(CompletionSuggestion(
CompletionSuggestionKind.INVOCATION,
- request.useNewRelevance ? Relevance.callFunction : DART_RELEVANCE_HIGH,
+ Relevance.callFunction,
callString,
callString.length,
0,
@@ -583,32 +495,21 @@
void suggestFunctionTypeAlias(FunctionTypeAliasElement functionTypeAlias,
{CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION,
String prefix}) {
- int relevance;
- if (request.useNewRelevance) {
- relevance = _computeTopLevelRelevance(functionTypeAlias,
- defaultRelevance: 750,
- elementType: _instantiateFunctionTypeAlias(functionTypeAlias));
- } else if (functionTypeAlias.hasOrInheritsDeprecated) {
- relevance = DART_RELEVANCE_LOW;
- } else {
- relevance = functionTypeAlias.library == request.libraryElement
- ? DART_RELEVANCE_LOCAL_FUNCTION
- : DART_RELEVANCE_DEFAULT;
- }
+ var relevance = _computeTopLevelRelevance(functionTypeAlias,
+ defaultRelevance: 750,
+ elementType: _instantiateFunctionTypeAlias(functionTypeAlias));
_add(_createSuggestion(functionTypeAlias,
kind: kind, prefix: prefix, relevance: relevance));
}
/// Add a suggestion for a [keyword]. The [offset] is the offset from the
/// beginning of the keyword where the cursor will be left.
- void suggestKeyword(String keyword, {int offset, @required int relevance}) {
- if (request.useNewRelevance) {
- // TODO(brianwilkerson) The default value should probably be a constant.
- relevance = toRelevance(
- request.featureComputer
- .keywordFeature(keyword, request.opType.completionLocation),
- 800);
- }
+ void suggestKeyword(String keyword, {int offset}) {
+ // TODO(brianwilkerson) The default value should probably be a constant.
+ var relevance = toRelevance(
+ request.featureComputer
+ .keywordFeature(keyword, request.opType.completionLocation),
+ 800);
_add(CompletionSuggestion(CompletionSuggestionKind.KEYWORD, relevance,
keyword, offset ?? keyword.length, 0, false, false));
}
@@ -619,14 +520,8 @@
// TODO(brianwilkerson) Figure out why we're excluding labels consisting of
// a single underscore.
if (completion != null && completion.isNotEmpty && completion != '_') {
- var suggestion = CompletionSuggestion(
- CompletionSuggestionKind.IDENTIFIER,
- request.useNewRelevance ? Relevance.label : DART_RELEVANCE_DEFAULT,
- completion,
- completion.length,
- 0,
- false,
- false);
+ var suggestion = CompletionSuggestion(CompletionSuggestionKind.IDENTIFIER,
+ Relevance.label, completion, completion.length, 0, false, false);
suggestion.element = createLocalElement(
request.source, protocol.ElementKind.LABEL, label.label,
returnType: NO_RETURN_TYPE);
@@ -637,49 +532,29 @@
/// Add a suggestion for the `loadLibrary` [function] associated with a
/// prefix.
void suggestLoadLibraryFunction(FunctionElement function) {
- int relevance;
- if (request.useNewRelevance) {
- // TODO(brianwilkerson) This might want to use the context type rather
- // than a fixed value.
- relevance = Relevance.loadLibrary;
- } else {
- relevance = function.hasOrInheritsDeprecated
- ? DART_RELEVANCE_LOW
- : DART_RELEVANCE_DEFAULT;
- }
-
+ // TODO(brianwilkerson) This might want to use the context type rather than
+ // a fixed value.
+ var relevance = Relevance.loadLibrary;
_add(_createSuggestion(function, relevance: relevance));
}
/// Add a suggestion for a local [variable].
void suggestLocalVariable(LocalVariableElement variable) {
var variableType = variable.type;
- int relevance;
- if (request.useNewRelevance) {
- var contextType = request.featureComputer
- .contextTypeFeature(request.contextType, variableType);
- var elementKind = _computeElementKind(variable);
- var isConstant = request.inConstantContext
- ? request.featureComputer.isConstantFeature(variable)
- : -1.0;
- var localVariableDistance = request.featureComputer
- .localVariableDistanceFeature(
- request.target.containingNode, variable);
- relevance = toRelevance(
- weightedAverage(
- [contextType, elementKind, isConstant, localVariableDistance],
- [1.0, 1.0, 1.0, 1.0]),
- 800);
- listener?.computedFeatures(contextType: contextType);
- } else {
- relevance = _computeOldMemberRelevance(variable);
- relevance =
- request.opType.returnValueSuggestionsFilter(variableType, relevance);
- if (relevance == null) {
- return;
- }
- }
-
+ var contextType = request.featureComputer
+ .contextTypeFeature(request.contextType, variableType);
+ var elementKind = _computeElementKind(variable);
+ var isConstant = request.inConstantContext
+ ? request.featureComputer.isConstantFeature(variable)
+ : -1.0;
+ var localVariableDistance = request.featureComputer
+ .localVariableDistanceFeature(request.target.containingNode, variable);
+ var relevance = toRelevance(
+ weightedAverage(
+ [contextType, elementKind, isConstant, localVariableDistance],
+ [1.0, 1.0, 1.0, 1.0]),
+ 800);
+ listener?.computedFeatures(contextType: contextType);
_add(_createSuggestion(variable, relevance: relevance));
}
@@ -693,45 +568,32 @@
// TODO(brianwilkerson) Refactor callers so that we're passing in the type
// of the target (assuming we don't already have that type available via
// the [request]) and compute the [inheritanceDistance] in this method.
- int relevance;
- if (request.useNewRelevance) {
- var featureComputer = request.featureComputer;
- var contextType = featureComputer.contextTypeFeature(
- request.contextType, method.returnType);
- var elementKind = _computeElementKind(method);
- var hasDeprecated = featureComputer.hasDeprecatedFeature(method);
- var isConstant = request.inConstantContext
- ? featureComputer.isConstantFeature(method)
- : -1.0;
- var startsWithDollar =
- featureComputer.startsWithDollarFeature(method.name);
- var superMatches = featureComputer.superMatchesFeature(
- _containingMemberName, method.name);
- relevance = _computeMemberRelevance(
- contextType: contextType,
- elementKind: elementKind,
- hasDeprecated: hasDeprecated,
- inheritanceDistance: inheritanceDistance,
- isConstant: isConstant,
- startsWithDollar: startsWithDollar,
- superMatches: superMatches);
- listener?.computedFeatures(
- contextType: contextType,
- elementKind: elementKind,
- hasDeprecated: hasDeprecated,
- inheritanceDistance: inheritanceDistance,
- startsWithDollar: startsWithDollar,
- superMatches: superMatches);
- } else {
- relevance = _computeOldMemberRelevance(method);
- if (request.opType.includeReturnValueSuggestions) {
- relevance = request.opType
- .returnValueSuggestionsFilter(method.returnType, relevance);
- }
- if (relevance == null) {
- return;
- }
- }
+ var featureComputer = request.featureComputer;
+ var contextType = featureComputer.contextTypeFeature(
+ request.contextType, method.returnType);
+ var elementKind = _computeElementKind(method);
+ var hasDeprecated = featureComputer.hasDeprecatedFeature(method);
+ var isConstant = request.inConstantContext
+ ? featureComputer.isConstantFeature(method)
+ : -1.0;
+ var startsWithDollar = featureComputer.startsWithDollarFeature(method.name);
+ var superMatches =
+ featureComputer.superMatchesFeature(_containingMemberName, method.name);
+ var relevance = _computeMemberRelevance(
+ contextType: contextType,
+ elementKind: elementKind,
+ hasDeprecated: hasDeprecated,
+ inheritanceDistance: inheritanceDistance,
+ isConstant: isConstant,
+ startsWithDollar: startsWithDollar,
+ superMatches: superMatches);
+ listener?.computedFeatures(
+ contextType: contextType,
+ elementKind: elementKind,
+ hasDeprecated: hasDeprecated,
+ inheritanceDistance: inheritanceDistance,
+ startsWithDollar: startsWithDollar,
+ superMatches: superMatches);
var suggestion =
_createSuggestion(method, kind: kind, relevance: relevance);
@@ -769,14 +631,8 @@
void suggestName(String name) {
// TODO(brianwilkerson) Explore whether there are any features of the name
// that can be used to provide better relevance scores.
- _add(CompletionSuggestion(
- CompletionSuggestionKind.IDENTIFIER,
- request.useNewRelevance ? 500 : DART_RELEVANCE_DEFAULT,
- name,
- name.length,
- 0,
- false,
- false));
+ _add(CompletionSuggestion(CompletionSuggestionKind.IDENTIFIER, 500, name,
+ name.length, 0, false, false));
}
/// Add a suggestion to add a named argument corresponding to the [parameter].
@@ -821,13 +677,9 @@
int relevance;
if (parameter.isRequiredNamed || parameter.hasRequired) {
- relevance = request.useNewRelevance
- ? Relevance.requiredNamedArgument
- : DART_RELEVANCE_NAMED_PARAMETER_REQUIRED;
+ relevance = Relevance.requiredNamedArgument;
} else {
- relevance = request.useNewRelevance
- ? Relevance.namedArgument
- : DART_RELEVANCE_NAMED_PARAMETER;
+ relevance = Relevance.namedArgument;
}
var suggestion = CompletionSuggestion(
@@ -894,7 +746,7 @@
displayTextBuffer.isNotEmpty ? displayTextBuffer.toString() : null;
var suggestion = CompletionSuggestion(
CompletionSuggestionKind.OVERRIDE,
- request.useNewRelevance ? Relevance.override : DART_RELEVANCE_HIGH,
+ Relevance.override,
completion,
selectionRange.offset - offsetDelta,
selectionRange.length,
@@ -908,47 +760,30 @@
/// Add a suggestion for a [parameter].
void suggestParameter(ParameterElement parameter) {
var variableType = parameter.type;
- int relevance;
- if (request.useNewRelevance) {
- // TODO(brianwilkerson) Use the distance to the declaring function as
- // another feature.
- var contextType = request.featureComputer
- .contextTypeFeature(request.contextType, variableType);
- var elementKind = _computeElementKind(parameter);
- var isConstant = request.inConstantContext
- ? request.featureComputer.isConstantFeature(parameter)
- : -1.0;
- relevance = toRelevance(
- weightedAverage(
- [contextType, elementKind, isConstant], [1.0, 1.0, 1.0]),
- 800);
- listener?.computedFeatures(contextType: contextType);
- } else {
- relevance = _computeOldMemberRelevance(parameter);
- relevance =
- request.opType.returnValueSuggestionsFilter(variableType, relevance);
- if (relevance == null) {
- return;
- }
- }
-
+ // TODO(brianwilkerson) Use the distance to the declaring function as
+ // another feature.
+ var contextType = request.featureComputer
+ .contextTypeFeature(request.contextType, variableType);
+ var elementKind = _computeElementKind(parameter);
+ var isConstant = request.inConstantContext
+ ? request.featureComputer.isConstantFeature(parameter)
+ : -1.0;
+ var relevance = toRelevance(
+ weightedAverage(
+ [contextType, elementKind, isConstant], [1.0, 1.0, 1.0]),
+ 800);
+ listener?.computedFeatures(contextType: contextType);
_add(_createSuggestion(parameter, relevance: relevance));
}
/// Add a suggestion for a [prefix] associated with a [library].
void suggestPrefix(LibraryElement library, String prefix) {
- int relevance;
- if (request.useNewRelevance) {
- var elementKind = _computeElementKind(library);
- // TODO(brianwilkerson) If we are in a constant context it would be nice
- // to promote prefixes for libraries that define constants, but that
- // might be more work than it's worth.
- relevance = toRelevance(elementKind, Relevance.prefix);
- listener?.computedFeatures(elementKind: elementKind);
- } else {
- relevance =
- library.hasDeprecated ? DART_RELEVANCE_LOW : DART_RELEVANCE_DEFAULT;
- }
+ var elementKind = _computeElementKind(library);
+ // TODO(brianwilkerson) If we are in a constant context it would be nice
+ // to promote prefixes for libraries that define constants, but that
+ // might be more work than it's worth.
+ var relevance = toRelevance(elementKind, Relevance.prefix);
+ listener?.computedFeatures(elementKind: elementKind);
_add(_createSuggestion(library,
completion: prefix,
kind: CompletionSuggestionKind.IDENTIFIER,
@@ -961,23 +796,8 @@
void suggestTopLevelFunction(FunctionElement function,
{CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION,
String prefix}) {
- int relevance;
- if (request.useNewRelevance) {
- relevance =
- _computeTopLevelRelevance(function, elementType: function.returnType);
- } else if (function.hasOrInheritsDeprecated) {
- relevance = DART_RELEVANCE_LOW;
- } else {
- relevance = function.library == request.libraryElement
- ? DART_RELEVANCE_LOCAL_FUNCTION
- : DART_RELEVANCE_DEFAULT;
- relevance =
- request.opType.returnValueSuggestionsFilter(function.type, relevance);
- if (relevance == null) {
- return;
- }
- }
-
+ var relevance =
+ _computeTopLevelRelevance(function, elementType: function.returnType);
_add(_createSuggestion(function,
kind: kind, prefix: prefix, relevance: relevance));
}
@@ -1002,43 +822,29 @@
}
} else {
var type = _getPropertyAccessorType(accessor);
- int relevance;
- if (request.useNewRelevance) {
- var featureComputer = request.featureComputer;
- var contextType =
- featureComputer.contextTypeFeature(request.contextType, type);
- var elementKind = _computeElementKind(accessor);
- var hasDeprecated = featureComputer.hasDeprecatedFeature(accessor);
- var isConstant = request.inConstantContext
- ? featureComputer.isConstantFeature(accessor)
- : -1.0;
- var startsWithDollar =
- featureComputer.startsWithDollarFeature(accessor.name);
- relevance = _computeMemberRelevance(
- contextType: contextType,
- elementKind: elementKind,
- hasDeprecated: hasDeprecated,
- inheritanceDistance: -1.0,
- isConstant: isConstant,
- startsWithDollar: startsWithDollar,
- superMatches: -1.0);
- listener?.computedFeatures(
- contextType: contextType,
- elementKind: elementKind,
- hasDeprecated: hasDeprecated,
- startsWithDollar: startsWithDollar);
- } else {
- relevance = accessor.hasOrInheritsDeprecated
- ? DART_RELEVANCE_LOW
- : _computeOldMemberRelevance(accessor);
- if (request.opType.includeReturnValueSuggestions) {
- relevance =
- request.opType.returnValueSuggestionsFilter(type, relevance);
- }
- if (relevance == null) {
- return;
- }
- }
+ var featureComputer = request.featureComputer;
+ var contextType =
+ featureComputer.contextTypeFeature(request.contextType, type);
+ var elementKind = _computeElementKind(accessor);
+ var hasDeprecated = featureComputer.hasDeprecatedFeature(accessor);
+ var isConstant = request.inConstantContext
+ ? featureComputer.isConstantFeature(accessor)
+ : -1.0;
+ var startsWithDollar =
+ featureComputer.startsWithDollarFeature(accessor.name);
+ var relevance = _computeMemberRelevance(
+ contextType: contextType,
+ elementKind: elementKind,
+ hasDeprecated: hasDeprecated,
+ inheritanceDistance: -1.0,
+ isConstant: isConstant,
+ startsWithDollar: startsWithDollar,
+ superMatches: -1.0);
+ listener?.computedFeatures(
+ contextType: contextType,
+ elementKind: elementKind,
+ hasDeprecated: hasDeprecated,
+ startsWithDollar: startsWithDollar);
_add(_createSuggestion(accessor, prefix: prefix, relevance: relevance));
}
}
@@ -1050,55 +856,30 @@
{CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION,
String prefix}) {
assert(variable.enclosingElement is CompilationUnitElement);
- int relevance;
- if (request.useNewRelevance) {
- relevance =
- _computeTopLevelRelevance(variable, elementType: variable.type);
- } else {
- var type = variable.type;
- relevance = variable.hasOrInheritsDeprecated
- ? DART_RELEVANCE_LOW
- : _computeOldMemberRelevance(variable);
- relevance = request.opType.returnValueSuggestionsFilter(type, relevance);
- if (relevance == null) {
- return;
- }
- }
-
+ var relevance =
+ _computeTopLevelRelevance(variable, elementType: variable.type);
_add(_createSuggestion(variable,
kind: kind, prefix: prefix, relevance: relevance));
}
/// Add a suggestion for a type [parameter].
void suggestTypeParameter(TypeParameterElement parameter) {
- int relevance;
- if (request.useNewRelevance) {
- var elementKind = _computeElementKind(parameter);
- var isConstant = request.inConstantContext
- ? request.featureComputer.isConstantFeature(parameter)
- : -1.0;
- relevance = toRelevance(
- weightedAverage([elementKind, isConstant], [1.0, 1.0]),
- Relevance.typeParameter);
- listener?.computedFeatures(elementKind: elementKind);
- } else {
- relevance = _computeOldMemberRelevance(parameter);
- }
-
+ var elementKind = _computeElementKind(parameter);
+ var isConstant = request.inConstantContext
+ ? request.featureComputer.isConstantFeature(parameter)
+ : -1.0;
+ var relevance = toRelevance(
+ weightedAverage([elementKind, isConstant], [1.0, 1.0]),
+ Relevance.typeParameter);
+ listener?.computedFeatures(elementKind: elementKind);
_add(_createSuggestion(parameter,
kind: CompletionSuggestionKind.IDENTIFIER, relevance: relevance));
}
/// Add a suggestion to use the [uri] in an import, export, or part directive.
void suggestUri(String uri) {
- int relevance;
- if (request.useNewRelevance) {
- relevance =
- uri == 'dart:core' ? Relevance.importDartCore : Relevance.import;
- } else {
- relevance =
- uri == 'dart:core' ? DART_RELEVANCE_LOW : DART_RELEVANCE_DEFAULT;
- }
+ var relevance =
+ uri == 'dart:core' ? Relevance.importDartCore : Relevance.import;
_add(CompletionSuggestion(CompletionSuggestionKind.IMPORT, relevance, uri,
uri.length, 0, false, false));
}
@@ -1175,46 +956,6 @@
return toRelevance(score, Relevance.member);
}
- /// Compute the old relevance score for a member.
- int _computeOldMemberRelevance(Element member) {
- if (member.hasOrInheritsDeprecated) {
- return DART_RELEVANCE_LOW;
- } else if (member.name == _containingMemberName) {
- // Boost the relevance of a super expression calling a method of the
- // same name as the containing method.
- return DART_RELEVANCE_HIGH;
- }
- var identifier = member.displayName;
- if (identifier != null && identifier.startsWith(r'$')) {
- // Decrease relevance of suggestions starting with $
- // https://github.com/dart-lang/sdk/issues/27303
- return DART_RELEVANCE_LOW;
- }
- if (member is LocalVariableElement) {
- return DART_RELEVANCE_LOCAL_VARIABLE;
- }
- if (!member.name.startsWith('_') &&
- member.library == request.libraryElement) {
- // Locally declared elements sometimes have a special relevance.
- if (member is PropertyAccessorElement) {
- return DART_RELEVANCE_LOCAL_ACCESSOR;
- } else if (member is FieldElement) {
- return DART_RELEVANCE_LOCAL_FIELD;
- } else if (member is FunctionElement) {
- return DART_RELEVANCE_LOCAL_FUNCTION;
- } else if (member is MethodElement) {
- return DART_RELEVANCE_LOCAL_METHOD;
- } else if (member is ParameterElement) {
- return DART_RELEVANCE_PARAMETER;
- } else if (member is TopLevelVariableElement) {
- return DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE;
- } else if (member is TypeParameterElement) {
- return DART_RELEVANCE_TYPE_PARAMETER;
- }
- }
- return DART_RELEVANCE_DEFAULT;
- }
-
/// Return the relevance score for a top-level [element].
int _computeTopLevelRelevance(Element element,
{int defaultRelevance = 800, @required DartType elementType}) {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart
index 3120c99..e3eee98 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart
@@ -236,11 +236,8 @@
types.addAll(superclassConstraints);
}
for (var targetType in types) {
- double inheritanceDistance;
- if (request.useNewRelevance) {
- inheritanceDistance = request.featureComputer
- .inheritanceDistanceFeature(type.element, targetType.element);
- }
+ var inheritanceDistance = request.featureComputer
+ .inheritanceDistanceFeature(type.element, targetType.element);
for (var method in targetType.methods) {
// Exclude static methods when completion on an instance.
if (!method.isStatic) {
diff --git a/pkg/analysis_server/test/domain_completion_test.dart b/pkg/analysis_server/test/domain_completion_test.dart
index c00d24e..59aaebb 100644
--- a/pkg/analysis_server/test/domain_completion_test.dart
+++ b/pkg/analysis_server/test/domain_completion_test.dart
@@ -6,7 +6,6 @@
import 'package:analysis_server/src/plugin/plugin_manager.dart';
import 'package:analysis_server/src/provisional/completion/completion_core.dart';
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
-import 'package:analysis_server/src/services/completion/dart/completion_manager.dart';
import 'package:analysis_server/src/services/completion/dart/contribution_sorter.dart';
import 'package:analyzer_plugin/protocol/protocol.dart' as plugin;
import 'package:analyzer_plugin/protocol/protocol_common.dart';
@@ -43,10 +42,8 @@
addTestFile('main() { new A(^);}'
'class A { A({one, two}) {} }');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'one: ',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'two: ',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'one: ');
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'two: ');
expect(suggestions, hasLength(2));
}
@@ -54,30 +51,24 @@
addTestFile('main() { new A(^);}'
'class A { factory A({one, two}) => throw 0; }');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'one: ',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'two: ',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'one: ');
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'two: ');
expect(suggestions, hasLength(2));
}
Future<void> test_ArgumentList_imported_function_named_param() async {
addTestFile('main() { int.parse("16", ^);}');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'radix: ',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'onError: ',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'radix: ');
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'onError: ');
expect(suggestions, hasLength(2));
}
Future<void> test_ArgumentList_imported_function_named_param1() async {
addTestFile('main() { foo(o^);} foo({one, two}) {}');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'one: ',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'two: ',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'one: ');
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'two: ');
expect(suggestions, hasLength(2));
}
@@ -85,54 +76,42 @@
addTestFile('mainx() {A a = new A(); a.foo(one: 7, ^);}'
'class A { foo({one, two}) {} }');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'two: ',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'two: ');
expect(suggestions, hasLength(1));
}
Future<void> test_ArgumentList_imported_function_named_param_label1() async {
addTestFile('main() { int.parse("16", r^: 16);}');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'radix',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'onError',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'radix');
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'onError');
expect(suggestions, hasLength(2));
}
Future<void> test_ArgumentList_imported_function_named_param_label3() async {
addTestFile('main() { int.parse("16", ^: 16);}');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'radix: ',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
- assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'onError: ',
- relevance: DART_RELEVANCE_NAMED_PARAMETER);
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'radix: ');
+ assertHasResult(CompletionSuggestionKind.NAMED_ARGUMENT, 'onError: ');
expect(suggestions, hasLength(2));
}
Future<void> test_catch() async {
addTestFile('main() {try {} ^}');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'on',
- relevance: DART_RELEVANCE_KEYWORD);
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'catch',
- relevance: DART_RELEVANCE_KEYWORD);
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'finally',
- relevance: DART_RELEVANCE_KEYWORD);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'on');
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'catch');
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'finally');
expect(suggestions, hasLength(3));
}
Future<void> test_catch2() async {
addTestFile('main() {try {} on Foo {} ^}');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'on',
- relevance: DART_RELEVANCE_KEYWORD);
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'catch',
- relevance: DART_RELEVANCE_KEYWORD);
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'finally',
- relevance: DART_RELEVANCE_KEYWORD);
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'for',
- relevance: DART_RELEVANCE_KEYWORD);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'on');
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'catch');
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'finally');
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'for');
suggestions.firstWhere(
(CompletionSuggestion suggestion) =>
suggestion.kind != CompletionSuggestionKind.KEYWORD, orElse: () {
@@ -146,8 +125,7 @@
assertNoResult('on');
assertNoResult('catch');
assertNoResult('finally');
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'for',
- relevance: DART_RELEVANCE_KEYWORD);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'for');
suggestions.firstWhere(
(CompletionSuggestion suggestion) =>
suggestion.kind != CompletionSuggestionKind.KEYWORD, orElse: () {
@@ -161,8 +139,7 @@
assertNoResult('on');
assertNoResult('catch');
assertNoResult('finally');
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'for',
- relevance: DART_RELEVANCE_KEYWORD);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'for');
suggestions.firstWhere(
(CompletionSuggestion suggestion) =>
suggestion.kind != CompletionSuggestionKind.KEYWORD, orElse: () {
@@ -173,65 +150,51 @@
Future<void> test_catch5() async {
addTestFile('main() {try {} ^ finally {}}');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'on',
- relevance: DART_RELEVANCE_KEYWORD);
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'catch',
- relevance: DART_RELEVANCE_KEYWORD);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'on');
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'catch');
expect(suggestions, hasLength(2));
}
Future<void> test_constructor() async {
addTestFile('class A {bool foo; A() : ^;}');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'super',
- relevance: DART_RELEVANCE_KEYWORD);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo',
- relevance: DART_RELEVANCE_LOCAL_FIELD);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'super');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo');
}
Future<void> test_constructor2() async {
addTestFile('class A {bool foo; A() : s^;}');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'super',
- relevance: DART_RELEVANCE_KEYWORD);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo',
- relevance: DART_RELEVANCE_LOCAL_FIELD);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'super');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo');
}
Future<void> test_constructor3() async {
addTestFile('class A {bool foo; A() : a=7,^;}');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'super',
- relevance: DART_RELEVANCE_KEYWORD);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo',
- relevance: DART_RELEVANCE_LOCAL_FIELD);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'super');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo');
}
Future<void> test_constructor4() async {
addTestFile('class A {bool foo; A() : a=7,s^;}');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'super',
- relevance: DART_RELEVANCE_KEYWORD);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo',
- relevance: DART_RELEVANCE_LOCAL_FIELD);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'super');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo');
}
Future<void> test_constructor5() async {
addTestFile('class A {bool foo; A() : a=7,s^}');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'super',
- relevance: DART_RELEVANCE_KEYWORD);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo',
- relevance: DART_RELEVANCE_LOCAL_FIELD);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'super');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo');
}
Future<void> test_constructor6() async {
addTestFile('class A {bool foo; A() : a=7,^ void bar() {}}');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'super',
- relevance: DART_RELEVANCE_KEYWORD);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo',
- relevance: DART_RELEVANCE_LOCAL_FIELD);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'super');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'foo');
}
Future<void> test_html() {
@@ -315,8 +278,7 @@
// Assert valid results for the second request
expect(allSuggestions[result2.id], same(suggestions));
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'class',
- relevance: DART_RELEVANCE_HIGH);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'class');
}
@failingTest
@@ -370,9 +332,9 @@
expect(replacementOffset, completionOffset - 3);
expect(replacementLength, 3);
assertHasResult(CompletionSuggestionKind.KEYWORD, 'export \'\';',
- selectionOffset: 8, relevance: DART_RELEVANCE_HIGH);
+ selectionOffset: 8);
assertHasResult(CompletionSuggestionKind.KEYWORD, 'import \'\';',
- selectionOffset: 8, relevance: DART_RELEVANCE_HIGH);
+ selectionOffset: 8);
assertNoResult('extends');
assertNoResult('library');
}
@@ -407,14 +369,13 @@
}
expect(replacementOffset, completionOffset - 1);
expect(replacementLength, 1);
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'library',
- relevance: DART_RELEVANCE_HIGH);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'library');
assertHasResult(CompletionSuggestionKind.KEYWORD, 'import \'\';',
- selectionOffset: 8, relevance: DART_RELEVANCE_HIGH);
+ selectionOffset: 8);
assertHasResult(CompletionSuggestionKind.KEYWORD, 'export \'\';',
- selectionOffset: 8, relevance: DART_RELEVANCE_HIGH);
+ selectionOffset: 8);
assertHasResult(CompletionSuggestionKind.KEYWORD, 'part \'\';',
- selectionOffset: 6, relevance: DART_RELEVANCE_HIGH);
+ selectionOffset: 6);
assertNoResult('extends');
}
@@ -509,10 +470,8 @@
main(aaa, bbb) {}
''');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'main',
- relevance: DART_RELEVANCE_LOCAL_FUNCTION);
- assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'foo',
- relevance: DART_RELEVANCE_LOCAL_FUNCTION);
+ assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'main');
+ assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'foo');
assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'min');
}
@@ -522,8 +481,7 @@
main(aaa, bbb) {}
''');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'main',
- relevance: DART_RELEVANCE_LOCAL_FUNCTION);
+ assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'main');
}
Future<void> test_inherited() {
@@ -538,8 +496,7 @@
return getSuggestions().then((_) {
expect(replacementOffset, equals(completionOffset));
expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'm',
- relevance: DART_RELEVANCE_LOCAL_METHOD);
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'm');
});
}
@@ -568,45 +525,16 @@
return getSuggestions().then((_) {
expect(replacementOffset, equals(completionOffset));
expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'b',
- relevance: DART_RELEVANCE_LOCAL_METHOD);
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'b');
});
}
- Future<void> test_invocation_sdk_relevancy_off() {
- var originalSorter = DartCompletionManager.contributionSorter;
- var mockSorter = MockRelevancySorter();
- DartCompletionManager.contributionSorter = mockSorter;
- addTestFile('main() {Map m; m.^}');
- return getSuggestions().then((_) {
- // Assert that the CommonUsageComputer has been replaced
- expect(suggestions.any((s) => s.relevance == DART_RELEVANCE_COMMON_USAGE),
- isFalse);
- DartCompletionManager.contributionSorter = originalSorter;
- mockSorter.enabled = false;
- });
- }
-
- Future<void> test_invocation_sdk_relevancy_on() {
- if (!server.options.useNewRelevance) {
- addTestFile('main() {Map m; m.^}');
- return getSuggestions().then((_) {
- // Assert that the CommonUsageComputer is working
- expect(
- suggestions.any((s) => s.relevance == DART_RELEVANCE_COMMON_USAGE),
- isTrue);
- });
- }
- return Future.value(null);
- }
-
Future<void> test_invocation_withTrailingStmt() {
addTestFile('class A {b() {}} main() {A a; a.^ int x = 7;}');
return getSuggestions().then((_) {
expect(replacementOffset, equals(completionOffset));
expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'b',
- relevance: DART_RELEVANCE_LOCAL_METHOD);
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'b');
});
}
@@ -615,8 +543,7 @@
class A { var isVisible;}
main(A p) { var v1 = p.is^; }''');
await getSuggestions();
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'isVisible',
- relevance: DART_RELEVANCE_LOCAL_FIELD);
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'isVisible');
}
Future<void> test_keyword() {
@@ -625,9 +552,8 @@
expect(replacementOffset, equals(completionOffset - 2));
expect(replacementLength, equals(2));
assertHasResult(CompletionSuggestionKind.KEYWORD, 'export \'\';',
- selectionOffset: 8, relevance: DART_RELEVANCE_HIGH);
- assertHasResult(CompletionSuggestionKind.KEYWORD, 'class',
- relevance: DART_RELEVANCE_HIGH);
+ selectionOffset: 8);
+ assertHasResult(CompletionSuggestionKind.KEYWORD, 'class');
});
}
@@ -679,8 +605,7 @@
return getSuggestions().then((_) {
expect(replacementOffset, equals(completionOffset));
expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'm',
- relevance: DART_RELEVANCE_LOCAL_METHOD);
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'm');
});
}
@@ -701,8 +626,7 @@
expect(replacementLength, equals(0));
// The class is suggested.
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'A',
- relevance: DART_RELEVANCE_LOCAL_VARIABLE);
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'A');
// Class and all its constructors are shadowed by the local variable.
assertNoResult('A', elementKind: ElementKind.CLASS);
@@ -717,12 +641,9 @@
expect(replacementLength, equals(0));
assertHasResult(CompletionSuggestionKind.INVOCATION, 'A',
elementKind: ElementKind.CLASS);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'a',
- relevance: DART_RELEVANCE_LOCAL_FIELD);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'b',
- relevance: DART_RELEVANCE_LOCAL_VARIABLE);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'x',
- relevance: DART_RELEVANCE_LOCAL_METHOD);
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'a');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'b');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'x');
assertHasResult(CompletionSuggestionKind.INVOCATION, 'DateTime',
elementKind: ElementKind.CLASS);
});
@@ -746,8 +667,7 @@
return getSuggestions().then((_) {
expect(replacementOffset, equals(completionOffset));
expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'm',
- relevance: DART_RELEVANCE_LOCAL_METHOD);
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'm');
});
}
@@ -838,8 +758,7 @@
await getSuggestions();
expect(replacementOffset, equals(completionOffset));
expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'b',
- relevance: DART_RELEVANCE_INHERITED_METHOD);
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'b');
assertNoResult('c');
}
@@ -854,8 +773,7 @@
expect(replacementLength, equals(4));
// Suggestions based upon imported elements are partially filtered
//assertHasResult(CompletionSuggestionKind.INVOCATION, 'Object');
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'test',
- relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE);
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'test');
assertNoResult('HtmlElement');
});
}
diff --git a/pkg/analysis_server/test/domain_completion_util.dart b/pkg/analysis_server/test/domain_completion_util.dart
index 7d42cf0..17cbdd8 100644
--- a/pkg/analysis_server/test/domain_completion_util.dart
+++ b/pkg/analysis_server/test/domain_completion_util.dart
@@ -8,7 +8,6 @@
import 'package:analysis_server/protocol/protocol_constants.dart';
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analysis_server/src/domain_completion.dart';
-import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
@@ -41,8 +40,7 @@
}
void assertHasResult(CompletionSuggestionKind kind, String completion,
- {int relevance = DART_RELEVANCE_DEFAULT,
- bool isDeprecated = false,
+ {bool isDeprecated = false,
bool isPotential = false,
int selectionOffset,
ElementKind elementKind}) {
@@ -70,9 +68,6 @@
fail('expected $expectationText, but found\n $completions');
}
expect(cs.kind, equals(kind));
- if (!server.options.useNewRelevance) {
- expect(cs.relevance, equals(relevance));
- }
expect(cs.selectionOffset, selectionOffset ?? completion.length);
expect(cs.selectionLength, equals(0));
expect(cs.isDeprecated, equals(isDeprecated));
diff --git a/pkg/analysis_server/test/services/completion/dart/common_usage_sorter_test.dart b/pkg/analysis_server/test/services/completion/dart/common_usage_sorter_test.dart
deleted file mode 100644
index c8d2ae5..0000000
--- a/pkg/analysis_server/test/services/completion/dart/common_usage_sorter_test.dart
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// 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 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
-import 'package:analysis_server/src/services/completion/dart/common_usage_sorter.dart';
-import 'package:analysis_server/src/services/completion/dart/completion_manager.dart';
-import 'package:analyzer_plugin/protocol/protocol_common.dart';
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../../../domain_completion_util.dart';
-
-void main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(CommonUsageSorterTest);
- });
-}
-
-@reflectiveTest
-class CommonUsageSorterTest extends AbstractCompletionDomainTest {
- Future getSuggestionsWith(Map<String, List<String>> selectorRelevance) async {
- var originalSorter = DartCompletionManager.contributionSorter;
- DartCompletionManager.contributionSorter =
- CommonUsageSorter(selectorRelevance);
- try {
- return await getSuggestions();
- } finally {
- DartCompletionManager.contributionSorter = originalSorter;
- }
- }
-
- Future<void> test_ConstructorName() async {
- // SimpleIdentifier ConstructorName InstanceCreationExpression
- addTestFile('import "dart:async"; class A {x() {new Future.^}}');
- await getSuggestionsWith({
- 'dart.async.Future': ['value', 'wait']
- });
- expect(replacementOffset, equals(completionOffset));
- expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'delayed');
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'value',
- relevance: DART_RELEVANCE_COMMON_USAGE);
- assertNoResult('Future');
- assertNoResult('Object');
- assertNoResult('A');
- }
-
- Future<void> test_namedArgument_enum() async {
- addTestFile('''
-enum E {e1, e2}
-f({E e}) {}
-main() {
- f(e: ^);
-}
-''');
- await getSuggestionsWith(<String, List<String>>{});
- expect(replacementOffset, equals(completionOffset));
- expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'E');
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'E.e1',
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'E.e2',
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
- }
-
- Future<void> test_PrefixedIdentifier_field() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestFile('class A {static int s1; static int s2; x() {A.^}}');
- await getSuggestionsWith({
- '.A': ['s2']
- });
- expect(replacementOffset, equals(completionOffset));
- expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 's1',
- relevance: DART_RELEVANCE_INHERITED_FIELD);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 's2',
- relevance: DART_RELEVANCE_COMMON_USAGE);
- assertNoResult('Future');
- assertNoResult('Object');
- assertNoResult('A');
- }
-
- Future<void> test_PrefixedIdentifier_field_inPart() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- newFile('/project/bin/myLib.dart',
- content:
- 'library L; part "${toUriStr(testFile)}"; class A {static int s2;}');
- addTestFile('part of L; foo() {A.^}');
- await getSuggestionsWith({
- 'L.A': ['s2']
- });
- expect(replacementOffset, equals(completionOffset));
- expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 's2',
- relevance: DART_RELEVANCE_COMMON_USAGE);
- assertNoResult('Future');
- assertNoResult('Object');
- assertNoResult('A');
- }
-
- Future<void> test_PrefixedIdentifier_getter() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestFile('class A {int get g1 => 1; int get g2 => 2; x() {new A().^}}');
- await getSuggestionsWith({
- '.A': ['g2']
- });
- expect(replacementOffset, equals(completionOffset));
- expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'g1',
- relevance: DART_RELEVANCE_LOCAL_ACCESSOR);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'g2',
- relevance: DART_RELEVANCE_COMMON_USAGE);
- assertNoResult('Future');
- assertNoResult('Object');
- assertNoResult('A');
- }
-
- Future<void> test_PrefixedIdentifier_setter() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestFile('class A {set s1(v) {}; set s2(v) {}; x() {new A().^}}');
- await getSuggestionsWith({
- '.A': ['s2']
- });
- expect(replacementOffset, equals(completionOffset));
- expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 's1',
- relevance: DART_RELEVANCE_LOCAL_ACCESSOR);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 's2',
- relevance: DART_RELEVANCE_COMMON_USAGE);
- assertNoResult('Future');
- assertNoResult('Object');
- assertNoResult('A');
- }
-
- Future<void> test_PrefixedIdentifier_static_method() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestFile('import "dart:async"; class A {x() {Future.^}}');
- await getSuggestionsWith({
- 'dart.async.Future': ['value', 'wait']
- });
- expect(replacementOffset, equals(completionOffset));
- expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'wait',
- relevance: DART_RELEVANCE_COMMON_USAGE - 1);
- assertNoResult('Future');
- assertNoResult('Object');
- assertNoResult('A');
- }
-
- Future<void> test_PropertyAccess() async {
- // SimpleIdentifier PropertyAccess ExpressionStatement
- addTestFile('import "dart:math"; class A {x() {new Random().^}}');
- await getSuggestionsWith({
- 'dart.math.Random': ['nextInt', 'nextDouble']
- });
- expect(replacementOffset, equals(completionOffset));
- expect(replacementLength, equals(0));
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'nextBool');
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'nextDouble',
- relevance: DART_RELEVANCE_COMMON_USAGE - 1);
- assertHasResult(CompletionSuggestionKind.INVOCATION, 'nextInt',
- relevance: DART_RELEVANCE_COMMON_USAGE);
- assertNoResult('Random');
- assertNoResult('Object');
- assertNoResult('A');
- }
-}
diff --git a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
index 8e22c6a..63573c1 100644
--- a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
+++ b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
@@ -96,10 +96,6 @@
/// where there is no `new` or `const` keyword.
bool get suggestConstructorsWithoutNew => true;
- /// Return `true` if the new relevance computations should be used when
- /// computing code completion suggestions.
- bool get useNewRelevance => false;
-
bool get usingFastaParser => analyzer.Parser.useFasta;
void addTestSource(String content) {
@@ -552,7 +548,7 @@
Future computeSuggestions({int times = 200}) async {
result = await session.getResolvedUnit(testFile);
var baseRequest = CompletionRequestImpl(
- result, completionOffset, useNewRelevance, CompletionPerformance());
+ result, completionOffset, CompletionPerformance());
return await baseRequest.performance.runRequestOperation(
(performance) async {
diff --git a/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart b/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart
index 5a3825d..cd8e243 100644
--- a/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart
@@ -51,7 +51,6 @@
var baseRequest = CompletionRequestImpl(
await session.getResolvedUnit(testFile),
completionOffset,
- false,
CompletionPerformance());
await baseRequest.performance.runRequestOperation((performance) async {
var requestCompleter = Completer<DartCompletionRequest>();
diff --git a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
index 610dded..ed2204d 100644
--- a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
@@ -315,7 +315,12 @@
assertNotSuggested('==');
}
+ @failingTest
Future<void> test_AsExpression_type_subtype_extends_filter() async {
+ // This test fails because we are not filtering out the class `A` when
+ // suggesting types. We ought to do so because there's no reason to cast a
+ // value to the type it already has.
+
// SimpleIdentifier TypeName AsExpression IfStatement
addSource('/home/test/lib/b.dart', '''
foo() { }
@@ -337,7 +342,12 @@
assertNotSuggested('main');
}
+ @failingTest
Future<void> test_AsExpression_type_subtype_implements_filter() async {
+ // This test fails because we are not filtering out the class `A` when
+ // suggesting types. We ought to do so because there's no reason to cast a
+ // value to the type it already has.
+
// SimpleIdentifier TypeName AsExpression IfStatement
addSource('/home/test/lib/b.dart', '''
foo() { }
@@ -3027,7 +3037,12 @@
assertSuggestClass('Object');
}
+ @failingTest
Future<void> test_IsExpression_type_subtype_extends_filter() async {
+ // This test fails because we are not filtering out the class `A` when
+ // suggesting types. We ought to do so because there's no reason to cast a
+ // value to the type it already has.
+
// SimpleIdentifier TypeName IsExpression IfStatement
addSource('/home/test/lib/b.dart', '''
foo() { }
@@ -3049,7 +3064,12 @@
assertNotSuggested('main');
}
+ @failingTest
Future<void> test_IsExpression_type_subtype_implements_filter() async {
+ // This test fails because we are not filtering out the class `A` when
+ // suggesting types. We ought to do so because there's no reason to cast a
+ // value to the type it already has.
+
// SimpleIdentifier TypeName IsExpression IfStatement
addSource('/home/test/lib/b.dart', '''
foo() { }
diff --git a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
index e0268de..a46708e 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
@@ -546,7 +546,12 @@
assertNotSuggested('==');
}
+ @failingTest
Future<void> test_AsExpression_type_filter_extends() async {
+ // This test fails because we are not filtering out the class `A` when
+ // suggesting types. We ought to do so because there's no reason to cast a
+ // value to the type it already has.
+
// SimpleIdentifier TypeName AsExpression
addTestSource('''
class A {} class B extends A {} class C extends A {} class D {}
@@ -562,7 +567,12 @@
assertNotSuggested('Object');
}
+ @failingTest
Future<void> test_AsExpression_type_filter_implements() async {
+ // This test fails because we are not filtering out the class `A` when
+ // suggesting types. We ought to do so because there's no reason to cast a
+ // value to the type it already has.
+
// SimpleIdentifier TypeName AsExpression
addTestSource('''
class A {} class B implements A {} class C implements A {} class D {}
@@ -3882,7 +3892,12 @@
assertNotSuggested('Object');
}
+ @failingTest
Future<void> test_IsExpression_type_filter_extends() async {
+ // This test fails because we are not filtering out the class `A` when
+ // suggesting types. We ought to do so because there's no reason to cast a
+ // value to the type it already has.
+
// SimpleIdentifier TypeName IsExpression IfStatement
addTestSource('''
class A {} class B extends A {} class C extends A {} class D {}
@@ -3898,7 +3913,12 @@
assertNotSuggested('Object');
}
+ @failingTest
Future<void> test_IsExpression_type_filter_implements() async {
+ // This test fails because we are not filtering out the class `A` when
+ // suggesting types. We ought to do so because there's no reason to cast a
+ // value to the type it already has.
+
// SimpleIdentifier TypeName IsExpression IfStatement
addTestSource('''
class A {} class B implements A {} class C implements A {} class D {}
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/completion_relevance.dart b/pkg/analysis_server/test/services/completion/dart/relevance/completion_relevance.dart
index 643fec4..81532df 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/completion_relevance.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/completion_relevance.dart
@@ -2,7 +2,6 @@
// 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 'package:analysis_server/src/analysis_server.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
@@ -10,10 +9,6 @@
class CompletionRelevanceTest extends AbstractCompletionDriverTest {
@override
- AnalysisServerOptions get serverOptions =>
- AnalysisServerOptions()..useNewRelevance = true;
-
- @override
bool get supportsAvailableSuggestions => true;
/// Assert that all of the given completions were produced and that the
diff --git a/pkg/analysis_server/test/services/completion/dart/relevance/instance_member_relevance_test.dart b/pkg/analysis_server/test/services/completion/dart/relevance/instance_member_relevance_test.dart
index 9b59000..62388ae 100644
--- a/pkg/analysis_server/test/services/completion/dart/relevance/instance_member_relevance_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/relevance/instance_member_relevance_test.dart
@@ -2,7 +2,6 @@
// 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 'package:analysis_server/src/analysis_server.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'completion_relevance.dart';
@@ -16,10 +15,6 @@
@reflectiveTest
class InstanceMemberRelevanceTest extends CompletionRelevanceTest {
@override
- AnalysisServerOptions get serverOptions =>
- AnalysisServerOptions()..useNewRelevance = true;
-
- @override
bool get supportsAvailableSuggestions => true;
Future<void> test_contextType() async {
diff --git a/pkg/analysis_server/test/services/completion/dart/test_all.dart b/pkg/analysis_server/test/services/completion/dart/test_all.dart
index 9b71160..3509cde 100644
--- a/pkg/analysis_server/test/services/completion/dart/test_all.dart
+++ b/pkg/analysis_server/test/services/completion/dart/test_all.dart
@@ -6,7 +6,6 @@
import 'arglist_contributor_test.dart' as arglist_test;
import 'combinator_contributor_test.dart' as combinator_test;
-import 'common_usage_sorter_test.dart' as common_usage_test;
import 'completion_manager_test.dart' as completion_manager;
import 'completion_ranking_internal_test.dart'
as completion_ranking_internal_test;
@@ -35,7 +34,6 @@
defineReflectiveSuite(() {
arglist_test.main();
combinator_test.main();
- common_usage_test.main();
completion_manager.main();
// TODO(lambdabaa): Run this test once we figure out how to suppress
// output from the tflite shared library
diff --git a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
index f1fd8f5..aea6d40 100644
--- a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
@@ -13,7 +13,6 @@
void main() {
defineReflectiveSuite(() {
defineReflectiveTests(TypeMemberContributorTest);
- defineReflectiveTests(TypeMemberContributorWithNewRelevanceTest);
});
}
@@ -4265,10 +4264,3 @@
assertNotSuggested('e');
}
}
-
-@reflectiveTest
-class TypeMemberContributorWithNewRelevanceTest
- extends TypeMemberContributorTest {
- @override
- bool get useNewRelevance => true;
-}
diff --git a/pkg/analysis_server/test/src/cider/completion_test.dart b/pkg/analysis_server/test/src/cider/completion_test.dart
index f37076b..3439eb2 100644
--- a/pkg/analysis_server/test/src/cider/completion_test.dart
+++ b/pkg/analysis_server/test/src/cider/completion_test.dart
@@ -325,8 +325,8 @@
''');
_assertOrder([
- _assertHasLocalVariable(text: 'a'),
_assertHasLocalVariable(text: 'b'),
+ _assertHasLocalVariable(text: 'a'),
]);
}
diff --git a/pkg/analysis_server/test/src/domains/completion/get_suggestions_available_test.dart b/pkg/analysis_server/test/src/domains/completion/get_suggestions_available_test.dart
index 8053be5..4a2d307 100644
--- a/pkg/analysis_server/test/src/domains/completion/get_suggestions_available_test.dart
+++ b/pkg/analysis_server/test/src/domains/completion/get_suggestions_available_test.dart
@@ -205,7 +205,6 @@
}
Future<void> test_relevanceTags_constructorBeforeClass() async {
- server.options.useNewRelevance = true;
addTestFile(r'''
void foo(List<int> a) {}
@@ -253,8 +252,7 @@
testCode.indexOf(' // ref'),
);
- if (server.options.useNewRelevance) {
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
+ assertJsonText(results.includedSuggestionRelevanceTags, r'''
[
{
"tag": "ElementKind.PREFIX",
@@ -302,16 +300,6 @@
}
]
''');
- } else {
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
-[
- {
- "tag": "package:test/a.dart::MyEnum",
- "relevanceBoost": 1100
- }
-]
-''');
- }
}
Future<void> test_relevanceTags_location_argumentList_named() async {
@@ -328,8 +316,7 @@
testCode.indexOf('); // ref'),
);
- if (server.options.useNewRelevance) {
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
+ assertJsonText(results.includedSuggestionRelevanceTags, r'''
[
{
"tag": "ElementKind.PREFIX",
@@ -377,16 +364,6 @@
}
]
''');
- } else {
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
-[
- {
- "tag": "dart:core::String",
- "relevanceBoost": 10
- }
-]
-''');
- }
}
Future<void> test_relevanceTags_location_argumentList_positional() async {
@@ -403,8 +380,7 @@
testCode.indexOf('); // ref'),
);
- if (server.options.useNewRelevance) {
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
+ assertJsonText(results.includedSuggestionRelevanceTags, r'''
[
{
"tag": "ElementKind.MIXIN",
@@ -460,16 +436,6 @@
}
]
''');
- } else {
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
-[
- {
- "tag": "dart:core::double",
- "relevanceBoost": 10
- }
-]
-''');
- }
}
Future<void> test_relevanceTags_location_assignment() async {
@@ -485,8 +451,7 @@
testCode.indexOf(' // ref'),
);
- if (server.options.useNewRelevance) {
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
+ assertJsonText(results.includedSuggestionRelevanceTags, r'''
[
{
"tag": "ElementKind.PREFIX",
@@ -534,16 +499,6 @@
}
]
''');
- } else {
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
-[
- {
- "tag": "dart:core::int",
- "relevanceBoost": 10
- }
-]
-''');
- }
}
Future<void> test_relevanceTags_location_initializer() async {
@@ -556,8 +511,7 @@
testCode.indexOf(' // ref'),
);
- if (server.options.useNewRelevance) {
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
+ assertJsonText(results.includedSuggestionRelevanceTags, r'''
[
{
"tag": "ElementKind.MIXIN",
@@ -613,16 +567,6 @@
}
]
''');
- } else {
- assertJsonText(results.includedSuggestionRelevanceTags, r'''
-[
- {
- "tag": "dart:core::int",
- "relevanceBoost": 10
- }
-]
-''');
- }
}
Future<void> test_relevanceTags_location_listLiteral() async {
diff --git a/pkg/analysis_server/test/stress/completion/completion_runner.dart b/pkg/analysis_server/test/stress/completion/completion_runner.dart
index 3f69cff..7a1d675 100644
--- a/pkg/analysis_server/test/stress/completion/completion_runner.dart
+++ b/pkg/analysis_server/test/stress/completion/completion_runner.dart
@@ -97,8 +97,7 @@
}
timer.start();
- var request =
- CompletionRequestImpl(result, offset, false, statistics);
+ var request = CompletionRequestImpl(result, offset, statistics);
var suggestions = await request.performance.runRequestOperation(
(performance) async {
return await contributor.computeSuggestions(
diff --git a/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart b/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart
index 13f27be..a0470c9 100644
--- a/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart
+++ b/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart
@@ -60,7 +60,6 @@
var code = await CompletionMetricsComputer(root,
availableSuggestions: result[AVAILABLE_SUGGESTIONS],
overlay: result[OVERLAY],
- skipOldRelevance: result[SKIP_OLD_RELEVANCE],
verbose: result[VERBOSE])
.compute();
stopwatch.stop();
@@ -87,10 +86,6 @@
/// completion offset should be removed.
const String OVERLAY_REMOVE_TOKEN = 'remove-token';
-/// A flag that causes metrics using the old relevance scores to not be
-/// produced.
-const String SKIP_OLD_RELEVANCE = 'skip-old-relevance';
-
/// A flag that causes additional output to be produced.
const String VERBOSE = 'verbose';
@@ -133,12 +128,7 @@
'Before attempting a completion at the location of each token, the '
'token can be removed, or the rest of the file can be removed to test '
'code completion with diverse methods. The default mode is to '
- 'complete at the start of the token without modifying the file.')
- ..addFlag(SKIP_OLD_RELEVANCE,
- help: 'Used to skip the computation of suggestions using the old '
- 'relevance scores.',
- defaultsTo: false,
- negatable: false);
+ 'complete at the start of the token without modifying the file.');
}
/// Print usage information for this tool.
@@ -439,8 +429,6 @@
final String overlay;
- final bool skipOldRelevance;
-
final bool verbose;
ResolvedUnitResult _resolvedUnitResult;
@@ -448,8 +436,6 @@
/// The int to be returned from the [compute] call.
int resultCode;
- CompletionMetrics metricsOldMode;
-
CompletionMetrics metricsNewMode;
final OverlayResourceProvider _provider =
@@ -460,7 +446,6 @@
CompletionMetricsComputer(this.rootPath,
{@required this.availableSuggestions,
@required this.overlay,
- @required this.skipOldRelevance,
@required this.verbose})
: assert(overlay == OVERLAY_NONE ||
overlay == OVERLAY_REMOVE_TOKEN ||
@@ -468,7 +453,6 @@
Future<int> compute() async {
resultCode = 0;
- metricsOldMode = CompletionMetrics('useNewRelevance = false');
metricsNewMode = CompletionMetrics('useNewRelevance = true');
final collection = AnalysisContextCollection(
includedPaths: [rootPath],
@@ -477,9 +461,6 @@
for (var context in collection.contexts) {
await _computeInContext(context.contextRoot);
}
- if (!skipOldRelevance) {
- printMetrics(metricsOldMode);
- }
printMetrics(metricsNewMode);
print('');
@@ -866,13 +847,11 @@
Future<int> handleExpectedCompletion(
{MetricsSuggestionListener listener,
@required CompletionMetrics metrics,
- @required bool printMissedCompletions,
- @required bool useNewRelevance}) async {
+ @required bool printMissedCompletions}) async {
var stopwatch = Stopwatch()..start();
var request = CompletionRequestImpl(
resolvedUnitResult,
expectedCompletion.offset,
- useNewRelevance,
CompletionPerformance(),
);
var directiveInfo = DartdocDirectiveInfo();
@@ -907,49 +886,12 @@
printMissedCompletions);
}
- // First we compute the completions useNewRelevance set to
- // false:
- int oldRank;
- if (!skipOldRelevance) {
- oldRank = await handleExpectedCompletion(
- metrics: metricsOldMode,
- printMissedCompletions: false,
- useNewRelevance: false);
- }
-
- // And again here with useNewRelevance set to true:
+ // Compute the completions.
var listener = MetricsSuggestionListener();
- var newRank = await handleExpectedCompletion(
+ await handleExpectedCompletion(
listener: listener,
metrics: metricsNewMode,
- printMissedCompletions: verbose,
- useNewRelevance: true);
-
- if (!skipOldRelevance && newRank != -1 && oldRank != -1) {
- if (newRank <= oldRank) {
- oldVsNewComparison.count('new relevance');
- } else {
- oldVsNewComparison.count('old relevance');
- }
- }
-
- if (!skipOldRelevance && verbose) {
- if (newRank > 0 && oldRank < 0) {
- print(' ===========');
- print(
- ' The `useNewRelevance = true` generated a completion that `useNewRelevance = false` did not:');
- print(' $expectedCompletion');
- print(' ===========');
- print('');
- } else if (newRank < 0 && oldRank > 0) {
- print(' ===========');
- print(
- ' The `useNewRelevance = false` generated a completion that `useNewRelevance = true` did not:');
- print(' $expectedCompletion');
- print(' ===========');
- print('');
- }
- }
+ printMissedCompletions: verbose);
// If an overlay option is being used, remove the overlay applied
// earlier
diff --git a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
index 43c56a1..b6de9bb 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
@@ -13,7 +13,6 @@
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element;
import 'package:analyzer_plugin/src/utilities/completion/completion_target.dart';
-import 'package:analyzer_plugin/utilities/completion/relevance.dart';
typedef SuggestionsFilter = int Function(DartType dartType, int relevance);
@@ -45,13 +44,6 @@
/// have a non-[void] return type should be suggested.
bool includeReturnValueSuggestions = false;
- /// If [includeReturnValueSuggestions] is set to true, then this function may
- /// be set to a non-default function to filter out potential suggestions
- /// (null) based on their static [DartType], or change the relative relevance
- /// by returning a higher or lower relevance.
- SuggestionsFilter returnValueSuggestionsFilter =
- (DartType _, int relevance) => relevance;
-
/// Indicates whether named arguments should be suggested.
bool includeNamedArgumentSuggestions = false;
@@ -190,17 +182,6 @@
_requiredType = null;
return;
}
-
- returnValueSuggestionsFilter = (DartType dartType, int relevance) {
- if (dartType != null) {
- if (dartType == _requiredType) {
- return relevance + DART_RELEVANCE_BOOST_TYPE;
- } else if (_isSubtypeOf(dartType, _requiredType)) {
- return relevance + DART_RELEVANCE_BOOST_SUBTYPE;
- }
- }
- return relevance;
- };
}
/// Return `true` if the [leftType] is a subtype of the [rightType].
diff --git a/pkg/analyzer_plugin/lib/utilities/completion/relevance.dart b/pkg/analyzer_plugin/lib/utilities/completion/relevance.dart
index 3d9bbd2..33fc86ea 100644
--- a/pkg/analyzer_plugin/lib/utilities/completion/relevance.dart
+++ b/pkg/analyzer_plugin/lib/utilities/completion/relevance.dart
@@ -6,35 +6,9 @@
// Constant values used for relevance values when creating completion
// suggestions in Dart code.
//
-
-/// The relevance boost for available declarations with the matching tag.
-const int DART_RELEVANCE_BOOST_AVAILABLE_DECLARATION = 10;
-
-/// The relevance boost for available enum constants with the matching tag.
-///
-/// It is so large to move enum constants to the very top.
-const int DART_RELEVANCE_BOOST_AVAILABLE_ENUM = 1100;
-
-const int DART_RELEVANCE_BOOST_SUBTYPE = 100;
-const int DART_RELEVANCE_BOOST_TYPE = 200;
-const int DART_RELEVANCE_COMMON_USAGE = 1200;
const int DART_RELEVANCE_DEFAULT = 1000;
const int DART_RELEVANCE_HIGH = 2000;
-const int DART_RELEVANCE_INHERITED_ACCESSOR = 1057;
-const int DART_RELEVANCE_INHERITED_FIELD = 1058;
-const int DART_RELEVANCE_INHERITED_METHOD = 1057;
-const int DART_RELEVANCE_KEYWORD = 1055;
-const int DART_RELEVANCE_LOCAL_ACCESSOR = 1057;
-const int DART_RELEVANCE_LOCAL_FIELD = 1058;
-const int DART_RELEVANCE_LOCAL_FUNCTION = 1056;
-const int DART_RELEVANCE_LOCAL_METHOD = 1057;
-const int DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE = 1056;
-const int DART_RELEVANCE_LOCAL_VARIABLE = 1059;
const int DART_RELEVANCE_LOW = 500;
-const int DART_RELEVANCE_NAMED_PARAMETER = 1060;
-const int DART_RELEVANCE_NAMED_PARAMETER_REQUIRED = 1065;
-const int DART_RELEVANCE_PARAMETER = 1059;
-const int DART_RELEVANCE_TYPE_PARAMETER = 1058;
/// A name scope for constants that are related to the relevance of completion
/// suggestions. The values are required to be in the range [0, 1000].
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index baa6b72..925b489 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -561,8 +561,7 @@
templateCantReadFile.withArguments(uri, e.message), Severity.error);
}
} catch (e) {
- Message message =
- templateExceptionReadingFile.withArguments(uri, e.message);
+ Message message = templateExceptionReadingFile.withArguments(uri, '$e');
reportWithoutLocation(message, Severity.error);
// We throw a new exception to ensure that the message include the uri
// that led to the exception. Exceptions in Uri don't include the
diff --git a/pkg/front_end/lib/src/fasta/builder/function_type_builder.dart b/pkg/front_end/lib/src/fasta/builder/function_type_builder.dart
index f56ac53..b360b52 100644
--- a/pkg/front_end/lib/src/fasta/builder/function_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/function_type_builder.dart
@@ -59,13 +59,13 @@
buffer.write("(");
if (formals != null) {
bool isFirst = true;
- for (dynamic t in formals) {
+ for (FormalParameterBuilder t in formals) {
if (!isFirst) {
buffer.write(", ");
} else {
isFirst = false;
}
- buffer.write(t?.fullNameForErrors);
+ buffer.write(t.fullNameForErrors);
}
}
buffer.write(") ->");
diff --git a/pkg/front_end/lib/src/fasta/command_line_reporting.dart b/pkg/front_end/lib/src/fasta/command_line_reporting.dart
index 137ecd1..1247aea 100644
--- a/pkg/front_end/lib/src/fasta/command_line_reporting.dart
+++ b/pkg/front_end/lib/src/fasta/command_line_reporting.dart
@@ -24,7 +24,7 @@
import 'package:_fe_analyzer_shared/src/util/relativize.dart'
show isWindows, relativizeUri;
-import 'package:kernel/ast.dart' show Location, TreeNode;
+import 'package:kernel/ast.dart' show Location, Source, TreeNode;
import '../compute_platform_binaries_location.dart' show translateSdk;
@@ -43,7 +43,8 @@
/// Formats [message] as a string that is suitable for output from a
/// command-line tool. This includes source snippets and different colors based
/// on [severity].
-String format(LocatedMessage message, Severity severity, {Location location}) {
+String format(LocatedMessage message, Severity severity,
+ {Location location, Map<Uri, Source> uriToSource}) {
try {
int length = message.length;
if (length < 1) {
@@ -85,7 +86,7 @@
if (location?.line == TreeNode.noOffset) {
location = null;
}
- String sourceLine = getSourceLine(location);
+ String sourceLine = getSourceLine(location, uriToSource);
return formatErrorMessage(
sourceLine, location, length, path, messageText);
} else {
diff --git a/pkg/front_end/lib/src/fasta/messages.dart b/pkg/front_end/lib/src/fasta/messages.dart
index a689553..396f054 100644
--- a/pkg/front_end/lib/src/fasta/messages.dart
+++ b/pkg/front_end/lib/src/fasta/messages.dart
@@ -4,7 +4,8 @@
library fasta.messages;
-import 'package:kernel/ast.dart' show Library, Location, Component, TreeNode;
+import 'package:kernel/ast.dart'
+ show Library, Location, Component, Source, TreeNode;
import 'compiler_context.dart' show CompilerContext;
@@ -21,10 +22,10 @@
return getLocation(uri, charOffset);
}
-String getSourceLine(Location location) {
+String getSourceLine(Location location, [Map<Uri, Source> uriToSource]) {
if (location == null) return null;
- return CompilerContext.current.uriToSource[location.file]
- ?.getTextLine(location.line);
+ uriToSource ??= CompilerContext.current.uriToSource;
+ return uriToSource[location.file]?.getTextLine(location.line);
}
Location getLocationFromNode(TreeNode node) {
diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt
index 204181e..6d17e58 100644
--- a/pkg/front_end/test/spell_checking_list_tests.txt
+++ b/pkg/front_end/test/spell_checking_list_tests.txt
@@ -126,6 +126,7 @@
compiler's
complement
completers
+complicated
confidence
confident
confirm
@@ -400,6 +401,7 @@
lints
linux
listening
+listing
literal2
ln
local1a
@@ -463,6 +465,7 @@
newworld
nil
ninja
+noisy
nondefault
nonexisting
noo
diff --git a/pkg/front_end/test/static_types/analysis_helper.dart b/pkg/front_end/test/static_types/analysis_helper.dart
new file mode 100644
index 0000000..f6c6981
--- /dev/null
+++ b/pkg/front_end/test/static_types/analysis_helper.dart
@@ -0,0 +1,342 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// 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:convert' as json;
+import 'dart:io';
+
+import 'package:_fe_analyzer_shared/src/messages/diagnostic_message.dart';
+import 'package:expect/expect.dart';
+import 'package:front_end/src/api_prototype/front_end.dart';
+import 'package:front_end/src/api_prototype/kernel_generator.dart';
+import 'package:front_end/src/api_prototype/terminal_color_support.dart';
+import 'package:front_end/src/api_unstable/ddc.dart';
+import 'package:front_end/src/compute_platform_binaries_location.dart';
+import 'package:front_end/src/fasta/command_line_reporting.dart';
+import 'package:front_end/src/fasta/fasta_codes.dart';
+import 'package:front_end/src/fasta/kernel/redirecting_factory_body.dart';
+import 'package:front_end/src/kernel_generator_impl.dart';
+import 'package:kernel/ast.dart';
+import 'package:kernel/class_hierarchy.dart';
+import 'package:kernel/core_types.dart';
+import 'package:kernel/type_environment.dart';
+
+run(Uri entryPoint, String allowedListPath,
+ {bool verbose = false,
+ bool generate = false,
+ bool analyzedUrisFilter(Uri uri)}) async {
+ CompilerOptions options = new CompilerOptions();
+ options.sdkRoot = computePlatformBinariesLocation(forceBuildDir: true);
+
+ options.onDiagnostic = (DiagnosticMessage message) {
+ printDiagnosticMessage(message, print);
+ };
+ InternalCompilerResult compilerResult = await kernelForProgramInternal(
+ entryPoint, options,
+ retainDataForTesting: true, requireMain: false);
+
+ new DynamicVisitor(options.onDiagnostic, compilerResult.component,
+ allowedListPath, analyzedUrisFilter)
+ .run(verbose: verbose, generate: generate);
+}
+
+class StaticTypeVisitorBase extends RecursiveVisitor<void> {
+ final TypeEnvironment typeEnvironment;
+
+ StaticTypeContext staticTypeContext;
+
+ StaticTypeVisitorBase(Component component, ClassHierarchy classHierarchy)
+ : typeEnvironment =
+ new TypeEnvironment(new CoreTypes(component), classHierarchy);
+
+ @override
+ void visitProcedure(Procedure node) {
+ if (node.kind == ProcedureKind.Factory && isRedirectingFactory(node)) {
+ // Don't visit redirecting factories.
+ return;
+ }
+ staticTypeContext = new StaticTypeContext(node, typeEnvironment);
+ super.visitProcedure(node);
+ staticTypeContext = null;
+ }
+
+ @override
+ void visitField(Field node) {
+ if (isRedirectingFactoryField(node)) {
+ // Skip synthetic .dill members.
+ return;
+ }
+ staticTypeContext = new StaticTypeContext(node, typeEnvironment);
+ super.visitField(node);
+ staticTypeContext = null;
+ }
+
+ @override
+ void visitConstructor(Constructor node) {
+ staticTypeContext = new StaticTypeContext(node, typeEnvironment);
+ super.visitConstructor(node);
+ staticTypeContext = null;
+ }
+}
+
+class DynamicVisitor extends StaticTypeVisitorBase {
+ // TODO(johnniwinther): Enable this when it is less noisy.
+ static const bool checkReturnTypes = false;
+
+ final DiagnosticMessageHandler onDiagnostic;
+ final Component component;
+ final String _allowedListPath;
+ final bool Function(Uri uri) analyzedUrisFilter;
+
+ Map _expectedJson = {};
+ Map<String, Map<String, List<FormattedMessage>>> _actualMessages = {};
+
+ DynamicVisitor(this.onDiagnostic, this.component, this._allowedListPath,
+ this.analyzedUrisFilter)
+ : super(
+ component, new ClassHierarchy(component, new CoreTypes(component)));
+
+ void run({bool verbose = false, bool generate = false}) {
+ if (!generate && _allowedListPath != null) {
+ File file = new File(_allowedListPath);
+ if (file.existsSync()) {
+ try {
+ _expectedJson = json.jsonDecode(file.readAsStringSync());
+ } catch (e) {
+ Expect.fail('Error reading allowed list from $_allowedListPath: $e');
+ }
+ }
+ }
+ component.accept(this);
+ if (generate && _allowedListPath != null) {
+ Map<String, Map<String, int>> actualJson = {};
+ _actualMessages.forEach(
+ (String uri, Map<String, List<FormattedMessage>> actualMessagesMap) {
+ Map<String, int> map = {};
+ actualMessagesMap
+ .forEach((String message, List<FormattedMessage> actualMessages) {
+ map[message] = actualMessages.length;
+ });
+ actualJson[uri] = map;
+ });
+
+ new File(_allowedListPath).writeAsStringSync(
+ new json.JsonEncoder.withIndent(' ').convert(actualJson));
+ return;
+ }
+
+ int errorCount = 0;
+ _expectedJson.forEach((uri, expectedMessages) {
+ Map<String, List<FormattedMessage>> actualMessagesMap =
+ _actualMessages[uri];
+ if (actualMessagesMap == null) {
+ print("Error: Allowed-listing of uri '$uri' isn't used. "
+ "Remove it from the allowed-list.");
+ errorCount++;
+ } else {
+ expectedMessages.forEach((expectedMessage, expectedCount) {
+ List<FormattedMessage> actualMessages =
+ actualMessagesMap[expectedMessage];
+ if (actualMessages == null) {
+ print("Error: Allowed-listing of message '$expectedMessage' "
+ "in uri '$uri' isn't used. Remove it from the allowed-list.");
+ errorCount++;
+ } else {
+ int actualCount = actualMessages.length;
+ if (actualCount != expectedCount) {
+ print("Error: Unexpected count of allowed message "
+ "'$expectedMessage' in uri '$uri'. "
+ "Expected $expectedCount, actual $actualCount:");
+ print(
+ '----------------------------------------------------------');
+ for (FormattedMessage message in actualMessages) {
+ onDiagnostic(message);
+ }
+ print(
+ '----------------------------------------------------------');
+ errorCount++;
+ }
+ }
+ });
+ actualMessagesMap
+ .forEach((String message, List<FormattedMessage> actualMessages) {
+ if (!expectedMessages.containsKey(message)) {
+ for (FormattedMessage message in actualMessages) {
+ onDiagnostic(message);
+ errorCount++;
+ }
+ }
+ });
+ }
+ });
+ _actualMessages.forEach(
+ (String uri, Map<String, List<FormattedMessage>> actualMessagesMap) {
+ if (!_expectedJson.containsKey(uri)) {
+ actualMessagesMap
+ .forEach((String message, List<FormattedMessage> actualMessages) {
+ for (FormattedMessage message in actualMessages) {
+ onDiagnostic(message);
+ errorCount++;
+ }
+ });
+ }
+ });
+ if (errorCount != 0) {
+ print('$errorCount error(s) found.');
+ print("""
+
+********************************************************************************
+* Unexpected dynamic invocations found by test:
+*
+* ${relativizeUri(Platform.script)}
+*
+* Please address the reported errors, or, if the errors are as expected, run
+*
+* dart ${relativizeUri(Platform.script)} -g
+*
+* to update the expectation file.
+********************************************************************************
+""");
+ exit(-1);
+ }
+ if (verbose) {
+ _actualMessages.forEach(
+ (String uri, Map<String, List<FormattedMessage>> actualMessagesMap) {
+ actualMessagesMap
+ .forEach((String message, List<FormattedMessage> actualMessages) {
+ for (FormattedMessage message in actualMessages) {
+ // TODO(johnniwinther): It is unnecessarily complicated to just
+ // add ' (allowed)' to an existing message!
+ LocatedMessage locatedMessage = message.locatedMessage;
+ String newMessageText =
+ '${locatedMessage.messageObject.message} (allowed)';
+ message = locatedMessage.withFormatting(
+ format(
+ new LocatedMessage(
+ locatedMessage.uri,
+ locatedMessage.charOffset,
+ locatedMessage.length,
+ new Message(locatedMessage.messageObject.code,
+ message: newMessageText,
+ tip: locatedMessage.messageObject.tip,
+ arguments: locatedMessage.messageObject.arguments)),
+ Severity.warning,
+ location:
+ new Location(message.uri, message.line, message.column),
+ uriToSource: component.uriToSource),
+ message.line,
+ message.column,
+ Severity.warning,
+ []);
+ onDiagnostic(message);
+ }
+ });
+ });
+ } else {
+ int total = 0;
+ _actualMessages.forEach(
+ (String uri, Map<String, List<FormattedMessage>> actualMessagesMap) {
+ int count = 0;
+ actualMessagesMap
+ .forEach((String message, List<FormattedMessage> actualMessages) {
+ count += actualMessages.length;
+ });
+
+ print('${count} error(s) allowed in $uri');
+ total += count;
+ });
+ if (total > 0) {
+ print('${total} error(s) allowed in total.');
+ }
+ }
+ }
+
+ @override
+ void visitLibrary(Library node) {
+ if (analyzedUrisFilter != null) {
+ if (analyzedUrisFilter(node.importUri)) {
+ super.visitLibrary(node);
+ }
+ } else {
+ super.visitLibrary(node);
+ }
+ }
+
+ @override
+ void visitPropertyGet(PropertyGet node) {
+ DartType receiverType = node.receiver.getStaticType(staticTypeContext);
+ if (receiverType is DynamicType && node.interfaceTarget == null) {
+ registerError(node, "Dynamic access of '${node.name}'.");
+ }
+ super.visitPropertyGet(node);
+ }
+
+ @override
+ void visitPropertySet(PropertySet node) {
+ DartType receiverType = node.receiver.getStaticType(staticTypeContext);
+ if (receiverType is DynamicType) {
+ registerError(node, "Dynamic update to '${node.name}'.");
+ }
+ super.visitPropertySet(node);
+ }
+
+ @override
+ void visitMethodInvocation(MethodInvocation node) {
+ DartType receiverType = node.receiver.getStaticType(staticTypeContext);
+ if (receiverType is DynamicType && node.interfaceTarget == null) {
+ registerError(node, "Dynamic invocation of '${node.name}'.");
+ }
+ super.visitMethodInvocation(node);
+ }
+
+ @override
+ void visitFunctionDeclaration(FunctionDeclaration node) {
+ if (checkReturnTypes && node.function.returnType is DynamicType) {
+ registerError(node, "Dynamic return type");
+ }
+ super.visitFunctionDeclaration(node);
+ }
+
+ @override
+ void visitFunctionExpression(FunctionExpression node) {
+ if (checkReturnTypes && node.function.returnType is DynamicType) {
+ registerError(node, "Dynamic return type");
+ }
+ super.visitFunctionExpression(node);
+ }
+
+ @override
+ void visitProcedure(Procedure node) {
+ if (checkReturnTypes &&
+ node.function.returnType is DynamicType &&
+ node.name.text != 'noSuchMethod') {
+ registerError(node, "Dynamic return type on $node");
+ }
+ super.visitProcedure(node);
+ }
+
+ void registerError(TreeNode node, String message) {
+ Location location = node.location;
+ Uri uri = location.file;
+ String uriString = relativizeUri(uri);
+ Map<String, List<FormattedMessage>> actualMap = _actualMessages.putIfAbsent(
+ uriString, () => <String, List<FormattedMessage>>{});
+ if (uri.scheme == 'org-dartlang-sdk') {
+ location = new Location(Uri.base.resolve(uri.path.substring(1)),
+ location.line, location.column);
+ }
+ LocatedMessage locatedMessage = templateUnspecified
+ .withArguments(message)
+ .withLocation(uri, node.fileOffset, noLength);
+ FormattedMessage diagnosticMessage = locatedMessage.withFormatting(
+ format(locatedMessage, Severity.warning,
+ location: location, uriToSource: component.uriToSource),
+ location.line,
+ location.column,
+ Severity.warning,
+ []);
+ actualMap
+ .putIfAbsent(message, () => <FormattedMessage>[])
+ .add(diagnosticMessage);
+ }
+}
diff --git a/pkg/front_end/test/static_types/cfe_allowed.json b/pkg/front_end/test/static_types/cfe_allowed.json
new file mode 100644
index 0000000..1e26e85
--- /dev/null
+++ b/pkg/front_end/test/static_types/cfe_allowed.json
@@ -0,0 +1,74 @@
+{
+ "pkg/front_end/lib/src/api_prototype/terminal_color_support.dart": {
+ "Dynamic invocation of 'split'.": 1
+ },
+ "pkg/front_end/lib/src/base/libraries_specification.dart": {
+ "Dynamic invocation of 'containsKey'.": 1,
+ "Dynamic invocation of '[]'.": 8,
+ "Dynamic invocation of 'forEach'.": 1,
+ "Dynamic invocation of 'toList'.": 1,
+ "Dynamic invocation of 'map'.": 1,
+ "Dynamic invocation of '[]='.": 1
+ },
+ "pkg/_fe_analyzer_shared/lib/src/util/colors.dart": {
+ "Dynamic access of 'supportsAnsiEscapes'.": 1,
+ "Dynamic invocation of 'split'.": 1
+ },
+ "pkg/_fe_analyzer_shared/lib/src/scanner/token_impl.dart": {
+ "Dynamic access of 'data'.": 1,
+ "Dynamic access of 'start'.": 1,
+ "Dynamic access of 'length'.": 1,
+ "Dynamic access of 'boolValue'.": 2
+ },
+ "pkg/kernel/lib/transformations/value_class.dart": {
+ "Dynamic access of 'text'.": 2,
+ "Dynamic access of 'name'.": 2,
+ "Dynamic access of 'type'.": 1
+ },
+ "pkg/front_end/lib/src/fasta/crash.dart": {
+ "Dynamic access of 'trace'.": 1,
+ "Dynamic access of 'uri'.": 1,
+ "Dynamic access of 'charOffset'.": 1,
+ "Dynamic access of 'error'.": 1
+ },
+ "pkg/front_end/lib/src/fasta/dill/dill_member_builder.dart": {
+ "Dynamic access of 'fileUri'.": 1
+ },
+ "pkg/_fe_analyzer_shared/lib/src/scanner/string_canonicalizer.dart": {
+ "Dynamic invocation of '[]'.": 2
+ },
+ "pkg/front_end/lib/src/fasta/kernel/body_builder.dart": {
+ "Dynamic invocation of 'buildForEffect'.": 1
+ },
+ "pkg/kernel/lib/text/text_serializer.dart": {
+ "Dynamic access of 'first'.": 68,
+ "Dynamic invocation of 'getReference'.": 10,
+ "Dynamic access of 'second'.": 88,
+ "Dynamic access of 'third'.": 29,
+ "Dynamic access of 'fourth'.": 17,
+ "Dynamic access of 'fifth'.": 3,
+ "Dynamic access of 'sixth'.": 2,
+ "Dynamic invocation of 'fold'.": 9,
+ "Dynamic invocation of '|'.": 8,
+ "Dynamic access of 'value'.": 11,
+ "Dynamic access of 'key'.": 11,
+ "Dynamic update to 'name'.": 2,
+ "Dynamic invocation of 'addAnnotation'.": 1,
+ "Dynamic access of 'expressions'.": 1,
+ "Dynamic access of 'length'.": 3,
+ "Dynamic invocation of '+'.": 2,
+ "Dynamic invocation of 'toList'.": 5,
+ "Dynamic invocation of 'cast'.": 5,
+ "Dynamic invocation of 'where'.": 5,
+ "Dynamic access of 'seventh'.": 1
+ },
+ "pkg/_fe_analyzer_shared/lib/src/util/link.dart": {
+ "Dynamic access of 'isEmpty'.": 1
+ },
+ "pkg/_fe_analyzer_shared/lib/src/util/link_implementation.dart": {
+ "Dynamic access of 'isNotEmpty'.": 1,
+ "Dynamic access of 'head'.": 1,
+ "Dynamic access of 'tail'.": 1,
+ "Dynamic access of 'isEmpty'.": 1
+ }
+}
\ No newline at end of file
diff --git a/pkg/front_end/test/static_types/cfe_dynamic_test.dart b/pkg/front_end/test/static_types/cfe_dynamic_test.dart
new file mode 100644
index 0000000..306dc85
--- /dev/null
+++ b/pkg/front_end/test/static_types/cfe_dynamic_test.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// 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 'analysis_helper.dart';
+
+/// Filter function used to only analysis cfe source code.
+bool cfeOnly(Uri uri) {
+ String text = '$uri';
+ for (String path in [
+ 'package:_fe_analyzer_shared/',
+ 'package:kernel/',
+ 'package:front_end/',
+ ]) {
+ if (text.startsWith(path)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+main(List<String> args) async {
+ await run(Uri.base.resolve('pkg/front_end/tool/_fasta/compile.dart'),
+ 'pkg/front_end/test/static_types/cfe_allowed.json',
+ analyzedUrisFilter: cfeOnly,
+ verbose: args.contains('-v'),
+ generate: args.contains('-g'));
+}
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index c1268c8..e5e3d20 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -10369,10 +10369,9 @@
}
@override
- bool operator ==(other) {
+ bool operator ==(Object other) {
if (identical(this, other)) return true;
- if (other is! Version) return false;
- return major == other.major && minor == other.minor;
+ return other is Version && major == other.major && minor == other.minor;
}
@override
diff --git a/pkg/kernel/lib/import_table.dart b/pkg/kernel/lib/import_table.dart
index 051d4ab..6450852 100644
--- a/pkg/kernel/lib/import_table.dart
+++ b/pkg/kernel/lib/import_table.dart
@@ -84,7 +84,7 @@
// To support using custom-uris in unit tests, we don't check directly
// whether the scheme is 'file:', but instead we check that is not 'dart:'
// or 'package:'.
- bool isFileOrCustomScheme(uri) =>
+ bool isFileOrCustomScheme(Uri uri) =>
uri.scheme != '' && uri.scheme != 'package' && uri.scheme != 'dart';
bool isTargetSchemeFileOrCustom = isFileOrCustomScheme(targetUri);
bool isReferenceSchemeFileOrCustom = isFileOrCustomScheme(referenceUri);
diff --git a/pkg/kernel/lib/src/bounds_checks.dart b/pkg/kernel/lib/src/bounds_checks.dart
index ac64f2c..00763ee 100644
--- a/pkg/kernel/lib/src/bounds_checks.dart
+++ b/pkg/kernel/lib/src/bounds_checks.dart
@@ -236,10 +236,10 @@
return hash;
}
- bool operator ==(dynamic other) {
+ bool operator ==(Object other) {
assert(other is TypeArgumentIssue);
- if (other is! TypeArgumentIssue) return false;
- return index == other.index &&
+ return other is TypeArgumentIssue &&
+ index == other.index &&
argument == other.argument &&
typeParameter == other.typeParameter &&
enclosingType == other.enclosingType;
diff --git a/pkg/kernel/lib/text/ast_to_text.dart b/pkg/kernel/lib/text/ast_to_text.dart
index e109f0b..c633646 100644
--- a/pkg/kernel/lib/text/ast_to_text.dart
+++ b/pkg/kernel/lib/text/ast_to_text.dart
@@ -971,7 +971,7 @@
if (name.isRoot) throw 'unexpected root';
if (name.name.startsWith('@')) throw 'unexpected @';
- libraryString(CanonicalName lib) {
+ String libraryString(CanonicalName lib) {
if (lib.reference?.node != null) {
return getLibraryReference(lib.reference.asLibrary);
}
@@ -979,7 +979,7 @@
lib.reference, lib);
}
- classString(CanonicalName cls) =>
+ String classString(CanonicalName cls) =>
libraryString(cls.parent) + '::' + cls.name;
if (name.parent.isRoot) return libraryString(name);
@@ -2336,7 +2336,7 @@
writeSymbol('<');
writeList([node.keyType, node.valueType], writeType);
writeSymbol('>{');
- writeList(node.entries, (entry) {
+ writeList(node.entries, (ConstantMapEntry entry) {
writeConstantReference(entry.key);
writeSymbol(':');
writeConstantReference(entry.value);
diff --git a/pkg/kernel/lib/transformations/continuation.dart b/pkg/kernel/lib/transformations/continuation.dart
index 3900833..adcb888 100644
--- a/pkg/kernel/lib/transformations/continuation.dart
+++ b/pkg/kernel/lib/transformations/continuation.dart
@@ -342,7 +342,7 @@
// This allows us to e.g. "shadow" the original parameter variables with copies
// unique to given sub-closure to prevent shared variables being overwritten.
class ShadowRewriter extends Transformer {
- final enclosingFunction;
+ final FunctionNode enclosingFunction;
Map<VariableDeclaration, VariableDeclaration> _shadowedParameters = {};
ShadowRewriter(this.enclosingFunction) {
diff --git a/runtime/bin/dartdev_isolate.cc b/runtime/bin/dartdev_isolate.cc
index 0153f2f..7b11213 100644
--- a/runtime/bin/dartdev_isolate.cc
+++ b/runtime/bin/dartdev_isolate.cc
@@ -213,15 +213,12 @@
Dart_Handle send_port = Dart_NewSendPort(send_port_id);
CHECK_RESULT(send_port);
- const intptr_t kNumIsolateArgs = 7;
+ const intptr_t kNumIsolateArgs = 4;
Dart_Handle isolate_args[kNumIsolateArgs];
- isolate_args[0] = Dart_Null(); // parentPort
- isolate_args[1] = main_closure; // entryPoint
- isolate_args[2] = runner->dart_options_->CreateRuntimeOptions(); // args
- isolate_args[3] = send_port; // message
- isolate_args[4] = Dart_True(); // isSpawnUri
- isolate_args[5] = Dart_Null(); // controlPort
- isolate_args[6] = Dart_Null(); // capabilities
+ isolate_args[0] = main_closure; // entryPoint
+ isolate_args[1] = runner->dart_options_->CreateRuntimeOptions(); // args
+ isolate_args[2] = send_port; // message
+ isolate_args[3] = Dart_True(); // isSpawnUri
Dart_Handle isolate_lib =
Dart_LookupLibrary(Dart_NewStringFromCString("dart:isolate"));
diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc
index d16d3d6..cb51ea4 100644
--- a/runtime/lib/isolate.cc
+++ b/runtime/lib/isolate.cc
@@ -293,6 +293,272 @@
return Object::null();
}
+class IsolateSpawnState {
+ public:
+ IsolateSpawnState(Dart_Port parent_port,
+ Dart_Port origin_id,
+ const char* script_url,
+ const Function& func,
+ SerializedObjectBuffer* message_buffer,
+ const char* package_config,
+ bool paused,
+ bool errorsAreFatal,
+ Dart_Port onExit,
+ Dart_Port onError,
+ const char* debug_name,
+ IsolateGroup* group);
+ IsolateSpawnState(Dart_Port parent_port,
+ const char* script_url,
+ const char* package_config,
+ SerializedObjectBuffer* args_buffer,
+ SerializedObjectBuffer* message_buffer,
+ bool paused,
+ bool errorsAreFatal,
+ Dart_Port onExit,
+ Dart_Port onError,
+ const char* debug_name,
+ IsolateGroup* group);
+ ~IsolateSpawnState();
+
+ Isolate* isolate() const { return isolate_; }
+ void set_isolate(Isolate* value) { isolate_ = value; }
+
+ Dart_Port parent_port() const { return parent_port_; }
+ Dart_Port origin_id() const { return origin_id_; }
+ Dart_Port on_exit_port() const { return on_exit_port_; }
+ Dart_Port on_error_port() const { return on_error_port_; }
+ const char* script_url() const { return script_url_; }
+ const char* package_config() const { return package_config_; }
+ const char* library_url() const { return library_url_; }
+ const char* class_name() const { return class_name_; }
+ const char* function_name() const { return function_name_; }
+ const char* debug_name() const { return debug_name_; }
+ bool is_spawn_uri() const { return library_url_ == nullptr; }
+ bool paused() const { return paused_; }
+ bool errors_are_fatal() const { return errors_are_fatal_; }
+ Dart_IsolateFlags* isolate_flags() { return &isolate_flags_; }
+
+ ObjectPtr ResolveFunction();
+ InstancePtr BuildArgs(Thread* thread);
+ InstancePtr BuildMessage(Thread* thread);
+
+ IsolateGroup* isolate_group() const { return isolate_group_; }
+
+ private:
+ Isolate* isolate_ = nullptr;
+ Dart_Port parent_port_;
+ Dart_Port origin_id_ = ILLEGAL_PORT;
+ Dart_Port on_exit_port_;
+ Dart_Port on_error_port_;
+ const char* script_url_;
+ const char* package_config_;
+ const char* library_url_ = nullptr;
+ const char* class_name_ = nullptr;
+ const char* function_name_ = nullptr;
+ const char* debug_name_;
+ IsolateGroup* isolate_group_;
+ std::unique_ptr<Message> serialized_args_;
+ std::unique_ptr<Message> serialized_message_;
+
+ Dart_IsolateFlags isolate_flags_;
+ bool paused_;
+ bool errors_are_fatal_;
+};
+
+static const char* NewConstChar(const char* chars) {
+ size_t len = strlen(chars);
+ char* mem = new char[len + 1];
+ memmove(mem, chars, len + 1);
+ return mem;
+}
+
+IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port,
+ Dart_Port origin_id,
+ const char* script_url,
+ const Function& func,
+ SerializedObjectBuffer* message_buffer,
+ const char* package_config,
+ bool paused,
+ bool errors_are_fatal,
+ Dart_Port on_exit_port,
+ Dart_Port on_error_port,
+ const char* debug_name,
+ IsolateGroup* isolate_group)
+ : parent_port_(parent_port),
+ origin_id_(origin_id),
+ on_exit_port_(on_exit_port),
+ on_error_port_(on_error_port),
+ script_url_(script_url),
+ package_config_(package_config),
+ debug_name_(debug_name),
+ isolate_group_(isolate_group),
+ serialized_args_(nullptr),
+ serialized_message_(message_buffer->StealMessage()),
+ paused_(paused),
+ errors_are_fatal_(errors_are_fatal) {
+ auto thread = Thread::Current();
+ auto isolate = thread->isolate();
+ auto zone = thread->zone();
+ const auto& cls = Class::Handle(zone, func.Owner());
+ const auto& lib = Library::Handle(zone, cls.library());
+ const auto& lib_url = String::Handle(zone, lib.url());
+ library_url_ = NewConstChar(lib_url.ToCString());
+
+ String& func_name = String::Handle(zone);
+ func_name = func.name();
+ function_name_ = NewConstChar(String::ScrubName(func_name));
+ if (!cls.IsTopLevel()) {
+ const auto& class_name = String::Handle(zone, cls.Name());
+ class_name_ = NewConstChar(class_name.ToCString());
+ }
+
+ // Inherit flags from spawning isolate.
+ isolate->FlagsCopyTo(isolate_flags());
+}
+
+IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port,
+ const char* script_url,
+ const char* package_config,
+ SerializedObjectBuffer* args_buffer,
+ SerializedObjectBuffer* message_buffer,
+ bool paused,
+ bool errors_are_fatal,
+ Dart_Port on_exit_port,
+ Dart_Port on_error_port,
+ const char* debug_name,
+ IsolateGroup* group)
+ : parent_port_(parent_port),
+ on_exit_port_(on_exit_port),
+ on_error_port_(on_error_port),
+ script_url_(script_url),
+ package_config_(package_config),
+ debug_name_(debug_name),
+ isolate_group_(group),
+ serialized_args_(args_buffer->StealMessage()),
+ serialized_message_(message_buffer->StealMessage()),
+ isolate_flags_(),
+ paused_(paused),
+ errors_are_fatal_(errors_are_fatal) {
+ function_name_ = NewConstChar("main");
+
+ // By default inherit flags from spawning isolate. These can be overridden
+ // from the calling code.
+ Isolate::Current()->FlagsCopyTo(isolate_flags());
+}
+
+IsolateSpawnState::~IsolateSpawnState() {
+ delete[] script_url_;
+ delete[] package_config_;
+ delete[] library_url_;
+ delete[] class_name_;
+ delete[] function_name_;
+ delete[] debug_name_;
+}
+
+ObjectPtr IsolateSpawnState::ResolveFunction() {
+ Thread* thread = Thread::Current();
+ Isolate* I = thread->isolate();
+ Zone* zone = thread->zone();
+
+ const String& func_name = String::Handle(zone, String::New(function_name()));
+
+ if (library_url() == nullptr) {
+ // Handle spawnUri lookup rules.
+ // Check whether the root library defines a main function.
+ const Library& lib =
+ Library::Handle(zone, I->object_store()->root_library());
+ Function& func = Function::Handle(zone, lib.LookupLocalFunction(func_name));
+ if (func.IsNull()) {
+ // Check whether main is reexported from the root library.
+ const Object& obj = Object::Handle(zone, lib.LookupReExport(func_name));
+ if (obj.IsFunction()) {
+ func ^= obj.raw();
+ }
+ }
+ if (func.IsNull()) {
+ const String& msg = String::Handle(
+ zone, String::NewFormatted(
+ "Unable to resolve function '%s' in script '%s'.",
+ function_name(), script_url()));
+ return LanguageError::New(msg);
+ }
+ return func.raw();
+ }
+
+ // Lookup the to be spawned function for the Isolate.spawn implementation.
+ // Resolve the library.
+ const String& lib_url = String::Handle(zone, String::New(library_url()));
+ const Library& lib =
+ Library::Handle(zone, Library::LookupLibrary(thread, lib_url));
+ if (lib.IsNull() || lib.IsError()) {
+ const String& msg = String::Handle(
+ zone,
+ String::NewFormatted("Unable to find library '%s'.", library_url()));
+ return LanguageError::New(msg);
+ }
+
+ // Resolve the function.
+ if (class_name() == nullptr) {
+ const Function& func =
+ Function::Handle(zone, lib.LookupLocalFunction(func_name));
+ if (func.IsNull()) {
+ const String& msg = String::Handle(
+ zone, String::NewFormatted(
+ "Unable to resolve function '%s' in library '%s'.",
+ function_name(), library_url()));
+ return LanguageError::New(msg);
+ }
+ return func.raw();
+ }
+
+ const String& cls_name = String::Handle(zone, String::New(class_name()));
+ const Class& cls = Class::Handle(zone, lib.LookupLocalClass(cls_name));
+ if (cls.IsNull()) {
+ const String& msg = String::Handle(
+ zone, String::NewFormatted(
+ "Unable to resolve class '%s' in library '%s'.", class_name(),
+ (library_url() != nullptr ? library_url() : script_url())));
+ return LanguageError::New(msg);
+ }
+ Function& func = Function::Handle(zone);
+ const auto& error = cls.EnsureIsFinalized(thread);
+ if (error == Error::null()) {
+ func = cls.LookupStaticFunctionAllowPrivate(func_name);
+ }
+ if (func.IsNull()) {
+ const String& msg = String::Handle(
+ zone, String::NewFormatted(
+ "Unable to resolve static method '%s.%s' in library '%s'.",
+ class_name(), function_name(),
+ (library_url() != nullptr ? library_url() : script_url())));
+ return LanguageError::New(msg);
+ }
+ return func.raw();
+}
+
+static InstancePtr DeserializeMessage(Thread* thread, Message* message) {
+ if (message == NULL) {
+ return Instance::null();
+ }
+ Zone* zone = thread->zone();
+ if (message->IsRaw()) {
+ return Instance::RawCast(message->raw_obj());
+ } else {
+ MessageSnapshotReader reader(message, thread);
+ const Object& obj = Object::Handle(zone, reader.ReadObject());
+ ASSERT(!obj.IsError());
+ return Instance::RawCast(obj.raw());
+ }
+}
+
+InstancePtr IsolateSpawnState::BuildArgs(Thread* thread) {
+ return DeserializeMessage(thread, serialized_args_.get());
+}
+
+InstancePtr IsolateSpawnState::BuildMessage(Thread* thread) {
+ return DeserializeMessage(thread, serialized_message_.get());
+}
+
static void ThrowIsolateSpawnException(const String& message) {
const Array& args = Array::Handle(Array::New(1));
args.SetAt(0, message);
@@ -340,9 +606,9 @@
// Make a copy of the state's isolate flags and hand it to the callback.
Dart_IsolateFlags api_flags = *(state_->isolate_flags());
- Isolate* isolate = reinterpret_cast<Isolate*>((create_group_callback)(
+ Dart_Isolate isolate = (create_group_callback)(
state_->script_url(), name, nullptr, state_->package_config(),
- &api_flags, parent_isolate_->init_callback_data(), &error));
+ &api_flags, parent_isolate_->init_callback_data(), &error);
parent_isolate_->DecrementSpawnCount();
parent_isolate_ = nullptr;
@@ -351,15 +617,8 @@
free(error);
return;
}
-
- if (isolate->object_store()->root_library() == Library::null()) {
- Dart_ShutdownIsolate();
- FailedSpawn(
- "The embedder has to ensure there is a root library (e.g. by calling "
- "Dart_LoadScriptFromKernel).");
- }
-
- Run(isolate);
+ Dart_EnterIsolate(isolate);
+ Run(reinterpret_cast<Isolate*>(isolate));
}
void RunLightweight(const char* name) {
@@ -399,28 +658,122 @@
}
isolate->set_init_callback_data(child_isolate_data);
- Dart_ExitIsolate();
Run(isolate);
}
private:
void Run(Isolate* child) {
+ if (!EnsureIsRunnable(child)) {
+ Dart_ShutdownIsolate();
+ return;
+ }
+
state_->set_isolate(child);
+ child->set_origin_id(state_->origin_id());
- MutexLocker ml(child->mutex());
+ bool success = true;
+ {
+ auto thread = Thread::Current();
+ TransitionNativeToVM transition(thread);
+ StackZone zone(thread);
+ HandleScope hs(thread);
+ success = EnqueueEntrypointInvocationAndNotifySpawner(thread);
+ }
+
+ if (!success) {
+ Dart_ShutdownIsolate();
+ return;
+ }
+
+ // All preconditions are met for this to always succeed.
+ char* error = nullptr;
+ if (!Dart_RunLoopAsync(state_->errors_are_fatal(), state_->on_error_port(),
+ state_->on_exit_port(), &error)) {
+ FATAL("Dart_RunLoopAsync() failed: %s. Please file a Dart VM bug report.",
+ error);
+ }
+ }
+
+ bool EnsureIsRunnable(Isolate* child) {
// We called out to the embedder to create/initialize a new isolate. The
// embedder callback sucessfully did so. It is now our responsibility to
// run the isolate.
- // If the isolate was not marked as runnable, we'll do so here and run it
+ // If the isolate was not marked as runnable, we'll do so here and run it.
if (!child->is_runnable()) {
- child->MakeRunnableLocked();
+ const char* error = child->MakeRunnable();
+ if (error != nullptr) {
+ FailedSpawn(error);
+ return false;
+ }
}
ASSERT(child->is_runnable());
+ return true;
+ }
- child->set_origin_id(state_->origin_id());
- child->set_spawn_state(std::move(state_));
- child->RunViaSpawnApi();
+ bool EnqueueEntrypointInvocationAndNotifySpawner(Thread* thread) {
+ auto isolate = thread->isolate();
+
+ // Step 1) Resolve the entrypoint function.
+ auto& result = Object::Handle(thread->zone(), state_->ResolveFunction());
+ const bool is_spawn_uri = state_->is_spawn_uri();
+ if (result.IsError()) {
+ ASSERT(is_spawn_uri);
+ ReportError("Failed to resolve entrypoint function.");
+ return false;
+ }
+ ASSERT(result.IsFunction());
+ auto& func = Function::Handle(thread->zone(), Function::Cast(result).raw());
+ func = func.ImplicitClosureFunction();
+ const auto& entrypoint_closure =
+ Object::Handle(func.ImplicitStaticClosure());
+
+ // Step 2) Enqueue delayed invocation of entrypoint callback.
+ const Array& args = Array::Handle(Array::New(4));
+ args.SetAt(0, entrypoint_closure);
+ args.SetAt(1, Instance::Handle(state_->BuildArgs(thread)));
+ args.SetAt(2, Instance::Handle(state_->BuildMessage(thread)));
+ args.SetAt(3, is_spawn_uri ? Bool::True() : Bool::False());
+
+ const auto& lib = Library::Handle(Library::IsolateLibrary());
+ const auto& entry_name =
+ String::Handle(String::New("_delayEntrypointInvocation"));
+ const auto& entry_point =
+ Function::Handle(lib.LookupLocalFunction(entry_name));
+ ASSERT(entry_point.IsFunction() && !entry_point.IsNull());
+ result = DartEntry::InvokeFunction(entry_point, args);
+ if (result.IsError()) {
+ ReportError("Failed to enqueue delayed entrypoint invocation.");
+ return false;
+ }
+
+ // Step 3) Pause the isolate if required & Notify parent isolate about
+ // isolate creation.
+ const auto& capabilities = Array::Handle(thread->zone(), Array::New(2));
+ auto& capability = Capability::Handle(thread->zone());
+ capability = Capability::New(isolate->pause_capability());
+ capabilities.SetAt(0, capability);
+ capability = Capability::New(isolate->terminate_capability());
+ capabilities.SetAt(1, capability);
+ const auto& send_port =
+ SendPort::Handle(SendPort::New(isolate->main_port()));
+ const auto& message = Array::Handle(thread->zone(), Array::New(2));
+ message.SetAt(0, send_port);
+ message.SetAt(1, capabilities);
+ if (state_->paused()) {
+ capability ^= capabilities.At(0);
+ const bool added = isolate->AddResumeCapability(capability);
+ ASSERT(added);
+ isolate->message_handler()->increment_paused();
+ }
+ {
+ MessageWriter writer(/*can_send_any_object=*/false);
+ // If parent isolate died, we ignore the fact that we cannot notify it.
+ PortMap::PostMessage(writer.WriteMessage(message, state_->parent_port(),
+ Message::kNormalPriority));
+ }
+
+ return true;
}
void FailedSpawn(const char* error) {
diff --git a/runtime/tests/vm/dart/causal_stacks/utils.dart b/runtime/tests/vm/dart/causal_stacks/utils.dart
index 6b3b6e6..ed1549c 100644
--- a/runtime/tests/vm/dart/causal_stacks/utils.dart
+++ b/runtime/tests/vm/dart/causal_stacks/utils.dart
@@ -295,7 +295,7 @@
r'^#4 doTestAwait ',
r'^#5 doTestsCausal ',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -307,7 +307,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -319,7 +319,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -338,7 +338,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -350,7 +350,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -362,7 +362,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -383,7 +383,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -395,7 +395,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -407,7 +407,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -428,7 +428,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -440,7 +440,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -452,7 +452,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -493,7 +493,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -505,7 +505,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -517,7 +517,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -537,7 +537,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -549,7 +549,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -561,7 +561,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -581,7 +581,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -593,7 +593,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -605,7 +605,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -633,7 +633,7 @@
r'#11 doTestsCausal ',
r'<asynchronous suspension>$',
r'#12 main \(.+\)$',
- r'#13 _startIsolate.<anonymous closure> ',
+ r'#13 _delayEntrypointInvocation.<anonymous closure> ',
r'#14 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -645,7 +645,7 @@
r'#11 doTestsCausal ',
r'<asynchronous suspension>$',
r'#12 main \(.+\)$',
- r'#13 _startIsolate.<anonymous closure> ',
+ r'#13 _delayEntrypointInvocation.<anonymous closure> ',
r'#14 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -657,7 +657,7 @@
r'#11 doTestsCausal ',
r'<asynchronous suspension>$',
r'#12 main \(.+\)$',
- r'#13 _startIsolate.<anonymous closure> ',
+ r'#13 _delayEntrypointInvocation.<anonymous closure> ',
r'#14 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -675,7 +675,7 @@
r'^#3 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#4 main \(.+\)$',
- r'^#5 _startIsolate.<anonymous closure> ',
+ r'^#5 _delayEntrypointInvocation.<anonymous closure> ',
r'^#6 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -687,7 +687,7 @@
r'^#3 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#4 main \(.+\)$',
- r'^#5 _startIsolate.<anonymous closure> ',
+ r'^#5 _delayEntrypointInvocation.<anonymous closure> ',
r'^#6 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -699,7 +699,7 @@
r'^#3 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#4 main \(.+\)$',
- r'^#5 _startIsolate.<anonymous closure> ',
+ r'^#5 _delayEntrypointInvocation.<anonymous closure> ',
r'^#6 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -717,7 +717,7 @@
r'^#3 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#4 main \(.+\)$',
- r'^#5 _startIsolate.<anonymous closure> ',
+ r'^#5 _delayEntrypointInvocation.<anonymous closure> ',
r'^#6 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -729,7 +729,7 @@
r'^#3 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#4 main \(.+\)$',
- r'^#5 _startIsolate.<anonymous closure> ',
+ r'^#5 _delayEntrypointInvocation.<anonymous closure> ',
r'^#6 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -741,7 +741,7 @@
r'^#3 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#4 main \(.+\)$',
- r'^#5 _startIsolate.<anonymous closure> ',
+ r'^#5 _delayEntrypointInvocation.<anonymous closure> ',
r'^#6 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
diff --git a/runtime/tests/vm/dart_2/causal_stacks/utils.dart b/runtime/tests/vm/dart_2/causal_stacks/utils.dart
index 743986d..a67a475 100644
--- a/runtime/tests/vm/dart_2/causal_stacks/utils.dart
+++ b/runtime/tests/vm/dart_2/causal_stacks/utils.dart
@@ -295,7 +295,7 @@
r'^#4 doTestAwait ',
r'^#5 doTestsCausal ',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -307,7 +307,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -319,7 +319,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -338,7 +338,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -350,7 +350,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -362,7 +362,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -383,7 +383,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -395,7 +395,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -407,7 +407,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -428,7 +428,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -440,7 +440,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -452,7 +452,7 @@
r'^#5 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#6 main ',
- r'^#7 _startIsolate.<anonymous closure> ',
+ r'^#7 _delayEntrypointInvocation.<anonymous closure> ',
r'^#8 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -493,7 +493,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -505,7 +505,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -517,7 +517,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -537,7 +537,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -549,7 +549,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -561,7 +561,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -581,7 +581,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -593,7 +593,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -605,7 +605,7 @@
r'^#4 doTestsCausal \(.+\)$',
r'^<asynchronous suspension>$',
r'^#5 main \(.+\)$',
- r'^#6 _startIsolate.<anonymous closure> \(.+\)$',
+ r'^#6 _delayEntrypointInvocation.<anonymous closure> \(.+\)$',
r'^#7 _RawReceivePortImpl._handleMessage \(.+\)$',
],
debugInfoFilename);
@@ -633,7 +633,7 @@
r'#11 doTestsCausal ',
r'<asynchronous suspension>$',
r'#12 main \(.+\)$',
- r'#13 _startIsolate.<anonymous closure> ',
+ r'#13 _delayEntrypointInvocation.<anonymous closure> ',
r'#14 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -645,7 +645,7 @@
r'#11 doTestsCausal ',
r'<asynchronous suspension>$',
r'#12 main \(.+\)$',
- r'#13 _startIsolate.<anonymous closure> ',
+ r'#13 _delayEntrypointInvocation.<anonymous closure> ',
r'#14 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -657,7 +657,7 @@
r'#11 doTestsCausal ',
r'<asynchronous suspension>$',
r'#12 main \(.+\)$',
- r'#13 _startIsolate.<anonymous closure> ',
+ r'#13 _delayEntrypointInvocation.<anonymous closure> ',
r'#14 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -675,7 +675,7 @@
r'^#3 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#4 main \(.+\)$',
- r'^#5 _startIsolate.<anonymous closure> ',
+ r'^#5 _delayEntrypointInvocation.<anonymous closure> ',
r'^#6 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -687,7 +687,7 @@
r'^#3 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#4 main \(.+\)$',
- r'^#5 _startIsolate.<anonymous closure> ',
+ r'^#5 _delayEntrypointInvocation.<anonymous closure> ',
r'^#6 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -699,7 +699,7 @@
r'^#3 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#4 main \(.+\)$',
- r'^#5 _startIsolate.<anonymous closure> ',
+ r'^#5 _delayEntrypointInvocation.<anonymous closure> ',
r'^#6 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -717,7 +717,7 @@
r'^#3 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#4 main \(.+\)$',
- r'^#5 _startIsolate.<anonymous closure> ',
+ r'^#5 _delayEntrypointInvocation.<anonymous closure> ',
r'^#6 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -729,7 +729,7 @@
r'^#3 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#4 main \(.+\)$',
- r'^#5 _startIsolate.<anonymous closure> ',
+ r'^#5 _delayEntrypointInvocation.<anonymous closure> ',
r'^#6 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
@@ -741,7 +741,7 @@
r'^#3 doTestsCausal ',
r'^<asynchronous suspension>$',
r'^#4 main \(.+\)$',
- r'^#5 _startIsolate.<anonymous closure> ',
+ r'^#5 _delayEntrypointInvocation.<anonymous closure> ',
r'^#6 _RawReceivePortImpl._handleMessage ',
],
debugInfoFilename);
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 7209a5e..53bfe24 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -2166,7 +2166,7 @@
}
Dart_ExitIsolate();
- isolate->RunViaEmbedder();
+ isolate->Run();
return true;
}
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index f85ce06..3751993 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -138,21 +138,6 @@
return writer.WriteCMessage(obj, dest_port, Message::kNormalPriority);
}
-static InstancePtr DeserializeMessage(Thread* thread, Message* message) {
- if (message == NULL) {
- return Instance::null();
- }
- Zone* zone = thread->zone();
- if (message->IsRaw()) {
- return Instance::RawCast(message->raw_obj());
- } else {
- MessageSnapshotReader reader(message, thread);
- const Object& obj = Object::Handle(zone, reader.ReadObject());
- ASSERT(!obj.IsError());
- return Instance::RawCast(obj.raw());
- }
-}
-
void IsolateGroupSource::add_loaded_blob(
Zone* zone,
const ExternalTypedData& external_typed_data) {
@@ -2055,10 +2040,6 @@
if (is_runnable() == true) {
return "Isolate is already runnable";
}
- if (spawn_state() != nullptr) {
- return "The embedder has to make the isolate runnable during isolate "
- "creation / initialization callback.";
- }
if (object_store()->root_library() == Library::null()) {
return "The embedder has to ensure there is a root library (e.g. by "
"calling Dart_LoadScriptFromKernel ).";
@@ -2070,7 +2051,6 @@
void Isolate::MakeRunnableLocked() {
ASSERT(mutex_.IsOwnedByCurrentThread());
ASSERT(!is_runnable());
- ASSERT(spawn_state() == nullptr);
ASSERT(object_store()->root_library() != Library::null());
// Set the isolate as runnable and if we are being spawned schedule
@@ -2309,102 +2289,6 @@
return listeners.Length() > 0;
}
-static MessageHandler::MessageStatus RunIsolate(uword parameter) {
- Isolate* isolate = reinterpret_cast<Isolate*>(parameter);
- IsolateSpawnState* state = nullptr;
- {
- // TODO(turnidge): Is this locking required here at all anymore?
- MutexLocker ml(isolate->mutex());
- state = isolate->spawn_state();
- }
- {
- StartIsolateScope start_scope(isolate);
- Thread* thread = Thread::Current();
- ASSERT(thread->isolate() == isolate);
- StackZone zone(thread);
- HandleScope handle_scope(thread);
-
- // If particular values were requested for this newly spawned isolate, then
- // they are set here before the isolate starts executing user code.
- isolate->SetErrorsFatal(state->errors_are_fatal());
- if (state->on_exit_port() != ILLEGAL_PORT) {
- const SendPort& listener =
- SendPort::Handle(SendPort::New(state->on_exit_port()));
- isolate->AddExitListener(listener, Instance::null_instance());
- }
- if (state->on_error_port() != ILLEGAL_PORT) {
- const SendPort& listener =
- SendPort::Handle(SendPort::New(state->on_error_port()));
- isolate->AddErrorListener(listener);
- }
-
- // Switch back to spawning isolate.
-
- if (!ClassFinalizer::ProcessPendingClasses()) {
-// Error is in sticky error already.
-#if defined(DEBUG)
- const Error& error = Error::Handle(thread->sticky_error());
- ASSERT(!error.IsUnwindError());
-#endif
- return MessageHandler::kError;
- }
-
- Object& result = Object::Handle();
- result = state->ResolveFunction();
- bool is_spawn_uri = state->is_spawn_uri();
- if (result.IsError()) {
- return StoreError(thread, Error::Cast(result));
- }
- ASSERT(result.IsFunction());
- Function& func = Function::Handle(thread->zone());
- func ^= result.raw();
-
- func = func.ImplicitClosureFunction();
-
- const Array& capabilities = Array::Handle(Array::New(2));
- Capability& capability = Capability::Handle();
- capability = Capability::New(isolate->pause_capability());
- capabilities.SetAt(0, capability);
- // Check whether this isolate should be started in paused state.
- if (state->paused()) {
- bool added = isolate->AddResumeCapability(capability);
- ASSERT(added); // There should be no pending resume capabilities.
- isolate->message_handler()->increment_paused();
- }
- capability = Capability::New(isolate->terminate_capability());
- capabilities.SetAt(1, capability);
-
- // Instead of directly invoking the entry point we call '_startIsolate' with
- // the entry point as argument.
- // Since this function ("RunIsolate") is used for both Isolate.spawn and
- // Isolate.spawnUri we also send a boolean flag as argument so that the
- // "_startIsolate" function can act corresponding to how the isolate was
- // created.
- const Array& args = Array::Handle(Array::New(7));
- args.SetAt(0, SendPort::Handle(SendPort::New(state->parent_port())));
- args.SetAt(1, Instance::Handle(func.ImplicitStaticClosure()));
- args.SetAt(2, Instance::Handle(state->BuildArgs(thread)));
- args.SetAt(3, Instance::Handle(state->BuildMessage(thread)));
- args.SetAt(4, is_spawn_uri ? Bool::True() : Bool::False());
- args.SetAt(5, ReceivePort::Handle(
- ReceivePort::New(isolate->main_port(), Symbols::Empty(),
- true /* control port */)));
- args.SetAt(6, capabilities);
-
- const Library& lib = Library::Handle(Library::IsolateLibrary());
- const String& entry_name = String::Handle(String::New("_startIsolate"));
- const Function& entry_point =
- Function::Handle(lib.LookupLocalFunction(entry_name));
- ASSERT(entry_point.IsFunction() && !entry_point.IsNull());
-
- result = DartEntry::InvokeFunction(entry_point, args);
- if (result.IsError()) {
- return StoreError(thread, Error::Cast(result));
- }
- }
- return MessageHandler::kOK;
-}
-
static void ShutdownIsolate(uword parameter) {
Dart_EnterIsolate(reinterpret_cast<Dart_Isolate>(parameter));
Dart_ShutdownIsolate();
@@ -2417,14 +2301,7 @@
sticky_error_ = sticky_error;
}
-void Isolate::RunViaSpawnApi() {
- ASSERT(spawn_state() != nullptr);
- message_handler()->Run(group()->thread_pool(), RunIsolate, ShutdownIsolate,
- reinterpret_cast<uword>(this));
-}
-
-void Isolate::RunViaEmbedder() {
- ASSERT(spawn_state() == nullptr);
+void Isolate::Run() {
message_handler()->Run(group()->thread_pool(), nullptr, ShutdownIsolate,
reinterpret_cast<uword>(this));
}
@@ -3842,188 +3719,4 @@
}
}
-static const char* NewConstChar(const char* chars) {
- size_t len = strlen(chars);
- char* mem = new char[len + 1];
- memmove(mem, chars, len + 1);
- return mem;
-}
-
-IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port,
- Dart_Port origin_id,
- const char* script_url,
- const Function& func,
- SerializedObjectBuffer* message_buffer,
- const char* package_config,
- bool paused,
- bool errors_are_fatal,
- Dart_Port on_exit_port,
- Dart_Port on_error_port,
- const char* debug_name,
- IsolateGroup* isolate_group)
- : isolate_(nullptr),
- parent_port_(parent_port),
- origin_id_(origin_id),
- on_exit_port_(on_exit_port),
- on_error_port_(on_error_port),
- script_url_(script_url),
- package_config_(package_config),
- library_url_(nullptr),
- class_name_(nullptr),
- function_name_(nullptr),
- debug_name_(debug_name),
- isolate_group_(isolate_group),
- serialized_args_(nullptr),
- serialized_message_(message_buffer->StealMessage()),
- paused_(paused),
- errors_are_fatal_(errors_are_fatal) {
- const Class& cls = Class::Handle(func.Owner());
- const Library& lib = Library::Handle(cls.library());
- const String& lib_url = String::Handle(lib.url());
- library_url_ = NewConstChar(lib_url.ToCString());
-
- String& func_name = String::Handle();
- func_name = func.name();
- function_name_ = NewConstChar(String::ScrubName(func_name));
- if (!cls.IsTopLevel()) {
- const String& class_name = String::Handle(cls.Name());
- class_name_ = NewConstChar(class_name.ToCString());
- }
-
- // Inherit flags from spawning isolate.
- Isolate::Current()->FlagsCopyTo(isolate_flags());
-}
-
-IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port,
- const char* script_url,
- const char* package_config,
- SerializedObjectBuffer* args_buffer,
- SerializedObjectBuffer* message_buffer,
- bool paused,
- bool errors_are_fatal,
- Dart_Port on_exit_port,
- Dart_Port on_error_port,
- const char* debug_name,
- IsolateGroup* group)
- : isolate_(nullptr),
- parent_port_(parent_port),
- origin_id_(ILLEGAL_PORT),
- on_exit_port_(on_exit_port),
- on_error_port_(on_error_port),
- script_url_(script_url),
- package_config_(package_config),
- library_url_(nullptr),
- class_name_(nullptr),
- function_name_(nullptr),
- debug_name_(debug_name),
- isolate_group_(group),
- serialized_args_(args_buffer->StealMessage()),
- serialized_message_(message_buffer->StealMessage()),
- isolate_flags_(),
- paused_(paused),
- errors_are_fatal_(errors_are_fatal) {
- function_name_ = NewConstChar("main");
-
- // By default inherit flags from spawning isolate. These can be overridden
- // from the calling code.
- Isolate::Current()->FlagsCopyTo(isolate_flags());
-}
-
-IsolateSpawnState::~IsolateSpawnState() {
- delete[] script_url_;
- delete[] package_config_;
- delete[] library_url_;
- delete[] class_name_;
- delete[] function_name_;
- delete[] debug_name_;
-}
-
-ObjectPtr IsolateSpawnState::ResolveFunction() {
- Thread* thread = Thread::Current();
- Zone* zone = thread->zone();
-
- const String& func_name = String::Handle(zone, String::New(function_name()));
-
- if (library_url() == nullptr) {
- // Handle spawnUri lookup rules.
- // Check whether the root library defines a main function.
- const Library& lib =
- Library::Handle(zone, I->object_store()->root_library());
- Function& func = Function::Handle(zone, lib.LookupLocalFunction(func_name));
- if (func.IsNull()) {
- // Check whether main is reexported from the root library.
- const Object& obj = Object::Handle(zone, lib.LookupReExport(func_name));
- if (obj.IsFunction()) {
- func ^= obj.raw();
- }
- }
- if (func.IsNull()) {
- const String& msg = String::Handle(
- zone, String::NewFormatted(
- "Unable to resolve function '%s' in script '%s'.",
- function_name(), script_url()));
- return LanguageError::New(msg);
- }
- return func.raw();
- }
-
- // Lookup the to be spawned function for the Isolate.spawn implementation.
- // Resolve the library.
- const String& lib_url = String::Handle(zone, String::New(library_url()));
- const Library& lib =
- Library::Handle(zone, Library::LookupLibrary(thread, lib_url));
- if (lib.IsNull() || lib.IsError()) {
- const String& msg = String::Handle(
- zone,
- String::NewFormatted("Unable to find library '%s'.", library_url()));
- return LanguageError::New(msg);
- }
-
- // Resolve the function.
- if (class_name() == nullptr) {
- const Function& func =
- Function::Handle(zone, lib.LookupLocalFunction(func_name));
- if (func.IsNull()) {
- const String& msg = String::Handle(
- zone, String::NewFormatted(
- "Unable to resolve function '%s' in library '%s'.",
- function_name(), library_url()));
- return LanguageError::New(msg);
- }
- return func.raw();
- }
-
- const String& cls_name = String::Handle(zone, String::New(class_name()));
- const Class& cls = Class::Handle(zone, lib.LookupLocalClass(cls_name));
- if (cls.IsNull()) {
- const String& msg = String::Handle(
- zone, String::NewFormatted(
- "Unable to resolve class '%s' in library '%s'.", class_name(),
- (library_url() != nullptr ? library_url() : script_url())));
- return LanguageError::New(msg);
- }
- Function& func = Function::Handle(zone);
- const auto& error = cls.EnsureIsFinalized(thread);
- if (error == Error::null()) {
- func = cls.LookupStaticFunctionAllowPrivate(func_name);
- }
- if (func.IsNull()) {
- const String& msg = String::Handle(
- zone, String::NewFormatted(
- "Unable to resolve static method '%s.%s' in library '%s'.",
- class_name(), function_name(),
- (library_url() != nullptr ? library_url() : script_url())));
- return LanguageError::New(msg);
- }
- return func.raw();
-}
-
-InstancePtr IsolateSpawnState::BuildArgs(Thread* thread) {
- return DeserializeMessage(thread, serialized_args_.get());
-}
-
-InstancePtr IsolateSpawnState::BuildMessage(Thread* thread) {
- return DeserializeMessage(thread, serialized_message_.get());
-}
-
} // namespace dart
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index 9a8d26e..0034b81 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -58,7 +58,6 @@
class IsolateObjectStore;
class IsolateProfilerData;
class IsolateReloadContext;
-class IsolateSpawnState;
class Log;
class Message;
class MessageHandler;
@@ -226,7 +225,7 @@
const uint8_t* kernel_buffer,
intptr_t kernel_buffer_size,
Dart_IsolateFlags flags)
- : script_uri(script_uri),
+ : script_uri(script_uri == nullptr ? nullptr : Utils::StrDup(script_uri)),
name(Utils::StrDup(name)),
snapshot_data(snapshot_data),
snapshot_instructions(snapshot_instructions),
@@ -237,14 +236,17 @@
script_kernel_size(-1),
loaded_blobs_(nullptr),
num_blob_loads_(0) {}
- ~IsolateGroupSource() { free(name); }
+ ~IsolateGroupSource() {
+ free(script_uri);
+ free(name);
+ }
void add_loaded_blob(Zone* zone_,
const ExternalTypedData& external_typed_data);
// The arguments used for spawning in
// `Dart_CreateIsolateGroupFromKernel` / `Dart_CreateIsolate`.
- const char* script_uri;
+ char* script_uri;
char* name;
const uint8_t* snapshot_data;
const uint8_t* snapshot_instructions;
@@ -939,15 +941,7 @@
const char* MakeRunnable();
void MakeRunnableLocked();
-
- // Runs the isolate if it was created inside the VM as a response to
- // invocation of Dart's `Isolate.spawn` api.
- //
- // It will wake up a potential await'er (e.g. `await Isolate.spawn()`).
- void RunViaSpawnApi();
-
- // Runs the isolate if it was created by the embedder.
- void RunViaEmbedder();
+ void Run();
MessageHandler* message_handler() const { return message_handler_; }
void set_message_handler(MessageHandler* value) { message_handler_ = value; }
@@ -962,11 +956,6 @@
#endif
}
- IsolateSpawnState* spawn_state() const { return spawn_state_.get(); }
- void set_spawn_state(std::unique_ptr<IsolateSpawnState> value) {
- spawn_state_ = std::move(value);
- }
-
Mutex* mutex() { return &mutex_; }
Mutex* constant_canonicalization_mutex() {
return &constant_canonicalization_mutex_;
@@ -1609,7 +1598,6 @@
Mutex kernel_data_class_cache_mutex_;
Mutex kernel_constants_mutex_;
MessageHandler* message_handler_ = nullptr;
- std::unique_ptr<IsolateSpawnState> spawn_state_;
intptr_t defer_finalization_count_ = 0;
MallocGrowableArray<PendingLazyDeopt>* pending_deopts_;
DeoptContext* deopt_context_ = nullptr;
@@ -1757,78 +1745,6 @@
DISALLOW_COPY_AND_ASSIGN(EnterIsolateGroupScope);
};
-class IsolateSpawnState {
- public:
- IsolateSpawnState(Dart_Port parent_port,
- Dart_Port origin_id,
- const char* script_url,
- const Function& func,
- SerializedObjectBuffer* message_buffer,
- const char* package_config,
- bool paused,
- bool errorsAreFatal,
- Dart_Port onExit,
- Dart_Port onError,
- const char* debug_name,
- IsolateGroup* group);
- IsolateSpawnState(Dart_Port parent_port,
- const char* script_url,
- const char* package_config,
- SerializedObjectBuffer* args_buffer,
- SerializedObjectBuffer* message_buffer,
- bool paused,
- bool errorsAreFatal,
- Dart_Port onExit,
- Dart_Port onError,
- const char* debug_name,
- IsolateGroup* group);
- ~IsolateSpawnState();
-
- Isolate* isolate() const { return isolate_; }
- void set_isolate(Isolate* value) { isolate_ = value; }
-
- Dart_Port parent_port() const { return parent_port_; }
- Dart_Port origin_id() const { return origin_id_; }
- Dart_Port on_exit_port() const { return on_exit_port_; }
- Dart_Port on_error_port() const { return on_error_port_; }
- const char* script_url() const { return script_url_; }
- const char* package_config() const { return package_config_; }
- const char* library_url() const { return library_url_; }
- const char* class_name() const { return class_name_; }
- const char* function_name() const { return function_name_; }
- const char* debug_name() const { return debug_name_; }
- bool is_spawn_uri() const { return library_url_ == nullptr; }
- bool paused() const { return paused_; }
- bool errors_are_fatal() const { return errors_are_fatal_; }
- Dart_IsolateFlags* isolate_flags() { return &isolate_flags_; }
-
- ObjectPtr ResolveFunction();
- InstancePtr BuildArgs(Thread* thread);
- InstancePtr BuildMessage(Thread* thread);
-
- IsolateGroup* isolate_group() const { return isolate_group_; }
-
- private:
- Isolate* isolate_;
- Dart_Port parent_port_;
- Dart_Port origin_id_;
- Dart_Port on_exit_port_;
- Dart_Port on_error_port_;
- const char* script_url_;
- const char* package_config_;
- const char* library_url_;
- const char* class_name_;
- const char* function_name_;
- const char* debug_name_;
- IsolateGroup* isolate_group_;
- std::unique_ptr<Message> serialized_args_;
- std::unique_ptr<Message> serialized_message_;
-
- Dart_IsolateFlags isolate_flags_;
- bool paused_;
- bool errors_are_fatal_;
-};
-
} // namespace dart
#endif // RUNTIME_VM_ISOLATE_H_
diff --git a/sdk/lib/_internal/vm/lib/isolate_patch.dart b/sdk/lib/_internal/vm/lib/isolate_patch.dart
index 23d5dfe..34ce5e4 100644
--- a/sdk/lib/_internal/vm/lib/isolate_patch.dart
+++ b/sdk/lib/_internal/vm/lib/isolate_patch.dart
@@ -240,20 +240,12 @@
typedef _BinaryFunction(Never args, Never message);
/**
- * Takes the real entry point as argument and invokes it with the
- * initial message. Defers execution of the entry point until the
- * isolate is in the message loop.
+ * Takes the real entry point as argument and schedules it to run in the message
+ * queue.
*/
@pragma("vm:entry-point", "call")
void _startMainIsolate(Function entryPoint, List<String>? args) {
- _startIsolate(
- null, // no parent port
- entryPoint,
- args,
- null, // no message
- true, // isSpawnUri
- null, // no control port
- null); // no capabilities
+ _delayEntrypointInvocation(entryPoint, args, null, true);
}
/**
@@ -268,47 +260,21 @@
}
/**
- * Takes the real entry point as argument and invokes it with the initial
- * message.
+ * Takes the real entry point as argument and schedules it to run in the message
+ * queue.
*/
@pragma("vm:entry-point", "call")
void _startIsolate(
- SendPort? parentPort,
- Function entryPoint,
- List<String>? args,
- Object? message,
- bool isSpawnUri,
- RawReceivePort? controlPort,
- List? capabilities) {
- // The control port (aka the main isolate port) does not handle any messages.
- if (controlPort != null) {
- controlPort.handler = (_) {}; // Nobody home on the control port.
+ Function entryPoint, List<String>? args, Object? message, bool isSpawnUri) {
+ _delayEntrypointInvocation(entryPoint, args, message, isSpawnUri);
+}
- if (parentPort != null) {
- // Build a message to our parent isolate providing access to the
- // current isolate's control port and capabilities.
- //
- // TODO(floitsch): Send an error message if we can't find the entry point.
- final readyMessage = List<Object?>.filled(2, null);
- readyMessage[0] = controlPort.sendPort;
- readyMessage[1] = capabilities;
-
- // Out of an excess of paranoia we clear the capabilities from the
- // stack. Not really necessary.
- capabilities = null;
- parentPort.send(readyMessage);
- }
- }
- assert(capabilities == null);
-
- // Delay all user code handling to the next run of the message loop. This
- // allows us to intercept certain conditions in the event dispatch, such as
- // starting in paused state.
- RawReceivePort port = new RawReceivePort();
+void _delayEntrypointInvocation(Function entryPoint, List<String>? args,
+ Object? message, bool allowZeroOneOrTwoArgs) {
+ final port = RawReceivePort();
port.handler = (_) {
port.close();
-
- if (isSpawnUri) {
+ if (allowZeroOneOrTwoArgs) {
if (entryPoint is _BinaryFunction) {
(entryPoint as dynamic)(args, message);
} else if (entryPoint is _UnaryFunction) {
@@ -320,7 +286,6 @@
entryPoint(message);
}
};
- // Make sure the message handler is triggered.
port.sendPort.send(null);
}
diff --git a/tools/VERSION b/tools/VERSION
index 4d52c68..e3a1704 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 12
PATCH 0
-PRERELEASE 45
+PRERELEASE 46
PRERELEASE_PATCH 0
\ No newline at end of file