Version 2.6.0-dev.7.0
Merge commit '13fbf569f666e5da17e6dbe05563a95e220e7f9d' into dev
diff --git a/.packages b/.packages
index 281eb23..dc5f1ef 100644
--- a/.packages
+++ b/.packages
@@ -38,6 +38,7 @@
diagnostic:pkg/diagnostic/lib
expect:pkg/expect/lib
fixnum:third_party/pkg/fixnum/lib
+frontend_server:pkg/frontend_server/lib
front_end:pkg/front_end/lib
gardening:tools/gardening/lib
glob:third_party/pkg/glob/lib
diff --git a/BUILD.gn b/BUILD.gn
index a0cbb53..6a6034d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -6,6 +6,12 @@
targetting_fuchsia = target_os == "fuchsia"
+declare_args() {
+ # Whether to use the NNBD fork of the SDK core libraries.
+ # TODO(rnystrom): Remove this when the fork has been merged back in.
+ use_nnbd = false
+}
+
# This target will be built if no target is specified when invoking ninja.
group("default") {
if (targetting_fuchsia) {
diff --git a/DEPS b/DEPS
index 7f92015..be3f1d9 100644
--- a/DEPS
+++ b/DEPS
@@ -84,7 +84,7 @@
# For more details, see https://github.com/dart-lang/sdk/issues/30164
"dart_style_tag": "1.3.1", # Please see the note above before updating.
- "dartdoc_tag" : "v0.28.6",
+ "dartdoc_tag" : "v0.28.7",
"fixnum_tag": "0.10.9",
"glob_tag": "1.1.7",
"html_tag" : "0.14.0+1",
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index e5254c7..109e3fc 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -130,10 +130,6 @@
# Compile for Thread Sanitizer to find threading bugs.
is_tsan = false
-
- # Whether to use the NNBD fork of the SDK core libraries.
- # TODO(rnystrom): Remove this when the fork has been merged back in.
- use_nnbd = false
}
# =============================================================================
diff --git a/build/config/linux/BUILD.gn b/build/config/linux/BUILD.gn
index 141ea68..04e5808 100644
--- a/build/config/linux/BUILD.gn
+++ b/build/config/linux/BUILD.gn
@@ -16,7 +16,7 @@
"-Wl,--exclude-libs=libc++.a",
]
- if (is_asan) {
+ if (is_asan || is_lsan || is_msan || is_tsan) {
ldflags += [ "-lrt" ]
}
diff --git a/build/config/sanitizers/sanitizers.gni b/build/config/sanitizers/sanitizers.gni
index a7b9658..a66b043 100644
--- a/build/config/sanitizers/sanitizers.gni
+++ b/build/config/sanitizers/sanitizers.gni
@@ -6,7 +6,7 @@
# Use libc++ (buildtools/third_party/libc++ and
# buildtools/third_party/libc++abi) instead of stdlibc++ as standard library.
# This is intended to be used for instrumented builds.
- use_custom_libcxx = (is_asan && is_linux) || is_tsan || is_msan
+ use_custom_libcxx = (is_asan && is_linux) || is_lsan || is_msan || is_tsan
# Track where uninitialized memory originates from. From fastest to slowest:
# 0 - no tracking, 1 - track only the initial allocation site, 2 - track the
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index c5d2376..94758fd 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -32,7 +32,6 @@
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/ast/token.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
-import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/member.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/error/codes.dart';
@@ -491,7 +490,8 @@
await _addFix_addExplicitCast();
await _addFix_changeTypeAnnotation();
}
- if (errorCode == StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION) {
+ if (errorCode ==
+ StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION) {
await _addFix_removeParentheses_inGetterInvocation();
}
if (errorCode == StaticTypeWarningCode.NON_BOOL_CONDITION) {
@@ -1456,7 +1456,12 @@
// Prepare parameters.
List<ParameterElement> parameters;
var parent = argumentList.parent;
- if (parent is InstanceCreationExpression) {
+ if (parent is FunctionExpressionInvocation) {
+ var invokeType = parent.staticInvokeType;
+ if (invokeType is FunctionType) {
+ parameters = invokeType.parameters;
+ }
+ } else if (parent is InstanceCreationExpression) {
parameters = parent.staticElement?.parameters;
} else if (parent is MethodInvocation) {
var invokeType = parent.staticInvokeType;
@@ -2094,8 +2099,12 @@
// should be parameter of function type
DartType parameterType = parameterElement.type;
if (parameterType is InterfaceType && parameterType.isDartCoreFunction) {
- ExecutableElement element = new MethodElementImpl('', -1);
- parameterType = new FunctionTypeImpl(element);
+ parameterType = FunctionTypeImpl.synthetic(
+ typeProvider.dynamicType,
+ [],
+ [],
+ nullabilitySuffix: NullabilitySuffix.none,
+ );
}
if (parameterType is! FunctionType) {
return;
@@ -3438,16 +3447,14 @@
}
Future<void> _addFix_removeParentheses_inGetterInvocation() async {
- if (node is SimpleIdentifier && node.parent is MethodInvocation) {
- MethodInvocation invocation = node.parent as MethodInvocation;
- if (invocation.methodName == node && invocation.target != null) {
- var changeBuilder = _newDartChangeBuilder();
- await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
- builder.addDeletion(range.endEnd(node, invocation));
- });
- _addFixFromBuilder(
- changeBuilder, DartFixKind.REMOVE_PARENTHESIS_IN_GETTER_INVOCATION);
- }
+ var invocation = coveredNode?.parent;
+ if (invocation is FunctionExpressionInvocation) {
+ var changeBuilder = _newDartChangeBuilder();
+ await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
+ builder.addDeletion(range.node(invocation.argumentList));
+ });
+ _addFixFromBuilder(
+ changeBuilder, DartFixKind.REMOVE_PARENTHESIS_IN_GETTER_INVOCATION);
}
}
diff --git a/pkg/analysis_server/test/completion_test.dart b/pkg/analysis_server/test/completion_test.dart
index 84426bd..862f6c7 100644
--- a/pkg/analysis_server/test/completion_test.dart
+++ b/pkg/analysis_server/test/completion_test.dart
@@ -995,13 +995,11 @@
buildTests('testCompletion_export_dart', '''
import 'dart:math
-import 'dart:_chrome
import 'dart:_collection.dev
export 'dart:!1''', <String>[
"1+dart:core",
"1+dart:math",
- "1-dart:_chrome",
- "1-dart:_collection.dev"
+ "1-dart:_collection.dev",
]);
buildTests(
@@ -1107,13 +1105,11 @@
buildTests('testCompletion_import_dart', '''
import 'dart:math
-import 'dart:_chrome
import 'dart:_collection.dev
import 'dart:!1''', <String>[
"1+dart:core",
"1+dart:math",
- "1-dart:_chrome",
- "1-dart:_collection.dev"
+ "1-dart:_collection.dev",
]);
buildTests('testCompletion_import_hasStringLiteral_noSemicolon', '''
diff --git a/pkg/analysis_server/test/search/element_references_test.dart b/pkg/analysis_server/test/search/element_references_test.dart
index eadbc58..e42e82c 100644
--- a/pkg/analysis_server/test/search/element_references_test.dart
+++ b/pkg/analysis_server/test/search/element_references_test.dart
@@ -177,12 +177,12 @@
assertHasResult(SearchResultKind.WRITE, 'fff = 2;');
assertHasResult(SearchResultKind.WRITE, 'fff += 3;');
assertHasResult(SearchResultKind.READ, 'fff); // in m()');
- assertHasResult(SearchResultKind.INVOCATION, 'fff(); // in m()');
+ assertHasResult(SearchResultKind.READ, 'fff(); // in m()');
// main()
assertHasResult(SearchResultKind.WRITE, 'fff = 20;');
assertHasResult(SearchResultKind.WRITE, 'fff += 30;');
assertHasResult(SearchResultKind.READ, 'fff); // in main()');
- assertHasResult(SearchResultKind.INVOCATION, 'fff(); // in main()');
+ assertHasResult(SearchResultKind.READ, 'fff(); // in main()');
}
Future<void> test_field_implicit() async {
@@ -266,12 +266,12 @@
assertHasResult(SearchResultKind.WRITE, 'fff = 2;');
assertHasResult(SearchResultKind.WRITE, 'fff += 3;');
assertHasResult(SearchResultKind.READ, 'fff); // in m()');
- assertHasResult(SearchResultKind.INVOCATION, 'fff(); // in m()');
+ assertHasResult(SearchResultKind.READ, 'fff(); // in m()');
// main()
assertHasResult(SearchResultKind.WRITE, 'fff = 20;');
assertHasResult(SearchResultKind.WRITE, 'fff += 30;');
assertHasResult(SearchResultKind.READ, 'fff); // in main()');
- assertHasResult(SearchResultKind.INVOCATION, 'fff(); // in main()');
+ assertHasResult(SearchResultKind.READ, 'fff(); // in main()');
}
test_field_ofExtension_implicit_instance() async {
@@ -489,7 +489,7 @@
assertHasResult(SearchResultKind.READ, 'vvv);');
assertHasResult(SearchResultKind.READ_WRITE, 'vvv += 3');
assertHasResult(SearchResultKind.WRITE, 'vvv = 2');
- assertHasResult(SearchResultKind.INVOCATION, 'vvv();');
+ assertHasResult(SearchResultKind.READ, 'vvv();');
}
Future<void> test_method() async {
@@ -605,7 +605,7 @@
assertHasResult(SearchResultKind.READ, 'ppp);');
assertHasResult(SearchResultKind.READ_WRITE, 'ppp += 3');
assertHasResult(SearchResultKind.WRITE, 'ppp = 2');
- assertHasResult(SearchResultKind.INVOCATION, 'ppp();');
+ assertHasResult(SearchResultKind.READ, 'ppp();');
}
@failingTest
@@ -789,7 +789,7 @@
assertHasResult(SearchResultKind.READ, 'vvv);');
assertHasResult(SearchResultKind.WRITE, 'vvv += 3');
assertHasResult(SearchResultKind.WRITE, 'vvv = 2');
- assertHasResult(SearchResultKind.INVOCATION, 'vvv();');
+ assertHasResult(SearchResultKind.READ, 'vvv();');
}
Future<void> test_topLevelVariable_implicit() async {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_named_arguments_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_named_arguments_test.dart
index b61d6ef..7760596 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_named_arguments_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_named_arguments_test.dart
@@ -32,6 +32,44 @@
await assertNoFix();
}
+ test_functionExpressionInvocation_getter() async {
+ await resolveTestUnit('''
+class A {
+ void Function({int aaa}) get g => null;
+}
+
+main(A a) {
+ a.g(0);
+}
+''');
+ await assertHasFix('''
+class A {
+ void Function({int aaa}) get g => null;
+}
+
+main(A a) {
+ a.g(aaa: 0);
+}
+''');
+ }
+
+ test_functionExpressionInvocation_variable() async {
+ await resolveTestUnit('''
+typedef F = void Function({int aaa});
+
+main(F f) {
+ f(0);
+}
+''');
+ await assertHasFix('''
+typedef F = void Function({int aaa});
+
+main(F f) {
+ f(aaa: 0);
+}
+''');
+ }
+
test_instanceCreation() async {
await resolveTestUnit('''
class A {
@@ -95,44 +133,6 @@
''');
}
- test_methodInvocation_functionTypedGetter() async {
- await resolveTestUnit('''
-class A {
- void Function({int aaa}) get g => null;
-}
-
-main(A a) {
- a.g(0);
-}
-''');
- await assertHasFix('''
-class A {
- void Function({int aaa}) get g => null;
-}
-
-main(A a) {
- a.g(aaa: 0);
-}
-''');
- }
-
- test_methodInvocation_functionTypedVariable() async {
- await resolveTestUnit('''
-typedef F = void Function({int aaa});
-
-main(F f) {
- f(0);
-}
-''');
- await assertHasFix('''
-typedef F = void Function({int aaa});
-
-main(F f) {
- f(aaa: 0);
-}
-''');
- }
-
test_noCompatibleParameter() async {
await resolveTestUnit('''
class A {
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index 427a827..4fffa1a 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -1,7 +1,13 @@
-## 0.38.5-dev
+## 0.38.5
* Added the interface `PromotableElement`, which representing
variables that can be type promoted (local variables and parameters,
but not fields).
+* Deprecated the boolean `AnalysisDriver.useSummary2`. Summary1 support has
+ been removed, so clients should assume Summary2 is in use now.
+* Deprecated the constructor argument `useDart2jsPaths` for SdkLibrariesReader.
+ We now always use Dart2js paths.
+* Bug fixes: #37608, #37708, #37867, #38498, #38565, #38572, #38589, #38641,
+ #38653, #38667, #38695, #38706.
## 0.38.4
* Bug fixes: #33300, #38484, #38505.
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index 5637045..b396c31 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -1207,6 +1207,7 @@
/// typedef F<T> = void Function<U>(T, U);
/// then a single type argument should be provided, and it will be substituted
/// for T.
+ @deprecated
FunctionType instantiate(List<DartType> argumentTypes);
/// Produces the function type resulting from instantiating this typedef with
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 9219d3e..a7f3aef 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -71,6 +71,7 @@
CompileTimeErrorCode.AMBIGUOUS_SET_OR_MAP_LITERAL_EITHER,
CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS,
CompileTimeErrorCode.ANNOTATION_WITH_TYPE_ARGUMENTS,
+ CompileTimeErrorCode.ASSERT_IN_REDIRECTING_CONSTRUCTOR,
CompileTimeErrorCode.ASYNC_FOR_IN_WRONG_CONTEXT,
CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT,
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_EXTENSION_NAME,
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index f28a361..f5a7f9a 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -89,7 +89,7 @@
/// TODO(scheglov) Clean up the list of implicitly analyzed files.
class AnalysisDriver implements AnalysisDriverGeneric {
/// The version of data format, should be incremented on every format change.
- static const int DATA_VERSION = 87;
+ static const int DATA_VERSION = 88;
/// The number of exception contexts allowed to write. Once this field is
/// zero, we stop writing any new exception contexts in this process.
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index ad3606f..23f3f02 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -116,7 +116,6 @@
Set<String> _referencedNames;
String _unlinkedKey;
AnalysisDriverUnlinkedUnit _driverUnlinkedUnit;
- UnlinkedUnit _unlinked;
List<int> _apiSignature;
UnlinkedUnit2 _unlinked2;
@@ -232,10 +231,7 @@
_fsState.externalSummaries.hasUnlinkedUnit(uriStr)) {
return _fsState.externalSummaries.isPartUnit(uriStr);
}
- if (_unlinked2 != null) {
- return !_unlinked2.hasLibraryDirective && _unlinked2.hasPartOfDirective;
- }
- return _unlinked.libraryNameOffset == 0 && _unlinked.isPartOf;
+ return !_unlinked2.hasLibraryDirective && _unlinked2.hasPartOfDirective;
}
/**
@@ -335,11 +331,6 @@
}
/**
- * The [UnlinkedUnit] of the file.
- */
- UnlinkedUnit get unlinked => _unlinked;
-
- /**
* The [UnlinkedUnit2] of the file.
*/
UnlinkedUnit2 get unlinked2 => _unlinked2;
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_context.dart b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
index ab1168e..6998356 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_context.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_context.dart
@@ -73,10 +73,6 @@
}) : this.logger = logger,
this.byteStore = byteStore,
this.analysisSession = session {
- if (externalSummaries != null) {
- store.addStore(externalSummaries);
- }
-
var synchronousSession =
SynchronousSession(analysisOptions, declaredVariables);
analysisContext = new RestrictedAnalysisContext(
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 6bdbfa6..cb5fd11 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -27,7 +27,6 @@
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/sdk.dart' show DartSdk;
import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
import 'package:analyzer/src/generated/utilities_collection.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
@@ -37,16 +36,6 @@
import 'package:analyzer/src/util/comment.dart';
import 'package:meta/meta.dart';
-/// Assert that the given [object] is null, which in the places where this
-/// function is called means that the element is not resynthesized.
-void _assertNotResynthesized(Object object) {
- // TODO(scheglov) I comment this check for now.
- // When we make a decision about switch to the new analysis driver,
- // we will need to rework the analysis code to don't call the setters
- // or restore / inline it.
-// assert(object == null);
-}
-
/// A concrete implementation of a [ClassElement].
abstract class AbstractClassElementImpl extends ElementImpl
implements ClassElement {
@@ -464,13 +453,7 @@
/// An [AbstractClassElementImpl] which is a class.
class ClassElementImpl extends AbstractClassElementImpl
- with TypeParameterizedElementMixin, SimplyBoundableMixin {
- /// The unlinked representation of the class in the summary.
- final UnlinkedClass _unlinkedClass;
-
- /// If this class is resynthesized, whether it has a constant constructor.
- bool _hasConstConstructorCached;
-
+ with TypeParameterizedElementMixin {
/// The superclass of the class, or `null` for [Object].
InterfaceType _supertype;
@@ -508,24 +491,14 @@
/// Initialize a newly created class element to have the given [name] at the
/// given [offset] in the file that contains the declaration of this element.
- ClassElementImpl(String name, int offset)
- : _unlinkedClass = null,
- super(name, offset);
+ ClassElementImpl(String name, int offset) : super(name, offset);
ClassElementImpl.forLinkedNode(CompilationUnitElementImpl enclosing,
Reference reference, AstNode linkedNode)
- : _unlinkedClass = null,
- super.forLinkedNode(enclosing, reference, linkedNode);
+ : super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created class element to have the given [name].
- ClassElementImpl.forNode(Identifier name)
- : _unlinkedClass = null,
- super.forNode(name);
-
- /// Initialize using the given serialized information.
- ClassElementImpl.forSerialized(
- this._unlinkedClass, CompilationUnitElementImpl enclosingUnit)
- : super.forSerialized(enclosingUnit);
+ ClassElementImpl.forNode(Identifier name) : super.forNode(name);
@override
List<PropertyAccessorElement> get accessors {
@@ -541,22 +514,10 @@
}
}
- if (_accessors == null) {
- if (_unlinkedClass != null) {
- _resynthesizeFieldsAndPropertyAccessors();
- }
- }
-
return _accessors ??= const <PropertyAccessorElement>[];
}
@override
- void set accessors(List<PropertyAccessorElement> accessors) {
- _assertNotResynthesized(_unlinkedClass);
- super.accessors = accessors;
- }
-
- @override
List<InterfaceType> get allSupertypes {
List<InterfaceType> list = new List<InterfaceType>();
collectAllSupertypes(list, thisType, thisType);
@@ -568,9 +529,6 @@
if (linkedNode != null) {
return linkedContext.getCodeLength(linkedNode);
}
- if (_unlinkedClass != null) {
- return _unlinkedClass.codeRange?.length;
- }
return super.codeLength;
}
@@ -579,9 +537,6 @@
if (linkedNode != null) {
return linkedContext.getCodeOffset(linkedNode);
}
- if (_unlinkedClass != null) {
- return _unlinkedClass.codeRange?.offset;
- }
return super.codeOffset;
}
@@ -621,36 +576,6 @@
}
}
- if (_unlinkedClass != null) {
- var unlinkedExecutables = _unlinkedClass.executables;
-
- var length = unlinkedExecutables.length;
- if (length != 0) {
- var count = 0;
- for (var i = 0; i < length; i++) {
- var e = unlinkedExecutables[i];
- if (e.kind == UnlinkedExecutableKind.constructor) {
- count++;
- }
- }
-
- if (count != 0) {
- var constructors = new List<ConstructorElement>(count);
- var index = 0;
- for (var i = 0; i < length; i++) {
- var e = unlinkedExecutables[i];
- if (e.kind == UnlinkedExecutableKind.constructor) {
- constructors[index++] =
- new ConstructorElementImpl.forSerialized(e, this);
- }
- }
- return _constructors = constructors;
- }
- }
-
- _constructors = const <ConstructorElement>[];
- }
-
if (_constructors.isEmpty) {
var constructor = new ConstructorElementImpl('', -1);
constructor.isSynthetic = true;
@@ -665,7 +590,6 @@
///
/// Should only be used for class elements that are not mixin applications.
void set constructors(List<ConstructorElement> constructors) {
- _assertNotResynthesized(_unlinkedClass);
assert(!isMixinApplication);
for (ConstructorElement constructor in constructors) {
(constructor as ConstructorElementImpl).enclosingElement = this;
@@ -680,9 +604,6 @@
var comment = context.getDocumentationComment(linkedNode);
return getCommentNodeRawText(comment);
}
- if (_unlinkedClass != null) {
- return _unlinkedClass.documentationComment?.text;
- }
return super.documentationComment;
}
@@ -703,33 +624,20 @@
}
}
- if (_fields == null) {
- if (_unlinkedClass != null) {
- _resynthesizeFieldsAndPropertyAccessors();
- }
- }
-
return _fields ?? const <FieldElement>[];
}
- @override
- void set fields(List<FieldElement> fields) {
- _assertNotResynthesized(_unlinkedClass);
- super.fields = fields;
- }
-
bool get hasBeenInferred {
if (linkedNode != null) {
return linkedContext.hasOverrideInferenceDone(linkedNode);
}
- return _unlinkedClass != null || _hasBeenInferred;
+ return _hasBeenInferred;
}
void set hasBeenInferred(bool hasBeenInferred) {
if (linkedNode != null) {
return linkedContext.setOverrideInferenceDone(linkedNode);
}
- _assertNotResynthesized(_unlinkedClass);
_hasBeenInferred = hasBeenInferred;
}
@@ -820,39 +728,11 @@
} else {
return _interfaces = const [];
}
- } else if (_unlinkedClass != null) {
- var unlinkedInterfaces = _unlinkedClass.interfaces;
- var length = unlinkedInterfaces.length;
- if (length == 0) {
- return _interfaces = const <InterfaceType>[];
- }
-
- ResynthesizerContext context = enclosingUnit.resynthesizerContext;
- var interfaces = new List<InterfaceType>(length);
- var index = 0;
- var hasNonInterfaceType = false;
- for (var i = 0; i < length; i++) {
- var t = unlinkedInterfaces[i];
- var type = context.resolveTypeRef(this, t);
- if (_isInterfaceTypeInterface(type)) {
- interfaces[index++] = type;
- } else {
- hasNonInterfaceType = true;
- }
- }
-
- if (hasNonInterfaceType) {
- interfaces = interfaces.sublist(0, index);
- }
-
- return _interfaces = interfaces;
}
-
return _interfaces = const <InterfaceType>[];
}
void set interfaces(List<InterfaceType> interfaces) {
- _assertNotResynthesized(_unlinkedClass);
_interfaces = interfaces;
}
@@ -861,15 +741,11 @@
if (linkedNode != null) {
return enclosingUnit.linkedContext.isAbstract(linkedNode);
}
- if (_unlinkedClass != null) {
- return _unlinkedClass.isAbstract;
- }
return hasModifier(Modifier.ABSTRACT);
}
/// Set whether this class is abstract.
void set isAbstract(bool isAbstract) {
- _assertNotResynthesized(_unlinkedClass);
setModifier(Modifier.ABSTRACT, isAbstract);
}
@@ -881,9 +757,6 @@
if (linkedNode != null) {
return linkedNode is ClassTypeAlias;
}
- if (_unlinkedClass != null) {
- return _unlinkedClass.isMixinApplication;
- }
return hasModifier(Modifier.MIXIN_APPLICATION);
}
@@ -926,15 +799,6 @@
}
@override
- List<ElementAnnotation> get metadata {
- if (_unlinkedClass != null) {
- return _metadata ??=
- _buildAnnotations(enclosingUnit, _unlinkedClass.annotations);
- }
- return super.metadata;
- }
-
- @override
List<MethodElement> get methods {
if (_methods != null) {
return _methods;
@@ -956,41 +820,11 @@
}).toList();
}
- if (_unlinkedClass != null) {
- var unlinkedExecutables = _unlinkedClass.executables;
-
- var length = unlinkedExecutables.length;
- if (length == 0) {
- return _methods = const <MethodElement>[];
- }
-
- var count = 0;
- for (var i = 0; i < length; i++) {
- var e = unlinkedExecutables[i];
- if (e.kind == UnlinkedExecutableKind.functionOrMethod) {
- count++;
- }
- }
- if (count == 0) {
- return _methods = const <MethodElement>[];
- }
-
- var methods = new List<MethodElement>(count);
- var index = 0;
- for (var i = 0; i < length; i++) {
- var e = unlinkedExecutables[i];
- if (e.kind == UnlinkedExecutableKind.functionOrMethod) {
- methods[index++] = new MethodElementImpl.forSerialized(e, this);
- }
- }
- return _methods = methods;
- }
return _methods = const <MethodElement>[];
}
/// Set the methods contained in this class to the given [methods].
void set methods(List<MethodElement> methods) {
- _assertNotResynthesized(_unlinkedClass);
for (MethodElement method in methods) {
(method as MethodElementImpl).enclosingElement = this;
}
@@ -999,7 +833,6 @@
/// Set whether this class is a mixin application.
void set mixinApplication(bool isMixinApplication) {
- _assertNotResynthesized(_unlinkedClass);
setModifier(Modifier.MIXIN_APPLICATION, isMixinApplication);
}
@@ -1025,45 +858,12 @@
} else {
return _mixins = const [];
}
- } else if (_unlinkedClass != null) {
- var unlinkedMixins = _unlinkedClass.mixins;
- var length = unlinkedMixins.length;
- if (length == 0) {
- return _mixins = const <InterfaceType>[];
- }
-
- ResynthesizerContext context = enclosingUnit.resynthesizerContext;
- var mixins = new List<InterfaceType>(length);
- var index = 0;
- var hasNonInterfaceType = false;
- for (var i = 0; i < length; i++) {
- var t = unlinkedMixins[i];
- var type = context.resolveTypeRef(this, t);
- if (_isInterfaceTypeInterface(type)) {
- mixins[index++] = type;
- } else {
- hasNonInterfaceType = true;
- }
- }
-
- if (hasNonInterfaceType) {
- mixins = mixins.sublist(0, index);
- }
-
- return _mixins = mixins;
}
-
return _mixins = const <InterfaceType>[];
}
void set mixins(List<InterfaceType> mixins) {
- _assertNotResynthesized(_unlinkedClass);
- // Note: if we are using the analysis driver, the set of mixins has already
- // been computed, and it's more accurate (since mixin arguments have been
- // inferred). So we only store mixins if we are using the old task model.
- if (_unlinkedClass == null) {
- _mixins = mixins;
- }
+ _mixins = mixins;
}
@override
@@ -1071,9 +871,6 @@
if (linkedNode != null) {
return reference.name;
}
- if (_unlinkedClass != null) {
- return _unlinkedClass.name;
- }
return super.name;
}
@@ -1082,12 +879,7 @@
if (linkedNode != null) {
return enclosingUnit.linkedContext.getNameOffset(linkedNode);
}
-
- int offset = super.nameOffset;
- if (offset == 0 && _unlinkedClass != null) {
- return _unlinkedClass.nameOffset;
- }
- return offset;
+ return super.nameOffset;
}
/// Names of methods, getters, setters, and operators that this mixin
@@ -1112,27 +904,11 @@
return _supertype = type;
}
return _supertype = this.context.typeProvider.objectType;
- } else if (_unlinkedClass != null) {
- if (_unlinkedClass.supertype != null) {
- DartType type = enclosingUnit.resynthesizerContext
- .resolveTypeRef(this, _unlinkedClass.supertype);
- if (_isInterfaceTypeClass(type)) {
- _supertype = type;
- } else {
- _supertype = context.typeProvider.objectType;
- }
- } else if (_unlinkedClass.hasNoSupertype) {
- return null;
- } else {
- _supertype = context.typeProvider.objectType;
- }
}
-
return _supertype;
}
void set supertype(InterfaceType supertype) {
- _assertNotResynthesized(_unlinkedClass);
_supertype = supertype;
}
@@ -1149,7 +925,6 @@
/// Set the type parameters defined for this class to the given
/// [typeParameters].
void set typeParameters(List<TypeParameterElement> typeParameters) {
- _assertNotResynthesized(_unlinkedClass);
for (TypeParameterElement typeParameter in typeParameters) {
(typeParameter as TypeParameterElementImpl).enclosingElement = this;
}
@@ -1157,10 +932,6 @@
}
@override
- List<UnlinkedTypeParam> get unlinkedTypeParams =>
- _unlinkedClass?.typeParameters;
-
- @override
ConstructorElement get unnamedConstructor {
for (ConstructorElement element in constructors) {
String name = element.displayName;
@@ -1171,21 +942,6 @@
return null;
}
- /// Return whether the class is resynthesized and has a constant constructor.
- bool get _hasConstConstructor {
- if (_hasConstConstructorCached == null) {
- _hasConstConstructorCached = false;
- if (_unlinkedClass != null) {
- _hasConstConstructorCached = _unlinkedClass.executables.any(
- (c) => c.kind == UnlinkedExecutableKind.constructor && c.isConst);
- }
- }
- return _hasConstConstructorCached;
- }
-
- @override
- int get _notSimplyBoundedSlot => _unlinkedClass?.notSimplyBoundedSlot;
-
@override
void appendTo(StringBuffer buffer) {
if (isAbstract) {
@@ -1312,16 +1068,17 @@
// to produce constructors for this class. We want to be robust in the
// face of errors, so drop any extra type arguments and fill in any missing
// ones with `dynamic`.
- List<DartType> parameterTypes =
- TypeParameterTypeImpl.getTypes(supertype.typeParameters);
+ var superTypeParameters = supertype.typeParameters;
List<DartType> argumentTypes = new List<DartType>.filled(
- parameterTypes.length, DynamicTypeImpl.instance);
+ superTypeParameters.length, DynamicTypeImpl.instance);
for (int i = 0; i < supertype.typeArguments.length; i++) {
if (i >= argumentTypes.length) {
break;
}
argumentTypes[i] = supertype.typeArguments[i];
}
+ var substitution =
+ Substitution.fromPairs(superTypeParameters, argumentTypes);
// Now create an implicit constructor for every constructor found above,
// substituting type parameters as appropriate.
@@ -1353,7 +1110,7 @@
implicitParameter.parameterKind = superParameter.parameterKind;
implicitParameter.isSynthetic = true;
implicitParameter.type =
- superParameter.type.substitute2(argumentTypes, parameterTypes);
+ substitution.substituteType(superParameter.type);
implicitParameters[i] = implicitParameter;
}
implicitConstructor.parameters = implicitParameters;
@@ -1447,112 +1204,6 @@
return type is InterfaceType && !type.element.isEnum;
}
- /// Resynthesize explicit fields and property accessors and fill [_fields] and
- /// [_accessors] with explicit and implicit elements.
- void _resynthesizeFieldsAndPropertyAccessors() {
- assert(_fields == null);
- assert(_accessors == null);
-
- var unlinkedFields = _unlinkedClass.fields;
- var unlinkedExecutables = _unlinkedClass.executables;
-
- // Build explicit fields and implicit property accessors.
- List<FieldElement> explicitFields;
- List<PropertyAccessorElement> implicitAccessors;
- var unlinkedFieldsLength = unlinkedFields.length;
- if (unlinkedFieldsLength != 0) {
- explicitFields = new List<FieldElement>(unlinkedFieldsLength);
- implicitAccessors = <PropertyAccessorElement>[];
- for (var i = 0; i < unlinkedFieldsLength; i++) {
- var v = unlinkedFields[i];
- FieldElementImpl field =
- new FieldElementImpl.forSerializedFactory(v, this);
- explicitFields[i] = field;
- implicitAccessors.add(
- new PropertyAccessorElementImpl_ImplicitGetter(field)
- ..enclosingElement = this);
- if (!field.isConst && !field.isFinal) {
- implicitAccessors.add(
- new PropertyAccessorElementImpl_ImplicitSetter(field)
- ..enclosingElement = this);
- }
- }
- } else {
- explicitFields = const <FieldElement>[];
- implicitAccessors = const <PropertyAccessorElement>[];
- }
-
- var unlinkedExecutablesLength = unlinkedExecutables.length;
- var getterSetterCount = 0;
- for (var i = 0; i < unlinkedExecutablesLength; i++) {
- var e = unlinkedExecutables[i];
- if (e.kind == UnlinkedExecutableKind.getter ||
- e.kind == UnlinkedExecutableKind.setter) {
- getterSetterCount++;
- }
- }
-
- // Build explicit property accessors and implicit fields.
- List<PropertyAccessorElement> explicitAccessors;
- Map<String, FieldElementImpl> implicitFields;
- if (getterSetterCount != 0) {
- explicitAccessors = new List<PropertyAccessorElement>(getterSetterCount);
- implicitFields = <String, FieldElementImpl>{};
- var index = 0;
- for (var i = 0; i < unlinkedExecutablesLength; i++) {
- var e = unlinkedExecutables[i];
- if (e.kind == UnlinkedExecutableKind.getter ||
- e.kind == UnlinkedExecutableKind.setter) {
- PropertyAccessorElementImpl accessor =
- new PropertyAccessorElementImpl.forSerialized(e, this);
- explicitAccessors[index++] = accessor;
- // Create or update the implicit field.
- String fieldName = accessor.displayName;
- FieldElementImpl field = implicitFields[fieldName];
- if (field == null) {
- field = new FieldElementImpl(fieldName, -1);
- implicitFields[fieldName] = field;
- field.enclosingElement = this;
- field.isSynthetic = true;
- field.isFinal = e.kind == UnlinkedExecutableKind.getter;
- field.isStatic = e.isStatic;
- } else {
- field.isFinal = false;
- }
- accessor.variable = field;
- if (e.kind == UnlinkedExecutableKind.getter) {
- field.getter = accessor;
- } else {
- field.setter = accessor;
- }
- }
- }
- } else {
- explicitAccessors = const <PropertyAccessorElement>[];
- implicitFields = const <String, FieldElementImpl>{};
- }
-
- // Combine explicit and implicit fields and property accessors.
- if (implicitFields.isEmpty) {
- _fields = explicitFields;
- } else if (explicitFields.isEmpty) {
- _fields = implicitFields.values.toList(growable: false);
- } else {
- _fields = <FieldElement>[]
- ..addAll(explicitFields)
- ..addAll(implicitFields.values);
- }
- if (explicitAccessors.isEmpty) {
- _accessors = implicitAccessors;
- } else if (implicitAccessors.isEmpty) {
- _accessors = explicitAccessors;
- } else {
- _accessors = <PropertyAccessorElement>[]
- ..addAll(explicitAccessors)
- ..addAll(implicitAccessors);
- }
- }
-
bool _safeIsOrInheritsProxy(
ClassElement element, HashSet<ClassElement> visited) {
if (visited.contains(element)) {
@@ -1625,16 +1276,6 @@
/// A concrete implementation of a [CompilationUnitElement].
class CompilationUnitElementImpl extends UriReferencedElementImpl
implements CompilationUnitElement {
- /// The context in which this unit is resynthesized, or `null` if the
- /// element is not resynthesized a summary.
- final ResynthesizerContext resynthesizerContext;
-
- /// The unlinked representation of the unit in the summary.
- final UnlinkedUnit _unlinkedUnit;
-
- /// The unlinked representation of the part in the summary.
- final UnlinkedPart _unlinkedPart;
-
final LinkedUnitContext linkedContext;
/// The source that corresponds to this compilation unit.
@@ -1690,36 +1331,15 @@
/// Resynthesized explicit top-level variables.
UnitExplicitTopLevelVariables _explicitTopLevelVariables;
- /// Description of top-level variable replacements that should be applied
- /// to implicit top-level variables because of re-linking top-level property
- /// accessors between different unit of the same library.
- Map<TopLevelVariableElement, TopLevelVariableElement>
- _topLevelVariableReplaceMap;
-
/// Initialize a newly created compilation unit element to have the given
/// [name].
CompilationUnitElementImpl()
- : resynthesizerContext = null,
- _unlinkedUnit = null,
- _unlinkedPart = null,
- linkedContext = null,
+ : linkedContext = null,
super(null, -1);
CompilationUnitElementImpl.forLinkedNode(LibraryElementImpl enclosingLibrary,
this.linkedContext, Reference reference, CompilationUnit linkedNode)
- : resynthesizerContext = null,
- _unlinkedUnit = null,
- _unlinkedPart = null,
- super.forLinkedNode(enclosingLibrary, reference, linkedNode) {
- _nameOffset = -1;
- }
-
- /// Initialize using the given serialized information.
- CompilationUnitElementImpl.forSerialized(LibraryElementImpl enclosingLibrary,
- this.resynthesizerContext, this._unlinkedUnit, this._unlinkedPart)
- : linkedContext = null,
- super.forSerialized(null) {
- _enclosingElement = enclosingLibrary;
+ : super.forLinkedNode(enclosingLibrary, reference, linkedNode) {
_nameOffset = -1;
}
@@ -1733,12 +1353,6 @@
return _accessors;
}
- if (_unlinkedUnit != null) {
- _explicitTopLevelAccessors ??=
- resynthesizerContext.buildTopLevelAccessors();
- _explicitTopLevelVariables ??=
- resynthesizerContext.buildTopLevelVariables();
- }
if (_explicitTopLevelAccessors != null) {
_accessors = <PropertyAccessorElementImpl>[]
..addAll(_explicitTopLevelAccessors.accessors)
@@ -1762,9 +1376,6 @@
if (linkedNode != null) {
return linkedContext.getCodeLength(linkedNode);
}
- if (_unlinkedUnit != null) {
- return _unlinkedUnit.codeRange?.length;
- }
return super.codeLength;
}
@@ -1773,9 +1384,6 @@
if (linkedNode != null) {
return linkedContext.getCodeOffset(linkedNode);
}
- if (_unlinkedUnit != null) {
- return _unlinkedUnit.codeRange?.offset;
- }
return super.codeOffset;
}
@@ -1805,17 +1413,11 @@
}).toList();
}
- if (_unlinkedUnit != null) {
- return _enums = _unlinkedUnit.enums
- .map((e) => new EnumElementImpl.forSerialized(e, this))
- .toList(growable: false);
- }
return _enums ??= const <ClassElement>[];
}
/// Set the enums contained in this compilation unit to the given [enums].
void set enums(List<ClassElement> enums) {
- _assertNotResynthesized(_unlinkedUnit);
for (ClassElement enumDeclaration in enums) {
(enumDeclaration as EnumElementImpl).enclosingElement = this;
}
@@ -1846,12 +1448,7 @@
}
}
return _extensions;
- } else if (_unlinkedUnit != null) {
- return _extensions = _unlinkedUnit.extensions
- .map((e) => ExtensionElementImpl.forSerialized(e, this))
- .toList(growable: false);
}
-
return _extensions ?? const <ExtensionElement>[];
}
@@ -1882,11 +1479,6 @@
}
return FunctionElementImpl.forLinkedNode(this, reference, node);
}).toList();
- } else if (_unlinkedUnit != null) {
- _functions = _unlinkedUnit.executables
- .where((e) => e.kind == UnlinkedExecutableKind.functionOrMethod)
- .map((e) => new FunctionElementImpl.forSerialized(e, this))
- .toList(growable: false);
}
return _functions ?? const <FunctionElement>[];
}
@@ -1925,11 +1517,6 @@
}).toList();
}
- if (_unlinkedUnit != null) {
- _typeAliases = _unlinkedUnit.typedefs.map((t) {
- return new GenericTypeAliasElementImpl.forSerialized(t, this);
- }).toList(growable: false);
- }
return _typeAliases ?? const <FunctionTypeAliasElement>[];
}
@@ -1954,18 +1541,6 @@
ElementKind get kind => ElementKind.COMPILATION_UNIT;
@override
- List<ElementAnnotation> get metadata {
- if (_metadata == null) {
- if (_unlinkedPart != null) {
- return _metadata = _buildAnnotations(
- library.definingCompilationUnit as CompilationUnitElementImpl,
- _unlinkedPart.annotations);
- }
- }
- return super.metadata;
- }
-
- @override
List<ClassElement> get mixins {
if (_mixins != null) return _mixins;
@@ -1983,17 +1558,11 @@
}).toList();
}
- if (_unlinkedUnit != null) {
- return _mixins = _unlinkedUnit.mixins
- .map((c) => new MixinElementImpl.forSerialized(c, this))
- .toList(growable: false);
- }
return _mixins ?? const <ClassElement>[];
}
/// Set the mixins contained in this compilation unit to the given [mixins].
void set mixins(List<ClassElement> mixins) {
- _assertNotResynthesized(_unlinkedUnit);
for (MixinElementImpl type in mixins) {
type.enclosingElement = this;
}
@@ -2008,39 +1577,12 @@
assert(_variables != null);
return _variables;
}
- if (_variables == null) {
- if (_unlinkedUnit != null) {
- _explicitTopLevelAccessors ??=
- resynthesizerContext.buildTopLevelAccessors();
- _explicitTopLevelVariables ??=
- resynthesizerContext.buildTopLevelVariables();
- }
- if (_explicitTopLevelVariables != null) {
- var variables = <TopLevelVariableElement>[]
- ..addAll(_explicitTopLevelVariables.variables)
- ..addAll(_explicitTopLevelAccessors.implicitVariables);
-
- // Ensure that getters and setters in different units use
- // the same top-level variables.
- BuildLibraryElementUtils.patchTopLevelAccessors(library);
-
- // Apply recorded patches to variables.
- _topLevelVariableReplaceMap?.forEach((from, to) {
- int index = variables.indexOf(from);
- variables[index] = to;
- });
- _topLevelVariableReplaceMap = null;
-
- _variables = variables;
- }
- }
return _variables ?? const <TopLevelVariableElement>[];
}
/// Set the top-level variables contained in this compilation unit to the
/// given[variables].
void set topLevelVariables(List<TopLevelVariableElement> variables) {
- assert(!isResynthesized);
for (TopLevelVariableElement field in variables) {
(field as TopLevelVariableElementImpl).enclosingElement = this;
}
@@ -2050,7 +1592,6 @@
/// Set the function type aliases contained in this compilation unit to the
/// given [typeAliases].
void set typeAliases(List<FunctionTypeAliasElement> typeAliases) {
- _assertNotResynthesized(_unlinkedUnit);
for (FunctionTypeAliasElement typeAlias in typeAliases) {
(typeAlias as ElementImpl).enclosingElement = this;
}
@@ -2089,18 +1630,11 @@
return _types;
}
- if (_unlinkedUnit != null) {
- return _types = _unlinkedUnit.classes
- .map((c) => new ClassElementImpl.forSerialized(c, this))
- .toList(growable: false);
- }
-
return _types ?? const <ClassElement>[];
}
/// Set the types contained in this compilation unit to the given [types].
void set types(List<ClassElement> types) {
- _assertNotResynthesized(_unlinkedUnit);
for (ClassElement type in types) {
// Another implementation of ClassElement is _DeferredClassElement,
// which is used to resynthesize classes lazily. We cannot cast it
@@ -2208,17 +1742,8 @@
/// unit.
void replaceTopLevelVariable(
TopLevelVariableElement from, TopLevelVariableElement to) {
- if (_unlinkedUnit != null) {
- // Getters and setter in different units should be patched to use the
- // same variables before these variables were asked and returned.
- assert(_variables == null);
- _topLevelVariableReplaceMap ??=
- <TopLevelVariableElement, TopLevelVariableElement>{};
- _topLevelVariableReplaceMap[from] = to;
- } else {
- int index = _variables.indexOf(from);
- _variables[index] = to;
- }
+ int index = _variables.indexOf(from);
+ _variables[index] = to;
}
/// Set the annotations associated with the directive at the given [offset] to
@@ -2357,26 +1882,18 @@
/// Initialize a newly created field element to have the given [name].
ConstFieldElementImpl.forNode(Identifier name) : super.forNode(name);
-
- /// Initialize using the given serialized information.
- ConstFieldElementImpl.forSerialized(
- UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement)
- : super.forSerialized(unlinkedVariable, enclosingElement);
}
/// A field element representing an enum constant.
class ConstFieldElementImpl_EnumValue extends ConstFieldElementImpl_ofEnum {
- final UnlinkedEnumValue _unlinkedEnumValue;
final int _index;
- ConstFieldElementImpl_EnumValue(
- EnumElementImpl enumElement, this._unlinkedEnumValue, this._index)
+ ConstFieldElementImpl_EnumValue(EnumElementImpl enumElement, this._index)
: super(enumElement);
ConstFieldElementImpl_EnumValue.forLinkedNode(EnumElementImpl enumElement,
Reference reference, AstNode linkedNode, this._index)
- : _unlinkedEnumValue = null,
- super.forLinkedNode(enumElement, reference, linkedNode);
+ : super.forLinkedNode(enumElement, reference, linkedNode);
@override
Expression get constantInitializer => null;
@@ -2388,9 +1905,6 @@
var comment = context.getDocumentationComment(linkedNode);
return getCommentNodeRawText(comment);
}
- if (_unlinkedEnumValue != null) {
- return _unlinkedEnumValue.documentationComment?.text;
- }
return super.documentationComment;
}
@@ -2409,22 +1923,10 @@
}
@override
- List<ElementAnnotation> get metadata {
- if (_unlinkedEnumValue != null) {
- return _metadata ??=
- _buildAnnotations(enclosingUnit, _unlinkedEnumValue.annotations);
- }
- return super.metadata;
- }
-
- @override
String get name {
if (linkedNode != null) {
return reference.name;
}
- if (_unlinkedEnumValue != null) {
- return _unlinkedEnumValue.name;
- }
return super.name;
}
@@ -2433,13 +1935,7 @@
if (linkedNode != null) {
return enclosingUnit.linkedContext.getNameOffset(linkedNode);
}
- int offset = super.nameOffset;
- if (offset == -1) {
- if (_unlinkedEnumValue != null) {
- return _unlinkedEnumValue.nameOffset;
- }
- }
- return offset;
+ return super.nameOffset;
}
@override
@@ -2575,11 +2071,6 @@
/// Initialize a newly created constructor element to have the given [name].
ConstructorElementImpl.forNode(Identifier name) : super.forNode(name);
- /// Initialize using the given serialized information.
- ConstructorElementImpl.forSerialized(
- UnlinkedExecutable serializedExecutable, ClassElementImpl enclosingClass)
- : super.forSerialized(serializedExecutable, enclosingClass);
-
/// Return the constant initializers for this element, which will be empty if
/// there are no initializers, or `null` if there was an error in the source.
List<ConstructorInitializer> get constantInitializers {
@@ -2591,18 +2082,11 @@
);
}
- if (serializedExecutable != null) {
- return _constantInitializers = serializedExecutable.constantInitializers
- .map((i) => _buildConstructorInitializer(i))
- .toList(growable: false);
- }
-
return _constantInitializers;
}
void set constantInitializers(
List<ConstructorInitializer> constantInitializers) {
- _assertNotResynthesized(serializedExecutable);
_constantInitializers = constantInitializers;
}
@@ -2624,7 +2108,6 @@
/// Set whether this constructor represents a factory method.
void set factory(bool isFactory) {
- _assertNotResynthesized(serializedExecutable);
setModifier(Modifier.FACTORY, isFactory);
}
@@ -2634,24 +2117,15 @@
ConstructorDeclaration linkedNode = this.linkedNode;
return linkedNode.constKeyword != null;
}
- if (serializedExecutable != null) {
- return serializedExecutable.isConst;
- }
return hasModifier(Modifier.CONST);
}
/// Set whether this constructor represents a 'const' constructor.
void set isConst(bool isConst) {
- _assertNotResynthesized(serializedExecutable);
setModifier(Modifier.CONST, isConst);
}
bool get isCycleFree {
- if (serializedExecutable != null) {
- return serializedExecutable.isConst &&
- !enclosingUnit.resynthesizerContext
- .isInConstCycle(serializedExecutable.constCycleSlot);
- }
return _isCycleFree;
}
@@ -2684,9 +2158,6 @@
ConstructorDeclaration linkedNode = this.linkedNode;
return linkedNode.factoryKeyword != null;
}
- if (serializedExecutable != null) {
- return serializedExecutable.isFactory;
- }
return hasModifier(Modifier.FACTORY);
}
@@ -2715,18 +2186,10 @@
}
}
- if (serializedExecutable != null) {
- if (serializedExecutable.name.isNotEmpty) {
- return serializedExecutable.nameEnd;
- } else {
- return serializedExecutable.nameOffset + enclosingElement.name.length;
- }
- }
return _nameEnd;
}
void set nameEnd(int nameEnd) {
- _assertNotResynthesized(serializedExecutable);
_nameEnd = nameEnd;
}
@@ -2737,16 +2200,10 @@
return node.period?.offset;
}
- if (serializedExecutable != null) {
- if (serializedExecutable.name.isNotEmpty) {
- return serializedExecutable.periodOffset;
- }
- }
return _periodOffset;
}
void set periodOffset(int periodOffset) {
- _assertNotResynthesized(serializedExecutable);
_periodOffset = periodOffset;
}
@@ -2770,26 +2227,10 @@
return null;
}
- if (serializedExecutable != null) {
- if (serializedExecutable.isRedirectedConstructor) {
- if (serializedExecutable.isFactory) {
- _redirectedConstructor = enclosingUnit.resynthesizerContext
- .resolveConstructorRef(
- enclosingElement, serializedExecutable.redirectedConstructor);
- } else {
- _redirectedConstructor = enclosingElement.getNamedConstructor(
- serializedExecutable.redirectedConstructorName);
- }
- } else {
- return null;
- }
- }
-
return _redirectedConstructor;
}
void set redirectedConstructor(ConstructorElement redirectedConstructor) {
- _assertNotResynthesized(serializedExecutable);
_redirectedConstructor = redirectedConstructor;
}
@@ -2850,64 +2291,6 @@
@override
ConstructorDeclaration computeNode() =>
getNodeMatching((node) => node is ConstructorDeclaration);
-
- /// Resynthesize the AST for the given serialized constructor initializer.
- ConstructorInitializer _buildConstructorInitializer(
- UnlinkedConstructorInitializer serialized) {
- UnlinkedConstructorInitializerKind kind = serialized.kind;
- String name = serialized.name;
- List<Expression> arguments = <Expression>[];
- {
- int numArguments = serialized.arguments.length;
- int numNames = serialized.argumentNames.length;
- for (int i = 0; i < numArguments; i++) {
- Expression expression = enclosingUnit.resynthesizerContext
- .buildExpression(this, serialized.arguments[i]);
- int nameIndex = numNames + i - numArguments;
- if (nameIndex >= 0) {
- expression = AstTestFactory.namedExpression2(
- serialized.argumentNames[nameIndex], expression);
- }
- arguments.add(expression);
- }
- }
- switch (kind) {
- case UnlinkedConstructorInitializerKind.field:
- ConstructorFieldInitializer initializer =
- AstTestFactory.constructorFieldInitializer(
- false,
- name,
- enclosingUnit.resynthesizerContext
- .buildExpression(this, serialized.expression));
- initializer.fieldName.staticElement = enclosingElement.getField(name);
- return initializer;
- case UnlinkedConstructorInitializerKind.assertInvocation:
- return AstTestFactory.assertInitializer(
- arguments[0], arguments.length > 1 ? arguments[1] : null);
- case UnlinkedConstructorInitializerKind.superInvocation:
- SuperConstructorInvocation initializer =
- AstTestFactory.superConstructorInvocation2(
- name.isNotEmpty ? name : null, arguments);
- ClassElement superElement = enclosingElement.supertype.element;
- ConstructorElement element = name.isEmpty
- ? superElement.unnamedConstructor
- : superElement.getNamedConstructor(name);
- initializer.staticElement = element;
- initializer.constructorName?.staticElement = element;
- return initializer;
- case UnlinkedConstructorInitializerKind.thisInvocation:
- RedirectingConstructorInvocation initializer =
- AstTestFactory.redirectingConstructorInvocation2(
- name.isNotEmpty ? name : null, arguments);
- ConstructorElement element = name.isEmpty
- ? enclosingElement.unnamedConstructor
- : enclosingElement.getNamedConstructor(name);
- initializer.staticElement = element;
- initializer.constructorName?.staticElement = element;
- return initializer;
- }
- return null;
- }
}
/// A [TopLevelVariableElement] for a top-level 'const' variable that has an
@@ -2927,11 +2310,6 @@
/// [name].
ConstTopLevelVariableElementImpl.forNode(Identifier name)
: super.forNode(name);
-
- /// Initialize using the given serialized information.
- ConstTopLevelVariableElementImpl.forSerialized(
- UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement)
- : super.forSerialized(unlinkedVariable, enclosingElement);
}
/// Mixin used by elements that represent constant variables and have
@@ -2963,15 +2341,10 @@
return _constantInitializer = context.readInitializer(linkedNode);
}
- if (_unlinkedConst != null) {
- _constantInitializer = enclosingUnit.resynthesizerContext
- .buildExpression(this, _unlinkedConst);
- }
return _constantInitializer;
}
void set constantInitializer(Expression constantInitializer) {
- _assertNotResynthesized(_unlinkedConst);
_constantInitializer = constantInitializer;
}
@@ -2984,10 +2357,6 @@
@override
bool get isConstantEvaluated => _evaluationResult != null;
- /// If this element is resynthesized from the summary, return the unlinked
- /// initializer, otherwise return `null`.
- UnlinkedExpr get _unlinkedConst;
-
/// Return a representation of the value of this variable, forcing the value
/// to be computed if it had not previously been computed, or `null` if either
/// this variable was not declared with the 'const' modifier or if the value
@@ -3017,11 +2386,6 @@
/// Initialize a newly created parameter element to have the given [name].
DefaultFieldFormalParameterElementImpl.forNode(Identifier name)
: super.forNode(name);
-
- /// Initialize using the given serialized information.
- DefaultFieldFormalParameterElementImpl.forSerialized(
- UnlinkedParam unlinkedParam, ElementImpl enclosingElement)
- : super.forSerialized(unlinkedParam, enclosingElement);
}
/// A [ParameterElement] for parameters that have an initializer.
@@ -3039,11 +2403,6 @@
/// Initialize a newly created parameter element to have the given [name].
DefaultParameterElementImpl.forNode(Identifier name) : super.forNode(name);
- /// Initialize using the given serialized information.
- DefaultParameterElementImpl.forSerialized(
- UnlinkedParam unlinkedParam, ElementImpl enclosingElement)
- : super.forSerialized(unlinkedParam, enclosingElement);
-
@deprecated
@override
DefaultFormalParameter computeNode() =>
@@ -3417,7 +2776,6 @@
/// The documentation comment source for this element.
void set documentationComment(String doc) {
- assert(!isResynthesized);
_docComment = doc?.replaceAll('\r\n', '\n');
}
@@ -3662,9 +3020,6 @@
@override
bool get isRequired => hasRequired;
- /// Return `true` if this element is resynthesized from a summary.
- bool get isResynthesized => enclosingUnit?.resynthesizerContext != null;
-
@override
bool get isSynthetic {
if (linkedNode != null) {
@@ -3713,7 +3068,6 @@
}
void set metadata(List<ElementAnnotation> metadata) {
- assert(!isResynthesized);
_metadata = metadata;
}
@@ -3881,7 +3235,6 @@
/// Set the code range for this element.
void setCodeRange(int offset, int length) {
- assert(!isResynthesized);
_codeOffset = offset;
_codeLength = length;
}
@@ -3904,22 +3257,6 @@
// There are no children to visit
}
- /// Return annotations for the given [unlinkedConsts] in the [unit].
- List<ElementAnnotation> _buildAnnotations(
- CompilationUnitElementImpl unit, List<UnlinkedExpr> unlinkedConsts) {
- int length = unlinkedConsts.length;
- if (length != 0) {
- List<ElementAnnotation> annotations = new List<ElementAnnotation>(length);
- ResynthesizerContext context = unit.resynthesizerContext;
- for (int i = 0; i < length; i++) {
- annotations[i] = context.buildAnnotation(this, unlinkedConsts[i]);
- }
- return annotations;
- } else {
- return const <ElementAnnotation>[];
- }
- }
-
/// Return annotations for the given [nodeList] in the [unit].
List<ElementAnnotation> _buildAnnotations2(
CompilationUnitElementImpl unit, List<Annotation> nodeList) {
@@ -4112,32 +3449,19 @@
/// An [AbstractClassElementImpl] which is an enum.
class EnumElementImpl extends AbstractClassElementImpl {
- /// The unlinked representation of the enum in the summary.
- final UnlinkedEnum _unlinkedEnum;
-
/// The type defined by the enum.
InterfaceType _type;
/// Initialize a newly created class element to have the given [name] at the
/// given [offset] in the file that contains the declaration of this element.
- EnumElementImpl(String name, int offset)
- : _unlinkedEnum = null,
- super(name, offset);
+ EnumElementImpl(String name, int offset) : super(name, offset);
EnumElementImpl.forLinkedNode(CompilationUnitElementImpl enclosing,
Reference reference, EnumDeclaration linkedNode)
- : _unlinkedEnum = null,
- super.forLinkedNode(enclosing, reference, linkedNode);
+ : super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created class element to have the given [name].
- EnumElementImpl.forNode(Identifier name)
- : _unlinkedEnum = null,
- super.forNode(name);
-
- /// Initialize using the given serialized information.
- EnumElementImpl.forSerialized(
- this._unlinkedEnum, CompilationUnitElementImpl enclosingUnit)
- : super.forSerialized(enclosingUnit);
+ EnumElementImpl.forNode(Identifier name) : super.forNode(name);
@override
List<PropertyAccessorElement> get accessors {
@@ -4145,16 +3469,12 @@
if (linkedNode != null) {
_resynthesizeMembers2();
}
- if (_unlinkedEnum != null) {
- _resynthesizeMembers();
- }
}
return _accessors ?? const <PropertyAccessorElement>[];
}
@override
void set accessors(List<PropertyAccessorElement> accessors) {
- _assertNotResynthesized(_unlinkedEnum);
super.accessors = accessors;
}
@@ -4166,9 +3486,6 @@
if (linkedNode != null) {
return linkedContext.getCodeLength(linkedNode);
}
- if (_unlinkedEnum != null) {
- return _unlinkedEnum.codeRange?.length;
- }
return super.codeLength;
}
@@ -4177,9 +3494,6 @@
if (linkedNode != null) {
return linkedContext.getCodeOffset(linkedNode);
}
- if (_unlinkedEnum != null) {
- return _unlinkedEnum.codeRange?.offset;
- }
return super.codeOffset;
}
@@ -4199,9 +3513,6 @@
var comment = context.getDocumentationComment(linkedNode);
return getCommentNodeRawText(comment);
}
- if (_unlinkedEnum != null) {
- return _unlinkedEnum.documentationComment?.text;
- }
return super.documentationComment;
}
@@ -4211,16 +3522,12 @@
if (linkedNode != null) {
_resynthesizeMembers2();
}
- if (_unlinkedEnum != null) {
- _resynthesizeMembers();
- }
}
return _fields ?? const <FieldElement>[];
}
@override
void set fields(List<FieldElement> fields) {
- _assertNotResynthesized(_unlinkedEnum);
super.fields = fields;
}
@@ -4258,23 +3565,11 @@
bool get isValidMixin => false;
@override
- List<ElementAnnotation> get metadata {
- if (_unlinkedEnum != null) {
- return _metadata ??=
- _buildAnnotations(enclosingUnit, _unlinkedEnum.annotations);
- }
- return super.metadata;
- }
-
- @override
List<MethodElement> get methods {
if (_methods == null) {
if (linkedNode != null) {
_resynthesizeMembers2();
}
- if (_unlinkedEnum != null) {
- _resynthesizeMembers();
- }
}
return _methods ?? const <MethodElement>[];
}
@@ -4287,9 +3582,6 @@
if (linkedNode != null) {
return reference.name;
}
- if (_unlinkedEnum != null) {
- return _unlinkedEnum.name;
- }
return super.name;
}
@@ -4299,11 +3591,7 @@
return enclosingUnit.linkedContext.getNameOffset(linkedNode);
}
- int offset = super.nameOffset;
- if (offset == 0 && _unlinkedEnum != null && _unlinkedEnum.nameOffset != 0) {
- return _unlinkedEnum.nameOffset;
- }
- return offset;
+ return super.nameOffset;
}
@override
@@ -4341,7 +3629,7 @@
void createToStringMethodElement() {
var method = new MethodElementImpl('toString', -1);
method.isSynthetic = true;
- if (linkedNode != null || _unlinkedEnum != null) {
+ if (linkedNode != null) {
method.returnType = context.typeProvider.stringType;
method.type = new FunctionTypeImpl(method);
}
@@ -4355,35 +3643,6 @@
@override
ConstructorElement getNamedConstructor(String name) => null;
- void _resynthesizeMembers() {
- List<FieldElementImpl> fields = <FieldElementImpl>[];
- // Build the 'index' field.
- fields.add(new FieldElementImpl('index', -1)
- ..enclosingElement = this
- ..isSynthetic = true
- ..isFinal = true
- ..type = context.typeProvider.intType);
- // Build the 'values' field.
- fields.add(new ConstFieldElementImpl_EnumValues(this));
- // Build fields for all enum constants.
- if (_unlinkedEnum != null) {
- for (int i = 0; i < _unlinkedEnum.values.length; i++) {
- UnlinkedEnumValue unlinkedValue = _unlinkedEnum.values[i];
- ConstFieldElementImpl_EnumValue field =
- new ConstFieldElementImpl_EnumValue(this, unlinkedValue, i);
- fields.add(field);
- }
- }
- // done
- _fields = fields;
- _accessors = fields
- .map((FieldElementImpl field) =>
- new PropertyAccessorElementImpl_ImplicitGetter(field)
- ..enclosingElement = this)
- .toList(growable: false);
- createToStringMethodElement();
- }
-
void _resynthesizeMembers2() {
var fields = <FieldElementImpl>[];
var getters = <PropertyAccessorElementImpl>[];
@@ -4433,9 +3692,6 @@
abstract class ExecutableElementImpl extends ElementImpl
with TypeParameterizedElementMixin
implements ExecutableElement {
- /// The unlinked representation of the executable in the summary.
- final UnlinkedExecutable serializedExecutable;
-
/// A list containing all of the parameters defined by this executable
/// element.
List<ParameterElement> _parameters;
@@ -4452,28 +3708,18 @@
/// Initialize a newly created executable element to have the given [name] and
/// [offset].
ExecutableElementImpl(String name, int offset, {Reference reference})
- : serializedExecutable = null,
- super(name, offset, reference: reference);
+ : super(name, offset, reference: reference);
/// Initialize using the given linked node.
ExecutableElementImpl.forLinkedNode(
ElementImpl enclosing, Reference reference, AstNode linkedNode)
- : serializedExecutable = null,
- super.forLinkedNode(enclosing, reference, linkedNode);
+ : super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created executable element to have the given [name].
- ExecutableElementImpl.forNode(Identifier name)
- : serializedExecutable = null,
- super.forNode(name);
-
- /// Initialize using the given serialized information.
- ExecutableElementImpl.forSerialized(
- this.serializedExecutable, ElementImpl enclosingElement)
- : super.forSerialized(enclosingElement);
+ ExecutableElementImpl.forNode(Identifier name) : super.forNode(name);
/// Set whether this executable element's body is asynchronous.
void set asynchronous(bool isAsynchronous) {
- _assertNotResynthesized(serializedExecutable);
setModifier(Modifier.ASYNCHRONOUS, isAsynchronous);
}
@@ -4482,9 +3728,6 @@
if (linkedNode != null) {
return linkedContext.getCodeLength(linkedNode);
}
- if (serializedExecutable != null) {
- return serializedExecutable.codeRange?.length;
- }
return super.codeLength;
}
@@ -4493,14 +3736,10 @@
if (linkedNode != null) {
return linkedContext.getCodeOffset(linkedNode);
}
- if (serializedExecutable != null) {
- return serializedExecutable.codeRange?.offset;
- }
return super.codeOffset;
}
void set declaredReturnType(DartType returnType) {
- _assertNotResynthesized(serializedExecutable);
_declaredReturnType = _checkElementOfType(returnType);
}
@@ -4509,9 +3748,6 @@
if (linkedNode != null) {
return reference.name;
}
- if (serializedExecutable != null) {
- return serializedExecutable.name;
- }
return super.displayName;
}
@@ -4522,21 +3758,16 @@
var comment = context.getDocumentationComment(linkedNode);
return getCommentNodeRawText(comment);
}
- if (serializedExecutable != null) {
- return serializedExecutable.documentationComment?.text;
- }
return super.documentationComment;
}
/// Set whether this executable element is external.
void set external(bool isExternal) {
- _assertNotResynthesized(serializedExecutable);
setModifier(Modifier.EXTERNAL, isExternal);
}
/// Set whether this method's body is a generator.
void set generator(bool isGenerator) {
- _assertNotResynthesized(serializedExecutable);
setModifier(Modifier.GENERATOR, isGenerator);
}
@@ -4545,16 +3776,11 @@
if (linkedNode != null) {
return linkedContext.hasImplicitReturnType(linkedNode);
}
- if (serializedExecutable != null) {
- return serializedExecutable.returnType == null &&
- serializedExecutable.kind != UnlinkedExecutableKind.constructor;
- }
return hasModifier(Modifier.IMPLICIT_TYPE);
}
/// Set whether this executable element has an implicit return type.
void set hasImplicitReturnType(bool hasImplicitReturnType) {
- _assertNotResynthesized(serializedExecutable);
setModifier(Modifier.IMPLICIT_TYPE, hasImplicitReturnType);
}
@@ -4563,9 +3789,6 @@
if (linkedNode != null) {
return !isExternal && enclosingUnit.linkedContext.isAbstract(linkedNode);
}
- if (serializedExecutable != null) {
- return serializedExecutable.isAbstract;
- }
return hasModifier(Modifier.ABSTRACT);
}
@@ -4574,9 +3797,6 @@
if (linkedNode != null) {
return enclosingUnit.linkedContext.isAsynchronous(linkedNode);
}
- if (serializedExecutable != null) {
- return serializedExecutable.isAsynchronous;
- }
return hasModifier(Modifier.ASYNCHRONOUS);
}
@@ -4585,9 +3805,6 @@
if (linkedNode != null) {
return enclosingUnit.linkedContext.isExternal(linkedNode);
}
- if (serializedExecutable != null) {
- return serializedExecutable.isExternal;
- }
return hasModifier(Modifier.EXTERNAL);
}
@@ -4596,9 +3813,6 @@
if (linkedNode != null) {
return enclosingUnit.linkedContext.isGenerator(linkedNode);
}
- if (serializedExecutable != null) {
- return serializedExecutable.isGenerator;
- }
return hasModifier(Modifier.GENERATOR);
}
@@ -4609,22 +3823,10 @@
bool get isSynchronous => !isAsynchronous;
@override
- List<ElementAnnotation> get metadata {
- if (serializedExecutable != null) {
- return _metadata ??=
- _buildAnnotations(enclosingUnit, serializedExecutable.annotations);
- }
- return super.metadata;
- }
-
- @override
String get name {
if (linkedNode != null) {
return reference.name;
}
- if (serializedExecutable != null) {
- return serializedExecutable.name;
- }
return super.name;
}
@@ -4634,11 +3836,7 @@
return enclosingUnit.linkedContext.getNameOffset(linkedNode);
}
- int offset = super.nameOffset;
- if (offset == 0 && serializedExecutable != null) {
- return serializedExecutable.nameOffset;
- }
- return offset;
+ return super.nameOffset;
}
@override
@@ -4657,18 +3855,12 @@
);
}
- if (serializedExecutable != null) {
- _parameters = ParameterElementImpl.resynthesizeList(
- serializedExecutable.parameters, this);
- }
-
return _parameters ??= const <ParameterElement>[];
}
/// Set the parameters defined by this executable element to the given
/// [parameters].
void set parameters(List<ParameterElement> parameters) {
- _assertNotResynthesized(serializedExecutable);
for (ParameterElement parameter in parameters) {
(parameter as ParameterElementImpl).enclosingElement = this;
}
@@ -4682,17 +3874,6 @@
var context = enclosingUnit.linkedContext;
return _returnType = context.getReturnType(linkedNode);
}
- if (serializedExecutable != null &&
- _declaredReturnType == null &&
- _returnType == null) {
- bool isSetter =
- serializedExecutable.kind == UnlinkedExecutableKind.setter;
- _returnType = enclosingUnit.resynthesizerContext
- .resolveLinkedType(this, serializedExecutable.inferredReturnTypeSlot);
- _declaredReturnType = enclosingUnit.resynthesizerContext.resolveTypeRef(
- this, serializedExecutable.returnType,
- defaultVoid: isSetter, declaredType: true);
- }
return _returnType ?? _declaredReturnType;
}
@@ -4700,7 +3881,6 @@
if (linkedNode != null) {
linkedContext.setReturnType(linkedNode, returnType);
}
- _assertNotResynthesized(serializedExecutable);
_returnType = _checkElementOfType(returnType);
}
@@ -4709,21 +3889,16 @@
if (linkedNode != null) {
return _type ??= new FunctionTypeImpl(this);
}
- if (serializedExecutable != null) {
- return _type ??= new FunctionTypeImpl(this);
- }
return _type;
}
void set type(FunctionType type) {
- _assertNotResynthesized(serializedExecutable);
_type = type;
}
/// Set the type parameters defined by this executable element to the given
/// [typeParameters].
void set typeParameters(List<TypeParameterElement> typeParameters) {
- _assertNotResynthesized(serializedExecutable);
for (TypeParameterElement parameter in typeParameters) {
(parameter as TypeParameterElementImpl).enclosingElement = this;
}
@@ -4731,10 +3906,6 @@
}
@override
- List<UnlinkedTypeParam> get unlinkedTypeParams =>
- serializedExecutable?.typeParameters;
-
- @override
void appendTo(StringBuffer buffer) {
appendToWithName(buffer, displayName);
}
@@ -4826,12 +3997,6 @@
/// A concrete implementation of an [ExportElement].
class ExportElementImpl extends UriReferencedElementImpl
implements ExportElement {
- /// The unlinked representation of the export in the summary.
- final UnlinkedExportPublic _unlinkedExportPublic;
-
- /// The unlinked representation of the export in the summary.
- final UnlinkedExportNonPublic _unlinkedExportNonPublic;
-
/// The library that is exported from this library by this export directive.
LibraryElement _exportedLibrary;
@@ -4839,25 +4004,12 @@
/// order in which they were specified.
List<NamespaceCombinator> _combinators;
- /// The URI that was selected based on the declared variables.
- String _selectedUri;
-
/// Initialize a newly created export element at the given [offset].
- ExportElementImpl(int offset)
- : _unlinkedExportPublic = null,
- _unlinkedExportNonPublic = null,
- super(null, offset);
+ ExportElementImpl(int offset) : super(null, offset);
ExportElementImpl.forLinkedNode(
LibraryElementImpl enclosing, ExportDirective linkedNode)
- : _unlinkedExportPublic = null,
- _unlinkedExportNonPublic = null,
- super.forLinkedNode(enclosing, null, linkedNode);
-
- /// Initialize using the given serialized information.
- ExportElementImpl.forSerialized(this._unlinkedExportPublic,
- this._unlinkedExportNonPublic, LibraryElementImpl enclosingLibrary)
- : super.forSerialized(enclosingLibrary);
+ : super.forLinkedNode(enclosing, null, linkedNode);
@override
List<NamespaceCombinator> get combinators {
@@ -4871,16 +4023,10 @@
);
}
- if (_unlinkedExportPublic != null) {
- return _combinators = ImportElementImpl._buildCombinators(
- _unlinkedExportPublic.combinators);
- }
-
return _combinators ?? const <NamespaceCombinator>[];
}
void set combinators(List<NamespaceCombinator> combinators) {
- _assertNotResynthesized(_unlinkedExportPublic);
_combinators = combinators;
}
@@ -4898,16 +4044,10 @@
return _exportedLibrary = linkedContext.directiveLibrary(linkedNode);
}
- if (_unlinkedExportNonPublic != null) {
- LibraryElementImpl library = enclosingElement as LibraryElementImpl;
- _exportedLibrary = library.resynthesizerContext.buildExportedLibrary(uri);
- }
-
return _exportedLibrary;
}
void set exportedLibrary(LibraryElement exportedLibrary) {
- _assertNotResynthesized(_unlinkedExportNonPublic);
_exportedLibrary = exportedLibrary;
}
@@ -4917,19 +4057,7 @@
@override
ElementKind get kind => ElementKind.EXPORT;
- @override
- List<ElementAnnotation> get metadata {
- if (_metadata == null) {
- if (_unlinkedExportNonPublic != null) {
- return _metadata = _buildAnnotations(library.definingCompilationUnit,
- _unlinkedExportNonPublic.annotations);
- }
- }
- return super.metadata;
- }
-
void set metadata(List<ElementAnnotation> metadata) {
- _assertNotResynthesized(_unlinkedExportNonPublic);
super.metadata = metadata;
}
@@ -4939,11 +4067,7 @@
return linkedContext.getDirectiveOffset(linkedNode);
}
- int offset = super.nameOffset;
- if (offset == 0 && _unlinkedExportNonPublic != null) {
- return _unlinkedExportNonPublic.offset;
- }
- return offset;
+ return super.nameOffset;
}
@override
@@ -4953,48 +4077,10 @@
return node.uri.stringValue;
}
- if (_unlinkedExportPublic != null) {
- return _selectedUri ??= _selectUri(
- _unlinkedExportPublic.uri, _unlinkedExportPublic.configurations);
- }
return super.uri;
}
@override
- void set uri(String uri) {
- _assertNotResynthesized(_unlinkedExportPublic);
- super.uri = uri;
- }
-
- @override
- int get uriEnd {
- if (_unlinkedExportNonPublic != null) {
- return _unlinkedExportNonPublic.uriEnd;
- }
- return super.uriEnd;
- }
-
- @override
- void set uriEnd(int uriEnd) {
- _assertNotResynthesized(_unlinkedExportNonPublic);
- super.uriEnd = uriEnd;
- }
-
- @override
- int get uriOffset {
- if (_unlinkedExportNonPublic != null) {
- return _unlinkedExportNonPublic.uriOffset;
- }
- return super.uriOffset;
- }
-
- @override
- void set uriOffset(int uriOffset) {
- _assertNotResynthesized(_unlinkedExportNonPublic);
- super.uriOffset = uriOffset;
- }
-
- @override
T accept<T>(ElementVisitor<T> visitor) => visitor.visitExportElement(this);
@override
@@ -5008,9 +4094,6 @@
class ExtensionElementImpl extends ElementImpl
with TypeParameterizedElementMixin
implements ExtensionElement {
- /// The unlinked representation of the extension in the summary.
- final UnlinkedExtension _unlinkedExtension;
-
/// The type being extended.
DartType _extendedType;
@@ -5027,25 +4110,15 @@
/// Initialize a newly created extension element to have the given [name] at
/// the given [offset] in the file that contains the declaration of this
/// element.
- ExtensionElementImpl(String name, int nameOffset)
- : _unlinkedExtension = null,
- super(name, nameOffset);
+ ExtensionElementImpl(String name, int nameOffset) : super(name, nameOffset);
/// Initialize using the given linked information.
ExtensionElementImpl.forLinkedNode(CompilationUnitElementImpl enclosing,
Reference reference, AstNode linkedNode)
- : _unlinkedExtension = null,
- super.forLinkedNode(enclosing, reference, linkedNode);
+ : super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created extension element to have the given [name].
- ExtensionElementImpl.forNode(Identifier name)
- : _unlinkedExtension = null,
- super.forNode(name);
-
- /// Initialize using the given serialized information.
- ExtensionElementImpl.forSerialized(
- this._unlinkedExtension, CompilationUnitElementImpl enclosingUnit)
- : super.forSerialized(enclosingUnit);
+ ExtensionElementImpl.forNode(Identifier name) : super.forNode(name);
@override
List<PropertyAccessorElement> get accessors {
@@ -5061,15 +4134,12 @@
} else {
return _accessors = const [];
}
- } else if (_unlinkedExtension != null) {
- _resynthesizeFieldsAndPropertyAccessors();
}
return _accessors ??= const <PropertyAccessorElement>[];
}
void set accessors(List<PropertyAccessorElement> accessors) {
- _assertNotResynthesized(_unlinkedExtension);
for (PropertyAccessorElement accessor in accessors) {
(accessor as PropertyAccessorElementImpl).enclosingElement = this;
}
@@ -5081,9 +4151,6 @@
if (linkedNode != null) {
return linkedContext.getCodeLength(linkedNode);
}
- if (_unlinkedExtension != null) {
- return _unlinkedExtension.codeRange?.length;
- }
return super.codeLength;
}
@@ -5092,9 +4159,6 @@
if (linkedNode != null) {
return linkedContext.getCodeOffset(linkedNode);
}
- if (_unlinkedExtension != null) {
- return _unlinkedExtension.codeRange?.offset;
- }
return super.codeOffset;
}
@@ -5108,9 +4172,6 @@
var comment = context.getDocumentationComment(linkedNode);
return getCommentNodeRawText(comment);
}
- if (_unlinkedExtension != null) {
- return _unlinkedExtension.documentationComment?.text;
- }
return super.documentationComment;
}
@@ -5119,22 +4180,16 @@
@override
DartType get extendedType {
- if (_extendedType != null) {
- return _extendedType;
- }
+ if (_extendedType != null) return _extendedType;
if (linkedNode != null) {
return _extendedType = linkedContext.getExtendedType(linkedNode).type;
- } else if (_unlinkedExtension != null) {
- return _extendedType = enclosingUnit.resynthesizerContext
- .resolveTypeRef(this, _unlinkedExtension.extendedType);
}
return _extendedType;
}
void set extendedType(DartType extendedType) {
- _assertNotResynthesized(_unlinkedExtension);
_extendedType = extendedType;
}
@@ -5152,15 +4207,12 @@
} else {
return _fields = const [];
}
- } else if (_unlinkedExtension != null) {
- _resynthesizeFieldsAndPropertyAccessors();
}
return _fields ?? const <FieldElement>[];
}
void set fields(List<FieldElement> fields) {
- _assertNotResynthesized(_unlinkedExtension);
for (FieldElement field in fields) {
(field as FieldElementImpl).enclosingElement = this;
}
@@ -5182,15 +4234,6 @@
ElementKind get kind => ElementKind.EXTENSION;
@override
- List<ElementAnnotation> get metadata {
- if (_unlinkedExtension != null) {
- return _metadata ??=
- _buildAnnotations(enclosingUnit, _unlinkedExtension.annotations);
- }
- return super.metadata;
- }
-
- @override
List<MethodElement> get methods {
if (_methods != null) {
return _methods;
@@ -5210,41 +4253,12 @@
}
return MethodElementImpl.forLinkedNode(this, reference, node);
}).toList();
- } else if (_unlinkedExtension != null) {
- var unlinkedExecutables = _unlinkedExtension.executables;
-
- var length = unlinkedExecutables.length;
- if (length == 0) {
- return _methods = const <MethodElement>[];
- }
-
- var count = 0;
- for (var i = 0; i < length; i++) {
- var e = unlinkedExecutables[i];
- if (e.kind == UnlinkedExecutableKind.functionOrMethod) {
- count++;
- }
- }
- if (count == 0) {
- return _methods = const <MethodElement>[];
- }
-
- var methods = new List<MethodElement>(count);
- var index = 0;
- for (var i = 0; i < length; i++) {
- var e = unlinkedExecutables[i];
- if (e.kind == UnlinkedExecutableKind.functionOrMethod) {
- methods[index++] = new MethodElementImpl.forSerialized(e, this);
- }
- }
- return _methods = methods;
}
return _methods = const <MethodElement>[];
}
/// Set the methods contained in this extension to the given [methods].
void set methods(List<MethodElement> methods) {
- _assertNotResynthesized(_unlinkedExtension);
for (MethodElement method in methods) {
(method as MethodElementImpl).enclosingElement = this;
}
@@ -5256,9 +4270,6 @@
if (linkedNode != null) {
return (linkedNode as ExtensionDeclaration).name?.name ?? '';
}
- if (_unlinkedExtension != null) {
- return _unlinkedExtension.name;
- }
return super.name;
}
@@ -5268,17 +4279,12 @@
return enclosingUnit.linkedContext.getNameOffset(linkedNode);
}
- int offset = super.nameOffset;
- if (offset == 0 && _unlinkedExtension != null) {
- return _unlinkedExtension.nameOffset;
- }
- return offset;
+ return super.nameOffset;
}
/// Set the type parameters defined by this extension to the given
/// [typeParameters].
void set typeParameters(List<TypeParameterElement> typeParameters) {
- _assertNotResynthesized(_unlinkedExtension);
for (TypeParameterElement typeParameter in typeParameters) {
(typeParameter as TypeParameterElementImpl).enclosingElement = this;
}
@@ -5286,10 +4292,6 @@
}
@override
- List<UnlinkedTypeParam> get unlinkedTypeParams =>
- _unlinkedExtension?.typeParameters;
-
- @override
T accept<T>(ElementVisitor<T> visitor) {
return visitor.visitExtensionElement(this);
}
@@ -5429,112 +4431,6 @@
_accessors = accessorList;
_fields = fieldList;
}
-
- /// Resynthesize explicit fields and property accessors and fill [_fields] and
- /// [_accessors] with explicit and implicit elements.
- void _resynthesizeFieldsAndPropertyAccessors() {
- assert(_fields == null);
- assert(_accessors == null);
-
- var unlinkedFields = _unlinkedExtension.fields;
- var unlinkedExecutables = _unlinkedExtension.executables;
-
- // Build explicit fields and implicit property accessors.
- List<FieldElement> explicitFields;
- List<PropertyAccessorElement> implicitAccessors;
- var unlinkedFieldsLength = unlinkedFields.length;
- if (unlinkedFieldsLength != 0) {
- explicitFields = new List<FieldElement>(unlinkedFieldsLength);
- implicitAccessors = <PropertyAccessorElement>[];
- for (var i = 0; i < unlinkedFieldsLength; i++) {
- var v = unlinkedFields[i];
- FieldElementImpl field =
- new FieldElementImpl.forSerializedFactory(v, this);
- explicitFields[i] = field;
- implicitAccessors.add(
- new PropertyAccessorElementImpl_ImplicitGetter(field)
- ..enclosingElement = this);
- if (!field.isConst && !field.isFinal) {
- implicitAccessors.add(
- new PropertyAccessorElementImpl_ImplicitSetter(field)
- ..enclosingElement = this);
- }
- }
- } else {
- explicitFields = const <FieldElement>[];
- implicitAccessors = const <PropertyAccessorElement>[];
- }
-
- var unlinkedExecutablesLength = unlinkedExecutables.length;
- var getterSetterCount = 0;
- for (var i = 0; i < unlinkedExecutablesLength; i++) {
- var e = unlinkedExecutables[i];
- if (e.kind == UnlinkedExecutableKind.getter ||
- e.kind == UnlinkedExecutableKind.setter) {
- getterSetterCount++;
- }
- }
-
- // Build explicit property accessors and implicit fields.
- List<PropertyAccessorElement> explicitAccessors;
- Map<String, FieldElementImpl> implicitFields;
- if (getterSetterCount != 0) {
- explicitAccessors = new List<PropertyAccessorElement>(getterSetterCount);
- implicitFields = <String, FieldElementImpl>{};
- var index = 0;
- for (var i = 0; i < unlinkedExecutablesLength; i++) {
- var e = unlinkedExecutables[i];
- if (e.kind == UnlinkedExecutableKind.getter ||
- e.kind == UnlinkedExecutableKind.setter) {
- PropertyAccessorElementImpl accessor =
- new PropertyAccessorElementImpl.forSerialized(e, this);
- explicitAccessors[index++] = accessor;
- // Create or update the implicit field.
- String fieldName = accessor.displayName;
- FieldElementImpl field = implicitFields[fieldName];
- if (field == null) {
- field = new FieldElementImpl(fieldName, -1);
- implicitFields[fieldName] = field;
- field.enclosingElement = this;
- field.isSynthetic = true;
- field.isFinal = e.kind == UnlinkedExecutableKind.getter;
- field.isStatic = e.isStatic;
- } else {
- field.isFinal = false;
- }
- accessor.variable = field;
- if (e.kind == UnlinkedExecutableKind.getter) {
- field.getter = accessor;
- } else {
- field.setter = accessor;
- }
- }
- }
- } else {
- explicitAccessors = const <PropertyAccessorElement>[];
- implicitFields = const <String, FieldElementImpl>{};
- }
-
- // Combine explicit and implicit fields and property accessors.
- if (implicitFields.isEmpty) {
- _fields = explicitFields;
- } else if (explicitFields.isEmpty) {
- _fields = implicitFields.values.toList(growable: false);
- } else {
- _fields = <FieldElement>[]
- ..addAll(explicitFields)
- ..addAll(implicitFields.values);
- }
- if (explicitAccessors.isEmpty) {
- _accessors = implicitAccessors;
- } else if (implicitAccessors.isEmpty) {
- _accessors = explicitAccessors;
- } else {
- _accessors = <PropertyAccessorElement>[]
- ..addAll(explicitAccessors)
- ..addAll(implicitAccessors);
- }
- }
}
/// A concrete implementation of a [FieldElement].
@@ -5580,44 +4476,17 @@
/// Initialize a newly created field element to have the given [name].
FieldElementImpl.forNode(Identifier name) : super.forNode(name);
- /// Initialize using the given serialized information.
- FieldElementImpl.forSerialized(
- UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement)
- : super.forSerialized(unlinkedVariable, enclosingElement);
-
- /// Initialize using the given serialized information.
- factory FieldElementImpl.forSerializedFactory(
- UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement) {
- if (unlinkedVariable.initializer?.bodyExpr != null &&
- (unlinkedVariable.isConst ||
- unlinkedVariable.isFinal &&
- !unlinkedVariable.isStatic &&
- enclosingElement is ClassElementImpl &&
- enclosingElement._hasConstConstructor)) {
- return new ConstFieldElementImpl.forSerialized(
- unlinkedVariable, enclosingElement);
- } else {
- return new FieldElementImpl.forSerialized(
- unlinkedVariable, enclosingElement);
- }
- }
-
@override
bool get isCovariant {
if (linkedNode != null) {
return linkedContext.isExplicitlyCovariant(linkedNode);
}
- if (_unlinkedVariable != null) {
- return _unlinkedVariable.isCovariant;
- }
-
return hasModifier(Modifier.COVARIANT);
}
/// Set whether this field is explicitly marked as being covariant.
void set isCovariant(bool isCovariant) {
- _assertNotResynthesized(_unlinkedVariable);
setModifier(Modifier.COVARIANT, isCovariant);
}
@@ -5632,15 +4501,11 @@
if (linkedNode != null) {
return enclosingUnit.linkedContext.isStatic(linkedNode);
}
- if (_unlinkedVariable != null) {
- return _unlinkedVariable.isStatic;
- }
return hasModifier(Modifier.STATIC);
}
/// Set whether this field is static.
void set isStatic(bool isStatic) {
- _assertNotResynthesized(_unlinkedVariable);
setModifier(Modifier.STATIC, isStatic);
}
@@ -5685,11 +4550,6 @@
FieldFormalParameterElementImpl.forNode(Identifier name)
: super.forNode(name);
- /// Initialize using the given serialized information.
- FieldFormalParameterElementImpl.forSerialized(
- UnlinkedParam unlinkedParam, ElementImpl enclosingElement)
- : super.forSerialized(unlinkedParam, enclosingElement);
-
@override
FieldElement get field {
if (_field == null) {
@@ -5697,9 +4557,6 @@
if (linkedNode != null) {
fieldName = linkedContext.getFieldFormalParameterName(linkedNode);
}
- if (unlinkedParam != null) {
- fieldName = unlinkedParam.name;
- }
if (fieldName != null) {
Element enclosingConstructor = enclosingElement;
if (enclosingConstructor is ConstructorElement) {
@@ -5717,7 +4574,6 @@
}
void set field(FieldElement field) {
- _assertNotResynthesized(unlinkedParam);
_field = field;
}
@@ -5725,19 +4581,7 @@
bool get isInitializingFormal => true;
@override
- DartType get type {
- if (unlinkedParam != null &&
- unlinkedParam.type == null &&
- !unlinkedParam.isFunctionTyped &&
- field != null) {
- _type ??= field?.type ?? DynamicTypeImpl.instance;
- }
- return super.type;
- }
-
- @override
void set type(DartType type) {
- _assertNotResynthesized(unlinkedParam);
_type = type;
}
@@ -5771,11 +4615,6 @@
/// [nameOffset]. This is used for function expressions, that have no name.
FunctionElementImpl.forOffset(int nameOffset) : super("", nameOffset);
- /// Initialize using the given serialized information.
- FunctionElementImpl.forSerialized(
- UnlinkedExecutable serializedExecutable, ElementImpl enclosingElement)
- : super.forSerialized(serializedExecutable, enclosingElement);
-
/// Synthesize an unnamed function element that takes [parameters] and returns
/// [returnType].
FunctionElementImpl.synthetic(
@@ -5832,13 +4671,6 @@
@override
SourceRange get visibleRange {
- if (serializedExecutable != null) {
- if (serializedExecutable.visibleLength == 0) {
- return null;
- }
- return new SourceRange(serializedExecutable.visibleOffset,
- serializedExecutable.visibleLength);
- }
if (_visibleRangeLength < 0) {
return null;
}
@@ -5856,7 +4688,6 @@
/// Set the visible range for this element to the range starting at the given
/// [offset] with the given [length].
void setVisibleRange(int offset, int length) {
- _assertNotResynthesized(serializedExecutable);
_visibleRangeOffset = offset;
_visibleRangeLength = length;
}
@@ -5875,23 +4706,6 @@
void shareTypeParameters(List<TypeParameterElement> typeParameters) {
this._typeParameterElements = typeParameters;
}
-
- /// Create and return [FunctionElement]s for the given [unlinkedFunctions].
- static List<FunctionElement> resynthesizeList(
- ExecutableElementImpl executableElement,
- List<UnlinkedExecutable> unlinkedFunctions) {
- int length = unlinkedFunctions.length;
- if (length != 0) {
- List<FunctionElement> elements = new List<FunctionElement>(length);
- for (int i = 0; i < length; i++) {
- elements[i] = new FunctionElementImpl.forSerialized(
- unlinkedFunctions[i], executableElement);
- }
- return elements;
- } else {
- return const <FunctionElement>[];
- }
- }
}
/// Implementation of [FunctionElementImpl] for a function typed parameter.
@@ -5915,54 +4729,6 @@
bool get isSynthetic => true;
}
-/// Implementation of [FunctionElementImpl] for a synthetic function element
-/// that was synthesized by a LUB computation.
-class FunctionElementImpl_forLUB extends FunctionElementImpl {
- final EntityRef _entityRef;
-
- FunctionElementImpl_forLUB(ElementImpl enclosingElement, this._entityRef)
- : super.forSerialized(null, enclosingElement);
-
- @override
- bool get isSynthetic => true;
-
- @override
- List<ParameterElement> get parameters {
- return _parameters ??= ParameterElementImpl.resynthesizeList(
- _entityRef.syntheticParams, this,
- synthetic: true);
- }
-
- @override
- void set parameters(List<ParameterElement> parameters) {
- assert(false);
- }
-
- @override
- DartType get returnType {
- return _returnType ??= enclosingUnit.resynthesizerContext
- .resolveTypeRef(this, _entityRef.syntheticReturnType);
- }
-
- @override
- void set returnType(DartType returnType) {
- assert(false);
- }
-
- @override
- FunctionType get type {
- return _type ??= new FunctionTypeImpl(this);
- }
-
- @override
- void set type(FunctionType type) {
- assert(false);
- }
-
- @override
- List<UnlinkedTypeParam> get unlinkedTypeParams => _entityRef.typeParameters;
-}
-
/// Common internal interface shared by elements whose type is a function type.
///
/// Clients may not extend, implement or mix-in this class.
@@ -5977,9 +4743,6 @@
class GenericFunctionTypeElementImpl extends ElementImpl
with TypeParameterizedElementMixin
implements GenericFunctionTypeElement, FunctionTypedElementImpl {
- /// The unlinked representation of the generic function type in the summary.
- EntityRef _entityRef;
-
/// The declared return type of the function.
DartType _returnType;
@@ -5998,11 +4761,6 @@
GenericFunctionTypeElementImpl.forOffset(int nameOffset)
: super("", nameOffset);
- /// Initialize from serialized information.
- GenericFunctionTypeElementImpl.forSerialized(
- ElementImpl enclosingElement, this._entityRef)
- : super.forSerialized(enclosingElement);
-
@override
TypeParameterizedElementMixin get enclosingTypeParameterContext {
return _enclosingElement.typeParameterContext;
@@ -6026,10 +4784,6 @@
context.getFormalParameters(linkedNode),
);
}
- if (_entityRef != null) {
- _parameters = ParameterElementImpl.resynthesizeList(
- _entityRef.syntheticParams, this);
- }
}
return _parameters ?? const <ParameterElement>[];
}
@@ -6037,7 +4791,6 @@
/// Set the parameters defined by this function type element to the given
/// [parameters].
void set parameters(List<ParameterElement> parameters) {
- _assertNotResynthesized(_entityRef);
for (ParameterElement parameter in parameters) {
(parameter as ParameterElementImpl).enclosingElement = this;
}
@@ -6051,11 +4804,6 @@
var context = enclosingUnit.linkedContext;
return _returnType = context.getReturnType(linkedNode);
}
- if (_entityRef != null) {
- _returnType = enclosingUnit.resynthesizerContext.resolveTypeRef(
- this, _entityRef.syntheticReturnType,
- defaultVoid: false, declaredType: true);
- }
}
return _returnType;
}
@@ -6063,7 +4811,6 @@
/// Set the return type defined by this function type element to the given
/// [returnType].
void set returnType(DartType returnType) {
- _assertNotResynthesized(_entityRef);
_returnType = _checkElementOfType(returnType);
}
@@ -6076,7 +4823,6 @@
/// Set the function type defined by this function type element to the given
/// [type].
void set type(FunctionType type) {
- _assertNotResynthesized(_entityRef);
_type = type;
}
@@ -6093,7 +4839,6 @@
/// Set the type parameters defined by this function type element to the given
/// [typeParameters].
void set typeParameters(List<TypeParameterElement> typeParameters) {
- _assertNotResynthesized(_entityRef);
for (TypeParameterElement parameter in typeParameters) {
(parameter as TypeParameterElementImpl).enclosingElement = this;
}
@@ -6101,9 +4846,6 @@
}
@override
- List<UnlinkedTypeParam> get unlinkedTypeParams => _entityRef?.typeParameters;
-
- @override
T accept<T>(ElementVisitor<T> visitor) {
return visitor.visitGenericFunctionTypeElement(this);
}
@@ -6154,11 +4896,8 @@
///
/// Clients may not extend, implement or mix-in this class.
class GenericTypeAliasElementImpl extends ElementImpl
- with TypeParameterizedElementMixin, SimplyBoundableMixin
+ with TypeParameterizedElementMixin
implements GenericTypeAliasElement {
- /// The unlinked representation of the type in the summary.
- final UnlinkedTypedef _unlinkedTypedef;
-
/// The element representing the generic function type.
GenericFunctionTypeElementImpl _function;
@@ -6166,35 +4905,22 @@
FunctionType _type;
/// Initialize a newly created type alias element to have the given [name].
- GenericTypeAliasElementImpl(String name, int offset)
- : _unlinkedTypedef = null,
- super(name, offset);
+ GenericTypeAliasElementImpl(String name, int offset) : super(name, offset);
GenericTypeAliasElementImpl.forLinkedNode(
CompilationUnitElementImpl enclosingUnit,
Reference reference,
AstNode linkedNode)
- : _unlinkedTypedef = null,
- super.forLinkedNode(enclosingUnit, reference, linkedNode);
+ : super.forLinkedNode(enclosingUnit, reference, linkedNode);
/// Initialize a newly created type alias element to have the given [name].
- GenericTypeAliasElementImpl.forNode(Identifier name)
- : _unlinkedTypedef = null,
- super.forNode(name);
-
- /// Initialize using the given serialized information.
- GenericTypeAliasElementImpl.forSerialized(
- this._unlinkedTypedef, CompilationUnitElementImpl enclosingUnit)
- : super.forSerialized(enclosingUnit);
+ GenericTypeAliasElementImpl.forNode(Identifier name) : super.forNode(name);
@override
int get codeLength {
if (linkedNode != null) {
return linkedContext.getCodeLength(linkedNode);
}
- if (_unlinkedTypedef != null) {
- return _unlinkedTypedef.codeRange?.length;
- }
return super.codeLength;
}
@@ -6203,9 +4929,6 @@
if (linkedNode != null) {
return linkedContext.getCodeOffset(linkedNode);
}
- if (_unlinkedTypedef != null) {
- return _unlinkedTypedef.codeRange?.offset;
- }
return super.codeOffset;
}
@@ -6219,9 +4942,6 @@
var comment = context.getDocumentationComment(linkedNode);
return getCommentNodeRawText(comment);
}
- if (_unlinkedTypedef != null) {
- return _unlinkedTypedef.documentationComment?.text;
- }
return super.documentationComment;
}
@@ -6261,36 +4981,12 @@
}
}
- if (_unlinkedTypedef != null) {
- if (_unlinkedTypedef.style == TypedefStyle.genericFunctionType) {
- DartType type = enclosingUnit.resynthesizerContext.resolveTypeRef(
- this, _unlinkedTypedef.returnType,
- declaredType: true);
- if (type is FunctionType) {
- Element element = type.element;
- if (element is GenericFunctionTypeElement) {
- (element as GenericFunctionTypeElementImpl).enclosingElement = this;
- _function = element;
- }
- }
- } else {
- _function = new GenericFunctionTypeElementImpl.forOffset(-1);
- _function.enclosingElement = this;
- _function.returnType = enclosingUnit.resynthesizerContext
- .resolveTypeRef(_function, _unlinkedTypedef.returnType,
- declaredType: true);
- _function.parameters = ParameterElementImpl.resynthesizeList(
- _unlinkedTypedef.parameters, _function);
- }
- }
-
return _function;
}
/// Set the function element representing the generic function type on the
/// right side of the equals to the given [function].
void set function(GenericFunctionTypeElementImpl function) {
- _assertNotResynthesized(_unlinkedTypedef);
if (function != null) {
function.enclosingElement = this;
}
@@ -6316,22 +5012,10 @@
ElementKind get kind => ElementKind.FUNCTION_TYPE_ALIAS;
@override
- List<ElementAnnotation> get metadata {
- if (_unlinkedTypedef != null) {
- return _metadata ??=
- _buildAnnotations(enclosingUnit, _unlinkedTypedef.annotations);
- }
- return super.metadata;
- }
-
- @override
String get name {
if (linkedNode != null) {
return reference.name;
}
- if (_unlinkedTypedef != null) {
- return _unlinkedTypedef.name;
- }
return super.name;
}
@@ -6341,11 +5025,7 @@
return enclosingUnit.linkedContext.getNameOffset(linkedNode);
}
- int offset = super.nameOffset;
- if (offset == 0 && _unlinkedTypedef != null) {
- return _unlinkedTypedef.nameOffset;
- }
- return offset;
+ return super.nameOffset;
}
@override
@@ -6378,14 +5058,12 @@
}
void set type(FunctionType type) {
- _assertNotResynthesized(_unlinkedTypedef);
_type = type;
}
/// Set the type parameters defined for this type to the given
/// [typeParameters].
void set typeParameters(List<TypeParameterElement> typeParameters) {
- _assertNotResynthesized(_unlinkedTypedef);
for (TypeParameterElement typeParameter in typeParameters) {
(typeParameter as TypeParameterElementImpl).enclosingElement = this;
}
@@ -6393,13 +5071,6 @@
}
@override
- List<UnlinkedTypeParam> get unlinkedTypeParams =>
- _unlinkedTypedef?.typeParameters;
-
- @override
- int get _notSimplyBoundedSlot => _unlinkedTypedef?.notSimplyBoundedSlot;
-
- @override
T accept<T>(ElementVisitor<T> visitor) =>
visitor.visitFunctionTypeAliasElement(this);
@@ -6443,7 +5114,10 @@
@override
FunctionType instantiate(List<DartType> argumentTypes) {
- return doInstantiate(this, argumentTypes);
+ return instantiate2(
+ typeArguments: argumentTypes,
+ nullabilitySuffix: NullabilitySuffix.star,
+ );
}
@override
@@ -6451,10 +5125,22 @@
@required List<DartType> typeArguments,
@required NullabilitySuffix nullabilitySuffix,
}) {
+ if (function == null) {
+ return null;
+ }
+
+ if (typeArguments.length != typeParameters.length) {
+ throw new ArgumentError(
+ "typeArguments.length (${typeArguments.length}) != "
+ "typeParameters.length (${typeParameters.length})");
+ }
+
+ var substitution = Substitution.fromPairs(typeParameters, typeArguments);
+ var type = substitution.substituteType(function.type) as FunctionType;
return FunctionTypeImpl.synthetic(
- returnType,
- typeParameters,
- parameters,
+ type.returnType,
+ type.typeFormals,
+ type.parameters,
element: this,
typeArguments: typeArguments,
nullabilitySuffix: nullabilitySuffix,
@@ -6467,54 +5153,10 @@
safelyVisitChildren(typeParameters, visitor);
function?.accept(visitor);
}
-
- static FunctionType doInstantiate(
- FunctionTypeAliasElement element, List<DartType> argumentTypes) {
- if (argumentTypes.length != element.typeParameters.length) {
- throw new ArgumentError('Wrong number of type arguments supplied');
- }
- if (element.typeParameters.isEmpty) return element.function.type;
- return typeAfterSubstitution(element, argumentTypes);
- }
-
- /// Return the type of the function defined by this typedef after substituting
- /// the given [typeArguments] for the type parameters defined for this typedef
- /// (but not the type parameters defined by the function). If the number of
- /// [typeArguments] does not match the number of type parameters, then
- /// `dynamic` will be used in place of each of the type arguments.
- static FunctionType typeAfterSubstitution(
- FunctionTypeAliasElement element, List<DartType> typeArguments) {
- GenericFunctionTypeElement function = element.function;
- if (function == null) {
- return null;
- }
- FunctionType functionType = function.type;
-
- List<TypeParameterElement> parameterElements = element.typeParameters;
- int parameterCount = parameterElements.length;
-
- if (typeArguments == null ||
- parameterElements.length != typeArguments.length) {
- DartType dynamicType = element.context.typeProvider.dynamicType;
- typeArguments = new List<DartType>.filled(parameterCount, dynamicType);
- }
-
- if (element is GenericTypeAliasElementImpl && element.linkedNode != null) {
- return Substitution.fromPairs(parameterElements, typeArguments)
- .substituteType(functionType);
- }
-
- List<DartType> parameterTypes =
- TypeParameterTypeImpl.getTypes(parameterElements);
- return functionType.substitute2(typeArguments, parameterTypes);
- }
}
/// A concrete implementation of a [HideElementCombinator].
class HideElementCombinatorImpl implements HideElementCombinator {
- /// The unlinked representation of the combinator in the summary.
- final UnlinkedCombinator _unlinkedCombinator;
-
final LinkedUnitContext linkedContext;
final HideCombinator linkedNode;
@@ -6523,18 +5165,11 @@
List<String> _hiddenNames;
HideElementCombinatorImpl()
- : _unlinkedCombinator = null,
- linkedContext = null,
- linkedNode = null;
-
- HideElementCombinatorImpl.forLinkedNode(this.linkedContext, this.linkedNode)
- : _unlinkedCombinator = null;
-
- /// Initialize using the given serialized information.
- HideElementCombinatorImpl.forSerialized(this._unlinkedCombinator)
: linkedContext = null,
linkedNode = null;
+ HideElementCombinatorImpl.forLinkedNode(this.linkedContext, this.linkedNode);
+
@override
List<String> get hiddenNames {
if (_hiddenNames != null) return _hiddenNames;
@@ -6543,15 +5178,10 @@
return _hiddenNames = linkedNode.hiddenNames.map((i) => i.name).toList();
}
- if (_unlinkedCombinator != null) {
- return _hiddenNames = _unlinkedCombinator.hides.toList(growable: false);
- }
-
return _hiddenNames ?? const <String>[];
}
void set hiddenNames(List<String> hiddenNames) {
- _assertNotResynthesized(_unlinkedCombinator);
_hiddenNames = hiddenNames;
}
@@ -6573,12 +5203,6 @@
/// A concrete implementation of an [ImportElement].
class ImportElementImpl extends UriReferencedElementImpl
implements ImportElement {
- /// The unlinked representation of the import in the summary.
- final UnlinkedImport _unlinkedImport;
-
- /// The index of the dependency in the `imports` list.
- final int _linkedDependency;
-
/// The offset of the prefix of this import in the file that contains the this
/// import directive, or `-1` if this import is synthetic.
int _prefixOffset = 0;
@@ -6594,29 +5218,16 @@
///` if there was no prefix specified.
PrefixElement _prefix;
- /// The URI that was selected based on the declared variables.
- String _selectedUri;
-
/// The cached value of [namespace].
Namespace _namespace;
/// Initialize a newly created import element at the given [offset].
/// The offset may be `-1` if the import is synthetic.
- ImportElementImpl(int offset)
- : _unlinkedImport = null,
- _linkedDependency = null,
- super(null, offset);
+ ImportElementImpl(int offset) : super(null, offset);
ImportElementImpl.forLinkedNode(
LibraryElementImpl enclosing, ImportDirective linkedNode)
- : _unlinkedImport = null,
- _linkedDependency = null,
- super.forLinkedNode(enclosing, null, linkedNode);
-
- /// Initialize using the given serialized information.
- ImportElementImpl.forSerialized(this._unlinkedImport, this._linkedDependency,
- LibraryElementImpl enclosingLibrary)
- : super.forSerialized(enclosingLibrary);
+ : super.forLinkedNode(enclosing, null, linkedNode);
@override
List<NamespaceCombinator> get combinators {
@@ -6630,21 +5241,15 @@
);
}
- if (_unlinkedImport != null) {
- return _combinators = _buildCombinators(_unlinkedImport.combinators);
- }
-
return _combinators ?? const <NamespaceCombinator>[];
}
void set combinators(List<NamespaceCombinator> combinators) {
- _assertNotResynthesized(_unlinkedImport);
_combinators = combinators;
}
/// Set whether this import is for a deferred library.
void set deferred(bool isDeferred) {
- _assertNotResynthesized(_unlinkedImport);
setModifier(Modifier.DEFERRED, isDeferred);
}
@@ -6665,23 +5270,10 @@
return _importedLibrary = linkedContext.directiveLibrary(linkedNode);
}
- if (_linkedDependency != null) {
- if (_importedLibrary == null) {
- LibraryElementImpl library = enclosingElement as LibraryElementImpl;
- if (_linkedDependency == 0) {
- _importedLibrary = library;
- } else {
- _importedLibrary = library.resynthesizerContext
- .buildImportedLibrary(_linkedDependency);
- }
- }
- }
-
return _importedLibrary;
}
void set importedLibrary(LibraryElement importedLibrary) {
- _assertNotResynthesized(_unlinkedImport);
_importedLibrary = importedLibrary;
}
@@ -6691,36 +5283,13 @@
ImportDirective linkedNode = this.linkedNode;
return linkedNode.deferredKeyword != null;
}
- if (_unlinkedImport != null) {
- return _unlinkedImport.isDeferred;
- }
return hasModifier(Modifier.DEFERRED);
}
@override
- bool get isSynthetic {
- if (_unlinkedImport != null) {
- return _unlinkedImport.isImplicit;
- }
- return super.isSynthetic;
- }
-
- @override
ElementKind get kind => ElementKind.IMPORT;
- @override
- List<ElementAnnotation> get metadata {
- if (_metadata == null) {
- if (_unlinkedImport != null) {
- return _metadata = _buildAnnotations(
- library.definingCompilationUnit, _unlinkedImport.annotations);
- }
- }
- return super.metadata;
- }
-
void set metadata(List<ElementAnnotation> metadata) {
- _assertNotResynthesized(_unlinkedImport);
super.metadata = metadata;
}
@@ -6730,14 +5299,7 @@
return linkedContext.getDirectiveOffset(linkedNode);
}
- int offset = super.nameOffset;
- if (offset == 0 && _unlinkedImport != null) {
- if (_unlinkedImport.isImplicit) {
- return -1;
- }
- return _unlinkedImport.offset;
- }
- return offset;
+ return super.nameOffset;
}
@override
@@ -6763,16 +5325,10 @@
}
}
- if (_unlinkedImport != null && _unlinkedImport.prefixReference != 0) {
- LibraryElementImpl library = enclosingElement as LibraryElementImpl;
- _prefix = new PrefixElementImpl.forSerialized(_unlinkedImport, library);
- }
-
return _prefix;
}
void set prefix(PrefixElement prefix) {
- _assertNotResynthesized(_unlinkedImport);
_prefix = prefix;
}
@@ -6782,14 +5338,10 @@
ImportDirective node = linkedNode;
return node.prefix?.offset ?? -1;
}
- if (_unlinkedImport != null) {
- return _unlinkedImport.prefixOffset;
- }
return _prefixOffset;
}
void set prefixOffset(int prefixOffset) {
- _assertNotResynthesized(_unlinkedImport);
_prefixOffset = prefixOffset;
}
@@ -6800,57 +5352,15 @@
return node.uri.stringValue;
}
- if (_unlinkedImport != null) {
- if (_unlinkedImport.isImplicit) {
- return null;
- }
- return _selectedUri ??=
- _selectUri(_unlinkedImport.uri, _unlinkedImport.configurations);
- }
return super.uri;
}
@override
void set uri(String uri) {
- _assertNotResynthesized(_unlinkedImport);
super.uri = uri;
}
@override
- int get uriEnd {
- if (_unlinkedImport != null) {
- if (_unlinkedImport.isImplicit) {
- return -1;
- }
- return _unlinkedImport.uriEnd;
- }
- return super.uriEnd;
- }
-
- @override
- void set uriEnd(int uriEnd) {
- _assertNotResynthesized(_unlinkedImport);
- super.uriEnd = uriEnd;
- }
-
- @override
- int get uriOffset {
- if (_unlinkedImport != null) {
- if (_unlinkedImport.isImplicit) {
- return -1;
- }
- return _unlinkedImport.uriOffset;
- }
- return super.uriOffset;
- }
-
- @override
- void set uriOffset(int uriOffset) {
- _assertNotResynthesized(_unlinkedImport);
- super.uriOffset = uriOffset;
- }
-
- @override
T accept<T>(ElementVisitor<T> visitor) => visitor.visitImportElement(this);
@override
@@ -6865,24 +5375,6 @@
prefix?.accept(visitor);
}
- static List<NamespaceCombinator> _buildCombinators(
- List<UnlinkedCombinator> unlinkedCombinators) {
- int length = unlinkedCombinators.length;
- if (length != 0) {
- List<NamespaceCombinator> combinators =
- new List<NamespaceCombinator>(length);
- for (int i = 0; i < length; i++) {
- UnlinkedCombinator unlinkedCombinator = unlinkedCombinators[i];
- combinators[i] = unlinkedCombinator.shows.isNotEmpty
- ? new ShowElementCombinatorImpl.forSerialized(unlinkedCombinator)
- : new HideElementCombinatorImpl.forSerialized(unlinkedCombinator);
- }
- return combinators;
- } else {
- return const <NamespaceCombinator>[];
- }
- }
-
static List<NamespaceCombinator> _buildCombinators2(
LinkedUnitContext context, List<Combinator> combinators) {
return combinators.map((node) {
@@ -6954,10 +5446,6 @@
@override
final AnalysisSession session;
- final LibraryResynthesizerContext resynthesizerContext;
-
- final UnlinkedUnit unlinkedDefiningUnit;
-
/// The context of the defining unit.
final LinkedUnitContext linkedContext;
@@ -7016,9 +5504,7 @@
/// the given [name] and [offset].
LibraryElementImpl(this.context, this.session, String name, int offset,
this.nameLength, this.isNonNullableByDefault)
- : resynthesizerContext = null,
- unlinkedDefiningUnit = null,
- linkedContext = null,
+ : linkedContext = null,
super(name, offset);
LibraryElementImpl.forLinkedNode(
@@ -7030,9 +5516,7 @@
this.linkedContext,
Reference reference,
CompilationUnit linkedNode)
- : resynthesizerContext = null,
- unlinkedDefiningUnit = null,
- isNonNullableByDefault = linkedContext.isNNBD,
+ : isNonNullableByDefault = linkedContext.isNNBD,
super.forLinkedNode(null, reference, linkedNode) {
_name = name;
_nameOffset = offset;
@@ -7047,31 +5531,9 @@
LibraryElementImpl.forNode(this.context, this.session, LibraryIdentifier name,
this.isNonNullableByDefault)
: nameLength = name != null ? name.length : 0,
- resynthesizerContext = null,
- unlinkedDefiningUnit = null,
linkedContext = null,
super.forNode(name);
- /// Initialize using the given serialized information.
- LibraryElementImpl.forSerialized(
- this.context,
- this.session,
- String name,
- int offset,
- this.nameLength,
- this.resynthesizerContext,
- this.unlinkedDefiningUnit)
- : linkedContext = null,
- isNonNullableByDefault = unlinkedDefiningUnit.isNNBD,
- super.forSerialized(null) {
- _name = name;
- _nameOffset = offset;
- setResolutionCapability(
- LibraryResolutionCapability.resolvedTypeNames, true);
- setResolutionCapability(
- LibraryResolutionCapability.constantExpressions, true);
- }
-
@override
int get codeLength {
CompilationUnitElement unit = _definingCompilationUnit;
@@ -7108,9 +5570,6 @@
var comment = linkedContext.getLibraryDocumentationComment(linkedNode);
return getCommentNodeRawText(comment);
}
- if (unlinkedDefiningUnit != null) {
- return unlinkedDefiningUnit.libraryDocumentationComment?.text;
- }
return super.documentationComment;
}
@@ -7126,10 +5585,6 @@
return null;
}
- if (resynthesizerContext != null) {
- return _entryPoint = resynthesizerContext.findEntryPoint();
- }
-
return _entryPoint;
}
@@ -7158,10 +5613,6 @@
return _exportNamespace = elements.buildExportNamespace(source.uri);
}
- if (resynthesizerContext != null) {
- _exportNamespace ??= resynthesizerContext.buildExportNamespace();
- }
-
return _exportNamespace;
}
@@ -7181,38 +5632,12 @@
.toList();
}
- if (unlinkedDefiningUnit != null) {
- List<UnlinkedExportNonPublic> unlinkedNonPublicExports =
- unlinkedDefiningUnit.exports;
- List<UnlinkedExportPublic> unlinkedPublicExports =
- unlinkedDefiningUnit.publicNamespace.exports;
- assert(
- unlinkedDefiningUnit.exports.length == unlinkedPublicExports.length);
- int length = unlinkedNonPublicExports.length;
- if (length != 0) {
- List<ExportElement> exports = new List<ExportElement>();
- for (int i = 0; i < length; i++) {
- UnlinkedExportPublic serializedExportPublic =
- unlinkedPublicExports[i];
- UnlinkedExportNonPublic serializedExportNonPublic =
- unlinkedNonPublicExports[i];
- ExportElementImpl exportElement = new ExportElementImpl.forSerialized(
- serializedExportPublic, serializedExportNonPublic, library);
- exports.add(exportElement);
- }
- _exports = exports;
- } else {
- _exports = const <ExportElement>[];
- }
- }
-
return _exports ??= const <ExportElement>[];
}
/// Set the specifications of all of the exports defined in this library to
/// the given list of [exports].
void set exports(List<ExportElement> exports) {
- _assertNotResynthesized(unlinkedDefiningUnit);
for (ExportElement exportElement in exports) {
(exportElement as ExportElementImpl).enclosingElement = this;
}
@@ -7234,15 +5659,6 @@
return false;
}
- if (unlinkedDefiningUnit != null) {
- List<UnlinkedImport> unlinkedImports = unlinkedDefiningUnit.imports;
- for (UnlinkedImport import in unlinkedImports) {
- if (DartUriResolver.isDartExtUri(import.uri)) {
- return true;
- }
- }
- return false;
- }
return hasModifier(Modifier.HAS_EXT_URI);
}
@@ -7301,18 +5717,12 @@
return _imports;
}
- if (unlinkedDefiningUnit != null) {
- _imports = buildImportsFromSummary(this, unlinkedDefiningUnit.imports,
- resynthesizerContext.linkedLibrary.importDependencies);
- }
-
return _imports ??= const <ImportElement>[];
}
/// Set the specifications of all of the imports defined in this library to
/// the given list of [imports].
void set imports(List<ImportElement> imports) {
- _assertNotResynthesized(unlinkedDefiningUnit);
for (ImportElement importElement in imports) {
(importElement as ImportElementImpl).enclosingElement = this;
PrefixElementImpl prefix = importElement.prefix as PrefixElementImpl;
@@ -7370,11 +5780,6 @@
}
@override
- bool get isResynthesized {
- return resynthesizerContext != null;
- }
-
- @override
bool get isSynthetic {
if (linkedNode != null) {
return linkedContext.isSynthetic;
@@ -7483,12 +5888,6 @@
return _metadata = _buildAnnotations2(definingCompilationUnit, metadata);
}
- if (unlinkedDefiningUnit != null) {
- return _metadata = _buildAnnotations(
- _definingCompilationUnit as CompilationUnitElementImpl,
- unlinkedDefiningUnit.libraryAnnotations);
- }
-
return super.metadata;
}
@@ -7519,9 +5918,6 @@
NamespaceBuilder().createPublicNamespaceForLibrary(this);
}
- if (resynthesizerContext != null) {
- return _publicNamespace = resynthesizerContext.buildPublicNamespace();
- }
return _publicNamespace;
}
@@ -7636,23 +6032,6 @@
safelyVisitChildren(_parts, visitor);
}
- static List<ImportElement> buildImportsFromSummary(LibraryElement library,
- List<UnlinkedImport> unlinkedImports, List<int> importDependencies) {
- int length = unlinkedImports.length;
- if (length != 0) {
- List<ImportElement> imports = new List<ImportElement>();
- for (int i = 0; i < length; i++) {
- int dependency = importDependencies[i];
- ImportElementImpl importElement = new ImportElementImpl.forSerialized(
- unlinkedImports[i], dependency, library);
- imports.add(importElement);
- }
- return imports;
- } else {
- return const <ImportElement>[];
- }
- }
-
static List<PrefixElement> buildPrefixesFromImports(
List<ImportElement> imports) {
HashSet<PrefixElement> prefixes = new HashSet<PrefixElement>();
@@ -7783,9 +6162,6 @@
@override
bool get isLate {
- if (_unlinkedVariable != null) {
- return _unlinkedVariable.isLate;
- }
return hasModifier(Modifier.LATE);
}
@@ -7848,11 +6224,6 @@
/// Initialize a newly created method element to have the given [name].
MethodElementImpl.forNode(Identifier name) : super.forNode(name);
- /// Initialize using the given serialized information.
- MethodElementImpl.forSerialized(UnlinkedExecutable serializedExecutable,
- TypeParameterizedElementMixin enclosingClass)
- : super.forSerialized(serializedExecutable, enclosingClass);
-
@override
String get displayName {
String displayName = super.displayName;
@@ -7868,7 +6239,6 @@
/// Set whether this class is abstract.
void set isAbstract(bool isAbstract) {
- _assertNotResynthesized(serializedExecutable);
setModifier(Modifier.ABSTRACT, isAbstract);
}
@@ -7890,15 +6260,11 @@
if (linkedNode != null) {
return enclosingUnit.linkedContext.isStatic(linkedNode);
}
- if (serializedExecutable != null) {
- return serializedExecutable.isStatic;
- }
return hasModifier(Modifier.STATIC);
}
/// Set whether this method is static.
void set isStatic(bool isStatic) {
- _assertNotResynthesized(serializedExecutable);
setModifier(Modifier.STATIC, isStatic);
}
@@ -7949,11 +6315,6 @@
/// Initialize a newly created class element to have the given [name].
MixinElementImpl.forNode(Identifier name) : super.forNode(name);
- /// Initialize using the given serialized information.
- MixinElementImpl.forSerialized(
- UnlinkedClass unlinkedClass, CompilationUnitElementImpl enclosingUnit)
- : super.forSerialized(unlinkedClass, enclosingUnit);
-
@override
bool get isAbstract => true;
@@ -7983,33 +6344,11 @@
return _superclassConstraints = constraints;
}
- if (_unlinkedClass != null) {
- List<InterfaceType> constraints;
- if (_unlinkedClass.superclassConstraints.isNotEmpty) {
- ResynthesizerContext context = enclosingUnit.resynthesizerContext;
- constraints = _unlinkedClass.superclassConstraints
- .map((EntityRef t) => context.resolveTypeRef(this, t))
- .where(_isInterfaceTypeInterface)
- .cast<InterfaceType>()
- .toList(growable: false);
- }
- if (constraints == null || constraints.isEmpty) {
- constraints = [context.typeProvider.objectType];
- }
- return _superclassConstraints = constraints;
- }
-
return _superclassConstraints ?? const <InterfaceType>[];
}
void set superclassConstraints(List<InterfaceType> superclassConstraints) {
- _assertNotResynthesized(_unlinkedClass);
- // Note: if we are using the analysis driver, the set of superclass
- // constraints has already been computed, and it's more accurate. So we
- // only store superclass constraints if we are using the old task model.
- if (_unlinkedClass == null) {
- _superclassConstraints = superclassConstraints;
- }
+ _superclassConstraints = superclassConstraints;
}
@override
@@ -8021,18 +6360,11 @@
linkedContext.getMixinSuperInvokedNames(linkedNode);
}
- if (_unlinkedClass != null) {
- return _superInvokedNames = _unlinkedClass.superInvokedNames;
- }
-
return _superInvokedNames ?? const <String>[];
}
void set superInvokedNames(List<String> superInvokedNames) {
- _assertNotResynthesized(_unlinkedClass);
- if (_unlinkedClass == null) {
- _superInvokedNames = superInvokedNames;
- }
+ _superInvokedNames = superInvokedNames;
}
@override
@@ -8487,38 +6819,24 @@
/// A [VariableElementImpl], which is not a parameter.
abstract class NonParameterVariableElementImpl extends VariableElementImpl {
- /// The unlinked representation of the variable in the summary.
- final UnlinkedVariable _unlinkedVariable;
-
/// Initialize a newly created variable element to have the given [name] and
/// [offset].
NonParameterVariableElementImpl(String name, int offset)
- : _unlinkedVariable = null,
- super(name, offset);
+ : super(name, offset);
NonParameterVariableElementImpl.forLinkedNode(
ElementImpl enclosing, Reference reference, AstNode linkedNode)
- : _unlinkedVariable = null,
- super.forLinkedNode(enclosing, reference, linkedNode);
+ : super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created variable element to have the given [name].
NonParameterVariableElementImpl.forNode(Identifier name)
- : _unlinkedVariable = null,
- super.forNode(name);
-
- /// Initialize using the given serialized information.
- NonParameterVariableElementImpl.forSerialized(
- this._unlinkedVariable, ElementImpl enclosingElement)
- : super.forSerialized(enclosingElement);
+ : super.forNode(name);
@override
int get codeLength {
if (linkedNode != null) {
return linkedContext.getCodeLength(linkedNode);
}
- if (_unlinkedVariable != null) {
- return _unlinkedVariable.codeRange?.length;
- }
return super.codeLength;
}
@@ -8527,9 +6845,6 @@
if (linkedNode != null) {
return linkedContext.getCodeOffset(linkedNode);
}
- if (_unlinkedVariable != null) {
- return _unlinkedVariable.codeRange?.offset;
- }
return super.codeOffset;
}
@@ -8540,9 +6855,6 @@
var comment = context.getDocumentationComment(linkedNode);
return getCommentNodeRawText(comment);
}
- if (_unlinkedVariable != null) {
- return _unlinkedVariable.documentationComment?.text;
- }
return super.documentationComment;
}
@@ -8551,15 +6863,11 @@
if (linkedNode != null) {
return linkedContext.hasImplicitType(linkedNode);
}
- if (_unlinkedVariable != null) {
- return _unlinkedVariable.type == null;
- }
return super.hasImplicitType;
}
@override
void set hasImplicitType(bool hasImplicitType) {
- _assertNotResynthesized(_unlinkedVariable);
super.hasImplicitType = hasImplicitType;
}
@@ -8574,72 +6882,15 @@
..enclosingElement = this;
}
}
- if (_unlinkedVariable != null) {
- UnlinkedExecutable unlinkedInitializer = _unlinkedVariable.initializer;
- if (unlinkedInitializer != null) {
- _initializer =
- new FunctionElementImpl.forSerialized(unlinkedInitializer, this)
- ..isSynthetic = true;
- } else {
- return null;
- }
- }
}
return super.initializer;
}
- /// Set the function representing this variable's initializer to the given
- /// [function].
- void set initializer(FunctionElement function) {
- _assertNotResynthesized(_unlinkedVariable);
- super.initializer = function;
- }
-
- @override
- bool get isConst {
- if (_unlinkedVariable != null) {
- return _unlinkedVariable.isConst;
- }
- return super.isConst;
- }
-
- @override
- void set isConst(bool isConst) {
- _assertNotResynthesized(_unlinkedVariable);
- super.isConst = isConst;
- }
-
- @override
- bool get isFinal {
- if (_unlinkedVariable != null) {
- return _unlinkedVariable.isFinal;
- }
- return super.isFinal;
- }
-
- @override
- void set isFinal(bool isFinal) {
- _assertNotResynthesized(_unlinkedVariable);
- super.isFinal = isFinal;
- }
-
- @override
- List<ElementAnnotation> get metadata {
- if (_unlinkedVariable != null) {
- return _metadata ??=
- _buildAnnotations(enclosingUnit, _unlinkedVariable.annotations);
- }
- return super.metadata;
- }
-
@override
String get name {
if (linkedNode != null) {
return reference.name;
}
- if (_unlinkedVariable != null) {
- return _unlinkedVariable.name;
- }
return super.name;
}
@@ -8649,24 +6900,7 @@
return enclosingUnit.linkedContext.getNameOffset(linkedNode);
}
- int offset = super.nameOffset;
- if (offset == 0) {
- if (_unlinkedVariable != null) {
- return _unlinkedVariable.nameOffset;
- }
- }
- return offset;
- }
-
- @override
- DartType get type {
- if (_unlinkedVariable != null && _declaredType == null && _type == null) {
- _type = enclosingUnit.resynthesizerContext
- .resolveLinkedType(this, _unlinkedVariable.inferredTypeSlot);
- declaredType = enclosingUnit.resynthesizerContext
- .resolveTypeRef(this, _unlinkedVariable.type, declaredType: true);
- }
- return super.type;
+ return super.nameOffset;
}
@override
@@ -8674,7 +6908,6 @@
if (linkedNode != null) {
return linkedContext.setVariableType(linkedNode, type);
}
- _assertNotResynthesized(_unlinkedVariable);
_type = _checkElementOfType(type);
}
@@ -8684,25 +6917,15 @@
return linkedContext.getTypeInferenceError(linkedNode);
}
- if (_unlinkedVariable != null) {
- return enclosingUnit.resynthesizerContext
- .getTypeInferenceError(_unlinkedVariable.inferredTypeSlot);
- }
// We don't support type inference errors without linking.
return null;
}
-
- /// Subclasses need this getter, see [ConstVariableElement._unlinkedConst].
- UnlinkedExpr get _unlinkedConst => _unlinkedVariable?.initializer?.bodyExpr;
}
/// A concrete implementation of a [ParameterElement].
class ParameterElementImpl extends VariableElementImpl
with ParameterElementMixin
implements ParameterElement {
- /// The unlinked representation of the parameter in the summary.
- final UnlinkedParam unlinkedParam;
-
/// A list containing all of the parameters defined by this parameter element.
/// There will only be parameters if this parameter is a function typed
/// parameter.
@@ -8730,14 +6953,11 @@
/// Initialize a newly created parameter element to have the given [name] and
/// [nameOffset].
- ParameterElementImpl(String name, int nameOffset)
- : unlinkedParam = null,
- super(name, nameOffset);
+ ParameterElementImpl(String name, int nameOffset) : super(name, nameOffset);
ParameterElementImpl.forLinkedNode(
ElementImpl enclosing, Reference reference, FormalParameter linkedNode)
- : unlinkedParam = null,
- super.forLinkedNode(enclosing, reference, linkedNode);
+ : super.forLinkedNode(enclosing, reference, linkedNode);
factory ParameterElementImpl.forLinkedNodeFactory(
ElementImpl enclosing, Reference reference, FormalParameter node) {
@@ -8756,40 +6976,7 @@
}
/// Initialize a newly created parameter element to have the given [name].
- ParameterElementImpl.forNode(Identifier name)
- : unlinkedParam = null,
- super.forNode(name);
-
- /// Initialize using the given serialized information.
- ParameterElementImpl.forSerialized(
- this.unlinkedParam, ElementImpl enclosingElement)
- : super.forSerialized(enclosingElement);
-
- /// Initialize using the given serialized information.
- factory ParameterElementImpl.forSerializedFactory(
- UnlinkedParam unlinkedParameter, ElementImpl enclosingElement,
- {bool synthetic: false}) {
- ParameterElementImpl element;
- if (unlinkedParameter.isInitializingFormal) {
- if (unlinkedParameter.kind == UnlinkedParamKind.requiredPositional) {
- element = new FieldFormalParameterElementImpl.forSerialized(
- unlinkedParameter, enclosingElement);
- } else {
- element = new DefaultFieldFormalParameterElementImpl.forSerialized(
- unlinkedParameter, enclosingElement);
- }
- } else {
- if (unlinkedParameter.kind == UnlinkedParamKind.requiredPositional) {
- element = new ParameterElementImpl.forSerialized(
- unlinkedParameter, enclosingElement);
- } else {
- element = new DefaultParameterElementImpl.forSerialized(
- unlinkedParameter, enclosingElement);
- }
- }
- element.isSynthetic = synthetic;
- return element;
- }
+ ParameterElementImpl.forNode(Identifier name) : super.forNode(name);
/// Creates a synthetic parameter with [name], [type] and [kind].
factory ParameterElementImpl.synthetic(
@@ -8806,9 +6993,6 @@
if (linkedNode != null) {
return linkedContext.getCodeLength(linkedNode);
}
- if (unlinkedParam != null) {
- return unlinkedParam.codeRange?.length;
- }
return super.codeLength;
}
@@ -8817,9 +7001,6 @@
if (linkedNode != null) {
return linkedContext.getCodeOffset(linkedNode);
}
- if (unlinkedParam != null) {
- return unlinkedParam.codeRange?.offset;
- }
return super.codeOffset;
}
@@ -8829,18 +7010,11 @@
return linkedContext.getDefaultValueCode(linkedNode);
}
- if (unlinkedParam != null) {
- if (unlinkedParam.initializer?.bodyExpr == null) {
- return null;
- }
- return unlinkedParam.defaultValueCode;
- }
return _defaultValueCode;
}
/// Set Dart code of the default value.
void set defaultValueCode(String defaultValueCode) {
- _assertNotResynthesized(unlinkedParam);
this._defaultValueCode = StringUtilities.intern(defaultValueCode);
}
@@ -8849,15 +7023,11 @@
if (linkedNode != null) {
return linkedContext.hasImplicitType(linkedNode);
}
- if (unlinkedParam != null) {
- return unlinkedParam.type == null && !unlinkedParam.isFunctionTyped;
- }
return super.hasImplicitType;
}
@override
void set hasImplicitType(bool hasImplicitType) {
- _assertNotResynthesized(unlinkedParam);
super.hasImplicitType = hasImplicitType;
}
@@ -8868,12 +7038,7 @@
if (linkedNode != null) {
return linkedContext.getInheritsCovariant(linkedNode);
}
- if (unlinkedParam != null) {
- return enclosingUnit.resynthesizerContext
- .inheritsCovariant(unlinkedParam.inheritsCovariantSlot);
- } else {
- return _inheritsCovariant;
- }
+ return _inheritsCovariant;
}
/// Record whether or not this parameter inherits from a covariant parameter.
@@ -8882,57 +7047,31 @@
linkedContext.setInheritsCovariant(linkedNode, value);
return;
}
-
- _assertNotResynthesized(unlinkedParam);
_inheritsCovariant = value;
}
@override
FunctionElement get initializer {
- if (_initializer == null) {
- if (linkedNode != null) {
- if (linkedContext.hasDefaultValue(linkedNode)) {
- _initializer = FunctionElementImpl('', -1)
- ..enclosingElement = this
- ..isSynthetic = true;
- }
- }
- if (unlinkedParam != null) {
- UnlinkedExecutable unlinkedInitializer = unlinkedParam.initializer;
- if (unlinkedInitializer != null) {
- _initializer =
- new FunctionElementImpl.forSerialized(unlinkedInitializer, this)
- ..isSynthetic = true;
- } else {
- return null;
- }
+ if (_initializer != null) return _initializer;
+
+ if (linkedNode != null) {
+ if (linkedContext.hasDefaultValue(linkedNode)) {
+ _initializer = FunctionElementImpl('', -1)
+ ..enclosingElement = this
+ ..isSynthetic = true;
}
}
+
return super.initializer;
}
/// Set the function representing this variable's initializer to the given
/// [function].
void set initializer(FunctionElement function) {
- _assertNotResynthesized(unlinkedParam);
super.initializer = function;
}
@override
- bool get isConst {
- if (unlinkedParam != null) {
- return false;
- }
- return super.isConst;
- }
-
- @override
- void set isConst(bool isConst) {
- _assertNotResynthesized(unlinkedParam);
- super.isConst = isConst;
- }
-
- @override
bool get isCovariant {
if (isExplicitlyCovariant || inheritsCovariant) {
return true;
@@ -8945,16 +7084,12 @@
if (linkedNode != null) {
return linkedContext.isExplicitlyCovariant(linkedNode);
}
- if (unlinkedParam != null) {
- return unlinkedParam.isExplicitlyCovariant;
- }
return hasModifier(Modifier.COVARIANT);
}
/// Set whether this variable parameter is explicitly marked as being
/// covariant.
void set isExplicitlyCovariant(bool isCovariant) {
- _assertNotResynthesized(unlinkedParam);
setModifier(Modifier.COVARIANT, isCovariant);
}
@@ -8964,19 +7099,10 @@
FormalParameter linkedNode = this.linkedNode;
return linkedNode.isFinal;
}
- if (unlinkedParam != null) {
- return unlinkedParam.isFinal;
- }
return super.isFinal;
}
@override
- void set isFinal(bool isFinal) {
- _assertNotResynthesized(unlinkedParam);
- super.isFinal = isFinal;
- }
-
- @override
bool get isInitializingFormal => false;
@override
@@ -8992,22 +7118,10 @@
ElementKind get kind => ElementKind.PARAMETER;
@override
- List<ElementAnnotation> get metadata {
- if (unlinkedParam != null) {
- return _metadata ??=
- _buildAnnotations(enclosingUnit, unlinkedParam.annotations);
- }
- return super.metadata;
- }
-
- @override
String get name {
if (linkedNode != null) {
return reference.name;
}
- if (unlinkedParam != null) {
- return unlinkedParam.name;
- }
return super.name;
}
@@ -9017,20 +7131,7 @@
return enclosingUnit.linkedContext.getNameOffset(linkedNode);
}
- int offset = super.nameOffset;
- if (offset == 0) {
- if (unlinkedParam != null) {
- if (isSynthetic ||
- (unlinkedParam.name.isEmpty &&
- unlinkedParam.kind != UnlinkedParamKind.requiredNamed &&
- unlinkedParam.kind != UnlinkedParamKind.optionalNamed &&
- enclosingElement is GenericFunctionTypeElement)) {
- return -1;
- }
- return unlinkedParam.nameOffset;
- }
- }
- return offset;
+ return super.nameOffset;
}
@override
@@ -9042,27 +7143,10 @@
// ignore: deprecated_member_use_from_same_package
return linkedNode.kind;
}
- if (unlinkedParam != null) {
- switch (unlinkedParam.kind) {
- case UnlinkedParamKind.optionalNamed:
- _parameterKind = ParameterKind.NAMED;
- break;
- case UnlinkedParamKind.optionalPositional:
- _parameterKind = ParameterKind.POSITIONAL;
- break;
- case UnlinkedParamKind.requiredPositional:
- _parameterKind = ParameterKind.REQUIRED;
- break;
- case UnlinkedParamKind.requiredNamed:
- _parameterKind = ParameterKind.NAMED_REQUIRED;
- break;
- }
- }
return _parameterKind;
}
void set parameterKind(ParameterKind parameterKind) {
- _assertNotResynthesized(unlinkedParam);
_parameterKind = parameterKind;
}
@@ -9086,11 +7170,6 @@
}
}
- if (unlinkedParam != null) {
- _resynthesizeTypeAndParameters();
- return _parameters ??= const <ParameterElement>[];
- }
-
return _parameters ??= const <ParameterElement>[];
}
@@ -9110,7 +7189,6 @@
var context = enclosingUnit.linkedContext;
return _type = context.getType(linkedNode);
}
- _resynthesizeTypeAndParameters();
return super.type;
}
@@ -9120,10 +7198,6 @@
return linkedContext.getTypeInferenceError(linkedNode);
}
- if (unlinkedParam != null) {
- return enclosingUnit.resynthesizerContext
- .getTypeInferenceError(unlinkedParam.inferredTypeSlot);
- }
// We don't support type inference errors without linking.
return null;
}
@@ -9162,22 +7236,12 @@
@override
SourceRange get visibleRange {
- if (unlinkedParam != null) {
- if (unlinkedParam.visibleLength == 0) {
- return null;
- }
- return new SourceRange(
- unlinkedParam.visibleOffset, unlinkedParam.visibleLength);
- }
if (_visibleRangeLength < 0) {
return null;
}
return new SourceRange(_visibleRangeOffset, _visibleRangeLength);
}
- /// Subclasses need this getter, see [ConstVariableElement._unlinkedConst].
- UnlinkedExpr get _unlinkedConst => unlinkedParam?.initializer?.bodyExpr;
-
@override
T accept<T>(ElementVisitor<T> visitor) => visitor.visitParameterElement(this);
@@ -9207,7 +7271,6 @@
/// Set the visible range for this element to the range starting at the given
/// [offset] with the given [length].
void setVisibleRange(int offset, int length) {
- _assertNotResynthesized(unlinkedParam);
_visibleRangeOffset = offset;
_visibleRangeLength = length;
}
@@ -9218,37 +7281,6 @@
safelyVisitChildren(parameters, visitor);
}
- /// If this element is resynthesized, and its type and parameters have not
- /// been build yet, build them and remember in the corresponding fields.
- void _resynthesizeTypeAndParameters() {
- if (unlinkedParam != null && _declaredType == null && _type == null) {
- if (unlinkedParam.isFunctionTyped) {
- CompilationUnitElementImpl enclosingUnit = this.enclosingUnit;
-
- var typeElement = new GenericFunctionTypeElementImpl.forOffset(-1);
- typeElement.enclosingElement = this;
-
- _parameters = ParameterElementImpl.resynthesizeList(
- unlinkedParam.parameters, typeElement,
- synthetic: isSynthetic);
- typeElement.parameters = _parameters;
-
- typeElement.returnType = enclosingUnit.resynthesizerContext
- .resolveTypeRef(this, unlinkedParam.type);
-
- _type = new FunctionTypeImpl(typeElement);
- typeElement.type = _type;
- } else {
- if (unlinkedParam.inferredTypeSlot != 0) {
- _type = enclosingUnit.resynthesizerContext
- .resolveLinkedType(this, unlinkedParam.inferredTypeSlot);
- }
- declaredType = enclosingUnit.resynthesizerContext
- .resolveTypeRef(this, unlinkedParam.type, declaredType: true);
- }
- }
- }
-
static List<ParameterElement> forLinkedNodeList(
ElementImpl enclosing,
LinkedUnitContext context,
@@ -9299,24 +7331,6 @@
}
}).toList();
}
-
- /// Create and return [ParameterElement]s for the given [unlinkedParameters].
- static List<ParameterElement> resynthesizeList(
- List<UnlinkedParam> unlinkedParameters, ElementImpl enclosingElement,
- {bool synthetic: false}) {
- int length = unlinkedParameters.length;
- if (length != 0) {
- List<ParameterElement> parameters = new List<ParameterElement>(length);
- for (int i = 0; i < length; i++) {
- parameters[i] = new ParameterElementImpl.forSerializedFactory(
- unlinkedParameters[i], enclosingElement,
- synthetic: synthetic);
- }
- return parameters;
- } else {
- return const <ParameterElement>[];
- }
- }
}
/// The parameter of an implicit setter.
@@ -9340,10 +7354,6 @@
var context = variable.linkedContext;
return context.getInheritsCovariant(variable.linkedNode);
}
- if (variable._unlinkedVariable != null) {
- return enclosingUnit.resynthesizerContext.inheritsCovariant(
- variable._unlinkedVariable.inheritsCovariantSlot);
- }
}
return false;
}
@@ -9438,29 +7448,16 @@
/// A concrete implementation of a [PrefixElement].
class PrefixElementImpl extends ElementImpl implements PrefixElement {
- /// The unlinked representation of the import in the summary.
- final UnlinkedImport _unlinkedImport;
-
/// Initialize a newly created method element to have the given [name] and
/// [nameOffset].
- PrefixElementImpl(String name, int nameOffset)
- : _unlinkedImport = null,
- super(name, nameOffset);
+ PrefixElementImpl(String name, int nameOffset) : super(name, nameOffset);
PrefixElementImpl.forLinkedNode(
ElementImpl enclosing, Reference reference, SimpleIdentifier linkedNode)
- : _unlinkedImport = null,
- super.forLinkedNode(enclosing, reference, linkedNode);
+ : super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created prefix element to have the given [name].
- PrefixElementImpl.forNode(Identifier name)
- : _unlinkedImport = null,
- super.forNode(name);
-
- /// Initialize using the given serialized information.
- PrefixElementImpl.forSerialized(
- this._unlinkedImport, LibraryElementImpl enclosingLibrary)
- : super.forSerialized(enclosingLibrary);
+ PrefixElementImpl.forNode(Identifier name) : super.forNode(name);
@override
String get displayName => name;
@@ -9480,13 +7477,6 @@
if (linkedNode != null) {
return reference.name;
}
- if (_name == null) {
- if (_unlinkedImport != null) {
- LibraryElementImpl library = enclosingElement as LibraryElementImpl;
- int prefixId = _unlinkedImport.prefixReference;
- return _name = library.unlinkedDefiningUnit.references[prefixId].name;
- }
- }
return super.name;
}
@@ -9495,11 +7485,7 @@
if (linkedNode != null) {
return (linkedNode as SimpleIdentifier).offset;
}
- int offset = super.nameOffset;
- if (offset == 0 && _unlinkedImport != null) {
- return _unlinkedImport.prefixOffset;
- }
- return offset;
+ return super.nameOffset;
}
@override
@@ -9530,11 +7516,6 @@
/// [name].
PropertyAccessorElementImpl.forNode(Identifier name) : super.forNode(name);
- /// Initialize using the given serialized information.
- PropertyAccessorElementImpl.forSerialized(
- UnlinkedExecutable serializedExecutable, ElementImpl enclosingElement)
- : super.forSerialized(serializedExecutable, enclosingElement);
-
/// Initialize a newly created synthetic property accessor element to be
/// associated with the given [variable].
PropertyAccessorElementImpl.forVariable(PropertyInducingElementImpl variable,
@@ -9562,23 +7543,12 @@
}
@override
- String get displayName {
- if (serializedExecutable != null && isSetter) {
- String name = serializedExecutable.name;
- assert(name.endsWith('='));
- return name.substring(0, name.length - 1);
- }
- return super.displayName;
- }
-
- @override
TypeParameterizedElementMixin get enclosingTypeParameterContext {
return (enclosingElement as ElementImpl).typeParameterContext;
}
/// Set whether this accessor is a getter.
void set getter(bool isGetter) {
- _assertNotResynthesized(serializedExecutable);
setModifier(Modifier.GETTER, isGetter);
}
@@ -9591,7 +7561,6 @@
/// Set whether this class is abstract.
void set isAbstract(bool isAbstract) {
- _assertNotResynthesized(serializedExecutable);
setModifier(Modifier.ABSTRACT, isAbstract);
}
@@ -9600,9 +7569,6 @@
if (linkedNode != null) {
return enclosingUnit.linkedContext.isGetter(linkedNode);
}
- if (serializedExecutable != null) {
- return serializedExecutable.kind == UnlinkedExecutableKind.getter;
- }
return hasModifier(Modifier.GETTER);
}
@@ -9611,9 +7577,6 @@
if (linkedNode != null) {
return enclosingUnit.linkedContext.isSetter(linkedNode);
}
- if (serializedExecutable != null) {
- return serializedExecutable.kind == UnlinkedExecutableKind.setter;
- }
return hasModifier(Modifier.SETTER);
}
@@ -9622,16 +7585,11 @@
if (linkedNode != null) {
return enclosingUnit.linkedContext.isStatic(linkedNode);
}
- if (serializedExecutable != null) {
- return serializedExecutable.isStatic ||
- variable is TopLevelVariableElement;
- }
return hasModifier(Modifier.STATIC);
}
/// Set whether this accessor is static.
void set isStatic(bool isStatic) {
- _assertNotResynthesized(serializedExecutable);
setModifier(Modifier.STATIC, isStatic);
}
@@ -9652,9 +7610,6 @@
}
return name;
}
- if (serializedExecutable != null) {
- return serializedExecutable.name;
- }
if (isSetter) {
return "${super.name}=";
}
@@ -9663,7 +7618,6 @@
/// Set whether this accessor is a setter.
void set setter(bool isSetter) {
- _assertNotResynthesized(serializedExecutable);
setModifier(Modifier.SETTER, isSetter);
}
@@ -9792,11 +7746,6 @@
/// Initialize a newly created element to have the given [name].
PropertyInducingElementImpl.forNode(Identifier name) : super.forNode(name);
- /// Initialize using the given serialized information.
- PropertyInducingElementImpl.forSerialized(
- UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement)
- : super.forSerialized(unlinkedVariable, enclosingElement);
-
@override
bool get isConstantEvaluated => true;
@@ -9805,9 +7754,6 @@
if (linkedNode != null) {
return enclosingUnit.linkedContext.isLate(linkedNode);
}
- if (_unlinkedVariable != null) {
- return _unlinkedVariable.isLate;
- }
return hasModifier(Modifier.LATE);
}
@@ -9840,61 +7786,8 @@
}
}
-/// The context in which elements are resynthesized.
-abstract class ResynthesizerContext {
- @deprecated
- bool get isStrongMode;
-
- /// Build [ElementAnnotationImpl] for the given [UnlinkedExpr].
- ElementAnnotationImpl buildAnnotation(ElementImpl context, UnlinkedExpr uc);
-
- /// Build [Expression] for the given [UnlinkedExpr].
- Expression buildExpression(ElementImpl context, UnlinkedExpr uc);
-
- /// Build explicit top-level property accessors.
- UnitExplicitTopLevelAccessors buildTopLevelAccessors();
-
- /// Build explicit top-level variables.
- UnitExplicitTopLevelVariables buildTopLevelVariables();
-
- /// Return the error reported during type inference for the given [slot],
- /// or `null` if there was no error.
- TopLevelInferenceError getTypeInferenceError(int slot);
-
- /// Return `true` if the given parameter [slot] inherits `@covariant`
- /// behavior.
- bool inheritsCovariant(int slot);
-
- /// Return `true` if the given const constructor [slot] is a part of a cycle.
- bool isInConstCycle(int slot);
-
- bool isSimplyBounded(int notSimplyBoundedSlot);
-
- /// Resolve an [EntityRef] into a constructor. If the reference is
- /// unresolved, return `null`.
- ConstructorElement resolveConstructorRef(
- ElementImpl context, EntityRef entry);
-
- /// Build the appropriate [DartType] object corresponding to a slot id in the
- /// [LinkedUnit.types] table.
- DartType resolveLinkedType(ElementImpl context, int slot);
-
- /// Resolve an [EntityRef] into a type. If the reference is
- /// unresolved, return [DynamicTypeImpl.instance].
- ///
- /// TODO(paulberry): or should we have a class representing an
- /// unresolved type, for consistency with the full element model?
- DartType resolveTypeRef(ElementImpl context, EntityRef type,
- {bool defaultVoid: false,
- bool instantiateToBoundsAllowed: true,
- bool declaredType: false});
-}
-
/// A concrete implementation of a [ShowElementCombinator].
class ShowElementCombinatorImpl implements ShowElementCombinator {
- /// The unlinked representation of the combinator in the summary.
- final UnlinkedCombinator _unlinkedCombinator;
-
final LinkedUnitContext linkedContext;
final ShowCombinator linkedNode;
@@ -9910,31 +7803,20 @@
int _offset = 0;
ShowElementCombinatorImpl()
- : _unlinkedCombinator = null,
- linkedContext = null,
- linkedNode = null;
-
- ShowElementCombinatorImpl.forLinkedNode(this.linkedContext, this.linkedNode)
- : _unlinkedCombinator = null;
-
- /// Initialize using the given serialized information.
- ShowElementCombinatorImpl.forSerialized(this._unlinkedCombinator)
: linkedContext = null,
linkedNode = null;
+ ShowElementCombinatorImpl.forLinkedNode(this.linkedContext, this.linkedNode);
+
@override
int get end {
if (linkedNode != null) {
return linkedContext.getCombinatorEnd(linkedNode);
}
- if (_unlinkedCombinator != null) {
- return _unlinkedCombinator.end;
- }
return _end;
}
void set end(int end) {
- _assertNotResynthesized(_unlinkedCombinator);
_end = end;
}
@@ -9943,14 +7825,10 @@
if (linkedNode != null) {
return linkedNode.keyword.offset;
}
- if (_unlinkedCombinator != null) {
- return _unlinkedCombinator.offset;
- }
return _offset;
}
void set offset(int offset) {
- _assertNotResynthesized(_unlinkedCombinator);
_offset = offset;
}
@@ -9962,15 +7840,10 @@
return _shownNames = linkedNode.shownNames.map((i) => i.name).toList();
}
- if (_unlinkedCombinator != null) {
- return _shownNames = _unlinkedCombinator.shows.toList(growable: false);
- }
-
return _shownNames ?? const <String>[];
}
void set shownNames(List<String> shownNames) {
- _assertNotResynthesized(_unlinkedCombinator);
_shownNames = shownNames;
}
@@ -9989,29 +7862,6 @@
}
}
-/// Mixin providing the implementation of
-/// [TypeParameterizedElement.isSimplyBounded] for elements that define a type.
-mixin SimplyBoundableMixin implements TypeParameterizedElement {
- CompilationUnitElementImpl get enclosingUnit;
-
- @override
- bool get isSimplyBounded {
- var notSimplyBoundedSlot = _notSimplyBoundedSlot;
- if (notSimplyBoundedSlot == null) {
- // No summary is in use; we must be on the old task model. Not supported.
- // TODO(paulberry): remove this check when the old task model is gone.
- return true;
- }
- if (notSimplyBoundedSlot == 0) {
- return true;
- }
- return enclosingUnit.resynthesizerContext
- .isSimplyBounded(_notSimplyBoundedSlot);
- }
-
- int get _notSimplyBoundedSlot;
-}
-
/// A concrete implementation of a [TopLevelVariableElement].
class TopLevelVariableElementImpl extends PropertyInducingElementImpl
implements TopLevelVariableElement {
@@ -10059,19 +7909,12 @@
/// [name].
TopLevelVariableElementImpl.forNode(Identifier name) : super.forNode(name);
- /// Initialize using the given serialized information.
- TopLevelVariableElementImpl.forSerialized(
- UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement)
- : super.forSerialized(unlinkedVariable, enclosingElement);
-
@override
bool get isStatic => true;
@override
ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE;
- UnlinkedVariable get unlinkedVariableForTesting => _unlinkedVariable;
-
@override
T accept<T>(ElementVisitor<T> visitor) =>
visitor.visitTopLevelVariableElement(this);
@@ -10085,9 +7928,6 @@
/// A concrete implementation of a [TypeParameterElement].
class TypeParameterElementImpl extends ElementImpl
implements TypeParameterElement {
- /// The unlinked representation of the type parameter in the summary.
- final UnlinkedTypeParam _unlinkedTypeParam;
-
/// The default value of the type parameter. It is used to provide the
/// corresponding missing type argument in type annotations and as the
/// fall-back type value in type inference.
@@ -10102,31 +7942,19 @@
/// Initialize a newly created method element to have the given [name] and
/// [offset].
- TypeParameterElementImpl(String name, int offset)
- : _unlinkedTypeParam = null,
- super(name, offset);
+ TypeParameterElementImpl(String name, int offset) : super(name, offset);
TypeParameterElementImpl.forLinkedNode(
ElementImpl enclosing, Reference reference, TypeParameter linkedNode)
- : _unlinkedTypeParam = null,
- super.forLinkedNode(enclosing, reference, linkedNode);
+ : super.forLinkedNode(enclosing, reference, linkedNode);
/// Initialize a newly created type parameter element to have the given
/// [name].
- TypeParameterElementImpl.forNode(Identifier name)
- : _unlinkedTypeParam = null,
- super.forNode(name);
-
- /// Initialize using the given serialized information.
- TypeParameterElementImpl.forSerialized(
- this._unlinkedTypeParam, ElementImpl enclosingElement)
- : super.forSerialized(enclosingElement);
+ TypeParameterElementImpl.forNode(Identifier name) : super.forNode(name);
/// Initialize a newly created synthetic type parameter element to have the
/// given [name], and with [synthetic] set to true.
- TypeParameterElementImpl.synthetic(String name)
- : _unlinkedTypeParam = null,
- super(name, -1) {
+ TypeParameterElementImpl.synthetic(String name) : super(name, -1) {
isSynthetic = true;
}
@@ -10138,20 +7966,10 @@
return _bound = context.getTypeParameterBound(linkedNode)?.type;
}
- if (_unlinkedTypeParam != null) {
- if (_unlinkedTypeParam.bound == null) {
- return null;
- }
- return _bound = enclosingUnit.resynthesizerContext.resolveTypeRef(
- this, _unlinkedTypeParam.bound,
- instantiateToBoundsAllowed: false, declaredType: true);
- }
-
return _bound;
}
void set bound(DartType bound) {
- _assertNotResynthesized(_unlinkedTypeParam);
_bound = _checkElementOfType(bound);
}
@@ -10160,9 +7978,6 @@
if (linkedNode != null) {
return linkedContext.getCodeLength(linkedNode);
}
- if (_unlinkedTypeParam != null) {
- return _unlinkedTypeParam.codeRange?.length;
- }
return super.codeLength;
}
@@ -10171,9 +7986,6 @@
if (linkedNode != null) {
return linkedContext.getCodeOffset(linkedNode);
}
- if (_unlinkedTypeParam != null) {
- return _unlinkedTypeParam.codeRange?.offset;
- }
return super.codeOffset;
}
@@ -10200,23 +8012,11 @@
ElementKind get kind => ElementKind.TYPE_PARAMETER;
@override
- List<ElementAnnotation> get metadata {
- if (_unlinkedTypeParam != null) {
- return _metadata ??=
- _buildAnnotations(enclosingUnit, _unlinkedTypeParam.annotations);
- }
- return super.metadata;
- }
-
- @override
String get name {
if (linkedNode != null) {
TypeParameter node = this.linkedNode;
return node.name.name;
}
- if (_unlinkedTypeParam != null) {
- return _unlinkedTypeParam.name;
- }
return super.name;
}
@@ -10226,11 +8026,7 @@
return enclosingUnit.linkedContext.getNameOffset(linkedNode);
}
- int offset = super.nameOffset;
- if (offset == 0 && _unlinkedTypeParam != null) {
- return _unlinkedTypeParam.nameOffset;
- }
- return offset;
+ return super.nameOffset;
}
TypeParameterType get type {
@@ -10310,17 +8106,6 @@
}).toList();
}
- List<UnlinkedTypeParam> unlinkedParams = unlinkedTypeParams;
- if (unlinkedParams != null) {
- int numTypeParameters = unlinkedParams.length;
- _typeParameterElements =
- new List<TypeParameterElement>(numTypeParameters);
- for (int i = 0; i < numTypeParameters; i++) {
- _typeParameterElements[i] =
- new TypeParameterElementImpl.forSerialized(unlinkedParams[i], this);
- }
- }
-
return _typeParameterElements ?? const <TypeParameterElement>[];
}
@@ -10333,12 +8118,6 @@
.toList(growable: false);
}
- /// Get the [UnlinkedTypeParam]s representing the type parameters declared by
- /// this element, or `null` if this element isn't from a summary.
- ///
- /// TODO(scheglov) make private after switching linker to Impl
- List<UnlinkedTypeParam> get unlinkedTypeParams;
-
@override
int computeDeBruijnIndex(TypeParameterElement typeParameter,
{int offset = 0}) {
@@ -10453,17 +8232,6 @@
void set uriOffset(int offset) {
_uriOffset = offset;
}
-
- String _selectUri(
- String defaultUri, List<UnlinkedConfiguration> configurations) {
- for (UnlinkedConfiguration configuration in configurations) {
- if (context.declaredVariables.get(configuration.name) ==
- configuration.value) {
- return configuration.uri;
- }
- }
- return defaultUri;
- }
}
/// A concrete implementation of a [VariableElement].
diff --git a/pkg/analyzer/lib/src/dart/element/handle.dart b/pkg/analyzer/lib/src/dart/element/handle.dart
index 534b44f..8b626ea 100644
--- a/pkg/analyzer/lib/src/dart/element/handle.dart
+++ b/pkg/analyzer/lib/src/dart/element/handle.dart
@@ -779,6 +779,7 @@
@override
FunctionTypeAlias computeNode() => actualElement.computeNode();
+ @deprecated
@override
FunctionType instantiate(List<DartType> argumentTypes) =>
actualElement.instantiate(argumentTypes);
@@ -837,6 +838,7 @@
@override
FunctionTypeAlias computeNode() => actualElement.computeNode();
+ @deprecated
@override
FunctionType instantiate(List<DartType> argumentTypes) =>
actualElement.instantiate(argumentTypes);
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index 8ceb5c9..1f363f8 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -2856,6 +2856,7 @@
* Return a list containing the type parameter types defined by the given
* array of type parameter elements ([typeParameters]).
*/
+ @deprecated
static List<TypeParameterType> getTypes(
List<TypeParameterElement> typeParameters) {
int count = typeParameters.length;
diff --git a/pkg/analyzer/lib/src/dart/element/type_algebra.dart b/pkg/analyzer/lib/src/dart/element/type_algebra.dart
index 2a0a6e3..566d6bb 100644
--- a/pkg/analyzer/lib/src/dart/element/type_algebra.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_algebra.dart
@@ -42,6 +42,43 @@
return new FreshTypeParameters(freshParameters, substitution);
}
+/// Given a generic function [type] of a class member (so that it does not
+/// carry its element and type arguments), substitute its type parameters with
+/// the [newTypeParameters] in the formal parameters and return type.
+FunctionType replaceTypeParameters(
+ FunctionTypeImpl type,
+ List<TypeParameterElement> newTypeParameters,
+) {
+ assert(newTypeParameters.length == type.typeFormals.length);
+ if (newTypeParameters.isEmpty) {
+ return type;
+ }
+
+ var typeArguments = newTypeParameters
+ .map((e) => e.instantiate(nullabilitySuffix: type.nullabilitySuffix))
+ .toList();
+ var substitution = Substitution.fromPairs(type.typeFormals, typeArguments);
+
+ ParameterElement transformParameter(ParameterElement p) {
+ var type = p.type;
+ var newType = substitution.substituteType(type);
+ if (identical(newType, type)) return p;
+ return ParameterElementImpl.synthetic(
+ p.name,
+ newType,
+ // ignore: deprecated_member_use_from_same_package
+ p.parameterKind,
+ )..isExplicitlyCovariant = p.isCovariant;
+ }
+
+ return FunctionTypeImpl.synthetic(
+ substitution.substituteType(type.returnType),
+ newTypeParameters,
+ type.parameters.map(transformParameter).toList(),
+ nullabilitySuffix: type.nullabilitySuffix,
+ );
+}
+
/// Returns a type where all occurrences of the given type parameters have been
/// replaced with the corresponding types.
///
diff --git a/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
index 683b8c1..48927a5 100644
--- a/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
@@ -377,6 +377,13 @@
}
@override
+ void visitConstructorDeclaration(ConstructorDeclaration node) {
+ assignedVariables.beginNode();
+ super.visitConstructorDeclaration(node);
+ assignedVariables.endNode(node);
+ }
+
+ @override
void visitDoStatement(DoStatement node) {
assignedVariables.beginNode();
super.visitDoStatement(node);
@@ -394,6 +401,30 @@
}
@override
+ void visitFunctionDeclaration(FunctionDeclaration node) {
+ bool isClosure = node.parent is! CompilationUnit;
+ assignedVariables.beginNode(isClosure: isClosure);
+ // Note: we bypass this.visitFunctionExpression so that the function
+ // expression isn't mistaken for a closure.
+ super.visitFunctionExpression(node.functionExpression);
+ assignedVariables.endNode(node, isClosure: isClosure);
+ }
+
+ @override
+ void visitFunctionExpression(FunctionExpression node) {
+ assignedVariables.beginNode(isClosure: true);
+ super.visitFunctionExpression(node);
+ assignedVariables.endNode(node, isClosure: true);
+ }
+
+ @override
+ void visitMethodDeclaration(MethodDeclaration node) {
+ assignedVariables.beginNode();
+ super.visitMethodDeclaration(node);
+ assignedVariables.endNode(node);
+ }
+
+ @override
void visitSwitchStatement(SwitchStatement node) {
var expression = node.expression;
var members = node.members;
diff --git a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
index 56e6382..6d999b9 100644
--- a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
@@ -3,9 +3,11 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.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/src/dart/ast/utilities.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/resolver/extension_member_resolver.dart';
@@ -19,6 +21,12 @@
class MethodInvocationResolver {
static final _nameCall = new Name(null, 'call');
+ /// Resolver visitor is separated from the elements resolver, which calls
+ /// this method resolver. If we rewrite a [MethodInvocation] node, we put
+ /// the resulting [FunctionExpressionInvocation] into the original node
+ /// under this key.
+ static const _rewriteResultKey = 'methodInvocationRewriteResult';
+
/// The resolver driving this participant.
final ResolverVisitor _resolver;
@@ -167,19 +175,6 @@
return null;
}
- /// If the invoked [target] is a getter, then actually the return type of
- /// the [target] is invoked. So, remember the [target] into
- /// [MethodInvocationImpl.methodNameType] and return the actual invoked type.
- DartType _getCalleeType(MethodInvocation node, ExecutableElement target) {
- if (target.kind == ElementKind.GETTER) {
- (node as MethodInvocationImpl).methodNameType = target.type;
- var calleeType = target.returnType;
- calleeType = _resolveTypeParameter(calleeType);
- return calleeType;
- }
- return target.type;
- }
-
/// Check for a generic type, and apply type arguments.
FunctionType _instantiateFunctionType(
FunctionType invokeType, TypeArgumentList typeArguments, AstNode node) {
@@ -238,6 +233,17 @@
);
}
+ void _reportStaticAccessToInstanceMember(
+ ExecutableElement element, SimpleIdentifier nameNode) {
+ if (!element.isStatic) {
+ _resolver.errorReporter.reportErrorForNode(
+ StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER,
+ nameNode,
+ [nameNode.name],
+ );
+ }
+ }
+
void _reportUndefinedFunction(
MethodInvocation node, Identifier ignorableIdentifier) {
_setDynamicResolution(node);
@@ -360,32 +366,39 @@
return result;
}
- var calleeType = _getCalleeType(node, member);
- _setResolution(node, calleeType);
+ if (member is PropertyAccessorElement) {
+ _rewriteAsFunctionExpressionInvocation(node, member.returnType);
+ return result;
+ }
+
+ _setResolution(node, member.type);
return result;
}
void _resolveExtensionMember(MethodInvocation node, Identifier receiver,
ExtensionElement extension, SimpleIdentifier nameNode, String name) {
- ExecutableElement element =
- extension.getMethod(name) ?? extension.getGetter(name);
- if (element == null) {
- _setDynamicResolution(node);
- _resolver.errorReporter.reportErrorForNode(
- CompileTimeErrorCode.UNDEFINED_EXTENSION_METHOD,
- nameNode,
- [name, extension.name],
- );
- } else {
- if (!element.isStatic) {
- _resolver.errorReporter.reportErrorForNode(
- StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER,
- nameNode,
- [name]);
- }
- nameNode.staticElement = element;
- _setResolution(node, _getCalleeType(node, element));
+ var getter = extension.getGetter(name);
+ if (getter != null) {
+ nameNode.staticElement = getter;
+ _reportStaticAccessToInstanceMember(getter, nameNode);
+ _rewriteAsFunctionExpressionInvocation(node, getter.returnType);
+ return;
}
+
+ var method = extension.getMethod(name);
+ if (method != null) {
+ nameNode.staticElement = method;
+ _reportStaticAccessToInstanceMember(method, nameNode);
+ _setResolution(node, method.type);
+ return;
+ }
+
+ _setDynamicResolution(node);
+ _resolver.errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.UNDEFINED_EXTENSION_METHOD,
+ nameNode,
+ [name, extension.name],
+ );
}
void _resolveExtensionOverride(MethodInvocation node,
@@ -417,8 +430,12 @@
}
nameNode.staticElement = member;
- var calleeType = _getCalleeType(node, member);
- _setResolution(node, calleeType);
+
+ if (member is PropertyAccessorElement) {
+ return _rewriteAsFunctionExpressionInvocation(node, member.returnType);
+ }
+
+ _setResolution(node, member.type);
}
void _resolveReceiverDynamic(MethodInvocation node, String name) {
@@ -439,9 +456,12 @@
ResolutionResult result =
_extensionResolver.findExtension(receiverType, name, nameNode);
if (result.isSingle) {
- nameNode.staticElement = result.getter;
- var calleeType = _getCalleeType(node, result.getter);
- return _setResolution(node, calleeType);
+ var member = result.getter;
+ nameNode.staticElement = member;
+ if (member is PropertyAccessorElement) {
+ return _rewriteAsFunctionExpressionInvocation(node, member.returnType);
+ }
+ return _setResolution(node, member.type);
} else if (result.isAmbiguous) {
return;
}
@@ -473,8 +493,10 @@
var target = _inheritance.getMember(receiverType, _currentName);
if (target != null) {
nameNode.staticElement = target;
- var calleeType = _getCalleeType(node, target);
- return _setResolution(node, calleeType);
+ if (target is PropertyAccessorElement) {
+ return _rewriteAsFunctionExpressionInvocation(node, target.returnType);
+ }
+ return _setResolution(node, target.type);
}
// Look for an applicable extension.
@@ -520,13 +542,15 @@
MultiplyDefinedElement multiply = element;
element = multiply.conflictingElements[0];
}
+ if (element is PropertyAccessorElement) {
+ return _rewriteAsFunctionExpressionInvocation(node, element.returnType);
+ }
if (element is ExecutableElement) {
- var calleeType = _getCalleeType(node, element);
- return _setResolution(node, calleeType);
+ return _setResolution(node, element.type);
}
if (element is VariableElement) {
var targetType = _localVariableTypeProvider.getType(nameNode);
- return _setResolution(node, targetType);
+ return _rewriteAsFunctionExpressionInvocation(node, targetType);
}
// TODO(scheglov) This is a questionable distinction.
if (element is PrefixElement) {
@@ -559,8 +583,10 @@
if (target != null) {
nameNode.staticElement = target;
- var calleeType = _getCalleeType(node, target);
- return _setResolution(node, calleeType);
+ if (target is PropertyAccessorElement) {
+ return _rewriteAsFunctionExpressionInvocation(node, target.returnType);
+ }
+ return _setResolution(node, target.type);
}
var targetElement = _lookUpClassMember(enclosingClass, name);
@@ -588,8 +614,7 @@
var target = result.getter;
if (target != null) {
nameNode.staticElement = target;
- var calleeType = _getCalleeType(node, target);
- _setResolution(node, calleeType);
+ _setResolution(node, target.type);
return;
}
}
@@ -625,9 +650,12 @@
element = multiply.conflictingElements[0];
}
+ if (element is PropertyAccessorElement) {
+ return _rewriteAsFunctionExpressionInvocation(node, element.returnType);
+ }
+
if (element is ExecutableElement) {
- var calleeType = _getCalleeType(node, element);
- return _setResolution(node, calleeType);
+ return _setResolution(node, element.type);
}
_reportUndefinedFunction(node, prefixedName);
@@ -650,8 +678,10 @@
// If there is that concrete dispatch target, then we are done.
if (target != null) {
nameNode.staticElement = target;
- var calleeType = _getCalleeType(node, target);
- _setResolution(node, calleeType);
+ if (target is PropertyAccessorElement) {
+ return _rewriteAsFunctionExpressionInvocation(node, target.returnType);
+ }
+ _setResolution(node, target.type);
return;
}
@@ -661,8 +691,7 @@
target = _inheritance.getInherited(receiverType, _currentName);
if (target != null) {
nameNode.staticElement = target;
- var calleeType = _getCalleeType(node, target);
- _setResolution(node, calleeType);
+ _setResolution(node, target.type);
_resolver.errorReporter.reportErrorForNode(
CompileTimeErrorCode.ABSTRACT_SUPER_MEMBER_REFERENCE,
@@ -689,8 +718,11 @@
if (element != null) {
if (element is ExecutableElement) {
nameNode.staticElement = element;
- var calleeType = _getCalleeType(node, element);
- _setResolution(node, calleeType);
+ if (element is PropertyAccessorElement) {
+ return _rewriteAsFunctionExpressionInvocation(
+ node, element.returnType);
+ }
+ _setResolution(node, element.type);
} else {
_reportInvocationOfNonFunction(node);
}
@@ -709,6 +741,86 @@
return type;
}
+ /// We have identified that [node] is not a real [MethodInvocation],
+ /// because it does not invoke a method, but instead invokes the result
+ /// of a getter execution, or implicitly invokes the `call` method of
+ /// an [InterfaceType]. So, it should be represented as instead as a
+ /// [FunctionExpressionInvocation].
+ void _rewriteAsFunctionExpressionInvocation(
+ MethodInvocation node,
+ DartType getterReturnType,
+ ) {
+ var targetType = _resolveTypeParameter(getterReturnType);
+ node.methodName.staticType = targetType;
+
+ Expression functionExpression;
+ var target = node.target;
+ if (target == null) {
+ functionExpression = node.methodName;
+ } else {
+ if (target is SimpleIdentifier && target.staticElement is PrefixElement) {
+ functionExpression = astFactory.prefixedIdentifier(
+ target,
+ node.operator,
+ node.methodName,
+ );
+ } else {
+ functionExpression = astFactory.propertyAccess(
+ target,
+ node.operator,
+ node.methodName,
+ );
+ }
+ functionExpression.staticType = targetType;
+ }
+
+ var invocation = astFactory.functionExpressionInvocation(
+ functionExpression,
+ node.typeArguments,
+ node.argumentList,
+ );
+ NodeReplacer.replace(node, invocation);
+ node.setProperty(_rewriteResultKey, invocation);
+
+ FunctionType rawFunctionType;
+ if (targetType is FunctionType) {
+ rawFunctionType = targetType;
+ } else if (targetType is InterfaceType) {
+ var call = _inheritance.getMember(targetType, _nameCall);
+ if (call == null) {
+ var result = _extensionResolver.findExtension(
+ targetType, _nameCall.name, node.methodName);
+ if (result.isSingle) {
+ call = result.getter;
+ } else if (result.isAmbiguous) {
+ return;
+ }
+ }
+ if (call != null && call.kind == ElementKind.METHOD) {
+ invocation.staticElement = call;
+ rawFunctionType = call.type;
+ }
+ }
+
+ if (rawFunctionType == null) {
+ invocation.staticInvokeType = _dynamicType;
+ invocation.staticType = _dynamicType;
+ return;
+ }
+
+ var instantiatedType = _instantiateFunctionType(
+ rawFunctionType,
+ invocation.typeArguments,
+ invocation.typeArguments,
+ );
+ instantiatedType = _toSyntheticFunctionType(instantiatedType);
+ invocation.staticInvokeType = instantiatedType;
+ invocation.staticType = instantiatedType.returnType;
+ invocation.argumentList.correspondingStaticParameters =
+ _resolveArgumentsToParameters(
+ invocation.argumentList, instantiatedType.parameters);
+ }
+
void _setDynamicResolution(MethodInvocation node,
{bool setNameTypeToDynamic: true}) {
if (setNameTypeToDynamic) {
@@ -742,22 +854,6 @@
return;
}
- if (type is InterfaceType) {
- var call = _inheritance.getMember(type, _nameCall);
- if (call == null) {
- var result = _extensionResolver.findExtension(
- type, _nameCall.name, node.methodName);
- if (result.isSingle) {
- call = result.getter;
- } else if (result.isAmbiguous) {
- return;
- }
- }
- if (call != null && call.kind == ElementKind.METHOD) {
- type = call.type;
- }
- }
-
if (type is FunctionType) {
// TODO(scheglov) Extract this when receiver is already FunctionType?
var instantiatedType = _instantiateFunctionType(
@@ -788,6 +884,14 @@
_reportInvocationOfNonFunction(node);
}
+ /// Resolver visitor is separated from the elements resolver, which calls
+ /// this method resolver. If we rewrite a [MethodInvocation] node, this
+ /// method will return the resulting [FunctionExpressionInvocation], so
+ /// that the resolver visitor will know to continue resolving this new node.
+ static FunctionExpressionInvocation getRewriteResult(MethodInvocation node) {
+ return node.getProperty(_rewriteResultKey);
+ }
+
/// Checks whether the given [expression] is a reference to a class. If it is
/// then the element representing the class is returned, otherwise `null` is
/// returned.
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index b8ebccc..9c49a15 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -410,6 +410,10 @@
static const ParserErrorCode ANNOTATION_WITH_TYPE_ARGUMENTS =
ParserErrorCode.ANNOTATION_WITH_TYPE_ARGUMENTS;
+ static const CompileTimeErrorCode ASSERT_IN_REDIRECTING_CONSTRUCTOR =
+ const CompileTimeErrorCode('ASSERT_IN_REDIRECTING_CONSTRUCTOR',
+ "A redirecting constructor can't have an 'assert' initializer.");
+
/**
* 17.6.3 Asynchronous For-in: It is a compile-time error if an asynchronous
* for-in statement appears inside a synchronous function.
@@ -6435,7 +6439,7 @@
*/
static const StaticWarningCode NEW_WITH_ABSTRACT_CLASS =
const StaticWarningCode('NEW_WITH_ABSTRACT_CLASS',
- "Abstract classes can't be created with a 'new' expression.",
+ "Abstract classes can't be instantiated.",
correction: "Try creating an instance of a subtype.");
/**
diff --git a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
index 4592e91..3e17c27 100644
--- a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
+++ b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
@@ -308,8 +308,7 @@
var genericType = node.function.staticType;
var instantiatedType = node.staticInvokeType;
if (genericType is FunctionType && instantiatedType is FunctionType) {
- var fnTypeParams =
- TypeParameterTypeImpl.getTypes(genericType.typeFormals);
+ var fnTypeParams = genericType.typeFormals;
var typeArgs = typeArgumentList.map((t) => t.type).toList();
// If the amount mismatches, clean up the lists to be substitutable. The
@@ -338,8 +337,13 @@
continue;
}
- DartType bound =
- fnTypeParams[i].bound.substitute2(typeArgs, fnTypeParams);
+ var rawBound = fnTypeParams[i].bound;
+ if (rawBound == null) {
+ continue;
+ }
+
+ var substitution = Substitution.fromPairs(fnTypeParams, typeArgs);
+ var bound = substitution.substituteType(rawBound);
if (!_typeSystem.isSubtypeOf(argType, bound)) {
_errorReporter.reportTypeErrorForNode(
CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 9072fbd..c279188 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -4538,7 +4538,8 @@
* redirected constructor invocation(s), super constructor invocations and
* field initializers.
*
- * See [CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR],
+ * See [CompileTimeErrorCode.ASSERT_IN_REDIRECTING_CONSTRUCTOR],
+ * [CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR],
* [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR],
* [CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS],
* [CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR], and
@@ -4606,6 +4607,11 @@
CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR,
initializer);
}
+ if (initializer is AssertInitializer) {
+ _errorReporter.reportErrorForNode(
+ CompileTimeErrorCode.ASSERT_IN_REDIRECTING_CONSTRUCTOR,
+ initializer);
+ }
}
}
}
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 5685ba6..c0e84af 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -27,6 +27,7 @@
import 'package:analyzer/src/dart/resolver/exit_detector.dart';
import 'package:analyzer/src/dart/resolver/extension_member_resolver.dart';
import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
+import 'package:analyzer/src/dart/resolver/method_invocation_resolver.dart';
import 'package:analyzer/src/dart/resolver/scope.dart';
import 'package:analyzer/src/diagnostic/diagnostic_factory.dart';
import 'package:analyzer/src/error/codes.dart';
@@ -344,6 +345,17 @@
}
@override
+ void visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
+ var callElement = node.staticElement;
+ if (callElement is MethodElement &&
+ callElement.name == FunctionElement.CALL_METHOD_NAME) {
+ _checkForDeprecatedMemberUse(callElement, node);
+ }
+
+ super.visitFunctionExpressionInvocation(node);
+ }
+
+ @override
void visitFunctionTypeAlias(FunctionTypeAlias node) {
_checkStrictInferenceReturnType(node.returnType, node, node.name.name);
super.visitFunctionTypeAlias(node);
@@ -442,12 +454,6 @@
@override
void visitMethodInvocation(MethodInvocation node) {
_checkForNullAwareHints(node, node.operator);
- DartType staticInvokeType = node.staticInvokeType;
- Element callElement = staticInvokeType?.element;
- if (callElement is MethodElement &&
- callElement.name == FunctionElement.CALL_METHOD_NAME) {
- _checkForDeprecatedMemberUse(callElement, node);
- }
super.visitMethodInvocation(node);
}
@@ -4063,9 +4069,7 @@
void visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
node.function?.accept(this);
node.accept(elementResolver);
- _inferArgumentTypesForInvocation(node);
- node.argumentList?.accept(this);
- node.accept(typeAnalyzer);
+ _visitFunctionExpressionInvocation(node);
}
@override
@@ -4245,9 +4249,15 @@
node.target?.accept(this);
node.typeArguments?.accept(this);
node.accept(elementResolver);
- _inferArgumentTypesForInvocation(node);
- node.argumentList?.accept(this);
- node.accept(typeAnalyzer);
+
+ var functionRewrite = MethodInvocationResolver.getRewriteResult(node);
+ if (functionRewrite != null) {
+ _visitFunctionExpressionInvocation(functionRewrite);
+ } else {
+ _inferArgumentTypesForInvocation(node);
+ node.argumentList?.accept(this);
+ node.accept(typeAnalyzer);
+ }
}
@override
@@ -4348,10 +4358,9 @@
@override
void visitReturnStatement(ReturnStatement node) {
- Expression e = node.expression;
- InferenceContext.setType(e, inferenceContext.returnContext);
+ InferenceContext.setType(node.expression, inferenceContext.returnContext);
super.visitReturnStatement(node);
- DartType type = e?.staticType;
+ DartType type = node.expression?.staticType;
// Generators cannot return values, so don't try to do any inference if
// we're processing erroneous code.
if (type != null && _enclosingFunction?.isGenerator == false) {
@@ -4996,6 +5005,14 @@
}
}
+ /// Continues resolution of the [FunctionExpressionInvocation] node after
+ /// resolving its function.
+ void _visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
+ _inferArgumentTypesForInvocation(node);
+ node.argumentList?.accept(this);
+ node.accept(typeAnalyzer);
+ }
+
/// Given an [argumentList] and the [parameters] related to the element that
/// will be invoked using those arguments, compute the list of parameters that
/// correspond to the list of arguments.
@@ -6230,9 +6247,11 @@
}
}
if (element is GenericTypeAliasElementImpl) {
- type = GenericTypeAliasElementImpl.typeAfterSubstitution(
- element, typeArguments) ??
- dynamicType;
+ type = element.instantiate2(
+ typeArguments: typeArguments,
+ nullabilitySuffix: _getNullability(node.question != null),
+ );
+ type ??= dynamicType;
} else {
type = typeSystem.instantiateType(type, typeArguments);
}
@@ -6241,14 +6260,14 @@
);
} else {
if (element is GenericTypeAliasElementImpl) {
- List<DartType> typeArguments =
- typeSystem.instantiateTypeFormalsToBounds2(element);
- type = GenericTypeAliasElementImpl.typeAfterSubstitution(
- element, typeArguments) ??
- dynamicType;
- type = (type as TypeImpl).withNullability(
- _getNullability(node.question != null),
+ var typeArguments = typeSystem.instantiateTypeFormalsToBounds(
+ element.typeParameters,
);
+ type = element.instantiate2(
+ typeArguments: typeArguments,
+ nullabilitySuffix: _getNullability(node.question != null),
+ );
+ type ??= dynamicType;
} else {
type = typeSystem.instantiateToBounds(type);
}
diff --git a/pkg/analyzer/lib/src/generated/type_promotion_manager.dart b/pkg/analyzer/lib/src/generated/type_promotion_manager.dart
index 14f1835..9ecf575 100644
--- a/pkg/analyzer/lib/src/generated/type_promotion_manager.dart
+++ b/pkg/analyzer/lib/src/generated/type_promotion_manager.dart
@@ -42,7 +42,11 @@
}
void exitFunctionBody() {
- _currentFunctionBody = _functionBodyStack.removeLast();
+ if (_functionBodyStack.isEmpty) {
+ assert(false, 'exitFunctionBody without a matching enterFunctionBody');
+ } else {
+ _currentFunctionBody = _functionBodyStack.removeLast();
+ }
}
void visitBinaryExpression_and_rhs(
diff --git a/pkg/analyzer/lib/src/generated/type_system.dart b/pkg/analyzer/lib/src/generated/type_system.dart
index 888ec81..cf1a27a 100644
--- a/pkg/analyzer/lib/src/generated/type_system.dart
+++ b/pkg/analyzer/lib/src/generated/type_system.dart
@@ -1249,8 +1249,11 @@
// Since we're trying to infer the instantiation, we want to ignore type
// formals as we check the parameters and return type.
- var inferFnType =
- fnType.instantiate(TypeParameterTypeImpl.getTypes(fnType.typeFormals));
+ var inferFnType = FunctionTypeImpl.synthetic(
+ fnType.returnType,
+ const [],
+ fnType.parameters,
+ );
tryMatchSubtypeOf(inferFnType, contextType, origin, covariant: true);
}
@@ -2688,16 +2691,6 @@
}
/**
- * Given a [DartType] type, return the [DartType]s corresponding
- * to its formal type parameters (if any).
- *
- * @param type the type whose type arguments are to be returned
- * @return the type arguments associated with the given type
- */
- List<DartType> typeFormalsAsTypes(DartType type) =>
- TypeParameterTypeImpl.getTypes(typeFormalsAsElements(type));
-
- /**
* Compute the least upper bound of function types [f] and [g].
*
* The spec rules for LUB on function types, informally, are pretty simple
diff --git a/pkg/analyzer/lib/src/summary/format.dart b/pkg/analyzer/lib/src/summary/format.dart
index 4260806..d907895 100644
--- a/pkg/analyzer/lib/src/summary/format.dart
+++ b/pkg/analyzer/lib/src/summary/format.dart
@@ -32,21 +32,6 @@
}
}
-class _EntityRefKindReader extends fb.Reader<idl.EntityRefKind> {
- const _EntityRefKindReader() : super();
-
- @override
- int get size => 1;
-
- @override
- idl.EntityRefKind read(fb.BufferContext bc, int offset) {
- int index = const fb.Uint8Reader().read(bc, offset);
- return index < idl.EntityRefKind.values.length
- ? idl.EntityRefKind.values[index]
- : idl.EntityRefKind.named;
- }
-}
-
class _EntityRefNullabilitySuffixReader
extends fb.Reader<idl.EntityRefNullabilitySuffix> {
const _EntityRefNullabilitySuffixReader() : super();
@@ -63,21 +48,6 @@
}
}
-class _IndexNameKindReader extends fb.Reader<idl.IndexNameKind> {
- const _IndexNameKindReader() : super();
-
- @override
- int get size => 1;
-
- @override
- idl.IndexNameKind read(fb.BufferContext bc, int offset) {
- int index = const fb.Uint8Reader().read(bc, offset);
- return index < idl.IndexNameKind.values.length
- ? idl.IndexNameKind.values[index]
- : idl.IndexNameKind.topLevel;
- }
-}
-
class _IndexRelationKindReader extends fb.Reader<idl.IndexRelationKind> {
const _IndexRelationKindReader() : super();
@@ -171,21 +141,6 @@
}
}
-class _ReferenceKindReader extends fb.Reader<idl.ReferenceKind> {
- const _ReferenceKindReader() : super();
-
- @override
- int get size => 1;
-
- @override
- idl.ReferenceKind read(fb.BufferContext bc, int offset) {
- int index = const fb.Uint8Reader().read(bc, offset);
- return index < idl.ReferenceKind.values.length
- ? idl.ReferenceKind.values[index]
- : idl.ReferenceKind.classOrEnum;
- }
-}
-
class _TopLevelInferenceErrorKindReader
extends fb.Reader<idl.TopLevelInferenceErrorKind> {
const _TopLevelInferenceErrorKindReader() : super();
@@ -202,115 +157,6 @@
}
}
-class _TypedefStyleReader extends fb.Reader<idl.TypedefStyle> {
- const _TypedefStyleReader() : super();
-
- @override
- int get size => 1;
-
- @override
- idl.TypedefStyle read(fb.BufferContext bc, int offset) {
- int index = const fb.Uint8Reader().read(bc, offset);
- return index < idl.TypedefStyle.values.length
- ? idl.TypedefStyle.values[index]
- : idl.TypedefStyle.functionType;
- }
-}
-
-class _UnlinkedConstructorInitializerKindReader
- extends fb.Reader<idl.UnlinkedConstructorInitializerKind> {
- const _UnlinkedConstructorInitializerKindReader() : super();
-
- @override
- int get size => 1;
-
- @override
- idl.UnlinkedConstructorInitializerKind read(fb.BufferContext bc, int offset) {
- int index = const fb.Uint8Reader().read(bc, offset);
- return index < idl.UnlinkedConstructorInitializerKind.values.length
- ? idl.UnlinkedConstructorInitializerKind.values[index]
- : idl.UnlinkedConstructorInitializerKind.field;
- }
-}
-
-class _UnlinkedExecutableKindReader
- extends fb.Reader<idl.UnlinkedExecutableKind> {
- const _UnlinkedExecutableKindReader() : super();
-
- @override
- int get size => 1;
-
- @override
- idl.UnlinkedExecutableKind read(fb.BufferContext bc, int offset) {
- int index = const fb.Uint8Reader().read(bc, offset);
- return index < idl.UnlinkedExecutableKind.values.length
- ? idl.UnlinkedExecutableKind.values[index]
- : idl.UnlinkedExecutableKind.functionOrMethod;
- }
-}
-
-class _UnlinkedExprAssignOperatorReader
- extends fb.Reader<idl.UnlinkedExprAssignOperator> {
- const _UnlinkedExprAssignOperatorReader() : super();
-
- @override
- int get size => 1;
-
- @override
- idl.UnlinkedExprAssignOperator read(fb.BufferContext bc, int offset) {
- int index = const fb.Uint8Reader().read(bc, offset);
- return index < idl.UnlinkedExprAssignOperator.values.length
- ? idl.UnlinkedExprAssignOperator.values[index]
- : idl.UnlinkedExprAssignOperator.assign;
- }
-}
-
-class _UnlinkedExprOperationReader
- extends fb.Reader<idl.UnlinkedExprOperation> {
- const _UnlinkedExprOperationReader() : super();
-
- @override
- int get size => 1;
-
- @override
- idl.UnlinkedExprOperation read(fb.BufferContext bc, int offset) {
- int index = const fb.Uint8Reader().read(bc, offset);
- return index < idl.UnlinkedExprOperation.values.length
- ? idl.UnlinkedExprOperation.values[index]
- : idl.UnlinkedExprOperation.pushInt;
- }
-}
-
-class _UnlinkedParamKindReader extends fb.Reader<idl.UnlinkedParamKind> {
- const _UnlinkedParamKindReader() : super();
-
- @override
- int get size => 1;
-
- @override
- idl.UnlinkedParamKind read(fb.BufferContext bc, int offset) {
- int index = const fb.Uint8Reader().read(bc, offset);
- return index < idl.UnlinkedParamKind.values.length
- ? idl.UnlinkedParamKind.values[index]
- : idl.UnlinkedParamKind.requiredPositional;
- }
-}
-
-class _UnlinkedTokenKindReader extends fb.Reader<idl.UnlinkedTokenKind> {
- const _UnlinkedTokenKindReader() : super();
-
- @override
- int get size => 1;
-
- @override
- idl.UnlinkedTokenKind read(fb.BufferContext bc, int offset) {
- int index = const fb.Uint8Reader().read(bc, offset);
- return index < idl.UnlinkedTokenKind.values.length
- ? idl.UnlinkedTokenKind.values[index]
- : idl.UnlinkedTokenKind.nothing;
- }
-}
-
class _UnlinkedTokenTypeReader extends fb.Reader<idl.UnlinkedTokenType> {
const _UnlinkedTokenTypeReader() : super();
@@ -3548,106 +3394,6 @@
String toString() => convert.json.encode(toJson());
}
-class CodeRangeBuilder extends Object
- with _CodeRangeMixin
- implements idl.CodeRange {
- int _length;
- int _offset;
-
- @override
- int get length => _length ??= 0;
-
- /// Length of the element code.
- set length(int value) {
- assert(value == null || value >= 0);
- this._length = value;
- }
-
- @override
- int get offset => _offset ??= 0;
-
- /// Offset of the element code relative to the beginning of the file.
- set offset(int value) {
- assert(value == null || value >= 0);
- this._offset = value;
- }
-
- CodeRangeBuilder({int length, int offset})
- : _length = length,
- _offset = offset;
-
- /// Flush [informative] data recursively.
- void flushInformative() {}
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addInt(this._offset ?? 0);
- signature.addInt(this._length ?? 0);
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fbBuilder.startTable();
- if (_length != null && _length != 0) {
- fbBuilder.addUint32(1, _length);
- }
- if (_offset != null && _offset != 0) {
- fbBuilder.addUint32(0, _offset);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _CodeRangeReader extends fb.TableReader<_CodeRangeImpl> {
- const _CodeRangeReader();
-
- @override
- _CodeRangeImpl createObject(fb.BufferContext bc, int offset) =>
- new _CodeRangeImpl(bc, offset);
-}
-
-class _CodeRangeImpl extends Object
- with _CodeRangeMixin
- implements idl.CodeRange {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _CodeRangeImpl(this._bc, this._bcOffset);
-
- int _length;
- int _offset;
-
- @override
- int get length {
- _length ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0);
- return _length;
- }
-
- @override
- int get offset {
- _offset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
- return _offset;
- }
-}
-
-abstract class _CodeRangeMixin implements idl.CodeRange {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (length != 0) _result["length"] = length;
- if (offset != 0) _result["offset"] = offset;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "length": length,
- "offset": offset,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
class DiagnosticMessageBuilder extends Object
with _DiagnosticMessageMixin
implements idl.DiagnosticMessage {
@@ -3929,966 +3675,38 @@
String toString() => convert.json.encode(toJson());
}
-class EntityRefBuilder extends Object
- with _EntityRefMixin
- implements idl.EntityRef {
- idl.EntityRefKind _entityKind;
- List<int> _implicitFunctionTypeIndices;
- idl.EntityRefNullabilitySuffix _nullabilitySuffix;
- int _paramReference;
- int _reference;
- int _refinedSlot;
- int _slot;
- List<UnlinkedParamBuilder> _syntheticParams;
- EntityRefBuilder _syntheticReturnType;
- List<EntityRefBuilder> _typeArguments;
- List<UnlinkedTypeParamBuilder> _typeParameters;
-
- @override
- idl.EntityRefKind get entityKind => _entityKind ??= idl.EntityRefKind.named;
-
- /// The kind of entity being represented.
- set entityKind(idl.EntityRefKind value) {
- this._entityKind = value;
- }
-
- @override
- List<int> get implicitFunctionTypeIndices =>
- _implicitFunctionTypeIndices ??= <int>[];
-
- /// Notice: This will be deprecated. However, its not deprecated yet, as we're
- /// keeping it for backwards compatibilty, and marking it deprecated makes it
- /// unreadable.
- ///
- /// TODO(mfairhurst) mark this deprecated, and remove its logic.
- ///
- /// If this is a reference to a function type implicitly defined by a
- /// function-typed parameter, a list of zero-based indices indicating the path
- /// from the entity referred to by [reference] to the appropriate type
- /// parameter. Otherwise the empty list.
- ///
- /// If there are N indices in this list, then the entity being referred to is
- /// the function type implicitly defined by a function-typed parameter of a
- /// function-typed parameter, to N levels of nesting. The first index in the
- /// list refers to the outermost level of nesting; for example if [reference]
- /// refers to the entity defined by:
- ///
- /// void f(x, void g(y, z, int h(String w))) { ... }
- ///
- /// Then to refer to the function type implicitly defined by parameter `h`
- /// (which is parameter 2 of parameter 1 of `f`), then
- /// [implicitFunctionTypeIndices] should be [1, 2].
- ///
- /// Note that if the entity being referred to is a generic method inside a
- /// generic class, then the type arguments in [typeArguments] are applied
- /// first to the class and then to the method.
- set implicitFunctionTypeIndices(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._implicitFunctionTypeIndices = value;
- }
-
- @override
- idl.EntityRefNullabilitySuffix get nullabilitySuffix =>
- _nullabilitySuffix ??= idl.EntityRefNullabilitySuffix.starOrIrrelevant;
-
- /// If the reference represents a type, the nullability of the type.
- set nullabilitySuffix(idl.EntityRefNullabilitySuffix value) {
- this._nullabilitySuffix = value;
- }
-
- @override
- int get paramReference => _paramReference ??= 0;
-
- /// If this is a reference to a type parameter, one-based index into the list
- /// of [UnlinkedTypeParam]s currently in effect. Indexing is done using De
- /// Bruijn index conventions; that is, innermost parameters come first, and
- /// if a class or method has multiple parameters, they are indexed from right
- /// to left. So for instance, if the enclosing declaration is
- ///
- /// class C<T,U> {
- /// m<V,W> {
- /// ...
- /// }
- /// }
- ///
- /// Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T,
- /// respectively.
- ///
- /// If the type being referred to is not a type parameter, [paramReference] is
- /// zero.
- set paramReference(int value) {
- assert(value == null || value >= 0);
- this._paramReference = value;
- }
-
- @override
- int get reference => _reference ??= 0;
-
- /// Index into [UnlinkedUnit.references] for the entity being referred to, or
- /// zero if this is a reference to a type parameter.
- set reference(int value) {
- assert(value == null || value >= 0);
- this._reference = value;
- }
-
- @override
- int get refinedSlot => _refinedSlot ??= 0;
-
- /// If this [EntityRef] appears in a syntactic context where its type
- /// arguments might need to be inferred by a method other than
- /// instantiate-to-bounds, and [typeArguments] is empty, a slot id (which is
- /// unique within the compilation unit). If an entry appears in
- /// [LinkedUnit.types] whose [slot] matches this value, that entry will
- /// contain the complete inferred type.
- ///
- /// This is called `refinedSlot` to clarify that if it points to an inferred
- /// type, it points to a type that is a "refinement" of this one (one in which
- /// some type arguments have been inferred).
- set refinedSlot(int value) {
- assert(value == null || value >= 0);
- this._refinedSlot = value;
- }
-
- @override
- int get slot => _slot ??= 0;
-
- /// If this [EntityRef] is contained within [LinkedUnit.types], slot id (which
- /// is unique within the compilation unit) identifying the target of type
- /// propagation or type inference with which this [EntityRef] is associated.
- ///
- /// Otherwise zero.
- set slot(int value) {
- assert(value == null || value >= 0);
- this._slot = value;
- }
-
- @override
- List<UnlinkedParamBuilder> get syntheticParams =>
- _syntheticParams ??= <UnlinkedParamBuilder>[];
-
- /// If this [EntityRef] is a reference to a function type whose
- /// [FunctionElement] is not in any library (e.g. a function type that was
- /// synthesized by a LUB computation), the function parameters. Otherwise
- /// empty.
- set syntheticParams(List<UnlinkedParamBuilder> value) {
- this._syntheticParams = value;
- }
-
- @override
- EntityRefBuilder get syntheticReturnType => _syntheticReturnType;
-
- /// If this [EntityRef] is a reference to a function type whose
- /// [FunctionElement] is not in any library (e.g. a function type that was
- /// synthesized by a LUB computation), the return type of the function.
- /// Otherwise `null`.
- set syntheticReturnType(EntityRefBuilder value) {
- this._syntheticReturnType = value;
- }
-
- @override
- List<EntityRefBuilder> get typeArguments =>
- _typeArguments ??= <EntityRefBuilder>[];
-
- /// If this is an instantiation of a generic type or generic executable, the
- /// type arguments used to instantiate it (if any).
- set typeArguments(List<EntityRefBuilder> value) {
- this._typeArguments = value;
- }
-
- @override
- List<UnlinkedTypeParamBuilder> get typeParameters =>
- _typeParameters ??= <UnlinkedTypeParamBuilder>[];
-
- /// If this is a function type, the type parameters defined for the function
- /// type (if any).
- set typeParameters(List<UnlinkedTypeParamBuilder> value) {
- this._typeParameters = value;
- }
-
- EntityRefBuilder(
- {idl.EntityRefKind entityKind,
- List<int> implicitFunctionTypeIndices,
- idl.EntityRefNullabilitySuffix nullabilitySuffix,
- int paramReference,
- int reference,
- int refinedSlot,
- int slot,
- List<UnlinkedParamBuilder> syntheticParams,
- EntityRefBuilder syntheticReturnType,
- List<EntityRefBuilder> typeArguments,
- List<UnlinkedTypeParamBuilder> typeParameters})
- : _entityKind = entityKind,
- _implicitFunctionTypeIndices = implicitFunctionTypeIndices,
- _nullabilitySuffix = nullabilitySuffix,
- _paramReference = paramReference,
- _reference = reference,
- _refinedSlot = refinedSlot,
- _slot = slot,
- _syntheticParams = syntheticParams,
- _syntheticReturnType = syntheticReturnType,
- _typeArguments = typeArguments,
- _typeParameters = typeParameters;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _syntheticParams?.forEach((b) => b.flushInformative());
- _syntheticReturnType?.flushInformative();
- _typeArguments?.forEach((b) => b.flushInformative());
- _typeParameters?.forEach((b) => b.flushInformative());
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addInt(this._reference ?? 0);
- if (this._typeArguments == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._typeArguments.length);
- for (var x in this._typeArguments) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addInt(this._slot ?? 0);
- signature.addInt(this._paramReference ?? 0);
- if (this._implicitFunctionTypeIndices == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._implicitFunctionTypeIndices.length);
- for (var x in this._implicitFunctionTypeIndices) {
- signature.addInt(x);
- }
- }
- signature.addBool(this._syntheticReturnType != null);
- this._syntheticReturnType?.collectApiSignature(signature);
- if (this._syntheticParams == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._syntheticParams.length);
- for (var x in this._syntheticParams) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._typeParameters == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._typeParameters.length);
- for (var x in this._typeParameters) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addInt(this._entityKind == null ? 0 : this._entityKind.index);
- signature.addInt(this._refinedSlot ?? 0);
- signature.addInt(
- this._nullabilitySuffix == null ? 0 : this._nullabilitySuffix.index);
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_implicitFunctionTypeIndices;
- fb.Offset offset_syntheticParams;
- fb.Offset offset_syntheticReturnType;
- fb.Offset offset_typeArguments;
- fb.Offset offset_typeParameters;
- if (!(_implicitFunctionTypeIndices == null ||
- _implicitFunctionTypeIndices.isEmpty)) {
- offset_implicitFunctionTypeIndices =
- fbBuilder.writeListUint32(_implicitFunctionTypeIndices);
- }
- if (!(_syntheticParams == null || _syntheticParams.isEmpty)) {
- offset_syntheticParams = fbBuilder
- .writeList(_syntheticParams.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_syntheticReturnType != null) {
- offset_syntheticReturnType = _syntheticReturnType.finish(fbBuilder);
- }
- if (!(_typeArguments == null || _typeArguments.isEmpty)) {
- offset_typeArguments = fbBuilder
- .writeList(_typeArguments.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_typeParameters == null || _typeParameters.isEmpty)) {
- offset_typeParameters = fbBuilder
- .writeList(_typeParameters.map((b) => b.finish(fbBuilder)).toList());
- }
- fbBuilder.startTable();
- if (_entityKind != null && _entityKind != idl.EntityRefKind.named) {
- fbBuilder.addUint8(8, _entityKind.index);
- }
- if (offset_implicitFunctionTypeIndices != null) {
- fbBuilder.addOffset(4, offset_implicitFunctionTypeIndices);
- }
- if (_nullabilitySuffix != null &&
- _nullabilitySuffix != idl.EntityRefNullabilitySuffix.starOrIrrelevant) {
- fbBuilder.addUint8(10, _nullabilitySuffix.index);
- }
- if (_paramReference != null && _paramReference != 0) {
- fbBuilder.addUint32(3, _paramReference);
- }
- if (_reference != null && _reference != 0) {
- fbBuilder.addUint32(0, _reference);
- }
- if (_refinedSlot != null && _refinedSlot != 0) {
- fbBuilder.addUint32(9, _refinedSlot);
- }
- if (_slot != null && _slot != 0) {
- fbBuilder.addUint32(2, _slot);
- }
- if (offset_syntheticParams != null) {
- fbBuilder.addOffset(6, offset_syntheticParams);
- }
- if (offset_syntheticReturnType != null) {
- fbBuilder.addOffset(5, offset_syntheticReturnType);
- }
- if (offset_typeArguments != null) {
- fbBuilder.addOffset(1, offset_typeArguments);
- }
- if (offset_typeParameters != null) {
- fbBuilder.addOffset(7, offset_typeParameters);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _EntityRefReader extends fb.TableReader<_EntityRefImpl> {
- const _EntityRefReader();
-
- @override
- _EntityRefImpl createObject(fb.BufferContext bc, int offset) =>
- new _EntityRefImpl(bc, offset);
-}
-
-class _EntityRefImpl extends Object
- with _EntityRefMixin
- implements idl.EntityRef {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _EntityRefImpl(this._bc, this._bcOffset);
-
- idl.EntityRefKind _entityKind;
- List<int> _implicitFunctionTypeIndices;
- idl.EntityRefNullabilitySuffix _nullabilitySuffix;
- int _paramReference;
- int _reference;
- int _refinedSlot;
- int _slot;
- List<idl.UnlinkedParam> _syntheticParams;
- idl.EntityRef _syntheticReturnType;
- List<idl.EntityRef> _typeArguments;
- List<idl.UnlinkedTypeParam> _typeParameters;
-
- @override
- idl.EntityRefKind get entityKind {
- _entityKind ??= const _EntityRefKindReader()
- .vTableGet(_bc, _bcOffset, 8, idl.EntityRefKind.named);
- return _entityKind;
- }
-
- @override
- List<int> get implicitFunctionTypeIndices {
- _implicitFunctionTypeIndices ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 4, const <int>[]);
- return _implicitFunctionTypeIndices;
- }
-
- @override
- idl.EntityRefNullabilitySuffix get nullabilitySuffix {
- _nullabilitySuffix ??= const _EntityRefNullabilitySuffixReader().vTableGet(
- _bc, _bcOffset, 10, idl.EntityRefNullabilitySuffix.starOrIrrelevant);
- return _nullabilitySuffix;
- }
-
- @override
- int get paramReference {
- _paramReference ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 3, 0);
- return _paramReference;
- }
-
- @override
- int get reference {
- _reference ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
- return _reference;
- }
-
- @override
- int get refinedSlot {
- _refinedSlot ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 9, 0);
- return _refinedSlot;
- }
-
- @override
- int get slot {
- _slot ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 2, 0);
- return _slot;
- }
-
- @override
- List<idl.UnlinkedParam> get syntheticParams {
- _syntheticParams ??=
- const fb.ListReader<idl.UnlinkedParam>(const _UnlinkedParamReader())
- .vTableGet(_bc, _bcOffset, 6, const <idl.UnlinkedParam>[]);
- return _syntheticParams;
- }
-
- @override
- idl.EntityRef get syntheticReturnType {
- _syntheticReturnType ??=
- const _EntityRefReader().vTableGet(_bc, _bcOffset, 5, null);
- return _syntheticReturnType;
- }
-
- @override
- List<idl.EntityRef> get typeArguments {
- _typeArguments ??=
- const fb.ListReader<idl.EntityRef>(const _EntityRefReader())
- .vTableGet(_bc, _bcOffset, 1, const <idl.EntityRef>[]);
- return _typeArguments;
- }
-
- @override
- List<idl.UnlinkedTypeParam> get typeParameters {
- _typeParameters ??= const fb.ListReader<idl.UnlinkedTypeParam>(
- const _UnlinkedTypeParamReader())
- .vTableGet(_bc, _bcOffset, 7, const <idl.UnlinkedTypeParam>[]);
- return _typeParameters;
- }
-}
-
-abstract class _EntityRefMixin implements idl.EntityRef {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (entityKind != idl.EntityRefKind.named)
- _result["entityKind"] = entityKind.toString().split('.')[1];
- if (implicitFunctionTypeIndices.isNotEmpty)
- _result["implicitFunctionTypeIndices"] = implicitFunctionTypeIndices;
- if (nullabilitySuffix != idl.EntityRefNullabilitySuffix.starOrIrrelevant)
- _result["nullabilitySuffix"] = nullabilitySuffix.toString().split('.')[1];
- if (paramReference != 0) _result["paramReference"] = paramReference;
- if (reference != 0) _result["reference"] = reference;
- if (refinedSlot != 0) _result["refinedSlot"] = refinedSlot;
- if (slot != 0) _result["slot"] = slot;
- if (syntheticParams.isNotEmpty)
- _result["syntheticParams"] =
- syntheticParams.map((_value) => _value.toJson()).toList();
- if (syntheticReturnType != null)
- _result["syntheticReturnType"] = syntheticReturnType.toJson();
- if (typeArguments.isNotEmpty)
- _result["typeArguments"] =
- typeArguments.map((_value) => _value.toJson()).toList();
- if (typeParameters.isNotEmpty)
- _result["typeParameters"] =
- typeParameters.map((_value) => _value.toJson()).toList();
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "entityKind": entityKind,
- "implicitFunctionTypeIndices": implicitFunctionTypeIndices,
- "nullabilitySuffix": nullabilitySuffix,
- "paramReference": paramReference,
- "reference": reference,
- "refinedSlot": refinedSlot,
- "slot": slot,
- "syntheticParams": syntheticParams,
- "syntheticReturnType": syntheticReturnType,
- "typeArguments": typeArguments,
- "typeParameters": typeParameters,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class LinkedDependencyBuilder extends Object
- with _LinkedDependencyMixin
- implements idl.LinkedDependency {
- List<String> _parts;
- String _uri;
-
- @override
- List<String> get parts => _parts ??= <String>[];
-
- /// Absolute URI for the compilation units listed in the library's `part`
- /// declarations, empty string for invalid URI.
- set parts(List<String> value) {
- this._parts = value;
- }
-
- @override
- String get uri => _uri ??= '';
-
- /// The absolute URI of the dependent library, e.g. `package:foo/bar.dart`.
- set uri(String value) {
- this._uri = value;
- }
-
- LinkedDependencyBuilder({List<String> parts, String uri})
- : _parts = parts,
- _uri = uri;
-
- /// Flush [informative] data recursively.
- void flushInformative() {}
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._uri ?? '');
- if (this._parts == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._parts.length);
- for (var x in this._parts) {
- signature.addString(x);
- }
- }
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_parts;
- fb.Offset offset_uri;
- if (!(_parts == null || _parts.isEmpty)) {
- offset_parts = fbBuilder
- .writeList(_parts.map((b) => fbBuilder.writeString(b)).toList());
- }
- if (_uri != null) {
- offset_uri = fbBuilder.writeString(_uri);
- }
- fbBuilder.startTable();
- if (offset_parts != null) {
- fbBuilder.addOffset(1, offset_parts);
- }
- if (offset_uri != null) {
- fbBuilder.addOffset(0, offset_uri);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _LinkedDependencyReader extends fb.TableReader<_LinkedDependencyImpl> {
- const _LinkedDependencyReader();
-
- @override
- _LinkedDependencyImpl createObject(fb.BufferContext bc, int offset) =>
- new _LinkedDependencyImpl(bc, offset);
-}
-
-class _LinkedDependencyImpl extends Object
- with _LinkedDependencyMixin
- implements idl.LinkedDependency {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _LinkedDependencyImpl(this._bc, this._bcOffset);
-
- List<String> _parts;
- String _uri;
-
- @override
- List<String> get parts {
- _parts ??= const fb.ListReader<String>(const fb.StringReader())
- .vTableGet(_bc, _bcOffset, 1, const <String>[]);
- return _parts;
- }
-
- @override
- String get uri {
- _uri ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _uri;
- }
-}
-
-abstract class _LinkedDependencyMixin implements idl.LinkedDependency {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (parts.isNotEmpty) _result["parts"] = parts;
- if (uri != '') _result["uri"] = uri;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "parts": parts,
- "uri": uri,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class LinkedExportNameBuilder extends Object
- with _LinkedExportNameMixin
- implements idl.LinkedExportName {
- int _dependency;
- idl.ReferenceKind _kind;
- String _name;
- int _unit;
-
- @override
- int get dependency => _dependency ??= 0;
-
- /// Index into [LinkedLibrary.dependencies] for the library in which the
- /// entity is defined.
- set dependency(int value) {
- assert(value == null || value >= 0);
- this._dependency = value;
- }
-
- @override
- idl.ReferenceKind get kind => _kind ??= idl.ReferenceKind.classOrEnum;
-
- /// The kind of the entity being referred to.
- set kind(idl.ReferenceKind value) {
- this._kind = value;
- }
-
- @override
- String get name => _name ??= '';
-
- /// Name of the exported entity. For an exported setter, this name includes
- /// the trailing '='.
- set name(String value) {
- this._name = value;
- }
-
- @override
- int get unit => _unit ??= 0;
-
- /// Integer index indicating which unit in the exported library contains the
- /// definition of the entity. As with indices into [LinkedLibrary.units],
- /// zero represents the defining compilation unit, and nonzero values
- /// represent parts in the order of the corresponding `part` declarations.
- set unit(int value) {
- assert(value == null || value >= 0);
- this._unit = value;
- }
-
- LinkedExportNameBuilder(
- {int dependency, idl.ReferenceKind kind, String name, int unit})
- : _dependency = dependency,
- _kind = kind,
- _name = name,
- _unit = unit;
-
- /// Flush [informative] data recursively.
- void flushInformative() {}
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addInt(this._dependency ?? 0);
- signature.addString(this._name ?? '');
- signature.addInt(this._unit ?? 0);
- signature.addInt(this._kind == null ? 0 : this._kind.index);
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_name;
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- fbBuilder.startTable();
- if (_dependency != null && _dependency != 0) {
- fbBuilder.addUint32(0, _dependency);
- }
- if (_kind != null && _kind != idl.ReferenceKind.classOrEnum) {
- fbBuilder.addUint8(3, _kind.index);
- }
- if (offset_name != null) {
- fbBuilder.addOffset(1, offset_name);
- }
- if (_unit != null && _unit != 0) {
- fbBuilder.addUint32(2, _unit);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _LinkedExportNameReader extends fb.TableReader<_LinkedExportNameImpl> {
- const _LinkedExportNameReader();
-
- @override
- _LinkedExportNameImpl createObject(fb.BufferContext bc, int offset) =>
- new _LinkedExportNameImpl(bc, offset);
-}
-
-class _LinkedExportNameImpl extends Object
- with _LinkedExportNameMixin
- implements idl.LinkedExportName {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _LinkedExportNameImpl(this._bc, this._bcOffset);
-
- int _dependency;
- idl.ReferenceKind _kind;
- String _name;
- int _unit;
-
- @override
- int get dependency {
- _dependency ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
- return _dependency;
- }
-
- @override
- idl.ReferenceKind get kind {
- _kind ??= const _ReferenceKindReader()
- .vTableGet(_bc, _bcOffset, 3, idl.ReferenceKind.classOrEnum);
- return _kind;
- }
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 1, '');
- return _name;
- }
-
- @override
- int get unit {
- _unit ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 2, 0);
- return _unit;
- }
-}
-
-abstract class _LinkedExportNameMixin implements idl.LinkedExportName {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (dependency != 0) _result["dependency"] = dependency;
- if (kind != idl.ReferenceKind.classOrEnum)
- _result["kind"] = kind.toString().split('.')[1];
- if (name != '') _result["name"] = name;
- if (unit != 0) _result["unit"] = unit;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "dependency": dependency,
- "kind": kind,
- "name": name,
- "unit": unit,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
class LinkedLibraryBuilder extends Object
with _LinkedLibraryMixin
implements idl.LinkedLibrary {
- List<LinkedDependencyBuilder> _dependencies;
- List<int> _exportDependencies;
- List<LinkedExportNameBuilder> _exportNames;
- List<int> _importDependencies;
- int _numPrelinkedDependencies;
- List<LinkedUnitBuilder> _units;
+ int _placeholder;
@override
- List<LinkedDependencyBuilder> get dependencies =>
- _dependencies ??= <LinkedDependencyBuilder>[];
+ int get placeholder => _placeholder ??= 0;
- /// The libraries that this library depends on (either via an explicit import
- /// statement or via the implicit dependencies on `dart:core` and
- /// `dart:async`). The first element of this array is a pseudo-dependency
- /// representing the library itself (it is also used for `dynamic` and
- /// `void`). This is followed by elements representing "prelinked"
- /// dependencies (direct imports and the transitive closure of exports).
- /// After the prelinked dependencies are elements representing "linked"
- /// dependencies.
- ///
- /// A library is only included as a "linked" dependency if it is a true
- /// dependency (e.g. a propagated or inferred type or constant value
- /// implicitly refers to an element declared in the library) or
- /// anti-dependency (e.g. the result of type propagation or type inference
- /// depends on the lack of a certain declaration in the library).
- set dependencies(List<LinkedDependencyBuilder> value) {
- this._dependencies = value;
- }
-
- @override
- List<int> get exportDependencies => _exportDependencies ??= <int>[];
-
- /// For each export in [UnlinkedUnit.exports], an index into [dependencies]
- /// of the library being exported.
- set exportDependencies(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._exportDependencies = value;
- }
-
- @override
- List<LinkedExportNameBuilder> get exportNames =>
- _exportNames ??= <LinkedExportNameBuilder>[];
-
- /// Information about entities in the export namespace of the library that are
- /// not in the public namespace of the library (that is, entities that are
- /// brought into the namespace via `export` directives).
- ///
- /// Sorted by name.
- set exportNames(List<LinkedExportNameBuilder> value) {
- this._exportNames = value;
- }
-
- @override
- Null get fallbackMode =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- List<int> get importDependencies => _importDependencies ??= <int>[];
-
- /// For each import in [UnlinkedUnit.imports], an index into [dependencies]
- /// of the library being imported.
- set importDependencies(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._importDependencies = value;
- }
-
- @override
- int get numPrelinkedDependencies => _numPrelinkedDependencies ??= 0;
-
- /// The number of elements in [dependencies] which are not "linked"
- /// dependencies (that is, the number of libraries in the direct imports plus
- /// the transitive closure of exports, plus the library itself).
- set numPrelinkedDependencies(int value) {
+ set placeholder(int value) {
assert(value == null || value >= 0);
- this._numPrelinkedDependencies = value;
+ this._placeholder = value;
}
- @override
- List<LinkedUnitBuilder> get units => _units ??= <LinkedUnitBuilder>[];
-
- /// The linked summary of all the compilation units constituting the
- /// library. The summary of the defining compilation unit is listed first,
- /// followed by the summary of each part, in the order of the `part`
- /// declarations in the defining compilation unit.
- set units(List<LinkedUnitBuilder> value) {
- this._units = value;
- }
-
- LinkedLibraryBuilder(
- {List<LinkedDependencyBuilder> dependencies,
- List<int> exportDependencies,
- List<LinkedExportNameBuilder> exportNames,
- List<int> importDependencies,
- int numPrelinkedDependencies,
- List<LinkedUnitBuilder> units})
- : _dependencies = dependencies,
- _exportDependencies = exportDependencies,
- _exportNames = exportNames,
- _importDependencies = importDependencies,
- _numPrelinkedDependencies = numPrelinkedDependencies,
- _units = units;
+ LinkedLibraryBuilder({int placeholder}) : _placeholder = placeholder;
/// Flush [informative] data recursively.
- void flushInformative() {
- _dependencies?.forEach((b) => b.flushInformative());
- _exportNames?.forEach((b) => b.flushInformative());
- _units?.forEach((b) => b.flushInformative());
- }
+ void flushInformative() {}
/// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
- if (this._dependencies == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._dependencies.length);
- for (var x in this._dependencies) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._importDependencies == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._importDependencies.length);
- for (var x in this._importDependencies) {
- signature.addInt(x);
- }
- }
- signature.addInt(this._numPrelinkedDependencies ?? 0);
- if (this._units == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._units.length);
- for (var x in this._units) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._exportNames == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._exportNames.length);
- for (var x in this._exportNames) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._exportDependencies == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._exportDependencies.length);
- for (var x in this._exportDependencies) {
- signature.addInt(x);
- }
- }
- }
-
- List<int> toBuffer() {
- fb.Builder fbBuilder = new fb.Builder();
- return fbBuilder.finish(finish(fbBuilder), "LLib");
+ signature.addInt(this._placeholder ?? 0);
}
fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_dependencies;
- fb.Offset offset_exportDependencies;
- fb.Offset offset_exportNames;
- fb.Offset offset_importDependencies;
- fb.Offset offset_units;
- if (!(_dependencies == null || _dependencies.isEmpty)) {
- offset_dependencies = fbBuilder
- .writeList(_dependencies.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_exportDependencies == null || _exportDependencies.isEmpty)) {
- offset_exportDependencies =
- fbBuilder.writeListUint32(_exportDependencies);
- }
- if (!(_exportNames == null || _exportNames.isEmpty)) {
- offset_exportNames = fbBuilder
- .writeList(_exportNames.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_importDependencies == null || _importDependencies.isEmpty)) {
- offset_importDependencies =
- fbBuilder.writeListUint32(_importDependencies);
- }
- if (!(_units == null || _units.isEmpty)) {
- offset_units =
- fbBuilder.writeList(_units.map((b) => b.finish(fbBuilder)).toList());
- }
fbBuilder.startTable();
- if (offset_dependencies != null) {
- fbBuilder.addOffset(0, offset_dependencies);
- }
- if (offset_exportDependencies != null) {
- fbBuilder.addOffset(6, offset_exportDependencies);
- }
- if (offset_exportNames != null) {
- fbBuilder.addOffset(4, offset_exportNames);
- }
- if (offset_importDependencies != null) {
- fbBuilder.addOffset(1, offset_importDependencies);
- }
- if (_numPrelinkedDependencies != null && _numPrelinkedDependencies != 0) {
- fbBuilder.addUint32(2, _numPrelinkedDependencies);
- }
- if (offset_units != null) {
- fbBuilder.addOffset(3, offset_units);
+ if (_placeholder != null && _placeholder != 0) {
+ fbBuilder.addUint32(0, _placeholder);
}
return fbBuilder.endTable();
}
}
-idl.LinkedLibrary readLinkedLibrary(List<int> buffer) {
- fb.BufferContext rootRef = new fb.BufferContext.fromBytes(buffer);
- return const _LinkedLibraryReader().read(rootRef, 0);
-}
-
class _LinkedLibraryReader extends fb.TableReader<_LinkedLibraryImpl> {
const _LinkedLibraryReader();
@@ -4905,59 +3723,12 @@
_LinkedLibraryImpl(this._bc, this._bcOffset);
- List<idl.LinkedDependency> _dependencies;
- List<int> _exportDependencies;
- List<idl.LinkedExportName> _exportNames;
- List<int> _importDependencies;
- int _numPrelinkedDependencies;
- List<idl.LinkedUnit> _units;
+ int _placeholder;
@override
- List<idl.LinkedDependency> get dependencies {
- _dependencies ??= const fb.ListReader<idl.LinkedDependency>(
- const _LinkedDependencyReader())
- .vTableGet(_bc, _bcOffset, 0, const <idl.LinkedDependency>[]);
- return _dependencies;
- }
-
- @override
- List<int> get exportDependencies {
- _exportDependencies ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 6, const <int>[]);
- return _exportDependencies;
- }
-
- @override
- List<idl.LinkedExportName> get exportNames {
- _exportNames ??= const fb.ListReader<idl.LinkedExportName>(
- const _LinkedExportNameReader())
- .vTableGet(_bc, _bcOffset, 4, const <idl.LinkedExportName>[]);
- return _exportNames;
- }
-
- @override
- Null get fallbackMode =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- List<int> get importDependencies {
- _importDependencies ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 1, const <int>[]);
- return _importDependencies;
- }
-
- @override
- int get numPrelinkedDependencies {
- _numPrelinkedDependencies ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 2, 0);
- return _numPrelinkedDependencies;
- }
-
- @override
- List<idl.LinkedUnit> get units {
- _units ??= const fb.ListReader<idl.LinkedUnit>(const _LinkedUnitReader())
- .vTableGet(_bc, _bcOffset, 3, const <idl.LinkedUnit>[]);
- return _units;
+ int get placeholder {
+ _placeholder ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
+ return _placeholder;
}
}
@@ -4965,31 +3736,13 @@
@override
Map<String, Object> toJson() {
Map<String, Object> _result = <String, Object>{};
- if (dependencies.isNotEmpty)
- _result["dependencies"] =
- dependencies.map((_value) => _value.toJson()).toList();
- if (exportDependencies.isNotEmpty)
- _result["exportDependencies"] = exportDependencies;
- if (exportNames.isNotEmpty)
- _result["exportNames"] =
- exportNames.map((_value) => _value.toJson()).toList();
- if (importDependencies.isNotEmpty)
- _result["importDependencies"] = importDependencies;
- if (numPrelinkedDependencies != 0)
- _result["numPrelinkedDependencies"] = numPrelinkedDependencies;
- if (units.isNotEmpty)
- _result["units"] = units.map((_value) => _value.toJson()).toList();
+ if (placeholder != 0) _result["placeholder"] = placeholder;
return _result;
}
@override
Map<String, Object> toMap() => {
- "dependencies": dependencies,
- "exportDependencies": exportDependencies,
- "exportNames": exportNames,
- "importDependencies": importDependencies,
- "numPrelinkedDependencies": numPrelinkedDependencies,
- "units": units,
+ "placeholder": placeholder,
};
@override
@@ -7691,6 +6444,7 @@
kind == idl.LinkedNodeKind.functionExpressionInvocation ||
kind == idl.LinkedNodeKind.indexExpression ||
kind == idl.LinkedNodeKind.instanceCreationExpression ||
+ kind == idl.LinkedNodeKind.integerLiteral ||
kind == idl.LinkedNodeKind.listLiteral ||
kind == idl.LinkedNodeKind.methodInvocation ||
kind == idl.LinkedNodeKind.nullLiteral ||
@@ -7725,6 +6479,7 @@
kind == idl.LinkedNodeKind.functionExpressionInvocation ||
kind == idl.LinkedNodeKind.indexExpression ||
kind == idl.LinkedNodeKind.instanceCreationExpression ||
+ kind == idl.LinkedNodeKind.integerLiteral ||
kind == idl.LinkedNodeKind.listLiteral ||
kind == idl.LinkedNodeKind.methodInvocation ||
kind == idl.LinkedNodeKind.nullLiteral ||
@@ -8717,8 +7472,10 @@
_variantField_25 = expression_type;
LinkedNodeBuilder.integerLiteral({
+ LinkedNodeTypeBuilder expression_type,
int integerLiteral_value,
}) : _kind = idl.LinkedNodeKind.integerLiteral,
+ _variantField_25 = expression_type,
_variantField_16 = integerLiteral_value;
LinkedNodeBuilder.interpolationExpression({
@@ -9427,6 +8184,7 @@
instanceCreationExpression_typeArguments?.flushInformative();
expression_type?.flushInformative();
} else if (kind == idl.LinkedNodeKind.integerLiteral) {
+ expression_type?.flushInformative();
} else if (kind == idl.LinkedNodeKind.interpolationExpression) {
interpolationExpression_expression?.flushInformative();
} else if (kind == idl.LinkedNodeKind.interpolationString) {
@@ -10535,6 +9293,8 @@
signature.addInt(this.kind == null ? 0 : this.kind.index);
signature.addInt(this.integerLiteral_value ?? 0);
signature.addInt(this.flags ?? 0);
+ signature.addBool(this.expression_type != null);
+ this.expression_type?.collectApiSignature(signature);
signature.addString(this.name ?? '');
} else if (kind == idl.LinkedNodeKind.interpolationExpression) {
signature.addInt(this.kind == null ? 0 : this.kind.index);
@@ -13462,6 +12222,7 @@
kind == idl.LinkedNodeKind.functionExpressionInvocation ||
kind == idl.LinkedNodeKind.indexExpression ||
kind == idl.LinkedNodeKind.instanceCreationExpression ||
+ kind == idl.LinkedNodeKind.integerLiteral ||
kind == idl.LinkedNodeKind.listLiteral ||
kind == idl.LinkedNodeKind.methodInvocation ||
kind == idl.LinkedNodeKind.nullLiteral ||
@@ -14430,6 +13191,8 @@
_result["expression_type"] = expression_type.toJson();
}
if (kind == idl.LinkedNodeKind.integerLiteral) {
+ if (expression_type != null)
+ _result["expression_type"] = expression_type.toJson();
if (integerLiteral_value != 0)
_result["integerLiteral_value"] = integerLiteral_value;
}
@@ -15620,6 +14383,7 @@
}
if (kind == idl.LinkedNodeKind.integerLiteral) {
return {
+ "expression_type": expression_type,
"flags": flags,
"integerLiteral_value": integerLiteral_value,
"kind": kind,
@@ -17668,562 +16432,12 @@
String toString() => convert.json.encode(toJson());
}
-class LinkedReferenceBuilder extends Object
- with _LinkedReferenceMixin
- implements idl.LinkedReference {
- int _containingReference;
- int _dependency;
- idl.ReferenceKind _kind;
- String _name;
- int _numTypeParameters;
- int _unit;
-
- @override
- int get containingReference => _containingReference ??= 0;
-
- /// If this [LinkedReference] doesn't have an associated [UnlinkedReference],
- /// and the entity being referred to is contained within another entity, index
- /// of the containing entity. This behaves similarly to
- /// [UnlinkedReference.prefixReference], however it is only used for class
- /// members, not for prefixed imports.
- ///
- /// Containing references must always point backward; that is, for all i, if
- /// LinkedUnit.references[i].containingReference != 0, then
- /// LinkedUnit.references[i].containingReference < i.
- set containingReference(int value) {
- assert(value == null || value >= 0);
- this._containingReference = value;
- }
-
- @override
- int get dependency => _dependency ??= 0;
-
- /// Index into [LinkedLibrary.dependencies] indicating which imported library
- /// declares the entity being referred to.
- ///
- /// Zero if this entity is contained within another entity (e.g. a class
- /// member), or if [kind] is [ReferenceKind.prefix].
- set dependency(int value) {
- assert(value == null || value >= 0);
- this._dependency = value;
- }
-
- @override
- idl.ReferenceKind get kind => _kind ??= idl.ReferenceKind.classOrEnum;
-
- /// The kind of the entity being referred to. For the pseudo-types `dynamic`
- /// and `void`, the kind is [ReferenceKind.classOrEnum].
- set kind(idl.ReferenceKind value) {
- this._kind = value;
- }
-
- @override
- Null get localIndex =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- String get name => _name ??= '';
-
- /// If this [LinkedReference] doesn't have an associated [UnlinkedReference],
- /// name of the entity being referred to. For the pseudo-type `dynamic`, the
- /// string is "dynamic". For the pseudo-type `void`, the string is "void".
- set name(String value) {
- this._name = value;
- }
-
- @override
- int get numTypeParameters => _numTypeParameters ??= 0;
-
- /// If the entity being referred to is generic, the number of type parameters
- /// it declares (does not include type parameters of enclosing entities).
- /// Otherwise zero.
- set numTypeParameters(int value) {
- assert(value == null || value >= 0);
- this._numTypeParameters = value;
- }
-
- @override
- int get unit => _unit ??= 0;
-
- /// Integer index indicating which unit in the imported library contains the
- /// definition of the entity. As with indices into [LinkedLibrary.units],
- /// zero represents the defining compilation unit, and nonzero values
- /// represent parts in the order of the corresponding `part` declarations.
- ///
- /// Zero if this entity is contained within another entity (e.g. a class
- /// member).
- set unit(int value) {
- assert(value == null || value >= 0);
- this._unit = value;
- }
-
- LinkedReferenceBuilder(
- {int containingReference,
- int dependency,
- idl.ReferenceKind kind,
- String name,
- int numTypeParameters,
- int unit})
- : _containingReference = containingReference,
- _dependency = dependency,
- _kind = kind,
- _name = name,
- _numTypeParameters = numTypeParameters,
- _unit = unit;
-
- /// Flush [informative] data recursively.
- void flushInformative() {}
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addInt(this._unit ?? 0);
- signature.addInt(this._dependency ?? 0);
- signature.addInt(this._kind == null ? 0 : this._kind.index);
- signature.addString(this._name ?? '');
- signature.addInt(this._numTypeParameters ?? 0);
- signature.addInt(this._containingReference ?? 0);
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_name;
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- fbBuilder.startTable();
- if (_containingReference != null && _containingReference != 0) {
- fbBuilder.addUint32(5, _containingReference);
- }
- if (_dependency != null && _dependency != 0) {
- fbBuilder.addUint32(1, _dependency);
- }
- if (_kind != null && _kind != idl.ReferenceKind.classOrEnum) {
- fbBuilder.addUint8(2, _kind.index);
- }
- if (offset_name != null) {
- fbBuilder.addOffset(3, offset_name);
- }
- if (_numTypeParameters != null && _numTypeParameters != 0) {
- fbBuilder.addUint32(4, _numTypeParameters);
- }
- if (_unit != null && _unit != 0) {
- fbBuilder.addUint32(0, _unit);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _LinkedReferenceReader extends fb.TableReader<_LinkedReferenceImpl> {
- const _LinkedReferenceReader();
-
- @override
- _LinkedReferenceImpl createObject(fb.BufferContext bc, int offset) =>
- new _LinkedReferenceImpl(bc, offset);
-}
-
-class _LinkedReferenceImpl extends Object
- with _LinkedReferenceMixin
- implements idl.LinkedReference {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _LinkedReferenceImpl(this._bc, this._bcOffset);
-
- int _containingReference;
- int _dependency;
- idl.ReferenceKind _kind;
- String _name;
- int _numTypeParameters;
- int _unit;
-
- @override
- int get containingReference {
- _containingReference ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 5, 0);
- return _containingReference;
- }
-
- @override
- int get dependency {
- _dependency ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0);
- return _dependency;
- }
-
- @override
- idl.ReferenceKind get kind {
- _kind ??= const _ReferenceKindReader()
- .vTableGet(_bc, _bcOffset, 2, idl.ReferenceKind.classOrEnum);
- return _kind;
- }
-
- @override
- Null get localIndex =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 3, '');
- return _name;
- }
-
- @override
- int get numTypeParameters {
- _numTypeParameters ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 4, 0);
- return _numTypeParameters;
- }
-
- @override
- int get unit {
- _unit ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
- return _unit;
- }
-}
-
-abstract class _LinkedReferenceMixin implements idl.LinkedReference {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (containingReference != 0)
- _result["containingReference"] = containingReference;
- if (dependency != 0) _result["dependency"] = dependency;
- if (kind != idl.ReferenceKind.classOrEnum)
- _result["kind"] = kind.toString().split('.')[1];
- if (name != '') _result["name"] = name;
- if (numTypeParameters != 0)
- _result["numTypeParameters"] = numTypeParameters;
- if (unit != 0) _result["unit"] = unit;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "containingReference": containingReference,
- "dependency": dependency,
- "kind": kind,
- "name": name,
- "numTypeParameters": numTypeParameters,
- "unit": unit,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class LinkedUnitBuilder extends Object
- with _LinkedUnitMixin
- implements idl.LinkedUnit {
- List<int> _constCycles;
- List<int> _notSimplyBounded;
- List<int> _parametersInheritingCovariant;
- List<LinkedReferenceBuilder> _references;
- List<TopLevelInferenceErrorBuilder> _topLevelInferenceErrors;
- List<EntityRefBuilder> _types;
-
- @override
- List<int> get constCycles => _constCycles ??= <int>[];
-
- /// List of slot ids (referring to [UnlinkedExecutable.constCycleSlot])
- /// corresponding to const constructors that are part of cycles.
- set constCycles(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._constCycles = value;
- }
-
- @override
- List<int> get notSimplyBounded => _notSimplyBounded ??= <int>[];
-
- /// List of slot ids (referring to [UnlinkedClass.notSimplyBoundedSlot] or
- /// [UnlinkedTypedef.notSimplyBoundedSlot]) corresponding to classes and
- /// typedefs that are not simply bounded.
- set notSimplyBounded(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._notSimplyBounded = value;
- }
-
- @override
- List<int> get parametersInheritingCovariant =>
- _parametersInheritingCovariant ??= <int>[];
-
- /// List of slot ids (referring to [UnlinkedParam.inheritsCovariantSlot] or
- /// [UnlinkedVariable.inheritsCovariantSlot]) corresponding to parameters
- /// that inherit `@covariant` behavior from a base class.
- set parametersInheritingCovariant(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._parametersInheritingCovariant = value;
- }
-
- @override
- List<LinkedReferenceBuilder> get references =>
- _references ??= <LinkedReferenceBuilder>[];
-
- /// Information about the resolution of references within the compilation
- /// unit. Each element of [UnlinkedUnit.references] has a corresponding
- /// element in this list (at the same index). If this list has additional
- /// elements beyond the number of elements in [UnlinkedUnit.references], those
- /// additional elements are references that are only referred to implicitly
- /// (e.g. elements involved in inferred or propagated types).
- set references(List<LinkedReferenceBuilder> value) {
- this._references = value;
- }
-
- @override
- List<TopLevelInferenceErrorBuilder> get topLevelInferenceErrors =>
- _topLevelInferenceErrors ??= <TopLevelInferenceErrorBuilder>[];
-
- /// The list of type inference errors.
- set topLevelInferenceErrors(List<TopLevelInferenceErrorBuilder> value) {
- this._topLevelInferenceErrors = value;
- }
-
- @override
- List<EntityRefBuilder> get types => _types ??= <EntityRefBuilder>[];
-
- /// List associating slot ids found inside the unlinked summary for the
- /// compilation unit with propagated and inferred types.
- set types(List<EntityRefBuilder> value) {
- this._types = value;
- }
-
- LinkedUnitBuilder(
- {List<int> constCycles,
- List<int> notSimplyBounded,
- List<int> parametersInheritingCovariant,
- List<LinkedReferenceBuilder> references,
- List<TopLevelInferenceErrorBuilder> topLevelInferenceErrors,
- List<EntityRefBuilder> types})
- : _constCycles = constCycles,
- _notSimplyBounded = notSimplyBounded,
- _parametersInheritingCovariant = parametersInheritingCovariant,
- _references = references,
- _topLevelInferenceErrors = topLevelInferenceErrors,
- _types = types;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _references?.forEach((b) => b.flushInformative());
- _topLevelInferenceErrors?.forEach((b) => b.flushInformative());
- _types?.forEach((b) => b.flushInformative());
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- if (this._references == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._references.length);
- for (var x in this._references) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._types == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._types.length);
- for (var x in this._types) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._constCycles == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._constCycles.length);
- for (var x in this._constCycles) {
- signature.addInt(x);
- }
- }
- if (this._parametersInheritingCovariant == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._parametersInheritingCovariant.length);
- for (var x in this._parametersInheritingCovariant) {
- signature.addInt(x);
- }
- }
- if (this._topLevelInferenceErrors == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._topLevelInferenceErrors.length);
- for (var x in this._topLevelInferenceErrors) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._notSimplyBounded == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._notSimplyBounded.length);
- for (var x in this._notSimplyBounded) {
- signature.addInt(x);
- }
- }
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_constCycles;
- fb.Offset offset_notSimplyBounded;
- fb.Offset offset_parametersInheritingCovariant;
- fb.Offset offset_references;
- fb.Offset offset_topLevelInferenceErrors;
- fb.Offset offset_types;
- if (!(_constCycles == null || _constCycles.isEmpty)) {
- offset_constCycles = fbBuilder.writeListUint32(_constCycles);
- }
- if (!(_notSimplyBounded == null || _notSimplyBounded.isEmpty)) {
- offset_notSimplyBounded = fbBuilder.writeListUint32(_notSimplyBounded);
- }
- if (!(_parametersInheritingCovariant == null ||
- _parametersInheritingCovariant.isEmpty)) {
- offset_parametersInheritingCovariant =
- fbBuilder.writeListUint32(_parametersInheritingCovariant);
- }
- if (!(_references == null || _references.isEmpty)) {
- offset_references = fbBuilder
- .writeList(_references.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_topLevelInferenceErrors == null ||
- _topLevelInferenceErrors.isEmpty)) {
- offset_topLevelInferenceErrors = fbBuilder.writeList(
- _topLevelInferenceErrors.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_types == null || _types.isEmpty)) {
- offset_types =
- fbBuilder.writeList(_types.map((b) => b.finish(fbBuilder)).toList());
- }
- fbBuilder.startTable();
- if (offset_constCycles != null) {
- fbBuilder.addOffset(2, offset_constCycles);
- }
- if (offset_notSimplyBounded != null) {
- fbBuilder.addOffset(5, offset_notSimplyBounded);
- }
- if (offset_parametersInheritingCovariant != null) {
- fbBuilder.addOffset(3, offset_parametersInheritingCovariant);
- }
- if (offset_references != null) {
- fbBuilder.addOffset(0, offset_references);
- }
- if (offset_topLevelInferenceErrors != null) {
- fbBuilder.addOffset(4, offset_topLevelInferenceErrors);
- }
- if (offset_types != null) {
- fbBuilder.addOffset(1, offset_types);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _LinkedUnitReader extends fb.TableReader<_LinkedUnitImpl> {
- const _LinkedUnitReader();
-
- @override
- _LinkedUnitImpl createObject(fb.BufferContext bc, int offset) =>
- new _LinkedUnitImpl(bc, offset);
-}
-
-class _LinkedUnitImpl extends Object
- with _LinkedUnitMixin
- implements idl.LinkedUnit {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _LinkedUnitImpl(this._bc, this._bcOffset);
-
- List<int> _constCycles;
- List<int> _notSimplyBounded;
- List<int> _parametersInheritingCovariant;
- List<idl.LinkedReference> _references;
- List<idl.TopLevelInferenceError> _topLevelInferenceErrors;
- List<idl.EntityRef> _types;
-
- @override
- List<int> get constCycles {
- _constCycles ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 2, const <int>[]);
- return _constCycles;
- }
-
- @override
- List<int> get notSimplyBounded {
- _notSimplyBounded ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 5, const <int>[]);
- return _notSimplyBounded;
- }
-
- @override
- List<int> get parametersInheritingCovariant {
- _parametersInheritingCovariant ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 3, const <int>[]);
- return _parametersInheritingCovariant;
- }
-
- @override
- List<idl.LinkedReference> get references {
- _references ??=
- const fb.ListReader<idl.LinkedReference>(const _LinkedReferenceReader())
- .vTableGet(_bc, _bcOffset, 0, const <idl.LinkedReference>[]);
- return _references;
- }
-
- @override
- List<idl.TopLevelInferenceError> get topLevelInferenceErrors {
- _topLevelInferenceErrors ??=
- const fb.ListReader<idl.TopLevelInferenceError>(
- const _TopLevelInferenceErrorReader())
- .vTableGet(_bc, _bcOffset, 4, const <idl.TopLevelInferenceError>[]);
- return _topLevelInferenceErrors;
- }
-
- @override
- List<idl.EntityRef> get types {
- _types ??= const fb.ListReader<idl.EntityRef>(const _EntityRefReader())
- .vTableGet(_bc, _bcOffset, 1, const <idl.EntityRef>[]);
- return _types;
- }
-}
-
-abstract class _LinkedUnitMixin implements idl.LinkedUnit {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (constCycles.isNotEmpty) _result["constCycles"] = constCycles;
- if (notSimplyBounded.isNotEmpty)
- _result["notSimplyBounded"] = notSimplyBounded;
- if (parametersInheritingCovariant.isNotEmpty)
- _result["parametersInheritingCovariant"] = parametersInheritingCovariant;
- if (references.isNotEmpty)
- _result["references"] =
- references.map((_value) => _value.toJson()).toList();
- if (topLevelInferenceErrors.isNotEmpty)
- _result["topLevelInferenceErrors"] =
- topLevelInferenceErrors.map((_value) => _value.toJson()).toList();
- if (types.isNotEmpty)
- _result["types"] = types.map((_value) => _value.toJson()).toList();
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "constCycles": constCycles,
- "notSimplyBounded": notSimplyBounded,
- "parametersInheritingCovariant": parametersInheritingCovariant,
- "references": references,
- "topLevelInferenceErrors": topLevelInferenceErrors,
- "types": types,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
class PackageBundleBuilder extends Object
with _PackageBundleMixin
implements idl.PackageBundle {
LinkedNodeBundleBuilder _bundle2;
- List<LinkedLibraryBuilder> _linkedLibraries;
- List<String> _linkedLibraryUris;
int _majorVersion;
int _minorVersion;
- List<UnlinkedUnitBuilder> _unlinkedUnits;
- List<String> _unlinkedUnitUris;
@override
Null get apiSignature =>
@@ -18242,22 +16456,12 @@
throw new UnimplementedError('attempt to access deprecated field');
@override
- List<LinkedLibraryBuilder> get linkedLibraries =>
- _linkedLibraries ??= <LinkedLibraryBuilder>[];
-
- /// Linked libraries.
- set linkedLibraries(List<LinkedLibraryBuilder> value) {
- this._linkedLibraries = value;
- }
+ Null get linkedLibraries =>
+ throw new UnimplementedError('attempt to access deprecated field');
@override
- List<String> get linkedLibraryUris => _linkedLibraryUris ??= <String>[];
-
- /// The list of URIs of items in [linkedLibraries], e.g. `dart:core` or
- /// `package:foo/bar.dart`.
- set linkedLibraryUris(List<String> value) {
- this._linkedLibraryUris = value;
- }
+ Null get linkedLibraryUris =>
+ throw new UnimplementedError('attempt to access deprecated field');
@override
int get majorVersion => _majorVersion ??= 0;
@@ -18284,79 +16488,26 @@
throw new UnimplementedError('attempt to access deprecated field');
@override
- List<UnlinkedUnitBuilder> get unlinkedUnits =>
- _unlinkedUnits ??= <UnlinkedUnitBuilder>[];
-
- /// Unlinked information for the compilation units constituting the package.
- set unlinkedUnits(List<UnlinkedUnitBuilder> value) {
- this._unlinkedUnits = value;
- }
+ Null get unlinkedUnits =>
+ throw new UnimplementedError('attempt to access deprecated field');
@override
- List<String> get unlinkedUnitUris => _unlinkedUnitUris ??= <String>[];
-
- /// The list of URIs of items in [unlinkedUnits], e.g. `dart:core/bool.dart`.
- set unlinkedUnitUris(List<String> value) {
- this._unlinkedUnitUris = value;
- }
+ Null get unlinkedUnitUris =>
+ throw new UnimplementedError('attempt to access deprecated field');
PackageBundleBuilder(
- {LinkedNodeBundleBuilder bundle2,
- List<LinkedLibraryBuilder> linkedLibraries,
- List<String> linkedLibraryUris,
- int majorVersion,
- int minorVersion,
- List<UnlinkedUnitBuilder> unlinkedUnits,
- List<String> unlinkedUnitUris})
+ {LinkedNodeBundleBuilder bundle2, int majorVersion, int minorVersion})
: _bundle2 = bundle2,
- _linkedLibraries = linkedLibraries,
- _linkedLibraryUris = linkedLibraryUris,
_majorVersion = majorVersion,
- _minorVersion = minorVersion,
- _unlinkedUnits = unlinkedUnits,
- _unlinkedUnitUris = unlinkedUnitUris;
+ _minorVersion = minorVersion;
/// Flush [informative] data recursively.
void flushInformative() {
_bundle2?.flushInformative();
- _linkedLibraries?.forEach((b) => b.flushInformative());
- _unlinkedUnits?.forEach((b) => b.flushInformative());
}
/// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
- if (this._linkedLibraries == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._linkedLibraries.length);
- for (var x in this._linkedLibraries) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._linkedLibraryUris == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._linkedLibraryUris.length);
- for (var x in this._linkedLibraryUris) {
- signature.addString(x);
- }
- }
- if (this._unlinkedUnits == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._unlinkedUnits.length);
- for (var x in this._unlinkedUnits) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._unlinkedUnitUris == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._unlinkedUnitUris.length);
- for (var x in this._unlinkedUnitUris) {
- signature.addString(x);
- }
- }
signature.addInt(this._majorVersion ?? 0);
signature.addInt(this._minorVersion ?? 0);
signature.addBool(this._bundle2 != null);
@@ -18370,51 +16521,19 @@
fb.Offset finish(fb.Builder fbBuilder) {
fb.Offset offset_bundle2;
- fb.Offset offset_linkedLibraries;
- fb.Offset offset_linkedLibraryUris;
- fb.Offset offset_unlinkedUnits;
- fb.Offset offset_unlinkedUnitUris;
if (_bundle2 != null) {
offset_bundle2 = _bundle2.finish(fbBuilder);
}
- if (!(_linkedLibraries == null || _linkedLibraries.isEmpty)) {
- offset_linkedLibraries = fbBuilder
- .writeList(_linkedLibraries.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_linkedLibraryUris == null || _linkedLibraryUris.isEmpty)) {
- offset_linkedLibraryUris = fbBuilder.writeList(
- _linkedLibraryUris.map((b) => fbBuilder.writeString(b)).toList());
- }
- if (!(_unlinkedUnits == null || _unlinkedUnits.isEmpty)) {
- offset_unlinkedUnits = fbBuilder
- .writeList(_unlinkedUnits.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_unlinkedUnitUris == null || _unlinkedUnitUris.isEmpty)) {
- offset_unlinkedUnitUris = fbBuilder.writeList(
- _unlinkedUnitUris.map((b) => fbBuilder.writeString(b)).toList());
- }
fbBuilder.startTable();
if (offset_bundle2 != null) {
fbBuilder.addOffset(9, offset_bundle2);
}
- if (offset_linkedLibraries != null) {
- fbBuilder.addOffset(0, offset_linkedLibraries);
- }
- if (offset_linkedLibraryUris != null) {
- fbBuilder.addOffset(1, offset_linkedLibraryUris);
- }
if (_majorVersion != null && _majorVersion != 0) {
fbBuilder.addUint32(5, _majorVersion);
}
if (_minorVersion != null && _minorVersion != 0) {
fbBuilder.addUint32(6, _minorVersion);
}
- if (offset_unlinkedUnits != null) {
- fbBuilder.addOffset(2, offset_unlinkedUnits);
- }
- if (offset_unlinkedUnitUris != null) {
- fbBuilder.addOffset(3, offset_unlinkedUnitUris);
- }
return fbBuilder.endTable();
}
}
@@ -18441,12 +16560,8 @@
_PackageBundleImpl(this._bc, this._bcOffset);
idl.LinkedNodeBundle _bundle2;
- List<idl.LinkedLibrary> _linkedLibraries;
- List<String> _linkedLibraryUris;
int _majorVersion;
int _minorVersion;
- List<idl.UnlinkedUnit> _unlinkedUnits;
- List<String> _unlinkedUnitUris;
@override
Null get apiSignature =>
@@ -18464,19 +16579,12 @@
throw new UnimplementedError('attempt to access deprecated field');
@override
- List<idl.LinkedLibrary> get linkedLibraries {
- _linkedLibraries ??=
- const fb.ListReader<idl.LinkedLibrary>(const _LinkedLibraryReader())
- .vTableGet(_bc, _bcOffset, 0, const <idl.LinkedLibrary>[]);
- return _linkedLibraries;
- }
+ Null get linkedLibraries =>
+ throw new UnimplementedError('attempt to access deprecated field');
@override
- List<String> get linkedLibraryUris {
- _linkedLibraryUris ??= const fb.ListReader<String>(const fb.StringReader())
- .vTableGet(_bc, _bcOffset, 1, const <String>[]);
- return _linkedLibraryUris;
- }
+ Null get linkedLibraryUris =>
+ throw new UnimplementedError('attempt to access deprecated field');
@override
int get majorVersion {
@@ -18495,19 +16603,12 @@
throw new UnimplementedError('attempt to access deprecated field');
@override
- List<idl.UnlinkedUnit> get unlinkedUnits {
- _unlinkedUnits ??=
- const fb.ListReader<idl.UnlinkedUnit>(const _UnlinkedUnitReader())
- .vTableGet(_bc, _bcOffset, 2, const <idl.UnlinkedUnit>[]);
- return _unlinkedUnits;
- }
+ Null get unlinkedUnits =>
+ throw new UnimplementedError('attempt to access deprecated field');
@override
- List<String> get unlinkedUnitUris {
- _unlinkedUnitUris ??= const fb.ListReader<String>(const fb.StringReader())
- .vTableGet(_bc, _bcOffset, 3, const <String>[]);
- return _unlinkedUnitUris;
- }
+ Null get unlinkedUnitUris =>
+ throw new UnimplementedError('attempt to access deprecated field');
}
abstract class _PackageBundleMixin implements idl.PackageBundle {
@@ -18515,465 +16616,92 @@
Map<String, Object> toJson() {
Map<String, Object> _result = <String, Object>{};
if (bundle2 != null) _result["bundle2"] = bundle2.toJson();
- if (linkedLibraries.isNotEmpty)
- _result["linkedLibraries"] =
- linkedLibraries.map((_value) => _value.toJson()).toList();
- if (linkedLibraryUris.isNotEmpty)
- _result["linkedLibraryUris"] = linkedLibraryUris;
if (majorVersion != 0) _result["majorVersion"] = majorVersion;
if (minorVersion != 0) _result["minorVersion"] = minorVersion;
- if (unlinkedUnits.isNotEmpty)
- _result["unlinkedUnits"] =
- unlinkedUnits.map((_value) => _value.toJson()).toList();
- if (unlinkedUnitUris.isNotEmpty)
- _result["unlinkedUnitUris"] = unlinkedUnitUris;
return _result;
}
@override
Map<String, Object> toMap() => {
"bundle2": bundle2,
- "linkedLibraries": linkedLibraries,
- "linkedLibraryUris": linkedLibraryUris,
"majorVersion": majorVersion,
"minorVersion": minorVersion,
- "unlinkedUnits": unlinkedUnits,
- "unlinkedUnitUris": unlinkedUnitUris,
};
@override
String toString() => convert.json.encode(toJson());
}
-class PackageIndexBuilder extends Object
- with _PackageIndexMixin
- implements idl.PackageIndex {
- List<idl.IndexSyntheticElementKind> _elementKinds;
- List<int> _elementNameClassMemberIds;
- List<int> _elementNameParameterIds;
- List<int> _elementNameUnitMemberIds;
- List<int> _elementUnits;
- List<String> _strings;
- List<int> _unitLibraryUris;
- List<UnitIndexBuilder> _units;
- List<int> _unitUnitUris;
+class PackageDependencyInfoBuilder extends Object
+ with _PackageDependencyInfoMixin
+ implements idl.PackageDependencyInfo {
+ int _placeholder;
@override
- List<idl.IndexSyntheticElementKind> get elementKinds =>
- _elementKinds ??= <idl.IndexSyntheticElementKind>[];
+ int get placeholder => _placeholder ??= 0;
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the kind of the synthetic element.
- set elementKinds(List<idl.IndexSyntheticElementKind> value) {
- this._elementKinds = value;
+ set placeholder(int value) {
+ assert(value == null || value >= 0);
+ this._placeholder = value;
}
- @override
- List<int> get elementNameClassMemberIds =>
- _elementNameClassMemberIds ??= <int>[];
-
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the identifier of the class member element name, or `null` if the element
- /// is a top-level element. The list is sorted in ascending order, so that
- /// the client can quickly check whether an element is referenced in this
- /// [PackageIndex].
- set elementNameClassMemberIds(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._elementNameClassMemberIds = value;
- }
-
- @override
- List<int> get elementNameParameterIds => _elementNameParameterIds ??= <int>[];
-
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the identifier of the named parameter name, or `null` if the element is
- /// not a named parameter. The list is sorted in ascending order, so that the
- /// client can quickly check whether an element is referenced in this
- /// [PackageIndex].
- set elementNameParameterIds(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._elementNameParameterIds = value;
- }
-
- @override
- List<int> get elementNameUnitMemberIds =>
- _elementNameUnitMemberIds ??= <int>[];
-
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the identifier of the top-level element name, or `null` if the element is
- /// the unit. The list is sorted in ascending order, so that the client can
- /// quickly check whether an element is referenced in this [PackageIndex].
- set elementNameUnitMemberIds(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._elementNameUnitMemberIds = value;
- }
-
- @override
- List<int> get elementUnits => _elementUnits ??= <int>[];
-
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the index into [unitLibraryUris] and [unitUnitUris] for the library
- /// specific unit where the element is declared.
- set elementUnits(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._elementUnits = value;
- }
-
- @override
- List<String> get strings => _strings ??= <String>[];
-
- /// List of unique element strings used in this [PackageIndex]. The list is
- /// sorted in ascending order, so that the client can quickly check the
- /// presence of a string in this [PackageIndex].
- set strings(List<String> value) {
- this._strings = value;
- }
-
- @override
- List<int> get unitLibraryUris => _unitLibraryUris ??= <int>[];
-
- /// Each item of this list corresponds to the library URI of a unique library
- /// specific unit referenced in the [PackageIndex]. It is an index into
- /// [strings] list.
- set unitLibraryUris(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._unitLibraryUris = value;
- }
-
- @override
- List<UnitIndexBuilder> get units => _units ??= <UnitIndexBuilder>[];
-
- /// List of indexes of each unit in this [PackageIndex].
- set units(List<UnitIndexBuilder> value) {
- this._units = value;
- }
-
- @override
- List<int> get unitUnitUris => _unitUnitUris ??= <int>[];
-
- /// Each item of this list corresponds to the unit URI of a unique library
- /// specific unit referenced in the [PackageIndex]. It is an index into
- /// [strings] list.
- set unitUnitUris(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._unitUnitUris = value;
- }
-
- PackageIndexBuilder(
- {List<idl.IndexSyntheticElementKind> elementKinds,
- List<int> elementNameClassMemberIds,
- List<int> elementNameParameterIds,
- List<int> elementNameUnitMemberIds,
- List<int> elementUnits,
- List<String> strings,
- List<int> unitLibraryUris,
- List<UnitIndexBuilder> units,
- List<int> unitUnitUris})
- : _elementKinds = elementKinds,
- _elementNameClassMemberIds = elementNameClassMemberIds,
- _elementNameParameterIds = elementNameParameterIds,
- _elementNameUnitMemberIds = elementNameUnitMemberIds,
- _elementUnits = elementUnits,
- _strings = strings,
- _unitLibraryUris = unitLibraryUris,
- _units = units,
- _unitUnitUris = unitUnitUris;
+ PackageDependencyInfoBuilder({int placeholder}) : _placeholder = placeholder;
/// Flush [informative] data recursively.
- void flushInformative() {
- _units?.forEach((b) => b.flushInformative());
- }
+ void flushInformative() {}
/// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
- if (this._elementUnits == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._elementUnits.length);
- for (var x in this._elementUnits) {
- signature.addInt(x);
- }
- }
- if (this._elementNameUnitMemberIds == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._elementNameUnitMemberIds.length);
- for (var x in this._elementNameUnitMemberIds) {
- signature.addInt(x);
- }
- }
- if (this._unitLibraryUris == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._unitLibraryUris.length);
- for (var x in this._unitLibraryUris) {
- signature.addInt(x);
- }
- }
- if (this._unitUnitUris == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._unitUnitUris.length);
- for (var x in this._unitUnitUris) {
- signature.addInt(x);
- }
- }
- if (this._units == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._units.length);
- for (var x in this._units) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._elementKinds == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._elementKinds.length);
- for (var x in this._elementKinds) {
- signature.addInt(x.index);
- }
- }
- if (this._strings == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._strings.length);
- for (var x in this._strings) {
- signature.addString(x);
- }
- }
- if (this._elementNameClassMemberIds == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._elementNameClassMemberIds.length);
- for (var x in this._elementNameClassMemberIds) {
- signature.addInt(x);
- }
- }
- if (this._elementNameParameterIds == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._elementNameParameterIds.length);
- for (var x in this._elementNameParameterIds) {
- signature.addInt(x);
- }
- }
- }
-
- List<int> toBuffer() {
- fb.Builder fbBuilder = new fb.Builder();
- return fbBuilder.finish(finish(fbBuilder), "Indx");
+ signature.addInt(this._placeholder ?? 0);
}
fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_elementKinds;
- fb.Offset offset_elementNameClassMemberIds;
- fb.Offset offset_elementNameParameterIds;
- fb.Offset offset_elementNameUnitMemberIds;
- fb.Offset offset_elementUnits;
- fb.Offset offset_strings;
- fb.Offset offset_unitLibraryUris;
- fb.Offset offset_units;
- fb.Offset offset_unitUnitUris;
- if (!(_elementKinds == null || _elementKinds.isEmpty)) {
- offset_elementKinds =
- fbBuilder.writeListUint8(_elementKinds.map((b) => b.index).toList());
- }
- if (!(_elementNameClassMemberIds == null ||
- _elementNameClassMemberIds.isEmpty)) {
- offset_elementNameClassMemberIds =
- fbBuilder.writeListUint32(_elementNameClassMemberIds);
- }
- if (!(_elementNameParameterIds == null ||
- _elementNameParameterIds.isEmpty)) {
- offset_elementNameParameterIds =
- fbBuilder.writeListUint32(_elementNameParameterIds);
- }
- if (!(_elementNameUnitMemberIds == null ||
- _elementNameUnitMemberIds.isEmpty)) {
- offset_elementNameUnitMemberIds =
- fbBuilder.writeListUint32(_elementNameUnitMemberIds);
- }
- if (!(_elementUnits == null || _elementUnits.isEmpty)) {
- offset_elementUnits = fbBuilder.writeListUint32(_elementUnits);
- }
- if (!(_strings == null || _strings.isEmpty)) {
- offset_strings = fbBuilder
- .writeList(_strings.map((b) => fbBuilder.writeString(b)).toList());
- }
- if (!(_unitLibraryUris == null || _unitLibraryUris.isEmpty)) {
- offset_unitLibraryUris = fbBuilder.writeListUint32(_unitLibraryUris);
- }
- if (!(_units == null || _units.isEmpty)) {
- offset_units =
- fbBuilder.writeList(_units.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_unitUnitUris == null || _unitUnitUris.isEmpty)) {
- offset_unitUnitUris = fbBuilder.writeListUint32(_unitUnitUris);
- }
fbBuilder.startTable();
- if (offset_elementKinds != null) {
- fbBuilder.addOffset(5, offset_elementKinds);
- }
- if (offset_elementNameClassMemberIds != null) {
- fbBuilder.addOffset(7, offset_elementNameClassMemberIds);
- }
- if (offset_elementNameParameterIds != null) {
- fbBuilder.addOffset(8, offset_elementNameParameterIds);
- }
- if (offset_elementNameUnitMemberIds != null) {
- fbBuilder.addOffset(1, offset_elementNameUnitMemberIds);
- }
- if (offset_elementUnits != null) {
- fbBuilder.addOffset(0, offset_elementUnits);
- }
- if (offset_strings != null) {
- fbBuilder.addOffset(6, offset_strings);
- }
- if (offset_unitLibraryUris != null) {
- fbBuilder.addOffset(2, offset_unitLibraryUris);
- }
- if (offset_units != null) {
- fbBuilder.addOffset(4, offset_units);
- }
- if (offset_unitUnitUris != null) {
- fbBuilder.addOffset(3, offset_unitUnitUris);
+ if (_placeholder != null && _placeholder != 0) {
+ fbBuilder.addUint32(0, _placeholder);
}
return fbBuilder.endTable();
}
}
-idl.PackageIndex readPackageIndex(List<int> buffer) {
- fb.BufferContext rootRef = new fb.BufferContext.fromBytes(buffer);
- return const _PackageIndexReader().read(rootRef, 0);
-}
-
-class _PackageIndexReader extends fb.TableReader<_PackageIndexImpl> {
- const _PackageIndexReader();
+class _PackageDependencyInfoReader
+ extends fb.TableReader<_PackageDependencyInfoImpl> {
+ const _PackageDependencyInfoReader();
@override
- _PackageIndexImpl createObject(fb.BufferContext bc, int offset) =>
- new _PackageIndexImpl(bc, offset);
+ _PackageDependencyInfoImpl createObject(fb.BufferContext bc, int offset) =>
+ new _PackageDependencyInfoImpl(bc, offset);
}
-class _PackageIndexImpl extends Object
- with _PackageIndexMixin
- implements idl.PackageIndex {
+class _PackageDependencyInfoImpl extends Object
+ with _PackageDependencyInfoMixin
+ implements idl.PackageDependencyInfo {
final fb.BufferContext _bc;
final int _bcOffset;
- _PackageIndexImpl(this._bc, this._bcOffset);
+ _PackageDependencyInfoImpl(this._bc, this._bcOffset);
- List<idl.IndexSyntheticElementKind> _elementKinds;
- List<int> _elementNameClassMemberIds;
- List<int> _elementNameParameterIds;
- List<int> _elementNameUnitMemberIds;
- List<int> _elementUnits;
- List<String> _strings;
- List<int> _unitLibraryUris;
- List<idl.UnitIndex> _units;
- List<int> _unitUnitUris;
+ int _placeholder;
@override
- List<idl.IndexSyntheticElementKind> get elementKinds {
- _elementKinds ??= const fb.ListReader<idl.IndexSyntheticElementKind>(
- const _IndexSyntheticElementKindReader())
- .vTableGet(_bc, _bcOffset, 5, const <idl.IndexSyntheticElementKind>[]);
- return _elementKinds;
- }
-
- @override
- List<int> get elementNameClassMemberIds {
- _elementNameClassMemberIds ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 7, const <int>[]);
- return _elementNameClassMemberIds;
- }
-
- @override
- List<int> get elementNameParameterIds {
- _elementNameParameterIds ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 8, const <int>[]);
- return _elementNameParameterIds;
- }
-
- @override
- List<int> get elementNameUnitMemberIds {
- _elementNameUnitMemberIds ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 1, const <int>[]);
- return _elementNameUnitMemberIds;
- }
-
- @override
- List<int> get elementUnits {
- _elementUnits ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 0, const <int>[]);
- return _elementUnits;
- }
-
- @override
- List<String> get strings {
- _strings ??= const fb.ListReader<String>(const fb.StringReader())
- .vTableGet(_bc, _bcOffset, 6, const <String>[]);
- return _strings;
- }
-
- @override
- List<int> get unitLibraryUris {
- _unitLibraryUris ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 2, const <int>[]);
- return _unitLibraryUris;
- }
-
- @override
- List<idl.UnitIndex> get units {
- _units ??= const fb.ListReader<idl.UnitIndex>(const _UnitIndexReader())
- .vTableGet(_bc, _bcOffset, 4, const <idl.UnitIndex>[]);
- return _units;
- }
-
- @override
- List<int> get unitUnitUris {
- _unitUnitUris ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 3, const <int>[]);
- return _unitUnitUris;
+ int get placeholder {
+ _placeholder ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
+ return _placeholder;
}
}
-abstract class _PackageIndexMixin implements idl.PackageIndex {
+abstract class _PackageDependencyInfoMixin
+ implements idl.PackageDependencyInfo {
@override
Map<String, Object> toJson() {
Map<String, Object> _result = <String, Object>{};
- if (elementKinds.isNotEmpty)
- _result["elementKinds"] = elementKinds
- .map((_value) => _value.toString().split('.')[1])
- .toList();
- if (elementNameClassMemberIds.isNotEmpty)
- _result["elementNameClassMemberIds"] = elementNameClassMemberIds;
- if (elementNameParameterIds.isNotEmpty)
- _result["elementNameParameterIds"] = elementNameParameterIds;
- if (elementNameUnitMemberIds.isNotEmpty)
- _result["elementNameUnitMemberIds"] = elementNameUnitMemberIds;
- if (elementUnits.isNotEmpty) _result["elementUnits"] = elementUnits;
- if (strings.isNotEmpty) _result["strings"] = strings;
- if (unitLibraryUris.isNotEmpty)
- _result["unitLibraryUris"] = unitLibraryUris;
- if (units.isNotEmpty)
- _result["units"] = units.map((_value) => _value.toJson()).toList();
- if (unitUnitUris.isNotEmpty) _result["unitUnitUris"] = unitUnitUris;
+ if (placeholder != 0) _result["placeholder"] = placeholder;
return _result;
}
@override
Map<String, Object> toMap() => {
- "elementKinds": elementKinds,
- "elementNameClassMemberIds": elementNameClassMemberIds,
- "elementNameParameterIds": elementNameParameterIds,
- "elementNameUnitMemberIds": elementNameUnitMemberIds,
- "elementUnits": elementUnits,
- "strings": strings,
- "unitLibraryUris": unitLibraryUris,
- "units": units,
- "unitUnitUris": unitUnitUris,
+ "placeholder": placeholder,
};
@override
@@ -19123,4656 +16851,6 @@
String toString() => convert.json.encode(toJson());
}
-class UnitIndexBuilder extends Object
- with _UnitIndexMixin
- implements idl.UnitIndex {
- List<idl.IndexNameKind> _definedNameKinds;
- List<int> _definedNameOffsets;
- List<int> _definedNames;
- int _unit;
- List<bool> _usedElementIsQualifiedFlags;
- List<idl.IndexRelationKind> _usedElementKinds;
- List<int> _usedElementLengths;
- List<int> _usedElementOffsets;
- List<int> _usedElements;
- List<bool> _usedNameIsQualifiedFlags;
- List<idl.IndexRelationKind> _usedNameKinds;
- List<int> _usedNameOffsets;
- List<int> _usedNames;
-
- @override
- List<idl.IndexNameKind> get definedNameKinds =>
- _definedNameKinds ??= <idl.IndexNameKind>[];
-
- /// Each item of this list is the kind of an element defined in this unit.
- set definedNameKinds(List<idl.IndexNameKind> value) {
- this._definedNameKinds = value;
- }
-
- @override
- List<int> get definedNameOffsets => _definedNameOffsets ??= <int>[];
-
- /// Each item of this list is the name offset of an element defined in this
- /// unit relative to the beginning of the file.
- set definedNameOffsets(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._definedNameOffsets = value;
- }
-
- @override
- List<int> get definedNames => _definedNames ??= <int>[];
-
- /// Each item of this list corresponds to an element defined in this unit. It
- /// is an index into [PackageIndex.strings] list. The list is sorted in
- /// ascending order, so that the client can quickly find name definitions in
- /// this [UnitIndex].
- set definedNames(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._definedNames = value;
- }
-
- @override
- int get unit => _unit ??= 0;
-
- /// Index into [PackageIndex.unitLibraryUris] and [PackageIndex.unitUnitUris]
- /// for the library specific unit that corresponds to this [UnitIndex].
- set unit(int value) {
- assert(value == null || value >= 0);
- this._unit = value;
- }
-
- @override
- List<bool> get usedElementIsQualifiedFlags =>
- _usedElementIsQualifiedFlags ??= <bool>[];
-
- /// Each item of this list is the `true` if the corresponding element usage
- /// is qualified with some prefix.
- set usedElementIsQualifiedFlags(List<bool> value) {
- this._usedElementIsQualifiedFlags = value;
- }
-
- @override
- List<idl.IndexRelationKind> get usedElementKinds =>
- _usedElementKinds ??= <idl.IndexRelationKind>[];
-
- /// Each item of this list is the kind of the element usage.
- set usedElementKinds(List<idl.IndexRelationKind> value) {
- this._usedElementKinds = value;
- }
-
- @override
- List<int> get usedElementLengths => _usedElementLengths ??= <int>[];
-
- /// Each item of this list is the length of the element usage.
- set usedElementLengths(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._usedElementLengths = value;
- }
-
- @override
- List<int> get usedElementOffsets => _usedElementOffsets ??= <int>[];
-
- /// Each item of this list is the offset of the element usage relative to the
- /// beginning of the file.
- set usedElementOffsets(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._usedElementOffsets = value;
- }
-
- @override
- List<int> get usedElements => _usedElements ??= <int>[];
-
- /// Each item of this list is the index into [PackageIndex.elementUnits] and
- /// [PackageIndex.elementOffsets]. The list is sorted in ascending order, so
- /// that the client can quickly find element references in this [UnitIndex].
- set usedElements(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._usedElements = value;
- }
-
- @override
- List<bool> get usedNameIsQualifiedFlags =>
- _usedNameIsQualifiedFlags ??= <bool>[];
-
- /// Each item of this list is the `true` if the corresponding name usage
- /// is qualified with some prefix.
- set usedNameIsQualifiedFlags(List<bool> value) {
- this._usedNameIsQualifiedFlags = value;
- }
-
- @override
- List<idl.IndexRelationKind> get usedNameKinds =>
- _usedNameKinds ??= <idl.IndexRelationKind>[];
-
- /// Each item of this list is the kind of the name usage.
- set usedNameKinds(List<idl.IndexRelationKind> value) {
- this._usedNameKinds = value;
- }
-
- @override
- List<int> get usedNameOffsets => _usedNameOffsets ??= <int>[];
-
- /// Each item of this list is the offset of the name usage relative to the
- /// beginning of the file.
- set usedNameOffsets(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._usedNameOffsets = value;
- }
-
- @override
- List<int> get usedNames => _usedNames ??= <int>[];
-
- /// Each item of this list is the index into [PackageIndex.strings] for a
- /// used name. The list is sorted in ascending order, so that the client can
- /// quickly find name uses in this [UnitIndex].
- set usedNames(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._usedNames = value;
- }
-
- UnitIndexBuilder(
- {List<idl.IndexNameKind> definedNameKinds,
- List<int> definedNameOffsets,
- List<int> definedNames,
- int unit,
- List<bool> usedElementIsQualifiedFlags,
- List<idl.IndexRelationKind> usedElementKinds,
- List<int> usedElementLengths,
- List<int> usedElementOffsets,
- List<int> usedElements,
- List<bool> usedNameIsQualifiedFlags,
- List<idl.IndexRelationKind> usedNameKinds,
- List<int> usedNameOffsets,
- List<int> usedNames})
- : _definedNameKinds = definedNameKinds,
- _definedNameOffsets = definedNameOffsets,
- _definedNames = definedNames,
- _unit = unit,
- _usedElementIsQualifiedFlags = usedElementIsQualifiedFlags,
- _usedElementKinds = usedElementKinds,
- _usedElementLengths = usedElementLengths,
- _usedElementOffsets = usedElementOffsets,
- _usedElements = usedElements,
- _usedNameIsQualifiedFlags = usedNameIsQualifiedFlags,
- _usedNameKinds = usedNameKinds,
- _usedNameOffsets = usedNameOffsets,
- _usedNames = usedNames;
-
- /// Flush [informative] data recursively.
- void flushInformative() {}
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addInt(this._unit ?? 0);
- if (this._usedElementLengths == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._usedElementLengths.length);
- for (var x in this._usedElementLengths) {
- signature.addInt(x);
- }
- }
- if (this._usedElementOffsets == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._usedElementOffsets.length);
- for (var x in this._usedElementOffsets) {
- signature.addInt(x);
- }
- }
- if (this._usedElements == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._usedElements.length);
- for (var x in this._usedElements) {
- signature.addInt(x);
- }
- }
- if (this._usedElementKinds == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._usedElementKinds.length);
- for (var x in this._usedElementKinds) {
- signature.addInt(x.index);
- }
- }
- if (this._definedNames == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._definedNames.length);
- for (var x in this._definedNames) {
- signature.addInt(x);
- }
- }
- if (this._definedNameKinds == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._definedNameKinds.length);
- for (var x in this._definedNameKinds) {
- signature.addInt(x.index);
- }
- }
- if (this._definedNameOffsets == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._definedNameOffsets.length);
- for (var x in this._definedNameOffsets) {
- signature.addInt(x);
- }
- }
- if (this._usedNames == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._usedNames.length);
- for (var x in this._usedNames) {
- signature.addInt(x);
- }
- }
- if (this._usedNameOffsets == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._usedNameOffsets.length);
- for (var x in this._usedNameOffsets) {
- signature.addInt(x);
- }
- }
- if (this._usedNameKinds == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._usedNameKinds.length);
- for (var x in this._usedNameKinds) {
- signature.addInt(x.index);
- }
- }
- if (this._usedElementIsQualifiedFlags == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._usedElementIsQualifiedFlags.length);
- for (var x in this._usedElementIsQualifiedFlags) {
- signature.addBool(x);
- }
- }
- if (this._usedNameIsQualifiedFlags == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._usedNameIsQualifiedFlags.length);
- for (var x in this._usedNameIsQualifiedFlags) {
- signature.addBool(x);
- }
- }
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_definedNameKinds;
- fb.Offset offset_definedNameOffsets;
- fb.Offset offset_definedNames;
- fb.Offset offset_usedElementIsQualifiedFlags;
- fb.Offset offset_usedElementKinds;
- fb.Offset offset_usedElementLengths;
- fb.Offset offset_usedElementOffsets;
- fb.Offset offset_usedElements;
- fb.Offset offset_usedNameIsQualifiedFlags;
- fb.Offset offset_usedNameKinds;
- fb.Offset offset_usedNameOffsets;
- fb.Offset offset_usedNames;
- if (!(_definedNameKinds == null || _definedNameKinds.isEmpty)) {
- offset_definedNameKinds = fbBuilder
- .writeListUint8(_definedNameKinds.map((b) => b.index).toList());
- }
- if (!(_definedNameOffsets == null || _definedNameOffsets.isEmpty)) {
- offset_definedNameOffsets =
- fbBuilder.writeListUint32(_definedNameOffsets);
- }
- if (!(_definedNames == null || _definedNames.isEmpty)) {
- offset_definedNames = fbBuilder.writeListUint32(_definedNames);
- }
- if (!(_usedElementIsQualifiedFlags == null ||
- _usedElementIsQualifiedFlags.isEmpty)) {
- offset_usedElementIsQualifiedFlags =
- fbBuilder.writeListBool(_usedElementIsQualifiedFlags);
- }
- if (!(_usedElementKinds == null || _usedElementKinds.isEmpty)) {
- offset_usedElementKinds = fbBuilder
- .writeListUint8(_usedElementKinds.map((b) => b.index).toList());
- }
- if (!(_usedElementLengths == null || _usedElementLengths.isEmpty)) {
- offset_usedElementLengths =
- fbBuilder.writeListUint32(_usedElementLengths);
- }
- if (!(_usedElementOffsets == null || _usedElementOffsets.isEmpty)) {
- offset_usedElementOffsets =
- fbBuilder.writeListUint32(_usedElementOffsets);
- }
- if (!(_usedElements == null || _usedElements.isEmpty)) {
- offset_usedElements = fbBuilder.writeListUint32(_usedElements);
- }
- if (!(_usedNameIsQualifiedFlags == null ||
- _usedNameIsQualifiedFlags.isEmpty)) {
- offset_usedNameIsQualifiedFlags =
- fbBuilder.writeListBool(_usedNameIsQualifiedFlags);
- }
- if (!(_usedNameKinds == null || _usedNameKinds.isEmpty)) {
- offset_usedNameKinds =
- fbBuilder.writeListUint8(_usedNameKinds.map((b) => b.index).toList());
- }
- if (!(_usedNameOffsets == null || _usedNameOffsets.isEmpty)) {
- offset_usedNameOffsets = fbBuilder.writeListUint32(_usedNameOffsets);
- }
- if (!(_usedNames == null || _usedNames.isEmpty)) {
- offset_usedNames = fbBuilder.writeListUint32(_usedNames);
- }
- fbBuilder.startTable();
- if (offset_definedNameKinds != null) {
- fbBuilder.addOffset(6, offset_definedNameKinds);
- }
- if (offset_definedNameOffsets != null) {
- fbBuilder.addOffset(7, offset_definedNameOffsets);
- }
- if (offset_definedNames != null) {
- fbBuilder.addOffset(5, offset_definedNames);
- }
- if (_unit != null && _unit != 0) {
- fbBuilder.addUint32(0, _unit);
- }
- if (offset_usedElementIsQualifiedFlags != null) {
- fbBuilder.addOffset(11, offset_usedElementIsQualifiedFlags);
- }
- if (offset_usedElementKinds != null) {
- fbBuilder.addOffset(4, offset_usedElementKinds);
- }
- if (offset_usedElementLengths != null) {
- fbBuilder.addOffset(1, offset_usedElementLengths);
- }
- if (offset_usedElementOffsets != null) {
- fbBuilder.addOffset(2, offset_usedElementOffsets);
- }
- if (offset_usedElements != null) {
- fbBuilder.addOffset(3, offset_usedElements);
- }
- if (offset_usedNameIsQualifiedFlags != null) {
- fbBuilder.addOffset(12, offset_usedNameIsQualifiedFlags);
- }
- if (offset_usedNameKinds != null) {
- fbBuilder.addOffset(10, offset_usedNameKinds);
- }
- if (offset_usedNameOffsets != null) {
- fbBuilder.addOffset(9, offset_usedNameOffsets);
- }
- if (offset_usedNames != null) {
- fbBuilder.addOffset(8, offset_usedNames);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnitIndexReader extends fb.TableReader<_UnitIndexImpl> {
- const _UnitIndexReader();
-
- @override
- _UnitIndexImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnitIndexImpl(bc, offset);
-}
-
-class _UnitIndexImpl extends Object
- with _UnitIndexMixin
- implements idl.UnitIndex {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnitIndexImpl(this._bc, this._bcOffset);
-
- List<idl.IndexNameKind> _definedNameKinds;
- List<int> _definedNameOffsets;
- List<int> _definedNames;
- int _unit;
- List<bool> _usedElementIsQualifiedFlags;
- List<idl.IndexRelationKind> _usedElementKinds;
- List<int> _usedElementLengths;
- List<int> _usedElementOffsets;
- List<int> _usedElements;
- List<bool> _usedNameIsQualifiedFlags;
- List<idl.IndexRelationKind> _usedNameKinds;
- List<int> _usedNameOffsets;
- List<int> _usedNames;
-
- @override
- List<idl.IndexNameKind> get definedNameKinds {
- _definedNameKinds ??=
- const fb.ListReader<idl.IndexNameKind>(const _IndexNameKindReader())
- .vTableGet(_bc, _bcOffset, 6, const <idl.IndexNameKind>[]);
- return _definedNameKinds;
- }
-
- @override
- List<int> get definedNameOffsets {
- _definedNameOffsets ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 7, const <int>[]);
- return _definedNameOffsets;
- }
-
- @override
- List<int> get definedNames {
- _definedNames ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 5, const <int>[]);
- return _definedNames;
- }
-
- @override
- int get unit {
- _unit ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
- return _unit;
- }
-
- @override
- List<bool> get usedElementIsQualifiedFlags {
- _usedElementIsQualifiedFlags ??=
- const fb.BoolListReader().vTableGet(_bc, _bcOffset, 11, const <bool>[]);
- return _usedElementIsQualifiedFlags;
- }
-
- @override
- List<idl.IndexRelationKind> get usedElementKinds {
- _usedElementKinds ??= const fb.ListReader<idl.IndexRelationKind>(
- const _IndexRelationKindReader())
- .vTableGet(_bc, _bcOffset, 4, const <idl.IndexRelationKind>[]);
- return _usedElementKinds;
- }
-
- @override
- List<int> get usedElementLengths {
- _usedElementLengths ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 1, const <int>[]);
- return _usedElementLengths;
- }
-
- @override
- List<int> get usedElementOffsets {
- _usedElementOffsets ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 2, const <int>[]);
- return _usedElementOffsets;
- }
-
- @override
- List<int> get usedElements {
- _usedElements ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 3, const <int>[]);
- return _usedElements;
- }
-
- @override
- List<bool> get usedNameIsQualifiedFlags {
- _usedNameIsQualifiedFlags ??=
- const fb.BoolListReader().vTableGet(_bc, _bcOffset, 12, const <bool>[]);
- return _usedNameIsQualifiedFlags;
- }
-
- @override
- List<idl.IndexRelationKind> get usedNameKinds {
- _usedNameKinds ??= const fb.ListReader<idl.IndexRelationKind>(
- const _IndexRelationKindReader())
- .vTableGet(_bc, _bcOffset, 10, const <idl.IndexRelationKind>[]);
- return _usedNameKinds;
- }
-
- @override
- List<int> get usedNameOffsets {
- _usedNameOffsets ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 9, const <int>[]);
- return _usedNameOffsets;
- }
-
- @override
- List<int> get usedNames {
- _usedNames ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 8, const <int>[]);
- return _usedNames;
- }
-}
-
-abstract class _UnitIndexMixin implements idl.UnitIndex {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (definedNameKinds.isNotEmpty)
- _result["definedNameKinds"] = definedNameKinds
- .map((_value) => _value.toString().split('.')[1])
- .toList();
- if (definedNameOffsets.isNotEmpty)
- _result["definedNameOffsets"] = definedNameOffsets;
- if (definedNames.isNotEmpty) _result["definedNames"] = definedNames;
- if (unit != 0) _result["unit"] = unit;
- if (usedElementIsQualifiedFlags.isNotEmpty)
- _result["usedElementIsQualifiedFlags"] = usedElementIsQualifiedFlags;
- if (usedElementKinds.isNotEmpty)
- _result["usedElementKinds"] = usedElementKinds
- .map((_value) => _value.toString().split('.')[1])
- .toList();
- if (usedElementLengths.isNotEmpty)
- _result["usedElementLengths"] = usedElementLengths;
- if (usedElementOffsets.isNotEmpty)
- _result["usedElementOffsets"] = usedElementOffsets;
- if (usedElements.isNotEmpty) _result["usedElements"] = usedElements;
- if (usedNameIsQualifiedFlags.isNotEmpty)
- _result["usedNameIsQualifiedFlags"] = usedNameIsQualifiedFlags;
- if (usedNameKinds.isNotEmpty)
- _result["usedNameKinds"] = usedNameKinds
- .map((_value) => _value.toString().split('.')[1])
- .toList();
- if (usedNameOffsets.isNotEmpty)
- _result["usedNameOffsets"] = usedNameOffsets;
- if (usedNames.isNotEmpty) _result["usedNames"] = usedNames;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "definedNameKinds": definedNameKinds,
- "definedNameOffsets": definedNameOffsets,
- "definedNames": definedNames,
- "unit": unit,
- "usedElementIsQualifiedFlags": usedElementIsQualifiedFlags,
- "usedElementKinds": usedElementKinds,
- "usedElementLengths": usedElementLengths,
- "usedElementOffsets": usedElementOffsets,
- "usedElements": usedElements,
- "usedNameIsQualifiedFlags": usedNameIsQualifiedFlags,
- "usedNameKinds": usedNameKinds,
- "usedNameOffsets": usedNameOffsets,
- "usedNames": usedNames,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedClassBuilder extends Object
- with _UnlinkedClassMixin
- implements idl.UnlinkedClass {
- List<UnlinkedExprBuilder> _annotations;
- CodeRangeBuilder _codeRange;
- UnlinkedDocumentationCommentBuilder _documentationComment;
- List<UnlinkedExecutableBuilder> _executables;
- List<UnlinkedVariableBuilder> _fields;
- bool _hasNoSupertype;
- List<EntityRefBuilder> _interfaces;
- bool _isAbstract;
- bool _isMixinApplication;
- List<EntityRefBuilder> _mixins;
- String _name;
- int _nameOffset;
- int _notSimplyBoundedSlot;
- List<EntityRefBuilder> _superclassConstraints;
- List<String> _superInvokedNames;
- EntityRefBuilder _supertype;
- List<UnlinkedTypeParamBuilder> _typeParameters;
-
- @override
- List<UnlinkedExprBuilder> get annotations =>
- _annotations ??= <UnlinkedExprBuilder>[];
-
- /// Annotations for this class.
- set annotations(List<UnlinkedExprBuilder> value) {
- this._annotations = value;
- }
-
- @override
- CodeRangeBuilder get codeRange => _codeRange;
-
- /// Code range of the class.
- set codeRange(CodeRangeBuilder value) {
- this._codeRange = value;
- }
-
- @override
- UnlinkedDocumentationCommentBuilder get documentationComment =>
- _documentationComment;
-
- /// Documentation comment for the class, or `null` if there is no
- /// documentation comment.
- set documentationComment(UnlinkedDocumentationCommentBuilder value) {
- this._documentationComment = value;
- }
-
- @override
- List<UnlinkedExecutableBuilder> get executables =>
- _executables ??= <UnlinkedExecutableBuilder>[];
-
- /// Executable objects (methods, getters, and setters) contained in the class.
- set executables(List<UnlinkedExecutableBuilder> value) {
- this._executables = value;
- }
-
- @override
- List<UnlinkedVariableBuilder> get fields =>
- _fields ??= <UnlinkedVariableBuilder>[];
-
- /// Field declarations contained in the class.
- set fields(List<UnlinkedVariableBuilder> value) {
- this._fields = value;
- }
-
- @override
- bool get hasNoSupertype => _hasNoSupertype ??= false;
-
- /// Indicates whether this class is the core "Object" class (and hence has no
- /// supertype)
- set hasNoSupertype(bool value) {
- this._hasNoSupertype = value;
- }
-
- @override
- List<EntityRefBuilder> get interfaces => _interfaces ??= <EntityRefBuilder>[];
-
- /// Interfaces appearing in an `implements` clause, if any.
- set interfaces(List<EntityRefBuilder> value) {
- this._interfaces = value;
- }
-
- @override
- bool get isAbstract => _isAbstract ??= false;
-
- /// Indicates whether the class is declared with the `abstract` keyword.
- set isAbstract(bool value) {
- this._isAbstract = value;
- }
-
- @override
- bool get isMixinApplication => _isMixinApplication ??= false;
-
- /// Indicates whether the class is declared using mixin application syntax.
- set isMixinApplication(bool value) {
- this._isMixinApplication = value;
- }
-
- @override
- List<EntityRefBuilder> get mixins => _mixins ??= <EntityRefBuilder>[];
-
- /// Mixins appearing in a `with` clause, if any.
- set mixins(List<EntityRefBuilder> value) {
- this._mixins = value;
- }
-
- @override
- String get name => _name ??= '';
-
- /// Name of the class.
- set name(String value) {
- this._name = value;
- }
-
- @override
- int get nameOffset => _nameOffset ??= 0;
-
- /// Offset of the class name relative to the beginning of the file.
- set nameOffset(int value) {
- assert(value == null || value >= 0);
- this._nameOffset = value;
- }
-
- @override
- int get notSimplyBoundedSlot => _notSimplyBoundedSlot ??= 0;
-
- /// If the class might not be simply bounded, a nonzero slot id which is unique
- /// within this compilation unit. If this id is found in
- /// [LinkedUnit.notSimplyBounded], then at least one of this class's type
- /// parameters is not simply bounded, hence this class can't be used as a raw
- /// type when specifying the bound of a type parameter.
- ///
- /// Otherwise, zero.
- set notSimplyBoundedSlot(int value) {
- assert(value == null || value >= 0);
- this._notSimplyBoundedSlot = value;
- }
-
- @override
- List<EntityRefBuilder> get superclassConstraints =>
- _superclassConstraints ??= <EntityRefBuilder>[];
-
- /// Superclass constraints for this mixin declaration. The list will be empty
- /// if this class is not a mixin declaration, or if the declaration does not
- /// have an `on` clause (in which case the type `Object` is implied).
- set superclassConstraints(List<EntityRefBuilder> value) {
- this._superclassConstraints = value;
- }
-
- @override
- List<String> get superInvokedNames => _superInvokedNames ??= <String>[];
-
- /// Names of methods, getters, setters, and operators that this mixin
- /// declaration super-invokes. For setters this includes the trailing "=".
- /// The list will be empty if this class is not a mixin declaration.
- set superInvokedNames(List<String> value) {
- this._superInvokedNames = value;
- }
-
- @override
- EntityRefBuilder get supertype => _supertype;
-
- /// Supertype of the class, or `null` if either (a) the class doesn't
- /// explicitly declare a supertype (and hence has supertype `Object`), or (b)
- /// the class *is* `Object` (and hence has no supertype).
- set supertype(EntityRefBuilder value) {
- this._supertype = value;
- }
-
- @override
- List<UnlinkedTypeParamBuilder> get typeParameters =>
- _typeParameters ??= <UnlinkedTypeParamBuilder>[];
-
- /// Type parameters of the class, if any.
- set typeParameters(List<UnlinkedTypeParamBuilder> value) {
- this._typeParameters = value;
- }
-
- UnlinkedClassBuilder(
- {List<UnlinkedExprBuilder> annotations,
- CodeRangeBuilder codeRange,
- UnlinkedDocumentationCommentBuilder documentationComment,
- List<UnlinkedExecutableBuilder> executables,
- List<UnlinkedVariableBuilder> fields,
- bool hasNoSupertype,
- List<EntityRefBuilder> interfaces,
- bool isAbstract,
- bool isMixinApplication,
- List<EntityRefBuilder> mixins,
- String name,
- int nameOffset,
- int notSimplyBoundedSlot,
- List<EntityRefBuilder> superclassConstraints,
- List<String> superInvokedNames,
- EntityRefBuilder supertype,
- List<UnlinkedTypeParamBuilder> typeParameters})
- : _annotations = annotations,
- _codeRange = codeRange,
- _documentationComment = documentationComment,
- _executables = executables,
- _fields = fields,
- _hasNoSupertype = hasNoSupertype,
- _interfaces = interfaces,
- _isAbstract = isAbstract,
- _isMixinApplication = isMixinApplication,
- _mixins = mixins,
- _name = name,
- _nameOffset = nameOffset,
- _notSimplyBoundedSlot = notSimplyBoundedSlot,
- _superclassConstraints = superclassConstraints,
- _superInvokedNames = superInvokedNames,
- _supertype = supertype,
- _typeParameters = typeParameters;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _annotations?.forEach((b) => b.flushInformative());
- _codeRange = null;
- _documentationComment = null;
- _executables?.forEach((b) => b.flushInformative());
- _fields?.forEach((b) => b.flushInformative());
- _interfaces?.forEach((b) => b.flushInformative());
- _mixins?.forEach((b) => b.flushInformative());
- _nameOffset = null;
- _superclassConstraints?.forEach((b) => b.flushInformative());
- _supertype?.flushInformative();
- _typeParameters?.forEach((b) => b.flushInformative());
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._name ?? '');
- if (this._executables == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._executables.length);
- for (var x in this._executables) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addBool(this._supertype != null);
- this._supertype?.collectApiSignature(signature);
- if (this._fields == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._fields.length);
- for (var x in this._fields) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._annotations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._annotations.length);
- for (var x in this._annotations) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._interfaces == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._interfaces.length);
- for (var x in this._interfaces) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addBool(this._isAbstract == true);
- if (this._typeParameters == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._typeParameters.length);
- for (var x in this._typeParameters) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._mixins == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._mixins.length);
- for (var x in this._mixins) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addBool(this._isMixinApplication == true);
- signature.addBool(this._hasNoSupertype == true);
- if (this._superclassConstraints == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._superclassConstraints.length);
- for (var x in this._superclassConstraints) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._superInvokedNames == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._superInvokedNames.length);
- for (var x in this._superInvokedNames) {
- signature.addString(x);
- }
- }
- signature.addInt(this._notSimplyBoundedSlot ?? 0);
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_annotations;
- fb.Offset offset_codeRange;
- fb.Offset offset_documentationComment;
- fb.Offset offset_executables;
- fb.Offset offset_fields;
- fb.Offset offset_interfaces;
- fb.Offset offset_mixins;
- fb.Offset offset_name;
- fb.Offset offset_superclassConstraints;
- fb.Offset offset_superInvokedNames;
- fb.Offset offset_supertype;
- fb.Offset offset_typeParameters;
- if (!(_annotations == null || _annotations.isEmpty)) {
- offset_annotations = fbBuilder
- .writeList(_annotations.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_codeRange != null) {
- offset_codeRange = _codeRange.finish(fbBuilder);
- }
- if (_documentationComment != null) {
- offset_documentationComment = _documentationComment.finish(fbBuilder);
- }
- if (!(_executables == null || _executables.isEmpty)) {
- offset_executables = fbBuilder
- .writeList(_executables.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_fields == null || _fields.isEmpty)) {
- offset_fields =
- fbBuilder.writeList(_fields.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_interfaces == null || _interfaces.isEmpty)) {
- offset_interfaces = fbBuilder
- .writeList(_interfaces.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_mixins == null || _mixins.isEmpty)) {
- offset_mixins =
- fbBuilder.writeList(_mixins.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- if (!(_superclassConstraints == null || _superclassConstraints.isEmpty)) {
- offset_superclassConstraints = fbBuilder.writeList(
- _superclassConstraints.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_superInvokedNames == null || _superInvokedNames.isEmpty)) {
- offset_superInvokedNames = fbBuilder.writeList(
- _superInvokedNames.map((b) => fbBuilder.writeString(b)).toList());
- }
- if (_supertype != null) {
- offset_supertype = _supertype.finish(fbBuilder);
- }
- if (!(_typeParameters == null || _typeParameters.isEmpty)) {
- offset_typeParameters = fbBuilder
- .writeList(_typeParameters.map((b) => b.finish(fbBuilder)).toList());
- }
- fbBuilder.startTable();
- if (offset_annotations != null) {
- fbBuilder.addOffset(5, offset_annotations);
- }
- if (offset_codeRange != null) {
- fbBuilder.addOffset(13, offset_codeRange);
- }
- if (offset_documentationComment != null) {
- fbBuilder.addOffset(6, offset_documentationComment);
- }
- if (offset_executables != null) {
- fbBuilder.addOffset(2, offset_executables);
- }
- if (offset_fields != null) {
- fbBuilder.addOffset(4, offset_fields);
- }
- if (_hasNoSupertype == true) {
- fbBuilder.addBool(12, true);
- }
- if (offset_interfaces != null) {
- fbBuilder.addOffset(7, offset_interfaces);
- }
- if (_isAbstract == true) {
- fbBuilder.addBool(8, true);
- }
- if (_isMixinApplication == true) {
- fbBuilder.addBool(11, true);
- }
- if (offset_mixins != null) {
- fbBuilder.addOffset(10, offset_mixins);
- }
- if (offset_name != null) {
- fbBuilder.addOffset(0, offset_name);
- }
- if (_nameOffset != null && _nameOffset != 0) {
- fbBuilder.addUint32(1, _nameOffset);
- }
- if (_notSimplyBoundedSlot != null && _notSimplyBoundedSlot != 0) {
- fbBuilder.addUint32(16, _notSimplyBoundedSlot);
- }
- if (offset_superclassConstraints != null) {
- fbBuilder.addOffset(14, offset_superclassConstraints);
- }
- if (offset_superInvokedNames != null) {
- fbBuilder.addOffset(15, offset_superInvokedNames);
- }
- if (offset_supertype != null) {
- fbBuilder.addOffset(3, offset_supertype);
- }
- if (offset_typeParameters != null) {
- fbBuilder.addOffset(9, offset_typeParameters);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedClassReader extends fb.TableReader<_UnlinkedClassImpl> {
- const _UnlinkedClassReader();
-
- @override
- _UnlinkedClassImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedClassImpl(bc, offset);
-}
-
-class _UnlinkedClassImpl extends Object
- with _UnlinkedClassMixin
- implements idl.UnlinkedClass {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedClassImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExpr> _annotations;
- idl.CodeRange _codeRange;
- idl.UnlinkedDocumentationComment _documentationComment;
- List<idl.UnlinkedExecutable> _executables;
- List<idl.UnlinkedVariable> _fields;
- bool _hasNoSupertype;
- List<idl.EntityRef> _interfaces;
- bool _isAbstract;
- bool _isMixinApplication;
- List<idl.EntityRef> _mixins;
- String _name;
- int _nameOffset;
- int _notSimplyBoundedSlot;
- List<idl.EntityRef> _superclassConstraints;
- List<String> _superInvokedNames;
- idl.EntityRef _supertype;
- List<idl.UnlinkedTypeParam> _typeParameters;
-
- @override
- List<idl.UnlinkedExpr> get annotations {
- _annotations ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 5, const <idl.UnlinkedExpr>[]);
- return _annotations;
- }
-
- @override
- idl.CodeRange get codeRange {
- _codeRange ??= const _CodeRangeReader().vTableGet(_bc, _bcOffset, 13, null);
- return _codeRange;
- }
-
- @override
- idl.UnlinkedDocumentationComment get documentationComment {
- _documentationComment ??= const _UnlinkedDocumentationCommentReader()
- .vTableGet(_bc, _bcOffset, 6, null);
- return _documentationComment;
- }
-
- @override
- List<idl.UnlinkedExecutable> get executables {
- _executables ??= const fb.ListReader<idl.UnlinkedExecutable>(
- const _UnlinkedExecutableReader())
- .vTableGet(_bc, _bcOffset, 2, const <idl.UnlinkedExecutable>[]);
- return _executables;
- }
-
- @override
- List<idl.UnlinkedVariable> get fields {
- _fields ??= const fb.ListReader<idl.UnlinkedVariable>(
- const _UnlinkedVariableReader())
- .vTableGet(_bc, _bcOffset, 4, const <idl.UnlinkedVariable>[]);
- return _fields;
- }
-
- @override
- bool get hasNoSupertype {
- _hasNoSupertype ??=
- const fb.BoolReader().vTableGet(_bc, _bcOffset, 12, false);
- return _hasNoSupertype;
- }
-
- @override
- List<idl.EntityRef> get interfaces {
- _interfaces ??= const fb.ListReader<idl.EntityRef>(const _EntityRefReader())
- .vTableGet(_bc, _bcOffset, 7, const <idl.EntityRef>[]);
- return _interfaces;
- }
-
- @override
- bool get isAbstract {
- _isAbstract ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 8, false);
- return _isAbstract;
- }
-
- @override
- bool get isMixinApplication {
- _isMixinApplication ??=
- const fb.BoolReader().vTableGet(_bc, _bcOffset, 11, false);
- return _isMixinApplication;
- }
-
- @override
- List<idl.EntityRef> get mixins {
- _mixins ??= const fb.ListReader<idl.EntityRef>(const _EntityRefReader())
- .vTableGet(_bc, _bcOffset, 10, const <idl.EntityRef>[]);
- return _mixins;
- }
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _name;
- }
-
- @override
- int get nameOffset {
- _nameOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0);
- return _nameOffset;
- }
-
- @override
- int get notSimplyBoundedSlot {
- _notSimplyBoundedSlot ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 16, 0);
- return _notSimplyBoundedSlot;
- }
-
- @override
- List<idl.EntityRef> get superclassConstraints {
- _superclassConstraints ??=
- const fb.ListReader<idl.EntityRef>(const _EntityRefReader())
- .vTableGet(_bc, _bcOffset, 14, const <idl.EntityRef>[]);
- return _superclassConstraints;
- }
-
- @override
- List<String> get superInvokedNames {
- _superInvokedNames ??= const fb.ListReader<String>(const fb.StringReader())
- .vTableGet(_bc, _bcOffset, 15, const <String>[]);
- return _superInvokedNames;
- }
-
- @override
- idl.EntityRef get supertype {
- _supertype ??= const _EntityRefReader().vTableGet(_bc, _bcOffset, 3, null);
- return _supertype;
- }
-
- @override
- List<idl.UnlinkedTypeParam> get typeParameters {
- _typeParameters ??= const fb.ListReader<idl.UnlinkedTypeParam>(
- const _UnlinkedTypeParamReader())
- .vTableGet(_bc, _bcOffset, 9, const <idl.UnlinkedTypeParam>[]);
- return _typeParameters;
- }
-}
-
-abstract class _UnlinkedClassMixin implements idl.UnlinkedClass {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (annotations.isNotEmpty)
- _result["annotations"] =
- annotations.map((_value) => _value.toJson()).toList();
- if (codeRange != null) _result["codeRange"] = codeRange.toJson();
- if (documentationComment != null)
- _result["documentationComment"] = documentationComment.toJson();
- if (executables.isNotEmpty)
- _result["executables"] =
- executables.map((_value) => _value.toJson()).toList();
- if (fields.isNotEmpty)
- _result["fields"] = fields.map((_value) => _value.toJson()).toList();
- if (hasNoSupertype != false) _result["hasNoSupertype"] = hasNoSupertype;
- if (interfaces.isNotEmpty)
- _result["interfaces"] =
- interfaces.map((_value) => _value.toJson()).toList();
- if (isAbstract != false) _result["isAbstract"] = isAbstract;
- if (isMixinApplication != false)
- _result["isMixinApplication"] = isMixinApplication;
- if (mixins.isNotEmpty)
- _result["mixins"] = mixins.map((_value) => _value.toJson()).toList();
- if (name != '') _result["name"] = name;
- if (nameOffset != 0) _result["nameOffset"] = nameOffset;
- if (notSimplyBoundedSlot != 0)
- _result["notSimplyBoundedSlot"] = notSimplyBoundedSlot;
- if (superclassConstraints.isNotEmpty)
- _result["superclassConstraints"] =
- superclassConstraints.map((_value) => _value.toJson()).toList();
- if (superInvokedNames.isNotEmpty)
- _result["superInvokedNames"] = superInvokedNames;
- if (supertype != null) _result["supertype"] = supertype.toJson();
- if (typeParameters.isNotEmpty)
- _result["typeParameters"] =
- typeParameters.map((_value) => _value.toJson()).toList();
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "annotations": annotations,
- "codeRange": codeRange,
- "documentationComment": documentationComment,
- "executables": executables,
- "fields": fields,
- "hasNoSupertype": hasNoSupertype,
- "interfaces": interfaces,
- "isAbstract": isAbstract,
- "isMixinApplication": isMixinApplication,
- "mixins": mixins,
- "name": name,
- "nameOffset": nameOffset,
- "notSimplyBoundedSlot": notSimplyBoundedSlot,
- "superclassConstraints": superclassConstraints,
- "superInvokedNames": superInvokedNames,
- "supertype": supertype,
- "typeParameters": typeParameters,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedCombinatorBuilder extends Object
- with _UnlinkedCombinatorMixin
- implements idl.UnlinkedCombinator {
- int _end;
- List<String> _hides;
- int _offset;
- List<String> _shows;
-
- @override
- int get end => _end ??= 0;
-
- /// If this is a `show` combinator, offset of the end of the list of shown
- /// names. Otherwise zero.
- set end(int value) {
- assert(value == null || value >= 0);
- this._end = value;
- }
-
- @override
- List<String> get hides => _hides ??= <String>[];
-
- /// List of names which are hidden. Empty if this is a `show` combinator.
- set hides(List<String> value) {
- this._hides = value;
- }
-
- @override
- int get offset => _offset ??= 0;
-
- /// If this is a `show` combinator, offset of the `show` keyword. Otherwise
- /// zero.
- set offset(int value) {
- assert(value == null || value >= 0);
- this._offset = value;
- }
-
- @override
- List<String> get shows => _shows ??= <String>[];
-
- /// List of names which are shown. Empty if this is a `hide` combinator.
- set shows(List<String> value) {
- this._shows = value;
- }
-
- UnlinkedCombinatorBuilder(
- {int end, List<String> hides, int offset, List<String> shows})
- : _end = end,
- _hides = hides,
- _offset = offset,
- _shows = shows;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _end = null;
- _offset = null;
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- if (this._shows == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._shows.length);
- for (var x in this._shows) {
- signature.addString(x);
- }
- }
- if (this._hides == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._hides.length);
- for (var x in this._hides) {
- signature.addString(x);
- }
- }
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_hides;
- fb.Offset offset_shows;
- if (!(_hides == null || _hides.isEmpty)) {
- offset_hides = fbBuilder
- .writeList(_hides.map((b) => fbBuilder.writeString(b)).toList());
- }
- if (!(_shows == null || _shows.isEmpty)) {
- offset_shows = fbBuilder
- .writeList(_shows.map((b) => fbBuilder.writeString(b)).toList());
- }
- fbBuilder.startTable();
- if (_end != null && _end != 0) {
- fbBuilder.addUint32(3, _end);
- }
- if (offset_hides != null) {
- fbBuilder.addOffset(1, offset_hides);
- }
- if (_offset != null && _offset != 0) {
- fbBuilder.addUint32(2, _offset);
- }
- if (offset_shows != null) {
- fbBuilder.addOffset(0, offset_shows);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedCombinatorReader
- extends fb.TableReader<_UnlinkedCombinatorImpl> {
- const _UnlinkedCombinatorReader();
-
- @override
- _UnlinkedCombinatorImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedCombinatorImpl(bc, offset);
-}
-
-class _UnlinkedCombinatorImpl extends Object
- with _UnlinkedCombinatorMixin
- implements idl.UnlinkedCombinator {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedCombinatorImpl(this._bc, this._bcOffset);
-
- int _end;
- List<String> _hides;
- int _offset;
- List<String> _shows;
-
- @override
- int get end {
- _end ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 3, 0);
- return _end;
- }
-
- @override
- List<String> get hides {
- _hides ??= const fb.ListReader<String>(const fb.StringReader())
- .vTableGet(_bc, _bcOffset, 1, const <String>[]);
- return _hides;
- }
-
- @override
- int get offset {
- _offset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 2, 0);
- return _offset;
- }
-
- @override
- List<String> get shows {
- _shows ??= const fb.ListReader<String>(const fb.StringReader())
- .vTableGet(_bc, _bcOffset, 0, const <String>[]);
- return _shows;
- }
-}
-
-abstract class _UnlinkedCombinatorMixin implements idl.UnlinkedCombinator {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (end != 0) _result["end"] = end;
- if (hides.isNotEmpty) _result["hides"] = hides;
- if (offset != 0) _result["offset"] = offset;
- if (shows.isNotEmpty) _result["shows"] = shows;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "end": end,
- "hides": hides,
- "offset": offset,
- "shows": shows,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedConfigurationBuilder extends Object
- with _UnlinkedConfigurationMixin
- implements idl.UnlinkedConfiguration {
- String _name;
- String _uri;
- String _value;
-
- @override
- String get name => _name ??= '';
-
- /// The name of the declared variable whose value is being used in the
- /// condition.
- set name(String value) {
- this._name = value;
- }
-
- @override
- String get uri => _uri ??= '';
-
- /// The URI of the implementation library to be used if the condition is true.
- set uri(String value) {
- this._uri = value;
- }
-
- @override
- String get value => _value ??= '';
-
- /// The value to which the value of the declared variable will be compared,
- /// or `true` if the condition does not include an equality test.
- set value(String value) {
- this._value = value;
- }
-
- UnlinkedConfigurationBuilder({String name, String uri, String value})
- : _name = name,
- _uri = uri,
- _value = value;
-
- /// Flush [informative] data recursively.
- void flushInformative() {}
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._name ?? '');
- signature.addString(this._value ?? '');
- signature.addString(this._uri ?? '');
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_name;
- fb.Offset offset_uri;
- fb.Offset offset_value;
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- if (_uri != null) {
- offset_uri = fbBuilder.writeString(_uri);
- }
- if (_value != null) {
- offset_value = fbBuilder.writeString(_value);
- }
- fbBuilder.startTable();
- if (offset_name != null) {
- fbBuilder.addOffset(0, offset_name);
- }
- if (offset_uri != null) {
- fbBuilder.addOffset(2, offset_uri);
- }
- if (offset_value != null) {
- fbBuilder.addOffset(1, offset_value);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedConfigurationReader
- extends fb.TableReader<_UnlinkedConfigurationImpl> {
- const _UnlinkedConfigurationReader();
-
- @override
- _UnlinkedConfigurationImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedConfigurationImpl(bc, offset);
-}
-
-class _UnlinkedConfigurationImpl extends Object
- with _UnlinkedConfigurationMixin
- implements idl.UnlinkedConfiguration {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedConfigurationImpl(this._bc, this._bcOffset);
-
- String _name;
- String _uri;
- String _value;
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _name;
- }
-
- @override
- String get uri {
- _uri ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 2, '');
- return _uri;
- }
-
- @override
- String get value {
- _value ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 1, '');
- return _value;
- }
-}
-
-abstract class _UnlinkedConfigurationMixin
- implements idl.UnlinkedConfiguration {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (name != '') _result["name"] = name;
- if (uri != '') _result["uri"] = uri;
- if (value != '') _result["value"] = value;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "name": name,
- "uri": uri,
- "value": value,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedConstructorInitializerBuilder extends Object
- with _UnlinkedConstructorInitializerMixin
- implements idl.UnlinkedConstructorInitializer {
- List<String> _argumentNames;
- List<UnlinkedExprBuilder> _arguments;
- UnlinkedExprBuilder _expression;
- idl.UnlinkedConstructorInitializerKind _kind;
- String _name;
-
- @override
- List<String> get argumentNames => _argumentNames ??= <String>[];
-
- /// If there are `m` [arguments] and `n` [argumentNames], then each argument
- /// from [arguments] with index `i` such that `n + i - m >= 0`, should be used
- /// with the name at `n + i - m`.
- set argumentNames(List<String> value) {
- this._argumentNames = value;
- }
-
- @override
- List<UnlinkedExprBuilder> get arguments =>
- _arguments ??= <UnlinkedExprBuilder>[];
-
- /// If [kind] is `thisInvocation` or `superInvocation`, the arguments of the
- /// invocation. Otherwise empty.
- set arguments(List<UnlinkedExprBuilder> value) {
- this._arguments = value;
- }
-
- @override
- UnlinkedExprBuilder get expression => _expression;
-
- /// If [kind] is `field`, the expression of the field initializer.
- /// Otherwise `null`.
- set expression(UnlinkedExprBuilder value) {
- this._expression = value;
- }
-
- @override
- idl.UnlinkedConstructorInitializerKind get kind =>
- _kind ??= idl.UnlinkedConstructorInitializerKind.field;
-
- /// The kind of the constructor initializer (field, redirect, super).
- set kind(idl.UnlinkedConstructorInitializerKind value) {
- this._kind = value;
- }
-
- @override
- String get name => _name ??= '';
-
- /// If [kind] is `field`, the name of the field declared in the class. If
- /// [kind] is `thisInvocation`, the name of the constructor, declared in this
- /// class, to redirect to. If [kind] is `superInvocation`, the name of the
- /// constructor, declared in the superclass, to invoke.
- set name(String value) {
- this._name = value;
- }
-
- UnlinkedConstructorInitializerBuilder(
- {List<String> argumentNames,
- List<UnlinkedExprBuilder> arguments,
- UnlinkedExprBuilder expression,
- idl.UnlinkedConstructorInitializerKind kind,
- String name})
- : _argumentNames = argumentNames,
- _arguments = arguments,
- _expression = expression,
- _kind = kind,
- _name = name;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _arguments?.forEach((b) => b.flushInformative());
- _expression?.flushInformative();
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._name ?? '');
- signature.addBool(this._expression != null);
- this._expression?.collectApiSignature(signature);
- signature.addInt(this._kind == null ? 0 : this._kind.index);
- if (this._arguments == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._arguments.length);
- for (var x in this._arguments) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._argumentNames == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._argumentNames.length);
- for (var x in this._argumentNames) {
- signature.addString(x);
- }
- }
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_argumentNames;
- fb.Offset offset_arguments;
- fb.Offset offset_expression;
- fb.Offset offset_name;
- if (!(_argumentNames == null || _argumentNames.isEmpty)) {
- offset_argumentNames = fbBuilder.writeList(
- _argumentNames.map((b) => fbBuilder.writeString(b)).toList());
- }
- if (!(_arguments == null || _arguments.isEmpty)) {
- offset_arguments = fbBuilder
- .writeList(_arguments.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_expression != null) {
- offset_expression = _expression.finish(fbBuilder);
- }
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- fbBuilder.startTable();
- if (offset_argumentNames != null) {
- fbBuilder.addOffset(4, offset_argumentNames);
- }
- if (offset_arguments != null) {
- fbBuilder.addOffset(3, offset_arguments);
- }
- if (offset_expression != null) {
- fbBuilder.addOffset(1, offset_expression);
- }
- if (_kind != null &&
- _kind != idl.UnlinkedConstructorInitializerKind.field) {
- fbBuilder.addUint8(2, _kind.index);
- }
- if (offset_name != null) {
- fbBuilder.addOffset(0, offset_name);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedConstructorInitializerReader
- extends fb.TableReader<_UnlinkedConstructorInitializerImpl> {
- const _UnlinkedConstructorInitializerReader();
-
- @override
- _UnlinkedConstructorInitializerImpl createObject(
- fb.BufferContext bc, int offset) =>
- new _UnlinkedConstructorInitializerImpl(bc, offset);
-}
-
-class _UnlinkedConstructorInitializerImpl extends Object
- with _UnlinkedConstructorInitializerMixin
- implements idl.UnlinkedConstructorInitializer {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedConstructorInitializerImpl(this._bc, this._bcOffset);
-
- List<String> _argumentNames;
- List<idl.UnlinkedExpr> _arguments;
- idl.UnlinkedExpr _expression;
- idl.UnlinkedConstructorInitializerKind _kind;
- String _name;
-
- @override
- List<String> get argumentNames {
- _argumentNames ??= const fb.ListReader<String>(const fb.StringReader())
- .vTableGet(_bc, _bcOffset, 4, const <String>[]);
- return _argumentNames;
- }
-
- @override
- List<idl.UnlinkedExpr> get arguments {
- _arguments ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 3, const <idl.UnlinkedExpr>[]);
- return _arguments;
- }
-
- @override
- idl.UnlinkedExpr get expression {
- _expression ??=
- const _UnlinkedExprReader().vTableGet(_bc, _bcOffset, 1, null);
- return _expression;
- }
-
- @override
- idl.UnlinkedConstructorInitializerKind get kind {
- _kind ??= const _UnlinkedConstructorInitializerKindReader().vTableGet(
- _bc, _bcOffset, 2, idl.UnlinkedConstructorInitializerKind.field);
- return _kind;
- }
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _name;
- }
-}
-
-abstract class _UnlinkedConstructorInitializerMixin
- implements idl.UnlinkedConstructorInitializer {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (argumentNames.isNotEmpty) _result["argumentNames"] = argumentNames;
- if (arguments.isNotEmpty)
- _result["arguments"] =
- arguments.map((_value) => _value.toJson()).toList();
- if (expression != null) _result["expression"] = expression.toJson();
- if (kind != idl.UnlinkedConstructorInitializerKind.field)
- _result["kind"] = kind.toString().split('.')[1];
- if (name != '') _result["name"] = name;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "argumentNames": argumentNames,
- "arguments": arguments,
- "expression": expression,
- "kind": kind,
- "name": name,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedDocumentationCommentBuilder extends Object
- with _UnlinkedDocumentationCommentMixin
- implements idl.UnlinkedDocumentationComment {
- String _text;
-
- @override
- Null get length =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- Null get offset =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- String get text => _text ??= '';
-
- /// Text of the documentation comment, with '\r\n' replaced by '\n'.
- ///
- /// References appearing within the doc comment in square brackets are not
- /// specially encoded.
- set text(String value) {
- this._text = value;
- }
-
- UnlinkedDocumentationCommentBuilder({String text}) : _text = text;
-
- /// Flush [informative] data recursively.
- void flushInformative() {}
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._text ?? '');
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_text;
- if (_text != null) {
- offset_text = fbBuilder.writeString(_text);
- }
- fbBuilder.startTable();
- if (offset_text != null) {
- fbBuilder.addOffset(1, offset_text);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedDocumentationCommentReader
- extends fb.TableReader<_UnlinkedDocumentationCommentImpl> {
- const _UnlinkedDocumentationCommentReader();
-
- @override
- _UnlinkedDocumentationCommentImpl createObject(
- fb.BufferContext bc, int offset) =>
- new _UnlinkedDocumentationCommentImpl(bc, offset);
-}
-
-class _UnlinkedDocumentationCommentImpl extends Object
- with _UnlinkedDocumentationCommentMixin
- implements idl.UnlinkedDocumentationComment {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedDocumentationCommentImpl(this._bc, this._bcOffset);
-
- String _text;
-
- @override
- Null get length =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- Null get offset =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- String get text {
- _text ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 1, '');
- return _text;
- }
-}
-
-abstract class _UnlinkedDocumentationCommentMixin
- implements idl.UnlinkedDocumentationComment {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (text != '') _result["text"] = text;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "text": text,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedEnumBuilder extends Object
- with _UnlinkedEnumMixin
- implements idl.UnlinkedEnum {
- List<UnlinkedExprBuilder> _annotations;
- CodeRangeBuilder _codeRange;
- UnlinkedDocumentationCommentBuilder _documentationComment;
- String _name;
- int _nameOffset;
- List<UnlinkedEnumValueBuilder> _values;
-
- @override
- List<UnlinkedExprBuilder> get annotations =>
- _annotations ??= <UnlinkedExprBuilder>[];
-
- /// Annotations for this enum.
- set annotations(List<UnlinkedExprBuilder> value) {
- this._annotations = value;
- }
-
- @override
- CodeRangeBuilder get codeRange => _codeRange;
-
- /// Code range of the enum.
- set codeRange(CodeRangeBuilder value) {
- this._codeRange = value;
- }
-
- @override
- UnlinkedDocumentationCommentBuilder get documentationComment =>
- _documentationComment;
-
- /// Documentation comment for the enum, or `null` if there is no documentation
- /// comment.
- set documentationComment(UnlinkedDocumentationCommentBuilder value) {
- this._documentationComment = value;
- }
-
- @override
- String get name => _name ??= '';
-
- /// Name of the enum type.
- set name(String value) {
- this._name = value;
- }
-
- @override
- int get nameOffset => _nameOffset ??= 0;
-
- /// Offset of the enum name relative to the beginning of the file.
- set nameOffset(int value) {
- assert(value == null || value >= 0);
- this._nameOffset = value;
- }
-
- @override
- List<UnlinkedEnumValueBuilder> get values =>
- _values ??= <UnlinkedEnumValueBuilder>[];
-
- /// Values listed in the enum declaration, in declaration order.
- set values(List<UnlinkedEnumValueBuilder> value) {
- this._values = value;
- }
-
- UnlinkedEnumBuilder(
- {List<UnlinkedExprBuilder> annotations,
- CodeRangeBuilder codeRange,
- UnlinkedDocumentationCommentBuilder documentationComment,
- String name,
- int nameOffset,
- List<UnlinkedEnumValueBuilder> values})
- : _annotations = annotations,
- _codeRange = codeRange,
- _documentationComment = documentationComment,
- _name = name,
- _nameOffset = nameOffset,
- _values = values;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _annotations?.forEach((b) => b.flushInformative());
- _codeRange = null;
- _documentationComment = null;
- _nameOffset = null;
- _values?.forEach((b) => b.flushInformative());
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._name ?? '');
- if (this._values == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._values.length);
- for (var x in this._values) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._annotations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._annotations.length);
- for (var x in this._annotations) {
- x?.collectApiSignature(signature);
- }
- }
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_annotations;
- fb.Offset offset_codeRange;
- fb.Offset offset_documentationComment;
- fb.Offset offset_name;
- fb.Offset offset_values;
- if (!(_annotations == null || _annotations.isEmpty)) {
- offset_annotations = fbBuilder
- .writeList(_annotations.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_codeRange != null) {
- offset_codeRange = _codeRange.finish(fbBuilder);
- }
- if (_documentationComment != null) {
- offset_documentationComment = _documentationComment.finish(fbBuilder);
- }
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- if (!(_values == null || _values.isEmpty)) {
- offset_values =
- fbBuilder.writeList(_values.map((b) => b.finish(fbBuilder)).toList());
- }
- fbBuilder.startTable();
- if (offset_annotations != null) {
- fbBuilder.addOffset(4, offset_annotations);
- }
- if (offset_codeRange != null) {
- fbBuilder.addOffset(5, offset_codeRange);
- }
- if (offset_documentationComment != null) {
- fbBuilder.addOffset(3, offset_documentationComment);
- }
- if (offset_name != null) {
- fbBuilder.addOffset(0, offset_name);
- }
- if (_nameOffset != null && _nameOffset != 0) {
- fbBuilder.addUint32(1, _nameOffset);
- }
- if (offset_values != null) {
- fbBuilder.addOffset(2, offset_values);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedEnumReader extends fb.TableReader<_UnlinkedEnumImpl> {
- const _UnlinkedEnumReader();
-
- @override
- _UnlinkedEnumImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedEnumImpl(bc, offset);
-}
-
-class _UnlinkedEnumImpl extends Object
- with _UnlinkedEnumMixin
- implements idl.UnlinkedEnum {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedEnumImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExpr> _annotations;
- idl.CodeRange _codeRange;
- idl.UnlinkedDocumentationComment _documentationComment;
- String _name;
- int _nameOffset;
- List<idl.UnlinkedEnumValue> _values;
-
- @override
- List<idl.UnlinkedExpr> get annotations {
- _annotations ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 4, const <idl.UnlinkedExpr>[]);
- return _annotations;
- }
-
- @override
- idl.CodeRange get codeRange {
- _codeRange ??= const _CodeRangeReader().vTableGet(_bc, _bcOffset, 5, null);
- return _codeRange;
- }
-
- @override
- idl.UnlinkedDocumentationComment get documentationComment {
- _documentationComment ??= const _UnlinkedDocumentationCommentReader()
- .vTableGet(_bc, _bcOffset, 3, null);
- return _documentationComment;
- }
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _name;
- }
-
- @override
- int get nameOffset {
- _nameOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0);
- return _nameOffset;
- }
-
- @override
- List<idl.UnlinkedEnumValue> get values {
- _values ??= const fb.ListReader<idl.UnlinkedEnumValue>(
- const _UnlinkedEnumValueReader())
- .vTableGet(_bc, _bcOffset, 2, const <idl.UnlinkedEnumValue>[]);
- return _values;
- }
-}
-
-abstract class _UnlinkedEnumMixin implements idl.UnlinkedEnum {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (annotations.isNotEmpty)
- _result["annotations"] =
- annotations.map((_value) => _value.toJson()).toList();
- if (codeRange != null) _result["codeRange"] = codeRange.toJson();
- if (documentationComment != null)
- _result["documentationComment"] = documentationComment.toJson();
- if (name != '') _result["name"] = name;
- if (nameOffset != 0) _result["nameOffset"] = nameOffset;
- if (values.isNotEmpty)
- _result["values"] = values.map((_value) => _value.toJson()).toList();
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "annotations": annotations,
- "codeRange": codeRange,
- "documentationComment": documentationComment,
- "name": name,
- "nameOffset": nameOffset,
- "values": values,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedEnumValueBuilder extends Object
- with _UnlinkedEnumValueMixin
- implements idl.UnlinkedEnumValue {
- List<UnlinkedExprBuilder> _annotations;
- UnlinkedDocumentationCommentBuilder _documentationComment;
- String _name;
- int _nameOffset;
-
- @override
- List<UnlinkedExprBuilder> get annotations =>
- _annotations ??= <UnlinkedExprBuilder>[];
-
- /// Annotations for this value.
- set annotations(List<UnlinkedExprBuilder> value) {
- this._annotations = value;
- }
-
- @override
- UnlinkedDocumentationCommentBuilder get documentationComment =>
- _documentationComment;
-
- /// Documentation comment for the enum value, or `null` if there is no
- /// documentation comment.
- set documentationComment(UnlinkedDocumentationCommentBuilder value) {
- this._documentationComment = value;
- }
-
- @override
- String get name => _name ??= '';
-
- /// Name of the enumerated value.
- set name(String value) {
- this._name = value;
- }
-
- @override
- int get nameOffset => _nameOffset ??= 0;
-
- /// Offset of the enum value name relative to the beginning of the file.
- set nameOffset(int value) {
- assert(value == null || value >= 0);
- this._nameOffset = value;
- }
-
- UnlinkedEnumValueBuilder(
- {List<UnlinkedExprBuilder> annotations,
- UnlinkedDocumentationCommentBuilder documentationComment,
- String name,
- int nameOffset})
- : _annotations = annotations,
- _documentationComment = documentationComment,
- _name = name,
- _nameOffset = nameOffset;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _annotations?.forEach((b) => b.flushInformative());
- _documentationComment = null;
- _nameOffset = null;
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._name ?? '');
- if (this._annotations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._annotations.length);
- for (var x in this._annotations) {
- x?.collectApiSignature(signature);
- }
- }
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_annotations;
- fb.Offset offset_documentationComment;
- fb.Offset offset_name;
- if (!(_annotations == null || _annotations.isEmpty)) {
- offset_annotations = fbBuilder
- .writeList(_annotations.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_documentationComment != null) {
- offset_documentationComment = _documentationComment.finish(fbBuilder);
- }
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- fbBuilder.startTable();
- if (offset_annotations != null) {
- fbBuilder.addOffset(3, offset_annotations);
- }
- if (offset_documentationComment != null) {
- fbBuilder.addOffset(2, offset_documentationComment);
- }
- if (offset_name != null) {
- fbBuilder.addOffset(0, offset_name);
- }
- if (_nameOffset != null && _nameOffset != 0) {
- fbBuilder.addUint32(1, _nameOffset);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedEnumValueReader extends fb.TableReader<_UnlinkedEnumValueImpl> {
- const _UnlinkedEnumValueReader();
-
- @override
- _UnlinkedEnumValueImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedEnumValueImpl(bc, offset);
-}
-
-class _UnlinkedEnumValueImpl extends Object
- with _UnlinkedEnumValueMixin
- implements idl.UnlinkedEnumValue {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedEnumValueImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExpr> _annotations;
- idl.UnlinkedDocumentationComment _documentationComment;
- String _name;
- int _nameOffset;
-
- @override
- List<idl.UnlinkedExpr> get annotations {
- _annotations ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 3, const <idl.UnlinkedExpr>[]);
- return _annotations;
- }
-
- @override
- idl.UnlinkedDocumentationComment get documentationComment {
- _documentationComment ??= const _UnlinkedDocumentationCommentReader()
- .vTableGet(_bc, _bcOffset, 2, null);
- return _documentationComment;
- }
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _name;
- }
-
- @override
- int get nameOffset {
- _nameOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0);
- return _nameOffset;
- }
-}
-
-abstract class _UnlinkedEnumValueMixin implements idl.UnlinkedEnumValue {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (annotations.isNotEmpty)
- _result["annotations"] =
- annotations.map((_value) => _value.toJson()).toList();
- if (documentationComment != null)
- _result["documentationComment"] = documentationComment.toJson();
- if (name != '') _result["name"] = name;
- if (nameOffset != 0) _result["nameOffset"] = nameOffset;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "annotations": annotations,
- "documentationComment": documentationComment,
- "name": name,
- "nameOffset": nameOffset,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedExecutableBuilder extends Object
- with _UnlinkedExecutableMixin
- implements idl.UnlinkedExecutable {
- List<UnlinkedExprBuilder> _annotations;
- UnlinkedExprBuilder _bodyExpr;
- CodeRangeBuilder _codeRange;
- List<UnlinkedConstructorInitializerBuilder> _constantInitializers;
- int _constCycleSlot;
- UnlinkedDocumentationCommentBuilder _documentationComment;
- int _inferredReturnTypeSlot;
- bool _isAbstract;
- bool _isAsynchronous;
- bool _isConst;
- bool _isExternal;
- bool _isFactory;
- bool _isGenerator;
- bool _isRedirectedConstructor;
- bool _isStatic;
- idl.UnlinkedExecutableKind _kind;
- List<UnlinkedExecutableBuilder> _localFunctions;
- String _name;
- int _nameEnd;
- int _nameOffset;
- List<UnlinkedParamBuilder> _parameters;
- int _periodOffset;
- EntityRefBuilder _redirectedConstructor;
- String _redirectedConstructorName;
- EntityRefBuilder _returnType;
- List<UnlinkedTypeParamBuilder> _typeParameters;
- int _visibleLength;
- int _visibleOffset;
-
- @override
- List<UnlinkedExprBuilder> get annotations =>
- _annotations ??= <UnlinkedExprBuilder>[];
-
- /// Annotations for this executable.
- set annotations(List<UnlinkedExprBuilder> value) {
- this._annotations = value;
- }
-
- @override
- UnlinkedExprBuilder get bodyExpr => _bodyExpr;
-
- /// If this executable's function body is declared using `=>`, the expression
- /// to the right of the `=>`. May be omitted if neither type inference nor
- /// constant evaluation depends on the function body.
- set bodyExpr(UnlinkedExprBuilder value) {
- this._bodyExpr = value;
- }
-
- @override
- CodeRangeBuilder get codeRange => _codeRange;
-
- /// Code range of the executable.
- set codeRange(CodeRangeBuilder value) {
- this._codeRange = value;
- }
-
- @override
- List<UnlinkedConstructorInitializerBuilder> get constantInitializers =>
- _constantInitializers ??= <UnlinkedConstructorInitializerBuilder>[];
-
- /// If a constant [UnlinkedExecutableKind.constructor], the constructor
- /// initializers. Otherwise empty.
- set constantInitializers(List<UnlinkedConstructorInitializerBuilder> value) {
- this._constantInitializers = value;
- }
-
- @override
- int get constCycleSlot => _constCycleSlot ??= 0;
-
- /// If [kind] is [UnlinkedExecutableKind.constructor] and [isConst] is `true`,
- /// a nonzero slot id which is unique within this compilation unit. If this
- /// id is found in [LinkedUnit.constCycles], then this constructor is part of
- /// a cycle.
- ///
- /// Otherwise, zero.
- set constCycleSlot(int value) {
- assert(value == null || value >= 0);
- this._constCycleSlot = value;
- }
-
- @override
- UnlinkedDocumentationCommentBuilder get documentationComment =>
- _documentationComment;
-
- /// Documentation comment for the executable, or `null` if there is no
- /// documentation comment.
- set documentationComment(UnlinkedDocumentationCommentBuilder value) {
- this._documentationComment = value;
- }
-
- @override
- int get inferredReturnTypeSlot => _inferredReturnTypeSlot ??= 0;
-
- /// If this executable's return type is inferable, nonzero slot id
- /// identifying which entry in [LinkedUnit.types] contains the inferred
- /// return type. If there is no matching entry in [LinkedUnit.types], then
- /// no return type was inferred for this variable, so its static type is
- /// `dynamic`.
- set inferredReturnTypeSlot(int value) {
- assert(value == null || value >= 0);
- this._inferredReturnTypeSlot = value;
- }
-
- @override
- bool get isAbstract => _isAbstract ??= false;
-
- /// Indicates whether the executable is declared using the `abstract` keyword.
- set isAbstract(bool value) {
- this._isAbstract = value;
- }
-
- @override
- bool get isAsynchronous => _isAsynchronous ??= false;
-
- /// Indicates whether the executable has body marked as being asynchronous.
- set isAsynchronous(bool value) {
- this._isAsynchronous = value;
- }
-
- @override
- bool get isConst => _isConst ??= false;
-
- /// Indicates whether the executable is declared using the `const` keyword.
- set isConst(bool value) {
- this._isConst = value;
- }
-
- @override
- bool get isExternal => _isExternal ??= false;
-
- /// Indicates whether the executable is declared using the `external` keyword.
- set isExternal(bool value) {
- this._isExternal = value;
- }
-
- @override
- bool get isFactory => _isFactory ??= false;
-
- /// Indicates whether the executable is declared using the `factory` keyword.
- set isFactory(bool value) {
- this._isFactory = value;
- }
-
- @override
- bool get isGenerator => _isGenerator ??= false;
-
- /// Indicates whether the executable has body marked as being a generator.
- set isGenerator(bool value) {
- this._isGenerator = value;
- }
-
- @override
- bool get isRedirectedConstructor => _isRedirectedConstructor ??= false;
-
- /// Indicates whether the executable is a redirected constructor.
- set isRedirectedConstructor(bool value) {
- this._isRedirectedConstructor = value;
- }
-
- @override
- bool get isStatic => _isStatic ??= false;
-
- /// Indicates whether the executable is declared using the `static` keyword.
- ///
- /// Note that for top level executables, this flag is false, since they are
- /// not declared using the `static` keyword (even though they are considered
- /// static for semantic purposes).
- set isStatic(bool value) {
- this._isStatic = value;
- }
-
- @override
- idl.UnlinkedExecutableKind get kind =>
- _kind ??= idl.UnlinkedExecutableKind.functionOrMethod;
-
- /// The kind of the executable (function/method, getter, setter, or
- /// constructor).
- set kind(idl.UnlinkedExecutableKind value) {
- this._kind = value;
- }
-
- @override
- List<UnlinkedExecutableBuilder> get localFunctions =>
- _localFunctions ??= <UnlinkedExecutableBuilder>[];
-
- /// The list of local functions.
- set localFunctions(List<UnlinkedExecutableBuilder> value) {
- this._localFunctions = value;
- }
-
- @override
- Null get localLabels =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- Null get localVariables =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- String get name => _name ??= '';
-
- /// Name of the executable. For setters, this includes the trailing "=". For
- /// named constructors, this excludes the class name and excludes the ".".
- /// For unnamed constructors, this is the empty string.
- set name(String value) {
- this._name = value;
- }
-
- @override
- int get nameEnd => _nameEnd ??= 0;
-
- /// If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty,
- /// the offset of the end of the constructor name. Otherwise zero.
- set nameEnd(int value) {
- assert(value == null || value >= 0);
- this._nameEnd = value;
- }
-
- @override
- int get nameOffset => _nameOffset ??= 0;
-
- /// Offset of the executable name relative to the beginning of the file. For
- /// named constructors, this excludes the class name and excludes the ".".
- /// For unnamed constructors, this is the offset of the class name (i.e. the
- /// offset of the second "C" in "class C { C(); }").
- set nameOffset(int value) {
- assert(value == null || value >= 0);
- this._nameOffset = value;
- }
-
- @override
- List<UnlinkedParamBuilder> get parameters =>
- _parameters ??= <UnlinkedParamBuilder>[];
-
- /// Parameters of the executable, if any. Note that getters have no
- /// parameters (hence this will be the empty list), and setters have a single
- /// parameter.
- set parameters(List<UnlinkedParamBuilder> value) {
- this._parameters = value;
- }
-
- @override
- int get periodOffset => _periodOffset ??= 0;
-
- /// If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty,
- /// the offset of the period before the constructor name. Otherwise zero.
- set periodOffset(int value) {
- assert(value == null || value >= 0);
- this._periodOffset = value;
- }
-
- @override
- EntityRefBuilder get redirectedConstructor => _redirectedConstructor;
-
- /// If [isRedirectedConstructor] and [isFactory] are both `true`, the
- /// constructor to which this constructor redirects; otherwise empty.
- set redirectedConstructor(EntityRefBuilder value) {
- this._redirectedConstructor = value;
- }
-
- @override
- String get redirectedConstructorName => _redirectedConstructorName ??= '';
-
- /// If [isRedirectedConstructor] is `true` and [isFactory] is `false`, the
- /// name of the constructor that this constructor redirects to; otherwise
- /// empty.
- set redirectedConstructorName(String value) {
- this._redirectedConstructorName = value;
- }
-
- @override
- EntityRefBuilder get returnType => _returnType;
-
- /// Declared return type of the executable. Absent if the executable is a
- /// constructor or the return type is implicit. Absent for executables
- /// associated with variable initializers and closures, since these
- /// executables may have return types that are not accessible via direct
- /// imports.
- set returnType(EntityRefBuilder value) {
- this._returnType = value;
- }
-
- @override
- List<UnlinkedTypeParamBuilder> get typeParameters =>
- _typeParameters ??= <UnlinkedTypeParamBuilder>[];
-
- /// Type parameters of the executable, if any. Empty if support for generic
- /// method syntax is disabled.
- set typeParameters(List<UnlinkedTypeParamBuilder> value) {
- this._typeParameters = value;
- }
-
- @override
- int get visibleLength => _visibleLength ??= 0;
-
- /// If a local function, the length of the visible range; zero otherwise.
- set visibleLength(int value) {
- assert(value == null || value >= 0);
- this._visibleLength = value;
- }
-
- @override
- int get visibleOffset => _visibleOffset ??= 0;
-
- /// If a local function, the beginning of the visible range; zero otherwise.
- set visibleOffset(int value) {
- assert(value == null || value >= 0);
- this._visibleOffset = value;
- }
-
- UnlinkedExecutableBuilder(
- {List<UnlinkedExprBuilder> annotations,
- UnlinkedExprBuilder bodyExpr,
- CodeRangeBuilder codeRange,
- List<UnlinkedConstructorInitializerBuilder> constantInitializers,
- int constCycleSlot,
- UnlinkedDocumentationCommentBuilder documentationComment,
- int inferredReturnTypeSlot,
- bool isAbstract,
- bool isAsynchronous,
- bool isConst,
- bool isExternal,
- bool isFactory,
- bool isGenerator,
- bool isRedirectedConstructor,
- bool isStatic,
- idl.UnlinkedExecutableKind kind,
- List<UnlinkedExecutableBuilder> localFunctions,
- String name,
- int nameEnd,
- int nameOffset,
- List<UnlinkedParamBuilder> parameters,
- int periodOffset,
- EntityRefBuilder redirectedConstructor,
- String redirectedConstructorName,
- EntityRefBuilder returnType,
- List<UnlinkedTypeParamBuilder> typeParameters,
- int visibleLength,
- int visibleOffset})
- : _annotations = annotations,
- _bodyExpr = bodyExpr,
- _codeRange = codeRange,
- _constantInitializers = constantInitializers,
- _constCycleSlot = constCycleSlot,
- _documentationComment = documentationComment,
- _inferredReturnTypeSlot = inferredReturnTypeSlot,
- _isAbstract = isAbstract,
- _isAsynchronous = isAsynchronous,
- _isConst = isConst,
- _isExternal = isExternal,
- _isFactory = isFactory,
- _isGenerator = isGenerator,
- _isRedirectedConstructor = isRedirectedConstructor,
- _isStatic = isStatic,
- _kind = kind,
- _localFunctions = localFunctions,
- _name = name,
- _nameEnd = nameEnd,
- _nameOffset = nameOffset,
- _parameters = parameters,
- _periodOffset = periodOffset,
- _redirectedConstructor = redirectedConstructor,
- _redirectedConstructorName = redirectedConstructorName,
- _returnType = returnType,
- _typeParameters = typeParameters,
- _visibleLength = visibleLength,
- _visibleOffset = visibleOffset;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _annotations?.forEach((b) => b.flushInformative());
- _bodyExpr?.flushInformative();
- _codeRange = null;
- _constantInitializers?.forEach((b) => b.flushInformative());
- _documentationComment = null;
- _isAsynchronous = null;
- _isGenerator = null;
- _localFunctions?.forEach((b) => b.flushInformative());
- _nameEnd = null;
- _nameOffset = null;
- _parameters?.forEach((b) => b.flushInformative());
- _periodOffset = null;
- _redirectedConstructor?.flushInformative();
- _returnType?.flushInformative();
- _typeParameters?.forEach((b) => b.flushInformative());
- _visibleLength = null;
- _visibleOffset = null;
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._name ?? '');
- if (this._parameters == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._parameters.length);
- for (var x in this._parameters) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addBool(this._returnType != null);
- this._returnType?.collectApiSignature(signature);
- signature.addInt(this._kind == null ? 0 : this._kind.index);
- signature.addInt(this._inferredReturnTypeSlot ?? 0);
- if (this._annotations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._annotations.length);
- for (var x in this._annotations) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addBool(this._isFactory == true);
- signature.addBool(this._isStatic == true);
- signature.addBool(this._isAbstract == true);
- signature.addBool(this._isExternal == true);
- signature.addBool(this._isConst == true);
- signature.addBool(this._isRedirectedConstructor == true);
- if (this._constantInitializers == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._constantInitializers.length);
- for (var x in this._constantInitializers) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addBool(this._redirectedConstructor != null);
- this._redirectedConstructor?.collectApiSignature(signature);
- if (this._typeParameters == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._typeParameters.length);
- for (var x in this._typeParameters) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addString(this._redirectedConstructorName ?? '');
- if (this._localFunctions == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._localFunctions.length);
- for (var x in this._localFunctions) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addInt(this._constCycleSlot ?? 0);
- signature.addBool(this._bodyExpr != null);
- this._bodyExpr?.collectApiSignature(signature);
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_annotations;
- fb.Offset offset_bodyExpr;
- fb.Offset offset_codeRange;
- fb.Offset offset_constantInitializers;
- fb.Offset offset_documentationComment;
- fb.Offset offset_localFunctions;
- fb.Offset offset_name;
- fb.Offset offset_parameters;
- fb.Offset offset_redirectedConstructor;
- fb.Offset offset_redirectedConstructorName;
- fb.Offset offset_returnType;
- fb.Offset offset_typeParameters;
- if (!(_annotations == null || _annotations.isEmpty)) {
- offset_annotations = fbBuilder
- .writeList(_annotations.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_bodyExpr != null) {
- offset_bodyExpr = _bodyExpr.finish(fbBuilder);
- }
- if (_codeRange != null) {
- offset_codeRange = _codeRange.finish(fbBuilder);
- }
- if (!(_constantInitializers == null || _constantInitializers.isEmpty)) {
- offset_constantInitializers = fbBuilder.writeList(
- _constantInitializers.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_documentationComment != null) {
- offset_documentationComment = _documentationComment.finish(fbBuilder);
- }
- if (!(_localFunctions == null || _localFunctions.isEmpty)) {
- offset_localFunctions = fbBuilder
- .writeList(_localFunctions.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- if (!(_parameters == null || _parameters.isEmpty)) {
- offset_parameters = fbBuilder
- .writeList(_parameters.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_redirectedConstructor != null) {
- offset_redirectedConstructor = _redirectedConstructor.finish(fbBuilder);
- }
- if (_redirectedConstructorName != null) {
- offset_redirectedConstructorName =
- fbBuilder.writeString(_redirectedConstructorName);
- }
- if (_returnType != null) {
- offset_returnType = _returnType.finish(fbBuilder);
- }
- if (!(_typeParameters == null || _typeParameters.isEmpty)) {
- offset_typeParameters = fbBuilder
- .writeList(_typeParameters.map((b) => b.finish(fbBuilder)).toList());
- }
- fbBuilder.startTable();
- if (offset_annotations != null) {
- fbBuilder.addOffset(6, offset_annotations);
- }
- if (offset_bodyExpr != null) {
- fbBuilder.addOffset(29, offset_bodyExpr);
- }
- if (offset_codeRange != null) {
- fbBuilder.addOffset(26, offset_codeRange);
- }
- if (offset_constantInitializers != null) {
- fbBuilder.addOffset(14, offset_constantInitializers);
- }
- if (_constCycleSlot != null && _constCycleSlot != 0) {
- fbBuilder.addUint32(25, _constCycleSlot);
- }
- if (offset_documentationComment != null) {
- fbBuilder.addOffset(7, offset_documentationComment);
- }
- if (_inferredReturnTypeSlot != null && _inferredReturnTypeSlot != 0) {
- fbBuilder.addUint32(5, _inferredReturnTypeSlot);
- }
- if (_isAbstract == true) {
- fbBuilder.addBool(10, true);
- }
- if (_isAsynchronous == true) {
- fbBuilder.addBool(27, true);
- }
- if (_isConst == true) {
- fbBuilder.addBool(12, true);
- }
- if (_isExternal == true) {
- fbBuilder.addBool(11, true);
- }
- if (_isFactory == true) {
- fbBuilder.addBool(8, true);
- }
- if (_isGenerator == true) {
- fbBuilder.addBool(28, true);
- }
- if (_isRedirectedConstructor == true) {
- fbBuilder.addBool(13, true);
- }
- if (_isStatic == true) {
- fbBuilder.addBool(9, true);
- }
- if (_kind != null && _kind != idl.UnlinkedExecutableKind.functionOrMethod) {
- fbBuilder.addUint8(4, _kind.index);
- }
- if (offset_localFunctions != null) {
- fbBuilder.addOffset(18, offset_localFunctions);
- }
- if (offset_name != null) {
- fbBuilder.addOffset(1, offset_name);
- }
- if (_nameEnd != null && _nameEnd != 0) {
- fbBuilder.addUint32(23, _nameEnd);
- }
- if (_nameOffset != null && _nameOffset != 0) {
- fbBuilder.addUint32(0, _nameOffset);
- }
- if (offset_parameters != null) {
- fbBuilder.addOffset(2, offset_parameters);
- }
- if (_periodOffset != null && _periodOffset != 0) {
- fbBuilder.addUint32(24, _periodOffset);
- }
- if (offset_redirectedConstructor != null) {
- fbBuilder.addOffset(15, offset_redirectedConstructor);
- }
- if (offset_redirectedConstructorName != null) {
- fbBuilder.addOffset(17, offset_redirectedConstructorName);
- }
- if (offset_returnType != null) {
- fbBuilder.addOffset(3, offset_returnType);
- }
- if (offset_typeParameters != null) {
- fbBuilder.addOffset(16, offset_typeParameters);
- }
- if (_visibleLength != null && _visibleLength != 0) {
- fbBuilder.addUint32(20, _visibleLength);
- }
- if (_visibleOffset != null && _visibleOffset != 0) {
- fbBuilder.addUint32(21, _visibleOffset);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedExecutableReader
- extends fb.TableReader<_UnlinkedExecutableImpl> {
- const _UnlinkedExecutableReader();
-
- @override
- _UnlinkedExecutableImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedExecutableImpl(bc, offset);
-}
-
-class _UnlinkedExecutableImpl extends Object
- with _UnlinkedExecutableMixin
- implements idl.UnlinkedExecutable {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedExecutableImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExpr> _annotations;
- idl.UnlinkedExpr _bodyExpr;
- idl.CodeRange _codeRange;
- List<idl.UnlinkedConstructorInitializer> _constantInitializers;
- int _constCycleSlot;
- idl.UnlinkedDocumentationComment _documentationComment;
- int _inferredReturnTypeSlot;
- bool _isAbstract;
- bool _isAsynchronous;
- bool _isConst;
- bool _isExternal;
- bool _isFactory;
- bool _isGenerator;
- bool _isRedirectedConstructor;
- bool _isStatic;
- idl.UnlinkedExecutableKind _kind;
- List<idl.UnlinkedExecutable> _localFunctions;
- String _name;
- int _nameEnd;
- int _nameOffset;
- List<idl.UnlinkedParam> _parameters;
- int _periodOffset;
- idl.EntityRef _redirectedConstructor;
- String _redirectedConstructorName;
- idl.EntityRef _returnType;
- List<idl.UnlinkedTypeParam> _typeParameters;
- int _visibleLength;
- int _visibleOffset;
-
- @override
- List<idl.UnlinkedExpr> get annotations {
- _annotations ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 6, const <idl.UnlinkedExpr>[]);
- return _annotations;
- }
-
- @override
- idl.UnlinkedExpr get bodyExpr {
- _bodyExpr ??=
- const _UnlinkedExprReader().vTableGet(_bc, _bcOffset, 29, null);
- return _bodyExpr;
- }
-
- @override
- idl.CodeRange get codeRange {
- _codeRange ??= const _CodeRangeReader().vTableGet(_bc, _bcOffset, 26, null);
- return _codeRange;
- }
-
- @override
- List<idl.UnlinkedConstructorInitializer> get constantInitializers {
- _constantInitializers ??=
- const fb.ListReader<idl.UnlinkedConstructorInitializer>(
- const _UnlinkedConstructorInitializerReader())
- .vTableGet(_bc, _bcOffset, 14,
- const <idl.UnlinkedConstructorInitializer>[]);
- return _constantInitializers;
- }
-
- @override
- int get constCycleSlot {
- _constCycleSlot ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 25, 0);
- return _constCycleSlot;
- }
-
- @override
- idl.UnlinkedDocumentationComment get documentationComment {
- _documentationComment ??= const _UnlinkedDocumentationCommentReader()
- .vTableGet(_bc, _bcOffset, 7, null);
- return _documentationComment;
- }
-
- @override
- int get inferredReturnTypeSlot {
- _inferredReturnTypeSlot ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 5, 0);
- return _inferredReturnTypeSlot;
- }
-
- @override
- bool get isAbstract {
- _isAbstract ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 10, false);
- return _isAbstract;
- }
-
- @override
- bool get isAsynchronous {
- _isAsynchronous ??=
- const fb.BoolReader().vTableGet(_bc, _bcOffset, 27, false);
- return _isAsynchronous;
- }
-
- @override
- bool get isConst {
- _isConst ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 12, false);
- return _isConst;
- }
-
- @override
- bool get isExternal {
- _isExternal ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 11, false);
- return _isExternal;
- }
-
- @override
- bool get isFactory {
- _isFactory ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 8, false);
- return _isFactory;
- }
-
- @override
- bool get isGenerator {
- _isGenerator ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 28, false);
- return _isGenerator;
- }
-
- @override
- bool get isRedirectedConstructor {
- _isRedirectedConstructor ??=
- const fb.BoolReader().vTableGet(_bc, _bcOffset, 13, false);
- return _isRedirectedConstructor;
- }
-
- @override
- bool get isStatic {
- _isStatic ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 9, false);
- return _isStatic;
- }
-
- @override
- idl.UnlinkedExecutableKind get kind {
- _kind ??= const _UnlinkedExecutableKindReader().vTableGet(
- _bc, _bcOffset, 4, idl.UnlinkedExecutableKind.functionOrMethod);
- return _kind;
- }
-
- @override
- List<idl.UnlinkedExecutable> get localFunctions {
- _localFunctions ??= const fb.ListReader<idl.UnlinkedExecutable>(
- const _UnlinkedExecutableReader())
- .vTableGet(_bc, _bcOffset, 18, const <idl.UnlinkedExecutable>[]);
- return _localFunctions;
- }
-
- @override
- Null get localLabels =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- Null get localVariables =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 1, '');
- return _name;
- }
-
- @override
- int get nameEnd {
- _nameEnd ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 23, 0);
- return _nameEnd;
- }
-
- @override
- int get nameOffset {
- _nameOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
- return _nameOffset;
- }
-
- @override
- List<idl.UnlinkedParam> get parameters {
- _parameters ??=
- const fb.ListReader<idl.UnlinkedParam>(const _UnlinkedParamReader())
- .vTableGet(_bc, _bcOffset, 2, const <idl.UnlinkedParam>[]);
- return _parameters;
- }
-
- @override
- int get periodOffset {
- _periodOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 24, 0);
- return _periodOffset;
- }
-
- @override
- idl.EntityRef get redirectedConstructor {
- _redirectedConstructor ??=
- const _EntityRefReader().vTableGet(_bc, _bcOffset, 15, null);
- return _redirectedConstructor;
- }
-
- @override
- String get redirectedConstructorName {
- _redirectedConstructorName ??=
- const fb.StringReader().vTableGet(_bc, _bcOffset, 17, '');
- return _redirectedConstructorName;
- }
-
- @override
- idl.EntityRef get returnType {
- _returnType ??= const _EntityRefReader().vTableGet(_bc, _bcOffset, 3, null);
- return _returnType;
- }
-
- @override
- List<idl.UnlinkedTypeParam> get typeParameters {
- _typeParameters ??= const fb.ListReader<idl.UnlinkedTypeParam>(
- const _UnlinkedTypeParamReader())
- .vTableGet(_bc, _bcOffset, 16, const <idl.UnlinkedTypeParam>[]);
- return _typeParameters;
- }
-
- @override
- int get visibleLength {
- _visibleLength ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 20, 0);
- return _visibleLength;
- }
-
- @override
- int get visibleOffset {
- _visibleOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 21, 0);
- return _visibleOffset;
- }
-}
-
-abstract class _UnlinkedExecutableMixin implements idl.UnlinkedExecutable {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (annotations.isNotEmpty)
- _result["annotations"] =
- annotations.map((_value) => _value.toJson()).toList();
- if (bodyExpr != null) _result["bodyExpr"] = bodyExpr.toJson();
- if (codeRange != null) _result["codeRange"] = codeRange.toJson();
- if (constantInitializers.isNotEmpty)
- _result["constantInitializers"] =
- constantInitializers.map((_value) => _value.toJson()).toList();
- if (constCycleSlot != 0) _result["constCycleSlot"] = constCycleSlot;
- if (documentationComment != null)
- _result["documentationComment"] = documentationComment.toJson();
- if (inferredReturnTypeSlot != 0)
- _result["inferredReturnTypeSlot"] = inferredReturnTypeSlot;
- if (isAbstract != false) _result["isAbstract"] = isAbstract;
- if (isAsynchronous != false) _result["isAsynchronous"] = isAsynchronous;
- if (isConst != false) _result["isConst"] = isConst;
- if (isExternal != false) _result["isExternal"] = isExternal;
- if (isFactory != false) _result["isFactory"] = isFactory;
- if (isGenerator != false) _result["isGenerator"] = isGenerator;
- if (isRedirectedConstructor != false)
- _result["isRedirectedConstructor"] = isRedirectedConstructor;
- if (isStatic != false) _result["isStatic"] = isStatic;
- if (kind != idl.UnlinkedExecutableKind.functionOrMethod)
- _result["kind"] = kind.toString().split('.')[1];
- if (localFunctions.isNotEmpty)
- _result["localFunctions"] =
- localFunctions.map((_value) => _value.toJson()).toList();
- if (name != '') _result["name"] = name;
- if (nameEnd != 0) _result["nameEnd"] = nameEnd;
- if (nameOffset != 0) _result["nameOffset"] = nameOffset;
- if (parameters.isNotEmpty)
- _result["parameters"] =
- parameters.map((_value) => _value.toJson()).toList();
- if (periodOffset != 0) _result["periodOffset"] = periodOffset;
- if (redirectedConstructor != null)
- _result["redirectedConstructor"] = redirectedConstructor.toJson();
- if (redirectedConstructorName != '')
- _result["redirectedConstructorName"] = redirectedConstructorName;
- if (returnType != null) _result["returnType"] = returnType.toJson();
- if (typeParameters.isNotEmpty)
- _result["typeParameters"] =
- typeParameters.map((_value) => _value.toJson()).toList();
- if (visibleLength != 0) _result["visibleLength"] = visibleLength;
- if (visibleOffset != 0) _result["visibleOffset"] = visibleOffset;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "annotations": annotations,
- "bodyExpr": bodyExpr,
- "codeRange": codeRange,
- "constantInitializers": constantInitializers,
- "constCycleSlot": constCycleSlot,
- "documentationComment": documentationComment,
- "inferredReturnTypeSlot": inferredReturnTypeSlot,
- "isAbstract": isAbstract,
- "isAsynchronous": isAsynchronous,
- "isConst": isConst,
- "isExternal": isExternal,
- "isFactory": isFactory,
- "isGenerator": isGenerator,
- "isRedirectedConstructor": isRedirectedConstructor,
- "isStatic": isStatic,
- "kind": kind,
- "localFunctions": localFunctions,
- "name": name,
- "nameEnd": nameEnd,
- "nameOffset": nameOffset,
- "parameters": parameters,
- "periodOffset": periodOffset,
- "redirectedConstructor": redirectedConstructor,
- "redirectedConstructorName": redirectedConstructorName,
- "returnType": returnType,
- "typeParameters": typeParameters,
- "visibleLength": visibleLength,
- "visibleOffset": visibleOffset,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedExportNonPublicBuilder extends Object
- with _UnlinkedExportNonPublicMixin
- implements idl.UnlinkedExportNonPublic {
- List<UnlinkedExprBuilder> _annotations;
- int _offset;
- int _uriEnd;
- int _uriOffset;
-
- @override
- List<UnlinkedExprBuilder> get annotations =>
- _annotations ??= <UnlinkedExprBuilder>[];
-
- /// Annotations for this export directive.
- set annotations(List<UnlinkedExprBuilder> value) {
- this._annotations = value;
- }
-
- @override
- int get offset => _offset ??= 0;
-
- /// Offset of the "export" keyword.
- set offset(int value) {
- assert(value == null || value >= 0);
- this._offset = value;
- }
-
- @override
- int get uriEnd => _uriEnd ??= 0;
-
- /// End of the URI string (including quotes) relative to the beginning of the
- /// file.
- set uriEnd(int value) {
- assert(value == null || value >= 0);
- this._uriEnd = value;
- }
-
- @override
- int get uriOffset => _uriOffset ??= 0;
-
- /// Offset of the URI string (including quotes) relative to the beginning of
- /// the file.
- set uriOffset(int value) {
- assert(value == null || value >= 0);
- this._uriOffset = value;
- }
-
- UnlinkedExportNonPublicBuilder(
- {List<UnlinkedExprBuilder> annotations,
- int offset,
- int uriEnd,
- int uriOffset})
- : _annotations = annotations,
- _offset = offset,
- _uriEnd = uriEnd,
- _uriOffset = uriOffset;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _annotations?.forEach((b) => b.flushInformative());
- _offset = null;
- _uriEnd = null;
- _uriOffset = null;
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- if (this._annotations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._annotations.length);
- for (var x in this._annotations) {
- x?.collectApiSignature(signature);
- }
- }
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_annotations;
- if (!(_annotations == null || _annotations.isEmpty)) {
- offset_annotations = fbBuilder
- .writeList(_annotations.map((b) => b.finish(fbBuilder)).toList());
- }
- fbBuilder.startTable();
- if (offset_annotations != null) {
- fbBuilder.addOffset(3, offset_annotations);
- }
- if (_offset != null && _offset != 0) {
- fbBuilder.addUint32(0, _offset);
- }
- if (_uriEnd != null && _uriEnd != 0) {
- fbBuilder.addUint32(1, _uriEnd);
- }
- if (_uriOffset != null && _uriOffset != 0) {
- fbBuilder.addUint32(2, _uriOffset);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedExportNonPublicReader
- extends fb.TableReader<_UnlinkedExportNonPublicImpl> {
- const _UnlinkedExportNonPublicReader();
-
- @override
- _UnlinkedExportNonPublicImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedExportNonPublicImpl(bc, offset);
-}
-
-class _UnlinkedExportNonPublicImpl extends Object
- with _UnlinkedExportNonPublicMixin
- implements idl.UnlinkedExportNonPublic {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedExportNonPublicImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExpr> _annotations;
- int _offset;
- int _uriEnd;
- int _uriOffset;
-
- @override
- List<idl.UnlinkedExpr> get annotations {
- _annotations ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 3, const <idl.UnlinkedExpr>[]);
- return _annotations;
- }
-
- @override
- int get offset {
- _offset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
- return _offset;
- }
-
- @override
- int get uriEnd {
- _uriEnd ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0);
- return _uriEnd;
- }
-
- @override
- int get uriOffset {
- _uriOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 2, 0);
- return _uriOffset;
- }
-}
-
-abstract class _UnlinkedExportNonPublicMixin
- implements idl.UnlinkedExportNonPublic {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (annotations.isNotEmpty)
- _result["annotations"] =
- annotations.map((_value) => _value.toJson()).toList();
- if (offset != 0) _result["offset"] = offset;
- if (uriEnd != 0) _result["uriEnd"] = uriEnd;
- if (uriOffset != 0) _result["uriOffset"] = uriOffset;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "annotations": annotations,
- "offset": offset,
- "uriEnd": uriEnd,
- "uriOffset": uriOffset,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedExportPublicBuilder extends Object
- with _UnlinkedExportPublicMixin
- implements idl.UnlinkedExportPublic {
- List<UnlinkedCombinatorBuilder> _combinators;
- List<UnlinkedConfigurationBuilder> _configurations;
- String _uri;
-
- @override
- List<UnlinkedCombinatorBuilder> get combinators =>
- _combinators ??= <UnlinkedCombinatorBuilder>[];
-
- /// Combinators contained in this export declaration.
- set combinators(List<UnlinkedCombinatorBuilder> value) {
- this._combinators = value;
- }
-
- @override
- List<UnlinkedConfigurationBuilder> get configurations =>
- _configurations ??= <UnlinkedConfigurationBuilder>[];
-
- /// Configurations used to control which library will actually be loaded at
- /// run-time.
- set configurations(List<UnlinkedConfigurationBuilder> value) {
- this._configurations = value;
- }
-
- @override
- String get uri => _uri ??= '';
-
- /// URI used in the source code to reference the exported library.
- set uri(String value) {
- this._uri = value;
- }
-
- UnlinkedExportPublicBuilder(
- {List<UnlinkedCombinatorBuilder> combinators,
- List<UnlinkedConfigurationBuilder> configurations,
- String uri})
- : _combinators = combinators,
- _configurations = configurations,
- _uri = uri;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _combinators?.forEach((b) => b.flushInformative());
- _configurations?.forEach((b) => b.flushInformative());
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._uri ?? '');
- if (this._combinators == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._combinators.length);
- for (var x in this._combinators) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._configurations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._configurations.length);
- for (var x in this._configurations) {
- x?.collectApiSignature(signature);
- }
- }
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_combinators;
- fb.Offset offset_configurations;
- fb.Offset offset_uri;
- if (!(_combinators == null || _combinators.isEmpty)) {
- offset_combinators = fbBuilder
- .writeList(_combinators.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_configurations == null || _configurations.isEmpty)) {
- offset_configurations = fbBuilder
- .writeList(_configurations.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_uri != null) {
- offset_uri = fbBuilder.writeString(_uri);
- }
- fbBuilder.startTable();
- if (offset_combinators != null) {
- fbBuilder.addOffset(1, offset_combinators);
- }
- if (offset_configurations != null) {
- fbBuilder.addOffset(2, offset_configurations);
- }
- if (offset_uri != null) {
- fbBuilder.addOffset(0, offset_uri);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedExportPublicReader
- extends fb.TableReader<_UnlinkedExportPublicImpl> {
- const _UnlinkedExportPublicReader();
-
- @override
- _UnlinkedExportPublicImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedExportPublicImpl(bc, offset);
-}
-
-class _UnlinkedExportPublicImpl extends Object
- with _UnlinkedExportPublicMixin
- implements idl.UnlinkedExportPublic {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedExportPublicImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedCombinator> _combinators;
- List<idl.UnlinkedConfiguration> _configurations;
- String _uri;
-
- @override
- List<idl.UnlinkedCombinator> get combinators {
- _combinators ??= const fb.ListReader<idl.UnlinkedCombinator>(
- const _UnlinkedCombinatorReader())
- .vTableGet(_bc, _bcOffset, 1, const <idl.UnlinkedCombinator>[]);
- return _combinators;
- }
-
- @override
- List<idl.UnlinkedConfiguration> get configurations {
- _configurations ??= const fb.ListReader<idl.UnlinkedConfiguration>(
- const _UnlinkedConfigurationReader())
- .vTableGet(_bc, _bcOffset, 2, const <idl.UnlinkedConfiguration>[]);
- return _configurations;
- }
-
- @override
- String get uri {
- _uri ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _uri;
- }
-}
-
-abstract class _UnlinkedExportPublicMixin implements idl.UnlinkedExportPublic {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (combinators.isNotEmpty)
- _result["combinators"] =
- combinators.map((_value) => _value.toJson()).toList();
- if (configurations.isNotEmpty)
- _result["configurations"] =
- configurations.map((_value) => _value.toJson()).toList();
- if (uri != '') _result["uri"] = uri;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "combinators": combinators,
- "configurations": configurations,
- "uri": uri,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedExprBuilder extends Object
- with _UnlinkedExprMixin
- implements idl.UnlinkedExpr {
- List<idl.UnlinkedExprAssignOperator> _assignmentOperators;
- List<double> _doubles;
- List<int> _ints;
- bool _isValidConst;
- List<idl.UnlinkedExprOperation> _operations;
- List<EntityRefBuilder> _references;
- String _sourceRepresentation;
- List<String> _strings;
-
- @override
- List<idl.UnlinkedExprAssignOperator> get assignmentOperators =>
- _assignmentOperators ??= <idl.UnlinkedExprAssignOperator>[];
-
- /// Sequence of operators used by assignment operations.
- set assignmentOperators(List<idl.UnlinkedExprAssignOperator> value) {
- this._assignmentOperators = value;
- }
-
- @override
- List<double> get doubles => _doubles ??= <double>[];
-
- /// Sequence of 64-bit doubles consumed by the operation `pushDouble`.
- set doubles(List<double> value) {
- this._doubles = value;
- }
-
- @override
- List<int> get ints => _ints ??= <int>[];
-
- /// Sequence of unsigned 32-bit integers consumed by the operations
- /// `pushArgument`, `pushInt`, `shiftOr`, `concatenate`, `invokeConstructor`,
- /// `makeList`, and `makeMap`.
- set ints(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._ints = value;
- }
-
- @override
- bool get isValidConst => _isValidConst ??= false;
-
- /// Indicates whether the expression is a valid potentially constant
- /// expression.
- set isValidConst(bool value) {
- this._isValidConst = value;
- }
-
- @override
- List<idl.UnlinkedExprOperation> get operations =>
- _operations ??= <idl.UnlinkedExprOperation>[];
-
- /// Sequence of operations to execute (starting with an empty stack) to form
- /// the constant value.
- set operations(List<idl.UnlinkedExprOperation> value) {
- this._operations = value;
- }
-
- @override
- List<EntityRefBuilder> get references => _references ??= <EntityRefBuilder>[];
-
- /// Sequence of language constructs consumed by the operations
- /// `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note
- /// that in the case of `pushReference` (and sometimes `invokeConstructor` the
- /// actual entity being referred to may be something other than a type.
- set references(List<EntityRefBuilder> value) {
- this._references = value;
- }
-
- @override
- String get sourceRepresentation => _sourceRepresentation ??= '';
-
- /// String representation of the expression in a form suitable to be tokenized
- /// and parsed.
- set sourceRepresentation(String value) {
- this._sourceRepresentation = value;
- }
-
- @override
- List<String> get strings => _strings ??= <String>[];
-
- /// Sequence of strings consumed by the operations `pushString` and
- /// `invokeConstructor`.
- set strings(List<String> value) {
- this._strings = value;
- }
-
- UnlinkedExprBuilder(
- {List<idl.UnlinkedExprAssignOperator> assignmentOperators,
- List<double> doubles,
- List<int> ints,
- bool isValidConst,
- List<idl.UnlinkedExprOperation> operations,
- List<EntityRefBuilder> references,
- String sourceRepresentation,
- List<String> strings})
- : _assignmentOperators = assignmentOperators,
- _doubles = doubles,
- _ints = ints,
- _isValidConst = isValidConst,
- _operations = operations,
- _references = references,
- _sourceRepresentation = sourceRepresentation,
- _strings = strings;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _references?.forEach((b) => b.flushInformative());
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- if (this._operations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._operations.length);
- for (var x in this._operations) {
- signature.addInt(x.index);
- }
- }
- if (this._ints == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._ints.length);
- for (var x in this._ints) {
- signature.addInt(x);
- }
- }
- if (this._references == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._references.length);
- for (var x in this._references) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._strings == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._strings.length);
- for (var x in this._strings) {
- signature.addString(x);
- }
- }
- if (this._doubles == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._doubles.length);
- for (var x in this._doubles) {
- signature.addDouble(x);
- }
- }
- signature.addBool(this._isValidConst == true);
- if (this._assignmentOperators == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._assignmentOperators.length);
- for (var x in this._assignmentOperators) {
- signature.addInt(x.index);
- }
- }
- signature.addString(this._sourceRepresentation ?? '');
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_assignmentOperators;
- fb.Offset offset_doubles;
- fb.Offset offset_ints;
- fb.Offset offset_operations;
- fb.Offset offset_references;
- fb.Offset offset_sourceRepresentation;
- fb.Offset offset_strings;
- if (!(_assignmentOperators == null || _assignmentOperators.isEmpty)) {
- offset_assignmentOperators = fbBuilder
- .writeListUint8(_assignmentOperators.map((b) => b.index).toList());
- }
- if (!(_doubles == null || _doubles.isEmpty)) {
- offset_doubles = fbBuilder.writeListFloat64(_doubles);
- }
- if (!(_ints == null || _ints.isEmpty)) {
- offset_ints = fbBuilder.writeListUint32(_ints);
- }
- if (!(_operations == null || _operations.isEmpty)) {
- offset_operations =
- fbBuilder.writeListUint8(_operations.map((b) => b.index).toList());
- }
- if (!(_references == null || _references.isEmpty)) {
- offset_references = fbBuilder
- .writeList(_references.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_sourceRepresentation != null) {
- offset_sourceRepresentation =
- fbBuilder.writeString(_sourceRepresentation);
- }
- if (!(_strings == null || _strings.isEmpty)) {
- offset_strings = fbBuilder
- .writeList(_strings.map((b) => fbBuilder.writeString(b)).toList());
- }
- fbBuilder.startTable();
- if (offset_assignmentOperators != null) {
- fbBuilder.addOffset(6, offset_assignmentOperators);
- }
- if (offset_doubles != null) {
- fbBuilder.addOffset(4, offset_doubles);
- }
- if (offset_ints != null) {
- fbBuilder.addOffset(1, offset_ints);
- }
- if (_isValidConst == true) {
- fbBuilder.addBool(5, true);
- }
- if (offset_operations != null) {
- fbBuilder.addOffset(0, offset_operations);
- }
- if (offset_references != null) {
- fbBuilder.addOffset(2, offset_references);
- }
- if (offset_sourceRepresentation != null) {
- fbBuilder.addOffset(7, offset_sourceRepresentation);
- }
- if (offset_strings != null) {
- fbBuilder.addOffset(3, offset_strings);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedExprReader extends fb.TableReader<_UnlinkedExprImpl> {
- const _UnlinkedExprReader();
-
- @override
- _UnlinkedExprImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedExprImpl(bc, offset);
-}
-
-class _UnlinkedExprImpl extends Object
- with _UnlinkedExprMixin
- implements idl.UnlinkedExpr {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedExprImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExprAssignOperator> _assignmentOperators;
- List<double> _doubles;
- List<int> _ints;
- bool _isValidConst;
- List<idl.UnlinkedExprOperation> _operations;
- List<idl.EntityRef> _references;
- String _sourceRepresentation;
- List<String> _strings;
-
- @override
- List<idl.UnlinkedExprAssignOperator> get assignmentOperators {
- _assignmentOperators ??=
- const fb.ListReader<idl.UnlinkedExprAssignOperator>(
- const _UnlinkedExprAssignOperatorReader())
- .vTableGet(
- _bc, _bcOffset, 6, const <idl.UnlinkedExprAssignOperator>[]);
- return _assignmentOperators;
- }
-
- @override
- List<double> get doubles {
- _doubles ??= const fb.Float64ListReader()
- .vTableGet(_bc, _bcOffset, 4, const <double>[]);
- return _doubles;
- }
-
- @override
- List<int> get ints {
- _ints ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 1, const <int>[]);
- return _ints;
- }
-
- @override
- bool get isValidConst {
- _isValidConst ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 5, false);
- return _isValidConst;
- }
-
- @override
- List<idl.UnlinkedExprOperation> get operations {
- _operations ??= const fb.ListReader<idl.UnlinkedExprOperation>(
- const _UnlinkedExprOperationReader())
- .vTableGet(_bc, _bcOffset, 0, const <idl.UnlinkedExprOperation>[]);
- return _operations;
- }
-
- @override
- List<idl.EntityRef> get references {
- _references ??= const fb.ListReader<idl.EntityRef>(const _EntityRefReader())
- .vTableGet(_bc, _bcOffset, 2, const <idl.EntityRef>[]);
- return _references;
- }
-
- @override
- String get sourceRepresentation {
- _sourceRepresentation ??=
- const fb.StringReader().vTableGet(_bc, _bcOffset, 7, '');
- return _sourceRepresentation;
- }
-
- @override
- List<String> get strings {
- _strings ??= const fb.ListReader<String>(const fb.StringReader())
- .vTableGet(_bc, _bcOffset, 3, const <String>[]);
- return _strings;
- }
-}
-
-abstract class _UnlinkedExprMixin implements idl.UnlinkedExpr {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (assignmentOperators.isNotEmpty)
- _result["assignmentOperators"] = assignmentOperators
- .map((_value) => _value.toString().split('.')[1])
- .toList();
- if (doubles.isNotEmpty)
- _result["doubles"] = doubles
- .map((_value) => _value.isFinite ? _value : _value.toString())
- .toList();
- if (ints.isNotEmpty) _result["ints"] = ints;
- if (isValidConst != false) _result["isValidConst"] = isValidConst;
- if (operations.isNotEmpty)
- _result["operations"] =
- operations.map((_value) => _value.toString().split('.')[1]).toList();
- if (references.isNotEmpty)
- _result["references"] =
- references.map((_value) => _value.toJson()).toList();
- if (sourceRepresentation != '')
- _result["sourceRepresentation"] = sourceRepresentation;
- if (strings.isNotEmpty) _result["strings"] = strings;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "assignmentOperators": assignmentOperators,
- "doubles": doubles,
- "ints": ints,
- "isValidConst": isValidConst,
- "operations": operations,
- "references": references,
- "sourceRepresentation": sourceRepresentation,
- "strings": strings,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedExtensionBuilder extends Object
- with _UnlinkedExtensionMixin
- implements idl.UnlinkedExtension {
- List<UnlinkedExprBuilder> _annotations;
- CodeRangeBuilder _codeRange;
- UnlinkedDocumentationCommentBuilder _documentationComment;
- List<UnlinkedExecutableBuilder> _executables;
- EntityRefBuilder _extendedType;
- List<UnlinkedVariableBuilder> _fields;
- String _name;
- int _nameOffset;
- List<UnlinkedTypeParamBuilder> _typeParameters;
-
- @override
- List<UnlinkedExprBuilder> get annotations =>
- _annotations ??= <UnlinkedExprBuilder>[];
-
- /// Annotations for this extension.
- set annotations(List<UnlinkedExprBuilder> value) {
- this._annotations = value;
- }
-
- @override
- CodeRangeBuilder get codeRange => _codeRange;
-
- /// Code range of the extension.
- set codeRange(CodeRangeBuilder value) {
- this._codeRange = value;
- }
-
- @override
- UnlinkedDocumentationCommentBuilder get documentationComment =>
- _documentationComment;
-
- /// Documentation comment for the extension, or `null` if there is no
- /// documentation comment.
- set documentationComment(UnlinkedDocumentationCommentBuilder value) {
- this._documentationComment = value;
- }
-
- @override
- List<UnlinkedExecutableBuilder> get executables =>
- _executables ??= <UnlinkedExecutableBuilder>[];
-
- /// Executable objects (methods, getters, and setters) contained in the
- /// extension.
- set executables(List<UnlinkedExecutableBuilder> value) {
- this._executables = value;
- }
-
- @override
- EntityRefBuilder get extendedType => _extendedType;
-
- /// The type being extended.
- set extendedType(EntityRefBuilder value) {
- this._extendedType = value;
- }
-
- @override
- List<UnlinkedVariableBuilder> get fields =>
- _fields ??= <UnlinkedVariableBuilder>[];
-
- /// Field declarations contained in the extension.
- set fields(List<UnlinkedVariableBuilder> value) {
- this._fields = value;
- }
-
- @override
- String get name => _name ??= '';
-
- /// Name of the extension, or an empty string if there is no name.
- set name(String value) {
- this._name = value;
- }
-
- @override
- int get nameOffset => _nameOffset ??= 0;
-
- /// Offset of the extension name relative to the beginning of the file, or
- /// zero if there is no name.
- set nameOffset(int value) {
- assert(value == null || value >= 0);
- this._nameOffset = value;
- }
-
- @override
- List<UnlinkedTypeParamBuilder> get typeParameters =>
- _typeParameters ??= <UnlinkedTypeParamBuilder>[];
-
- /// Type parameters of the extension, if any.
- set typeParameters(List<UnlinkedTypeParamBuilder> value) {
- this._typeParameters = value;
- }
-
- UnlinkedExtensionBuilder(
- {List<UnlinkedExprBuilder> annotations,
- CodeRangeBuilder codeRange,
- UnlinkedDocumentationCommentBuilder documentationComment,
- List<UnlinkedExecutableBuilder> executables,
- EntityRefBuilder extendedType,
- List<UnlinkedVariableBuilder> fields,
- String name,
- int nameOffset,
- List<UnlinkedTypeParamBuilder> typeParameters})
- : _annotations = annotations,
- _codeRange = codeRange,
- _documentationComment = documentationComment,
- _executables = executables,
- _extendedType = extendedType,
- _fields = fields,
- _name = name,
- _nameOffset = nameOffset,
- _typeParameters = typeParameters;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _annotations?.forEach((b) => b.flushInformative());
- _codeRange = null;
- _documentationComment = null;
- _executables?.forEach((b) => b.flushInformative());
- _extendedType?.flushInformative();
- _fields?.forEach((b) => b.flushInformative());
- _nameOffset = null;
- _typeParameters?.forEach((b) => b.flushInformative());
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._name ?? '');
- if (this._executables == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._executables.length);
- for (var x in this._executables) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addBool(this._extendedType != null);
- this._extendedType?.collectApiSignature(signature);
- if (this._annotations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._annotations.length);
- for (var x in this._annotations) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._typeParameters == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._typeParameters.length);
- for (var x in this._typeParameters) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._fields == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._fields.length);
- for (var x in this._fields) {
- x?.collectApiSignature(signature);
- }
- }
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_annotations;
- fb.Offset offset_codeRange;
- fb.Offset offset_documentationComment;
- fb.Offset offset_executables;
- fb.Offset offset_extendedType;
- fb.Offset offset_fields;
- fb.Offset offset_name;
- fb.Offset offset_typeParameters;
- if (!(_annotations == null || _annotations.isEmpty)) {
- offset_annotations = fbBuilder
- .writeList(_annotations.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_codeRange != null) {
- offset_codeRange = _codeRange.finish(fbBuilder);
- }
- if (_documentationComment != null) {
- offset_documentationComment = _documentationComment.finish(fbBuilder);
- }
- if (!(_executables == null || _executables.isEmpty)) {
- offset_executables = fbBuilder
- .writeList(_executables.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_extendedType != null) {
- offset_extendedType = _extendedType.finish(fbBuilder);
- }
- if (!(_fields == null || _fields.isEmpty)) {
- offset_fields =
- fbBuilder.writeList(_fields.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- if (!(_typeParameters == null || _typeParameters.isEmpty)) {
- offset_typeParameters = fbBuilder
- .writeList(_typeParameters.map((b) => b.finish(fbBuilder)).toList());
- }
- fbBuilder.startTable();
- if (offset_annotations != null) {
- fbBuilder.addOffset(4, offset_annotations);
- }
- if (offset_codeRange != null) {
- fbBuilder.addOffset(7, offset_codeRange);
- }
- if (offset_documentationComment != null) {
- fbBuilder.addOffset(5, offset_documentationComment);
- }
- if (offset_executables != null) {
- fbBuilder.addOffset(2, offset_executables);
- }
- if (offset_extendedType != null) {
- fbBuilder.addOffset(3, offset_extendedType);
- }
- if (offset_fields != null) {
- fbBuilder.addOffset(8, offset_fields);
- }
- if (offset_name != null) {
- fbBuilder.addOffset(0, offset_name);
- }
- if (_nameOffset != null && _nameOffset != 0) {
- fbBuilder.addUint32(1, _nameOffset);
- }
- if (offset_typeParameters != null) {
- fbBuilder.addOffset(6, offset_typeParameters);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedExtensionReader extends fb.TableReader<_UnlinkedExtensionImpl> {
- const _UnlinkedExtensionReader();
-
- @override
- _UnlinkedExtensionImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedExtensionImpl(bc, offset);
-}
-
-class _UnlinkedExtensionImpl extends Object
- with _UnlinkedExtensionMixin
- implements idl.UnlinkedExtension {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedExtensionImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExpr> _annotations;
- idl.CodeRange _codeRange;
- idl.UnlinkedDocumentationComment _documentationComment;
- List<idl.UnlinkedExecutable> _executables;
- idl.EntityRef _extendedType;
- List<idl.UnlinkedVariable> _fields;
- String _name;
- int _nameOffset;
- List<idl.UnlinkedTypeParam> _typeParameters;
-
- @override
- List<idl.UnlinkedExpr> get annotations {
- _annotations ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 4, const <idl.UnlinkedExpr>[]);
- return _annotations;
- }
-
- @override
- idl.CodeRange get codeRange {
- _codeRange ??= const _CodeRangeReader().vTableGet(_bc, _bcOffset, 7, null);
- return _codeRange;
- }
-
- @override
- idl.UnlinkedDocumentationComment get documentationComment {
- _documentationComment ??= const _UnlinkedDocumentationCommentReader()
- .vTableGet(_bc, _bcOffset, 5, null);
- return _documentationComment;
- }
-
- @override
- List<idl.UnlinkedExecutable> get executables {
- _executables ??= const fb.ListReader<idl.UnlinkedExecutable>(
- const _UnlinkedExecutableReader())
- .vTableGet(_bc, _bcOffset, 2, const <idl.UnlinkedExecutable>[]);
- return _executables;
- }
-
- @override
- idl.EntityRef get extendedType {
- _extendedType ??=
- const _EntityRefReader().vTableGet(_bc, _bcOffset, 3, null);
- return _extendedType;
- }
-
- @override
- List<idl.UnlinkedVariable> get fields {
- _fields ??= const fb.ListReader<idl.UnlinkedVariable>(
- const _UnlinkedVariableReader())
- .vTableGet(_bc, _bcOffset, 8, const <idl.UnlinkedVariable>[]);
- return _fields;
- }
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _name;
- }
-
- @override
- int get nameOffset {
- _nameOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0);
- return _nameOffset;
- }
-
- @override
- List<idl.UnlinkedTypeParam> get typeParameters {
- _typeParameters ??= const fb.ListReader<idl.UnlinkedTypeParam>(
- const _UnlinkedTypeParamReader())
- .vTableGet(_bc, _bcOffset, 6, const <idl.UnlinkedTypeParam>[]);
- return _typeParameters;
- }
-}
-
-abstract class _UnlinkedExtensionMixin implements idl.UnlinkedExtension {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (annotations.isNotEmpty)
- _result["annotations"] =
- annotations.map((_value) => _value.toJson()).toList();
- if (codeRange != null) _result["codeRange"] = codeRange.toJson();
- if (documentationComment != null)
- _result["documentationComment"] = documentationComment.toJson();
- if (executables.isNotEmpty)
- _result["executables"] =
- executables.map((_value) => _value.toJson()).toList();
- if (extendedType != null) _result["extendedType"] = extendedType.toJson();
- if (fields.isNotEmpty)
- _result["fields"] = fields.map((_value) => _value.toJson()).toList();
- if (name != '') _result["name"] = name;
- if (nameOffset != 0) _result["nameOffset"] = nameOffset;
- if (typeParameters.isNotEmpty)
- _result["typeParameters"] =
- typeParameters.map((_value) => _value.toJson()).toList();
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "annotations": annotations,
- "codeRange": codeRange,
- "documentationComment": documentationComment,
- "executables": executables,
- "extendedType": extendedType,
- "fields": fields,
- "name": name,
- "nameOffset": nameOffset,
- "typeParameters": typeParameters,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedImportBuilder extends Object
- with _UnlinkedImportMixin
- implements idl.UnlinkedImport {
- List<UnlinkedExprBuilder> _annotations;
- List<UnlinkedCombinatorBuilder> _combinators;
- List<UnlinkedConfigurationBuilder> _configurations;
- bool _isDeferred;
- bool _isImplicit;
- int _offset;
- int _prefixOffset;
- int _prefixReference;
- String _uri;
- int _uriEnd;
- int _uriOffset;
-
- @override
- List<UnlinkedExprBuilder> get annotations =>
- _annotations ??= <UnlinkedExprBuilder>[];
-
- /// Annotations for this import declaration.
- set annotations(List<UnlinkedExprBuilder> value) {
- this._annotations = value;
- }
-
- @override
- List<UnlinkedCombinatorBuilder> get combinators =>
- _combinators ??= <UnlinkedCombinatorBuilder>[];
-
- /// Combinators contained in this import declaration.
- set combinators(List<UnlinkedCombinatorBuilder> value) {
- this._combinators = value;
- }
-
- @override
- List<UnlinkedConfigurationBuilder> get configurations =>
- _configurations ??= <UnlinkedConfigurationBuilder>[];
-
- /// Configurations used to control which library will actually be loaded at
- /// run-time.
- set configurations(List<UnlinkedConfigurationBuilder> value) {
- this._configurations = value;
- }
-
- @override
- bool get isDeferred => _isDeferred ??= false;
-
- /// Indicates whether the import declaration uses the `deferred` keyword.
- set isDeferred(bool value) {
- this._isDeferred = value;
- }
-
- @override
- bool get isImplicit => _isImplicit ??= false;
-
- /// Indicates whether the import declaration is implicit.
- set isImplicit(bool value) {
- this._isImplicit = value;
- }
-
- @override
- int get offset => _offset ??= 0;
-
- /// If [isImplicit] is false, offset of the "import" keyword. If [isImplicit]
- /// is true, zero.
- set offset(int value) {
- assert(value == null || value >= 0);
- this._offset = value;
- }
-
- @override
- int get prefixOffset => _prefixOffset ??= 0;
-
- /// Offset of the prefix name relative to the beginning of the file, or zero
- /// if there is no prefix.
- set prefixOffset(int value) {
- assert(value == null || value >= 0);
- this._prefixOffset = value;
- }
-
- @override
- int get prefixReference => _prefixReference ??= 0;
-
- /// Index into [UnlinkedUnit.references] of the prefix declared by this
- /// import declaration, or zero if this import declaration declares no prefix.
- ///
- /// Note that multiple imports can declare the same prefix.
- set prefixReference(int value) {
- assert(value == null || value >= 0);
- this._prefixReference = value;
- }
-
- @override
- String get uri => _uri ??= '';
-
- /// URI used in the source code to reference the imported library.
- set uri(String value) {
- this._uri = value;
- }
-
- @override
- int get uriEnd => _uriEnd ??= 0;
-
- /// End of the URI string (including quotes) relative to the beginning of the
- /// file. If [isImplicit] is true, zero.
- set uriEnd(int value) {
- assert(value == null || value >= 0);
- this._uriEnd = value;
- }
-
- @override
- int get uriOffset => _uriOffset ??= 0;
-
- /// Offset of the URI string (including quotes) relative to the beginning of
- /// the file. If [isImplicit] is true, zero.
- set uriOffset(int value) {
- assert(value == null || value >= 0);
- this._uriOffset = value;
- }
-
- UnlinkedImportBuilder(
- {List<UnlinkedExprBuilder> annotations,
- List<UnlinkedCombinatorBuilder> combinators,
- List<UnlinkedConfigurationBuilder> configurations,
- bool isDeferred,
- bool isImplicit,
- int offset,
- int prefixOffset,
- int prefixReference,
- String uri,
- int uriEnd,
- int uriOffset})
- : _annotations = annotations,
- _combinators = combinators,
- _configurations = configurations,
- _isDeferred = isDeferred,
- _isImplicit = isImplicit,
- _offset = offset,
- _prefixOffset = prefixOffset,
- _prefixReference = prefixReference,
- _uri = uri,
- _uriEnd = uriEnd,
- _uriOffset = uriOffset;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _annotations?.forEach((b) => b.flushInformative());
- _combinators?.forEach((b) => b.flushInformative());
- _configurations?.forEach((b) => b.flushInformative());
- _offset = null;
- _prefixOffset = null;
- _uriEnd = null;
- _uriOffset = null;
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._uri ?? '');
- if (this._combinators == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._combinators.length);
- for (var x in this._combinators) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addBool(this._isImplicit == true);
- signature.addInt(this._prefixReference ?? 0);
- if (this._annotations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._annotations.length);
- for (var x in this._annotations) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addBool(this._isDeferred == true);
- if (this._configurations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._configurations.length);
- for (var x in this._configurations) {
- x?.collectApiSignature(signature);
- }
- }
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_annotations;
- fb.Offset offset_combinators;
- fb.Offset offset_configurations;
- fb.Offset offset_uri;
- if (!(_annotations == null || _annotations.isEmpty)) {
- offset_annotations = fbBuilder
- .writeList(_annotations.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_combinators == null || _combinators.isEmpty)) {
- offset_combinators = fbBuilder
- .writeList(_combinators.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_configurations == null || _configurations.isEmpty)) {
- offset_configurations = fbBuilder
- .writeList(_configurations.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_uri != null) {
- offset_uri = fbBuilder.writeString(_uri);
- }
- fbBuilder.startTable();
- if (offset_annotations != null) {
- fbBuilder.addOffset(8, offset_annotations);
- }
- if (offset_combinators != null) {
- fbBuilder.addOffset(4, offset_combinators);
- }
- if (offset_configurations != null) {
- fbBuilder.addOffset(10, offset_configurations);
- }
- if (_isDeferred == true) {
- fbBuilder.addBool(9, true);
- }
- if (_isImplicit == true) {
- fbBuilder.addBool(5, true);
- }
- if (_offset != null && _offset != 0) {
- fbBuilder.addUint32(0, _offset);
- }
- if (_prefixOffset != null && _prefixOffset != 0) {
- fbBuilder.addUint32(6, _prefixOffset);
- }
- if (_prefixReference != null && _prefixReference != 0) {
- fbBuilder.addUint32(7, _prefixReference);
- }
- if (offset_uri != null) {
- fbBuilder.addOffset(1, offset_uri);
- }
- if (_uriEnd != null && _uriEnd != 0) {
- fbBuilder.addUint32(2, _uriEnd);
- }
- if (_uriOffset != null && _uriOffset != 0) {
- fbBuilder.addUint32(3, _uriOffset);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedImportReader extends fb.TableReader<_UnlinkedImportImpl> {
- const _UnlinkedImportReader();
-
- @override
- _UnlinkedImportImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedImportImpl(bc, offset);
-}
-
-class _UnlinkedImportImpl extends Object
- with _UnlinkedImportMixin
- implements idl.UnlinkedImport {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedImportImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExpr> _annotations;
- List<idl.UnlinkedCombinator> _combinators;
- List<idl.UnlinkedConfiguration> _configurations;
- bool _isDeferred;
- bool _isImplicit;
- int _offset;
- int _prefixOffset;
- int _prefixReference;
- String _uri;
- int _uriEnd;
- int _uriOffset;
-
- @override
- List<idl.UnlinkedExpr> get annotations {
- _annotations ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 8, const <idl.UnlinkedExpr>[]);
- return _annotations;
- }
-
- @override
- List<idl.UnlinkedCombinator> get combinators {
- _combinators ??= const fb.ListReader<idl.UnlinkedCombinator>(
- const _UnlinkedCombinatorReader())
- .vTableGet(_bc, _bcOffset, 4, const <idl.UnlinkedCombinator>[]);
- return _combinators;
- }
-
- @override
- List<idl.UnlinkedConfiguration> get configurations {
- _configurations ??= const fb.ListReader<idl.UnlinkedConfiguration>(
- const _UnlinkedConfigurationReader())
- .vTableGet(_bc, _bcOffset, 10, const <idl.UnlinkedConfiguration>[]);
- return _configurations;
- }
-
- @override
- bool get isDeferred {
- _isDeferred ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 9, false);
- return _isDeferred;
- }
-
- @override
- bool get isImplicit {
- _isImplicit ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 5, false);
- return _isImplicit;
- }
-
- @override
- int get offset {
- _offset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
- return _offset;
- }
-
- @override
- int get prefixOffset {
- _prefixOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 6, 0);
- return _prefixOffset;
- }
-
- @override
- int get prefixReference {
- _prefixReference ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 7, 0);
- return _prefixReference;
- }
-
- @override
- String get uri {
- _uri ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 1, '');
- return _uri;
- }
-
- @override
- int get uriEnd {
- _uriEnd ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 2, 0);
- return _uriEnd;
- }
-
- @override
- int get uriOffset {
- _uriOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 3, 0);
- return _uriOffset;
- }
-}
-
-abstract class _UnlinkedImportMixin implements idl.UnlinkedImport {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (annotations.isNotEmpty)
- _result["annotations"] =
- annotations.map((_value) => _value.toJson()).toList();
- if (combinators.isNotEmpty)
- _result["combinators"] =
- combinators.map((_value) => _value.toJson()).toList();
- if (configurations.isNotEmpty)
- _result["configurations"] =
- configurations.map((_value) => _value.toJson()).toList();
- if (isDeferred != false) _result["isDeferred"] = isDeferred;
- if (isImplicit != false) _result["isImplicit"] = isImplicit;
- if (offset != 0) _result["offset"] = offset;
- if (prefixOffset != 0) _result["prefixOffset"] = prefixOffset;
- if (prefixReference != 0) _result["prefixReference"] = prefixReference;
- if (uri != '') _result["uri"] = uri;
- if (uriEnd != 0) _result["uriEnd"] = uriEnd;
- if (uriOffset != 0) _result["uriOffset"] = uriOffset;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "annotations": annotations,
- "combinators": combinators,
- "configurations": configurations,
- "isDeferred": isDeferred,
- "isImplicit": isImplicit,
- "offset": offset,
- "prefixOffset": prefixOffset,
- "prefixReference": prefixReference,
- "uri": uri,
- "uriEnd": uriEnd,
- "uriOffset": uriOffset,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
class UnlinkedInformativeDataBuilder extends Object
with _UnlinkedInformativeDataMixin
implements idl.UnlinkedInformativeData {
@@ -25237,1453 +18315,33 @@
String toString() => convert.json.encode(toJson());
}
-class UnlinkedParamBuilder extends Object
- with _UnlinkedParamMixin
- implements idl.UnlinkedParam {
- List<UnlinkedExprBuilder> _annotations;
- CodeRangeBuilder _codeRange;
- String _defaultValueCode;
- int _inferredTypeSlot;
- int _inheritsCovariantSlot;
- UnlinkedExecutableBuilder _initializer;
- bool _isExplicitlyCovariant;
- bool _isFinal;
- bool _isFunctionTyped;
- bool _isInitializingFormal;
- idl.UnlinkedParamKind _kind;
- String _name;
- int _nameOffset;
- List<UnlinkedParamBuilder> _parameters;
- EntityRefBuilder _type;
- int _visibleLength;
- int _visibleOffset;
-
- @override
- List<UnlinkedExprBuilder> get annotations =>
- _annotations ??= <UnlinkedExprBuilder>[];
-
- /// Annotations for this parameter.
- set annotations(List<UnlinkedExprBuilder> value) {
- this._annotations = value;
- }
-
- @override
- CodeRangeBuilder get codeRange => _codeRange;
-
- /// Code range of the parameter.
- set codeRange(CodeRangeBuilder value) {
- this._codeRange = value;
- }
-
- @override
- String get defaultValueCode => _defaultValueCode ??= '';
-
- /// If the parameter has a default value, the source text of the constant
- /// expression in the default value. Otherwise the empty string.
- set defaultValueCode(String value) {
- this._defaultValueCode = value;
- }
-
- @override
- int get inferredTypeSlot => _inferredTypeSlot ??= 0;
-
- /// If this parameter's type is inferable, nonzero slot id identifying which
- /// entry in [LinkedLibrary.types] contains the inferred type. If there is no
- /// matching entry in [LinkedLibrary.types], then no type was inferred for
- /// this variable, so its static type is `dynamic`.
- ///
- /// Note that although strong mode considers initializing formals to be
- /// inferable, they are not marked as such in the summary; if their type is
- /// not specified, they always inherit the static type of the corresponding
- /// field.
- set inferredTypeSlot(int value) {
- assert(value == null || value >= 0);
- this._inferredTypeSlot = value;
- }
-
- @override
- int get inheritsCovariantSlot => _inheritsCovariantSlot ??= 0;
-
- /// If this is a parameter of an instance method, a nonzero slot id which is
- /// unique within this compilation unit. If this id is found in
- /// [LinkedUnit.parametersInheritingCovariant], then this parameter inherits
- /// `@covariant` behavior from a base class.
- ///
- /// Otherwise, zero.
- set inheritsCovariantSlot(int value) {
- assert(value == null || value >= 0);
- this._inheritsCovariantSlot = value;
- }
-
- @override
- UnlinkedExecutableBuilder get initializer => _initializer;
-
- /// The synthetic initializer function of the parameter. Absent if the
- /// variable does not have an initializer.
- set initializer(UnlinkedExecutableBuilder value) {
- this._initializer = value;
- }
-
- @override
- bool get isExplicitlyCovariant => _isExplicitlyCovariant ??= false;
-
- /// Indicates whether this parameter is explicitly marked as being covariant.
- set isExplicitlyCovariant(bool value) {
- this._isExplicitlyCovariant = value;
- }
-
- @override
- bool get isFinal => _isFinal ??= false;
-
- /// Indicates whether the parameter is declared using the `final` keyword.
- set isFinal(bool value) {
- this._isFinal = value;
- }
-
- @override
- bool get isFunctionTyped => _isFunctionTyped ??= false;
-
- /// Indicates whether this is a function-typed parameter. A parameter is
- /// function-typed if the declaration of the parameter has explicit formal
- /// parameters
- /// ```
- /// int functionTyped(int p)
- /// ```
- /// but is not function-typed if it does not, even if the type of the
- /// parameter is a function type.
- set isFunctionTyped(bool value) {
- this._isFunctionTyped = value;
- }
-
- @override
- bool get isInitializingFormal => _isInitializingFormal ??= false;
-
- /// Indicates whether this is an initializing formal parameter (i.e. it is
- /// declared using `this.` syntax).
- set isInitializingFormal(bool value) {
- this._isInitializingFormal = value;
- }
-
- @override
- idl.UnlinkedParamKind get kind =>
- _kind ??= idl.UnlinkedParamKind.requiredPositional;
-
- /// Kind of the parameter.
- set kind(idl.UnlinkedParamKind value) {
- this._kind = value;
- }
-
- @override
- String get name => _name ??= '';
-
- /// Name of the parameter.
- set name(String value) {
- this._name = value;
- }
-
- @override
- int get nameOffset => _nameOffset ??= 0;
-
- /// Offset of the parameter name relative to the beginning of the file.
- set nameOffset(int value) {
- assert(value == null || value >= 0);
- this._nameOffset = value;
- }
-
- @override
- List<UnlinkedParamBuilder> get parameters =>
- _parameters ??= <UnlinkedParamBuilder>[];
-
- /// If [isFunctionTyped] is `true`, the parameters of the function type.
- set parameters(List<UnlinkedParamBuilder> value) {
- this._parameters = value;
- }
-
- @override
- EntityRefBuilder get type => _type;
-
- /// If [isFunctionTyped] is `true`, the declared return type. If
- /// [isFunctionTyped] is `false`, the declared type. Absent if the type is
- /// implicit.
- set type(EntityRefBuilder value) {
- this._type = value;
- }
-
- @override
- int get visibleLength => _visibleLength ??= 0;
-
- /// The length of the visible range.
- set visibleLength(int value) {
- assert(value == null || value >= 0);
- this._visibleLength = value;
- }
-
- @override
- int get visibleOffset => _visibleOffset ??= 0;
-
- /// The beginning of the visible range.
- set visibleOffset(int value) {
- assert(value == null || value >= 0);
- this._visibleOffset = value;
- }
-
- UnlinkedParamBuilder(
- {List<UnlinkedExprBuilder> annotations,
- CodeRangeBuilder codeRange,
- String defaultValueCode,
- int inferredTypeSlot,
- int inheritsCovariantSlot,
- UnlinkedExecutableBuilder initializer,
- bool isExplicitlyCovariant,
- bool isFinal,
- bool isFunctionTyped,
- bool isInitializingFormal,
- idl.UnlinkedParamKind kind,
- String name,
- int nameOffset,
- List<UnlinkedParamBuilder> parameters,
- EntityRefBuilder type,
- int visibleLength,
- int visibleOffset})
- : _annotations = annotations,
- _codeRange = codeRange,
- _defaultValueCode = defaultValueCode,
- _inferredTypeSlot = inferredTypeSlot,
- _inheritsCovariantSlot = inheritsCovariantSlot,
- _initializer = initializer,
- _isExplicitlyCovariant = isExplicitlyCovariant,
- _isFinal = isFinal,
- _isFunctionTyped = isFunctionTyped,
- _isInitializingFormal = isInitializingFormal,
- _kind = kind,
- _name = name,
- _nameOffset = nameOffset,
- _parameters = parameters,
- _type = type,
- _visibleLength = visibleLength,
- _visibleOffset = visibleOffset;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _annotations?.forEach((b) => b.flushInformative());
- _codeRange = null;
- _defaultValueCode = null;
- _initializer?.flushInformative();
- _nameOffset = null;
- _parameters?.forEach((b) => b.flushInformative());
- _type?.flushInformative();
- _visibleLength = null;
- _visibleOffset = null;
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._name ?? '');
- signature.addInt(this._inferredTypeSlot ?? 0);
- signature.addBool(this._type != null);
- this._type?.collectApiSignature(signature);
- signature.addInt(this._kind == null ? 0 : this._kind.index);
- signature.addBool(this._isFunctionTyped == true);
- signature.addBool(this._isInitializingFormal == true);
- if (this._parameters == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._parameters.length);
- for (var x in this._parameters) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._annotations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._annotations.length);
- for (var x in this._annotations) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addBool(this._initializer != null);
- this._initializer?.collectApiSignature(signature);
- signature.addInt(this._inheritsCovariantSlot ?? 0);
- signature.addBool(this._isExplicitlyCovariant == true);
- signature.addBool(this._isFinal == true);
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_annotations;
- fb.Offset offset_codeRange;
- fb.Offset offset_defaultValueCode;
- fb.Offset offset_initializer;
- fb.Offset offset_name;
- fb.Offset offset_parameters;
- fb.Offset offset_type;
- if (!(_annotations == null || _annotations.isEmpty)) {
- offset_annotations = fbBuilder
- .writeList(_annotations.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_codeRange != null) {
- offset_codeRange = _codeRange.finish(fbBuilder);
- }
- if (_defaultValueCode != null) {
- offset_defaultValueCode = fbBuilder.writeString(_defaultValueCode);
- }
- if (_initializer != null) {
- offset_initializer = _initializer.finish(fbBuilder);
- }
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- if (!(_parameters == null || _parameters.isEmpty)) {
- offset_parameters = fbBuilder
- .writeList(_parameters.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_type != null) {
- offset_type = _type.finish(fbBuilder);
- }
- fbBuilder.startTable();
- if (offset_annotations != null) {
- fbBuilder.addOffset(9, offset_annotations);
- }
- if (offset_codeRange != null) {
- fbBuilder.addOffset(7, offset_codeRange);
- }
- if (offset_defaultValueCode != null) {
- fbBuilder.addOffset(13, offset_defaultValueCode);
- }
- if (_inferredTypeSlot != null && _inferredTypeSlot != 0) {
- fbBuilder.addUint32(2, _inferredTypeSlot);
- }
- if (_inheritsCovariantSlot != null && _inheritsCovariantSlot != 0) {
- fbBuilder.addUint32(14, _inheritsCovariantSlot);
- }
- if (offset_initializer != null) {
- fbBuilder.addOffset(12, offset_initializer);
- }
- if (_isExplicitlyCovariant == true) {
- fbBuilder.addBool(15, true);
- }
- if (_isFinal == true) {
- fbBuilder.addBool(16, true);
- }
- if (_isFunctionTyped == true) {
- fbBuilder.addBool(5, true);
- }
- if (_isInitializingFormal == true) {
- fbBuilder.addBool(6, true);
- }
- if (_kind != null && _kind != idl.UnlinkedParamKind.requiredPositional) {
- fbBuilder.addUint8(4, _kind.index);
- }
- if (offset_name != null) {
- fbBuilder.addOffset(0, offset_name);
- }
- if (_nameOffset != null && _nameOffset != 0) {
- fbBuilder.addUint32(1, _nameOffset);
- }
- if (offset_parameters != null) {
- fbBuilder.addOffset(8, offset_parameters);
- }
- if (offset_type != null) {
- fbBuilder.addOffset(3, offset_type);
- }
- if (_visibleLength != null && _visibleLength != 0) {
- fbBuilder.addUint32(10, _visibleLength);
- }
- if (_visibleOffset != null && _visibleOffset != 0) {
- fbBuilder.addUint32(11, _visibleOffset);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedParamReader extends fb.TableReader<_UnlinkedParamImpl> {
- const _UnlinkedParamReader();
-
- @override
- _UnlinkedParamImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedParamImpl(bc, offset);
-}
-
-class _UnlinkedParamImpl extends Object
- with _UnlinkedParamMixin
- implements idl.UnlinkedParam {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedParamImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExpr> _annotations;
- idl.CodeRange _codeRange;
- String _defaultValueCode;
- int _inferredTypeSlot;
- int _inheritsCovariantSlot;
- idl.UnlinkedExecutable _initializer;
- bool _isExplicitlyCovariant;
- bool _isFinal;
- bool _isFunctionTyped;
- bool _isInitializingFormal;
- idl.UnlinkedParamKind _kind;
- String _name;
- int _nameOffset;
- List<idl.UnlinkedParam> _parameters;
- idl.EntityRef _type;
- int _visibleLength;
- int _visibleOffset;
-
- @override
- List<idl.UnlinkedExpr> get annotations {
- _annotations ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 9, const <idl.UnlinkedExpr>[]);
- return _annotations;
- }
-
- @override
- idl.CodeRange get codeRange {
- _codeRange ??= const _CodeRangeReader().vTableGet(_bc, _bcOffset, 7, null);
- return _codeRange;
- }
-
- @override
- String get defaultValueCode {
- _defaultValueCode ??=
- const fb.StringReader().vTableGet(_bc, _bcOffset, 13, '');
- return _defaultValueCode;
- }
-
- @override
- int get inferredTypeSlot {
- _inferredTypeSlot ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 2, 0);
- return _inferredTypeSlot;
- }
-
- @override
- int get inheritsCovariantSlot {
- _inheritsCovariantSlot ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 14, 0);
- return _inheritsCovariantSlot;
- }
-
- @override
- idl.UnlinkedExecutable get initializer {
- _initializer ??=
- const _UnlinkedExecutableReader().vTableGet(_bc, _bcOffset, 12, null);
- return _initializer;
- }
-
- @override
- bool get isExplicitlyCovariant {
- _isExplicitlyCovariant ??=
- const fb.BoolReader().vTableGet(_bc, _bcOffset, 15, false);
- return _isExplicitlyCovariant;
- }
-
- @override
- bool get isFinal {
- _isFinal ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 16, false);
- return _isFinal;
- }
-
- @override
- bool get isFunctionTyped {
- _isFunctionTyped ??=
- const fb.BoolReader().vTableGet(_bc, _bcOffset, 5, false);
- return _isFunctionTyped;
- }
-
- @override
- bool get isInitializingFormal {
- _isInitializingFormal ??=
- const fb.BoolReader().vTableGet(_bc, _bcOffset, 6, false);
- return _isInitializingFormal;
- }
-
- @override
- idl.UnlinkedParamKind get kind {
- _kind ??= const _UnlinkedParamKindReader()
- .vTableGet(_bc, _bcOffset, 4, idl.UnlinkedParamKind.requiredPositional);
- return _kind;
- }
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _name;
- }
-
- @override
- int get nameOffset {
- _nameOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0);
- return _nameOffset;
- }
-
- @override
- List<idl.UnlinkedParam> get parameters {
- _parameters ??=
- const fb.ListReader<idl.UnlinkedParam>(const _UnlinkedParamReader())
- .vTableGet(_bc, _bcOffset, 8, const <idl.UnlinkedParam>[]);
- return _parameters;
- }
-
- @override
- idl.EntityRef get type {
- _type ??= const _EntityRefReader().vTableGet(_bc, _bcOffset, 3, null);
- return _type;
- }
-
- @override
- int get visibleLength {
- _visibleLength ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 10, 0);
- return _visibleLength;
- }
-
- @override
- int get visibleOffset {
- _visibleOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 11, 0);
- return _visibleOffset;
- }
-}
-
-abstract class _UnlinkedParamMixin implements idl.UnlinkedParam {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (annotations.isNotEmpty)
- _result["annotations"] =
- annotations.map((_value) => _value.toJson()).toList();
- if (codeRange != null) _result["codeRange"] = codeRange.toJson();
- if (defaultValueCode != '') _result["defaultValueCode"] = defaultValueCode;
- if (inferredTypeSlot != 0) _result["inferredTypeSlot"] = inferredTypeSlot;
- if (inheritsCovariantSlot != 0)
- _result["inheritsCovariantSlot"] = inheritsCovariantSlot;
- if (initializer != null) _result["initializer"] = initializer.toJson();
- if (isExplicitlyCovariant != false)
- _result["isExplicitlyCovariant"] = isExplicitlyCovariant;
- if (isFinal != false) _result["isFinal"] = isFinal;
- if (isFunctionTyped != false) _result["isFunctionTyped"] = isFunctionTyped;
- if (isInitializingFormal != false)
- _result["isInitializingFormal"] = isInitializingFormal;
- if (kind != idl.UnlinkedParamKind.requiredPositional)
- _result["kind"] = kind.toString().split('.')[1];
- if (name != '') _result["name"] = name;
- if (nameOffset != 0) _result["nameOffset"] = nameOffset;
- if (parameters.isNotEmpty)
- _result["parameters"] =
- parameters.map((_value) => _value.toJson()).toList();
- if (type != null) _result["type"] = type.toJson();
- if (visibleLength != 0) _result["visibleLength"] = visibleLength;
- if (visibleOffset != 0) _result["visibleOffset"] = visibleOffset;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "annotations": annotations,
- "codeRange": codeRange,
- "defaultValueCode": defaultValueCode,
- "inferredTypeSlot": inferredTypeSlot,
- "inheritsCovariantSlot": inheritsCovariantSlot,
- "initializer": initializer,
- "isExplicitlyCovariant": isExplicitlyCovariant,
- "isFinal": isFinal,
- "isFunctionTyped": isFunctionTyped,
- "isInitializingFormal": isInitializingFormal,
- "kind": kind,
- "name": name,
- "nameOffset": nameOffset,
- "parameters": parameters,
- "type": type,
- "visibleLength": visibleLength,
- "visibleOffset": visibleOffset,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedPartBuilder extends Object
- with _UnlinkedPartMixin
- implements idl.UnlinkedPart {
- List<UnlinkedExprBuilder> _annotations;
- int _uriEnd;
- int _uriOffset;
-
- @override
- List<UnlinkedExprBuilder> get annotations =>
- _annotations ??= <UnlinkedExprBuilder>[];
-
- /// Annotations for this part declaration.
- set annotations(List<UnlinkedExprBuilder> value) {
- this._annotations = value;
- }
-
- @override
- int get uriEnd => _uriEnd ??= 0;
-
- /// End of the URI string (including quotes) relative to the beginning of the
- /// file.
- set uriEnd(int value) {
- assert(value == null || value >= 0);
- this._uriEnd = value;
- }
-
- @override
- int get uriOffset => _uriOffset ??= 0;
-
- /// Offset of the URI string (including quotes) relative to the beginning of
- /// the file.
- set uriOffset(int value) {
- assert(value == null || value >= 0);
- this._uriOffset = value;
- }
-
- UnlinkedPartBuilder(
- {List<UnlinkedExprBuilder> annotations, int uriEnd, int uriOffset})
- : _annotations = annotations,
- _uriEnd = uriEnd,
- _uriOffset = uriOffset;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _annotations?.forEach((b) => b.flushInformative());
- _uriEnd = null;
- _uriOffset = null;
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- if (this._annotations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._annotations.length);
- for (var x in this._annotations) {
- x?.collectApiSignature(signature);
- }
- }
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_annotations;
- if (!(_annotations == null || _annotations.isEmpty)) {
- offset_annotations = fbBuilder
- .writeList(_annotations.map((b) => b.finish(fbBuilder)).toList());
- }
- fbBuilder.startTable();
- if (offset_annotations != null) {
- fbBuilder.addOffset(2, offset_annotations);
- }
- if (_uriEnd != null && _uriEnd != 0) {
- fbBuilder.addUint32(0, _uriEnd);
- }
- if (_uriOffset != null && _uriOffset != 0) {
- fbBuilder.addUint32(1, _uriOffset);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedPartReader extends fb.TableReader<_UnlinkedPartImpl> {
- const _UnlinkedPartReader();
-
- @override
- _UnlinkedPartImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedPartImpl(bc, offset);
-}
-
-class _UnlinkedPartImpl extends Object
- with _UnlinkedPartMixin
- implements idl.UnlinkedPart {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedPartImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExpr> _annotations;
- int _uriEnd;
- int _uriOffset;
-
- @override
- List<idl.UnlinkedExpr> get annotations {
- _annotations ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 2, const <idl.UnlinkedExpr>[]);
- return _annotations;
- }
-
- @override
- int get uriEnd {
- _uriEnd ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
- return _uriEnd;
- }
-
- @override
- int get uriOffset {
- _uriOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0);
- return _uriOffset;
- }
-}
-
-abstract class _UnlinkedPartMixin implements idl.UnlinkedPart {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (annotations.isNotEmpty)
- _result["annotations"] =
- annotations.map((_value) => _value.toJson()).toList();
- if (uriEnd != 0) _result["uriEnd"] = uriEnd;
- if (uriOffset != 0) _result["uriOffset"] = uriOffset;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "annotations": annotations,
- "uriEnd": uriEnd,
- "uriOffset": uriOffset,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedPublicNameBuilder extends Object
- with _UnlinkedPublicNameMixin
- implements idl.UnlinkedPublicName {
- idl.ReferenceKind _kind;
- List<UnlinkedPublicNameBuilder> _members;
- String _name;
- int _numTypeParameters;
-
- @override
- idl.ReferenceKind get kind => _kind ??= idl.ReferenceKind.classOrEnum;
-
- /// The kind of object referred to by the name.
- set kind(idl.ReferenceKind value) {
- this._kind = value;
- }
-
- @override
- List<UnlinkedPublicNameBuilder> get members =>
- _members ??= <UnlinkedPublicNameBuilder>[];
-
- /// If this [UnlinkedPublicName] is a class, the list of members which can be
- /// referenced statically - static fields, static methods, and constructors.
- /// Otherwise empty.
- ///
- /// Unnamed constructors are not included since they do not constitute a
- /// separate name added to any namespace.
- set members(List<UnlinkedPublicNameBuilder> value) {
- this._members = value;
- }
-
- @override
- String get name => _name ??= '';
-
- /// The name itself.
- set name(String value) {
- this._name = value;
- }
-
- @override
- int get numTypeParameters => _numTypeParameters ??= 0;
-
- /// If the entity being referred to is generic, the number of type parameters
- /// it accepts. Otherwise zero.
- set numTypeParameters(int value) {
- assert(value == null || value >= 0);
- this._numTypeParameters = value;
- }
-
- UnlinkedPublicNameBuilder(
- {idl.ReferenceKind kind,
- List<UnlinkedPublicNameBuilder> members,
- String name,
- int numTypeParameters})
- : _kind = kind,
- _members = members,
- _name = name,
- _numTypeParameters = numTypeParameters;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _members?.forEach((b) => b.flushInformative());
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._name ?? '');
- signature.addInt(this._kind == null ? 0 : this._kind.index);
- if (this._members == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._members.length);
- for (var x in this._members) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addInt(this._numTypeParameters ?? 0);
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_members;
- fb.Offset offset_name;
- if (!(_members == null || _members.isEmpty)) {
- offset_members = fbBuilder
- .writeList(_members.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- fbBuilder.startTable();
- if (_kind != null && _kind != idl.ReferenceKind.classOrEnum) {
- fbBuilder.addUint8(1, _kind.index);
- }
- if (offset_members != null) {
- fbBuilder.addOffset(2, offset_members);
- }
- if (offset_name != null) {
- fbBuilder.addOffset(0, offset_name);
- }
- if (_numTypeParameters != null && _numTypeParameters != 0) {
- fbBuilder.addUint32(3, _numTypeParameters);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedPublicNameReader
- extends fb.TableReader<_UnlinkedPublicNameImpl> {
- const _UnlinkedPublicNameReader();
-
- @override
- _UnlinkedPublicNameImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedPublicNameImpl(bc, offset);
-}
-
-class _UnlinkedPublicNameImpl extends Object
- with _UnlinkedPublicNameMixin
- implements idl.UnlinkedPublicName {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedPublicNameImpl(this._bc, this._bcOffset);
-
- idl.ReferenceKind _kind;
- List<idl.UnlinkedPublicName> _members;
- String _name;
- int _numTypeParameters;
-
- @override
- idl.ReferenceKind get kind {
- _kind ??= const _ReferenceKindReader()
- .vTableGet(_bc, _bcOffset, 1, idl.ReferenceKind.classOrEnum);
- return _kind;
- }
-
- @override
- List<idl.UnlinkedPublicName> get members {
- _members ??= const fb.ListReader<idl.UnlinkedPublicName>(
- const _UnlinkedPublicNameReader())
- .vTableGet(_bc, _bcOffset, 2, const <idl.UnlinkedPublicName>[]);
- return _members;
- }
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _name;
- }
-
- @override
- int get numTypeParameters {
- _numTypeParameters ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 3, 0);
- return _numTypeParameters;
- }
-}
-
-abstract class _UnlinkedPublicNameMixin implements idl.UnlinkedPublicName {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (kind != idl.ReferenceKind.classOrEnum)
- _result["kind"] = kind.toString().split('.')[1];
- if (members.isNotEmpty)
- _result["members"] = members.map((_value) => _value.toJson()).toList();
- if (name != '') _result["name"] = name;
- if (numTypeParameters != 0)
- _result["numTypeParameters"] = numTypeParameters;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "kind": kind,
- "members": members,
- "name": name,
- "numTypeParameters": numTypeParameters,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedPublicNamespaceBuilder extends Object
- with _UnlinkedPublicNamespaceMixin
- implements idl.UnlinkedPublicNamespace {
- List<UnlinkedExportPublicBuilder> _exports;
- List<UnlinkedPublicNameBuilder> _names;
- List<String> _parts;
-
- @override
- List<UnlinkedExportPublicBuilder> get exports =>
- _exports ??= <UnlinkedExportPublicBuilder>[];
-
- /// Export declarations in the compilation unit.
- set exports(List<UnlinkedExportPublicBuilder> value) {
- this._exports = value;
- }
-
- @override
- List<UnlinkedPublicNameBuilder> get names =>
- _names ??= <UnlinkedPublicNameBuilder>[];
-
- /// Public names defined in the compilation unit.
- ///
- /// TODO(paulberry): consider sorting these names to reduce unnecessary
- /// relinking.
- set names(List<UnlinkedPublicNameBuilder> value) {
- this._names = value;
- }
-
- @override
- List<String> get parts => _parts ??= <String>[];
-
- /// URIs referenced by part declarations in the compilation unit.
- set parts(List<String> value) {
- this._parts = value;
- }
-
- UnlinkedPublicNamespaceBuilder(
- {List<UnlinkedExportPublicBuilder> exports,
- List<UnlinkedPublicNameBuilder> names,
- List<String> parts})
- : _exports = exports,
- _names = names,
- _parts = parts;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _exports?.forEach((b) => b.flushInformative());
- _names?.forEach((b) => b.flushInformative());
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- if (this._names == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._names.length);
- for (var x in this._names) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._parts == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._parts.length);
- for (var x in this._parts) {
- signature.addString(x);
- }
- }
- if (this._exports == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._exports.length);
- for (var x in this._exports) {
- x?.collectApiSignature(signature);
- }
- }
- }
-
- List<int> toBuffer() {
- fb.Builder fbBuilder = new fb.Builder();
- return fbBuilder.finish(finish(fbBuilder), "UPNS");
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_exports;
- fb.Offset offset_names;
- fb.Offset offset_parts;
- if (!(_exports == null || _exports.isEmpty)) {
- offset_exports = fbBuilder
- .writeList(_exports.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_names == null || _names.isEmpty)) {
- offset_names =
- fbBuilder.writeList(_names.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_parts == null || _parts.isEmpty)) {
- offset_parts = fbBuilder
- .writeList(_parts.map((b) => fbBuilder.writeString(b)).toList());
- }
- fbBuilder.startTable();
- if (offset_exports != null) {
- fbBuilder.addOffset(2, offset_exports);
- }
- if (offset_names != null) {
- fbBuilder.addOffset(0, offset_names);
- }
- if (offset_parts != null) {
- fbBuilder.addOffset(1, offset_parts);
- }
- return fbBuilder.endTable();
- }
-}
-
-idl.UnlinkedPublicNamespace readUnlinkedPublicNamespace(List<int> buffer) {
- fb.BufferContext rootRef = new fb.BufferContext.fromBytes(buffer);
- return const _UnlinkedPublicNamespaceReader().read(rootRef, 0);
-}
-
-class _UnlinkedPublicNamespaceReader
- extends fb.TableReader<_UnlinkedPublicNamespaceImpl> {
- const _UnlinkedPublicNamespaceReader();
-
- @override
- _UnlinkedPublicNamespaceImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedPublicNamespaceImpl(bc, offset);
-}
-
-class _UnlinkedPublicNamespaceImpl extends Object
- with _UnlinkedPublicNamespaceMixin
- implements idl.UnlinkedPublicNamespace {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedPublicNamespaceImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExportPublic> _exports;
- List<idl.UnlinkedPublicName> _names;
- List<String> _parts;
-
- @override
- List<idl.UnlinkedExportPublic> get exports {
- _exports ??= const fb.ListReader<idl.UnlinkedExportPublic>(
- const _UnlinkedExportPublicReader())
- .vTableGet(_bc, _bcOffset, 2, const <idl.UnlinkedExportPublic>[]);
- return _exports;
- }
-
- @override
- List<idl.UnlinkedPublicName> get names {
- _names ??= const fb.ListReader<idl.UnlinkedPublicName>(
- const _UnlinkedPublicNameReader())
- .vTableGet(_bc, _bcOffset, 0, const <idl.UnlinkedPublicName>[]);
- return _names;
- }
-
- @override
- List<String> get parts {
- _parts ??= const fb.ListReader<String>(const fb.StringReader())
- .vTableGet(_bc, _bcOffset, 1, const <String>[]);
- return _parts;
- }
-}
-
-abstract class _UnlinkedPublicNamespaceMixin
- implements idl.UnlinkedPublicNamespace {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (exports.isNotEmpty)
- _result["exports"] = exports.map((_value) => _value.toJson()).toList();
- if (names.isNotEmpty)
- _result["names"] = names.map((_value) => _value.toJson()).toList();
- if (parts.isNotEmpty) _result["parts"] = parts;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "exports": exports,
- "names": names,
- "parts": parts,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedReferenceBuilder extends Object
- with _UnlinkedReferenceMixin
- implements idl.UnlinkedReference {
- String _name;
- int _prefixReference;
-
- @override
- String get name => _name ??= '';
-
- /// Name of the entity being referred to. For the pseudo-type `dynamic`, the
- /// string is "dynamic". For the pseudo-type `void`, the string is "void".
- /// For the pseudo-type `bottom`, the string is "*bottom*".
- set name(String value) {
- this._name = value;
- }
-
- @override
- int get prefixReference => _prefixReference ??= 0;
-
- /// Prefix used to refer to the entity, or zero if no prefix is used. This is
- /// an index into [UnlinkedUnit.references].
- ///
- /// Prefix references must always point backward; that is, for all i, if
- /// UnlinkedUnit.references[i].prefixReference != 0, then
- /// UnlinkedUnit.references[i].prefixReference < i.
- set prefixReference(int value) {
- assert(value == null || value >= 0);
- this._prefixReference = value;
- }
-
- UnlinkedReferenceBuilder({String name, int prefixReference})
- : _name = name,
- _prefixReference = prefixReference;
-
- /// Flush [informative] data recursively.
- void flushInformative() {}
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._name ?? '');
- signature.addInt(this._prefixReference ?? 0);
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_name;
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- fbBuilder.startTable();
- if (offset_name != null) {
- fbBuilder.addOffset(0, offset_name);
- }
- if (_prefixReference != null && _prefixReference != 0) {
- fbBuilder.addUint32(1, _prefixReference);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedReferenceReader extends fb.TableReader<_UnlinkedReferenceImpl> {
- const _UnlinkedReferenceReader();
-
- @override
- _UnlinkedReferenceImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedReferenceImpl(bc, offset);
-}
-
-class _UnlinkedReferenceImpl extends Object
- with _UnlinkedReferenceMixin
- implements idl.UnlinkedReference {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedReferenceImpl(this._bc, this._bcOffset);
-
- String _name;
- int _prefixReference;
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _name;
- }
-
- @override
- int get prefixReference {
- _prefixReference ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0);
- return _prefixReference;
- }
-}
-
-abstract class _UnlinkedReferenceMixin implements idl.UnlinkedReference {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (name != '') _result["name"] = name;
- if (prefixReference != 0) _result["prefixReference"] = prefixReference;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "name": name,
- "prefixReference": prefixReference,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
class UnlinkedTokensBuilder extends Object
with _UnlinkedTokensMixin
implements idl.UnlinkedTokens {
- List<int> _endGroup;
- List<bool> _isSynthetic;
- List<idl.UnlinkedTokenKind> _kind;
- List<int> _length;
- List<String> _lexeme;
- List<int> _next;
- List<int> _offset;
- List<int> _precedingComment;
- List<idl.UnlinkedTokenType> _type;
+ int _placeholder;
@override
- List<int> get endGroup => _endGroup ??= <int>[];
+ int get placeholder => _placeholder ??= 0;
- /// The token that corresponds to this token, or `0` if this token is not
- /// the first of a pair of matching tokens (such as parentheses).
- set endGroup(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._endGroup = value;
+ set placeholder(int value) {
+ assert(value == null || value >= 0);
+ this._placeholder = value;
}
- @override
- List<bool> get isSynthetic => _isSynthetic ??= <bool>[];
-
- /// Return `true` if this token is a synthetic token. A synthetic token is a
- /// token that was introduced by the parser in order to recover from an error
- /// in the code.
- set isSynthetic(List<bool> value) {
- this._isSynthetic = value;
- }
-
- @override
- List<idl.UnlinkedTokenKind> get kind => _kind ??= <idl.UnlinkedTokenKind>[];
-
- set kind(List<idl.UnlinkedTokenKind> value) {
- this._kind = value;
- }
-
- @override
- List<int> get length => _length ??= <int>[];
-
- set length(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._length = value;
- }
-
- @override
- List<String> get lexeme => _lexeme ??= <String>[];
-
- set lexeme(List<String> value) {
- this._lexeme = value;
- }
-
- @override
- List<int> get next => _next ??= <int>[];
-
- /// The next token in the token stream, `0` for [UnlinkedTokenType.EOF] or
- /// the last comment token.
- set next(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._next = value;
- }
-
- @override
- List<int> get offset => _offset ??= <int>[];
-
- set offset(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._offset = value;
- }
-
- @override
- List<int> get precedingComment => _precedingComment ??= <int>[];
-
- /// The first comment token in the list of comments that precede this token,
- /// or `0` if there are no comments preceding this token. Additional comments
- /// can be reached by following the token stream using [next] until `0` is
- /// reached.
- set precedingComment(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._precedingComment = value;
- }
-
- @override
- List<idl.UnlinkedTokenType> get type => _type ??= <idl.UnlinkedTokenType>[];
-
- set type(List<idl.UnlinkedTokenType> value) {
- this._type = value;
- }
-
- UnlinkedTokensBuilder(
- {List<int> endGroup,
- List<bool> isSynthetic,
- List<idl.UnlinkedTokenKind> kind,
- List<int> length,
- List<String> lexeme,
- List<int> next,
- List<int> offset,
- List<int> precedingComment,
- List<idl.UnlinkedTokenType> type})
- : _endGroup = endGroup,
- _isSynthetic = isSynthetic,
- _kind = kind,
- _length = length,
- _lexeme = lexeme,
- _next = next,
- _offset = offset,
- _precedingComment = precedingComment,
- _type = type;
+ UnlinkedTokensBuilder({int placeholder}) : _placeholder = placeholder;
/// Flush [informative] data recursively.
void flushInformative() {}
/// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
- if (this._endGroup == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._endGroup.length);
- for (var x in this._endGroup) {
- signature.addInt(x);
- }
- }
- if (this._isSynthetic == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._isSynthetic.length);
- for (var x in this._isSynthetic) {
- signature.addBool(x);
- }
- }
- if (this._kind == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._kind.length);
- for (var x in this._kind) {
- signature.addInt(x.index);
- }
- }
- if (this._length == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._length.length);
- for (var x in this._length) {
- signature.addInt(x);
- }
- }
- if (this._lexeme == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._lexeme.length);
- for (var x in this._lexeme) {
- signature.addString(x);
- }
- }
- if (this._next == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._next.length);
- for (var x in this._next) {
- signature.addInt(x);
- }
- }
- if (this._offset == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._offset.length);
- for (var x in this._offset) {
- signature.addInt(x);
- }
- }
- if (this._precedingComment == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._precedingComment.length);
- for (var x in this._precedingComment) {
- signature.addInt(x);
- }
- }
- if (this._type == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._type.length);
- for (var x in this._type) {
- signature.addInt(x.index);
- }
- }
+ signature.addInt(this._placeholder ?? 0);
}
fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_endGroup;
- fb.Offset offset_isSynthetic;
- fb.Offset offset_kind;
- fb.Offset offset_length;
- fb.Offset offset_lexeme;
- fb.Offset offset_next;
- fb.Offset offset_offset;
- fb.Offset offset_precedingComment;
- fb.Offset offset_type;
- if (!(_endGroup == null || _endGroup.isEmpty)) {
- offset_endGroup = fbBuilder.writeListUint32(_endGroup);
- }
- if (!(_isSynthetic == null || _isSynthetic.isEmpty)) {
- offset_isSynthetic = fbBuilder.writeListBool(_isSynthetic);
- }
- if (!(_kind == null || _kind.isEmpty)) {
- offset_kind =
- fbBuilder.writeListUint8(_kind.map((b) => b.index).toList());
- }
- if (!(_length == null || _length.isEmpty)) {
- offset_length = fbBuilder.writeListUint32(_length);
- }
- if (!(_lexeme == null || _lexeme.isEmpty)) {
- offset_lexeme = fbBuilder
- .writeList(_lexeme.map((b) => fbBuilder.writeString(b)).toList());
- }
- if (!(_next == null || _next.isEmpty)) {
- offset_next = fbBuilder.writeListUint32(_next);
- }
- if (!(_offset == null || _offset.isEmpty)) {
- offset_offset = fbBuilder.writeListUint32(_offset);
- }
- if (!(_precedingComment == null || _precedingComment.isEmpty)) {
- offset_precedingComment = fbBuilder.writeListUint32(_precedingComment);
- }
- if (!(_type == null || _type.isEmpty)) {
- offset_type =
- fbBuilder.writeListUint8(_type.map((b) => b.index).toList());
- }
fbBuilder.startTable();
- if (offset_endGroup != null) {
- fbBuilder.addOffset(0, offset_endGroup);
- }
- if (offset_isSynthetic != null) {
- fbBuilder.addOffset(1, offset_isSynthetic);
- }
- if (offset_kind != null) {
- fbBuilder.addOffset(2, offset_kind);
- }
- if (offset_length != null) {
- fbBuilder.addOffset(3, offset_length);
- }
- if (offset_lexeme != null) {
- fbBuilder.addOffset(4, offset_lexeme);
- }
- if (offset_next != null) {
- fbBuilder.addOffset(5, offset_next);
- }
- if (offset_offset != null) {
- fbBuilder.addOffset(6, offset_offset);
- }
- if (offset_precedingComment != null) {
- fbBuilder.addOffset(7, offset_precedingComment);
- }
- if (offset_type != null) {
- fbBuilder.addOffset(8, offset_type);
+ if (_placeholder != null && _placeholder != 0) {
+ fbBuilder.addUint32(0, _placeholder);
}
return fbBuilder.endTable();
}
@@ -26705,79 +18363,12 @@
_UnlinkedTokensImpl(this._bc, this._bcOffset);
- List<int> _endGroup;
- List<bool> _isSynthetic;
- List<idl.UnlinkedTokenKind> _kind;
- List<int> _length;
- List<String> _lexeme;
- List<int> _next;
- List<int> _offset;
- List<int> _precedingComment;
- List<idl.UnlinkedTokenType> _type;
+ int _placeholder;
@override
- List<int> get endGroup {
- _endGroup ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 0, const <int>[]);
- return _endGroup;
- }
-
- @override
- List<bool> get isSynthetic {
- _isSynthetic ??=
- const fb.BoolListReader().vTableGet(_bc, _bcOffset, 1, const <bool>[]);
- return _isSynthetic;
- }
-
- @override
- List<idl.UnlinkedTokenKind> get kind {
- _kind ??= const fb.ListReader<idl.UnlinkedTokenKind>(
- const _UnlinkedTokenKindReader())
- .vTableGet(_bc, _bcOffset, 2, const <idl.UnlinkedTokenKind>[]);
- return _kind;
- }
-
- @override
- List<int> get length {
- _length ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 3, const <int>[]);
- return _length;
- }
-
- @override
- List<String> get lexeme {
- _lexeme ??= const fb.ListReader<String>(const fb.StringReader())
- .vTableGet(_bc, _bcOffset, 4, const <String>[]);
- return _lexeme;
- }
-
- @override
- List<int> get next {
- _next ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 5, const <int>[]);
- return _next;
- }
-
- @override
- List<int> get offset {
- _offset ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 6, const <int>[]);
- return _offset;
- }
-
- @override
- List<int> get precedingComment {
- _precedingComment ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 7, const <int>[]);
- return _precedingComment;
- }
-
- @override
- List<idl.UnlinkedTokenType> get type {
- _type ??= const fb.ListReader<idl.UnlinkedTokenType>(
- const _UnlinkedTokenTypeReader())
- .vTableGet(_bc, _bcOffset, 8, const <idl.UnlinkedTokenType>[]);
- return _type;
+ int get placeholder {
+ _placeholder ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
+ return _placeholder;
}
}
@@ -26785,624 +18376,13 @@
@override
Map<String, Object> toJson() {
Map<String, Object> _result = <String, Object>{};
- if (endGroup.isNotEmpty) _result["endGroup"] = endGroup;
- if (isSynthetic.isNotEmpty) _result["isSynthetic"] = isSynthetic;
- if (kind.isNotEmpty)
- _result["kind"] =
- kind.map((_value) => _value.toString().split('.')[1]).toList();
- if (length.isNotEmpty) _result["length"] = length;
- if (lexeme.isNotEmpty) _result["lexeme"] = lexeme;
- if (next.isNotEmpty) _result["next"] = next;
- if (offset.isNotEmpty) _result["offset"] = offset;
- if (precedingComment.isNotEmpty)
- _result["precedingComment"] = precedingComment;
- if (type.isNotEmpty)
- _result["type"] =
- type.map((_value) => _value.toString().split('.')[1]).toList();
+ if (placeholder != 0) _result["placeholder"] = placeholder;
return _result;
}
@override
Map<String, Object> toMap() => {
- "endGroup": endGroup,
- "isSynthetic": isSynthetic,
- "kind": kind,
- "length": length,
- "lexeme": lexeme,
- "next": next,
- "offset": offset,
- "precedingComment": precedingComment,
- "type": type,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedTypedefBuilder extends Object
- with _UnlinkedTypedefMixin
- implements idl.UnlinkedTypedef {
- List<UnlinkedExprBuilder> _annotations;
- CodeRangeBuilder _codeRange;
- UnlinkedDocumentationCommentBuilder _documentationComment;
- String _name;
- int _nameOffset;
- int _notSimplyBoundedSlot;
- List<UnlinkedParamBuilder> _parameters;
- EntityRefBuilder _returnType;
- idl.TypedefStyle _style;
- List<UnlinkedTypeParamBuilder> _typeParameters;
-
- @override
- List<UnlinkedExprBuilder> get annotations =>
- _annotations ??= <UnlinkedExprBuilder>[];
-
- /// Annotations for this typedef.
- set annotations(List<UnlinkedExprBuilder> value) {
- this._annotations = value;
- }
-
- @override
- CodeRangeBuilder get codeRange => _codeRange;
-
- /// Code range of the typedef.
- set codeRange(CodeRangeBuilder value) {
- this._codeRange = value;
- }
-
- @override
- UnlinkedDocumentationCommentBuilder get documentationComment =>
- _documentationComment;
-
- /// Documentation comment for the typedef, or `null` if there is no
- /// documentation comment.
- set documentationComment(UnlinkedDocumentationCommentBuilder value) {
- this._documentationComment = value;
- }
-
- @override
- String get name => _name ??= '';
-
- /// Name of the typedef.
- set name(String value) {
- this._name = value;
- }
-
- @override
- int get nameOffset => _nameOffset ??= 0;
-
- /// Offset of the typedef name relative to the beginning of the file.
- set nameOffset(int value) {
- assert(value == null || value >= 0);
- this._nameOffset = value;
- }
-
- @override
- int get notSimplyBoundedSlot => _notSimplyBoundedSlot ??= 0;
-
- /// If the typedef might not be simply bounded, a nonzero slot id which is
- /// unique within this compilation unit. If this id is found in
- /// [LinkedUnit.notSimplyBounded], then at least one of this typedef's type
- /// parameters is not simply bounded, hence this typedef can't be used as a
- /// raw type when specifying the bound of a type parameter.
- ///
- /// Otherwise, zero.
- set notSimplyBoundedSlot(int value) {
- assert(value == null || value >= 0);
- this._notSimplyBoundedSlot = value;
- }
-
- @override
- List<UnlinkedParamBuilder> get parameters =>
- _parameters ??= <UnlinkedParamBuilder>[];
-
- /// Parameters of the executable, if any.
- set parameters(List<UnlinkedParamBuilder> value) {
- this._parameters = value;
- }
-
- @override
- EntityRefBuilder get returnType => _returnType;
-
- /// If [style] is [TypedefStyle.functionType], the return type of the typedef.
- /// If [style] is [TypedefStyle.genericFunctionType], the function type being
- /// defined.
- set returnType(EntityRefBuilder value) {
- this._returnType = value;
- }
-
- @override
- idl.TypedefStyle get style => _style ??= idl.TypedefStyle.functionType;
-
- /// The style of the typedef.
- set style(idl.TypedefStyle value) {
- this._style = value;
- }
-
- @override
- List<UnlinkedTypeParamBuilder> get typeParameters =>
- _typeParameters ??= <UnlinkedTypeParamBuilder>[];
-
- /// Type parameters of the typedef, if any.
- set typeParameters(List<UnlinkedTypeParamBuilder> value) {
- this._typeParameters = value;
- }
-
- UnlinkedTypedefBuilder(
- {List<UnlinkedExprBuilder> annotations,
- CodeRangeBuilder codeRange,
- UnlinkedDocumentationCommentBuilder documentationComment,
- String name,
- int nameOffset,
- int notSimplyBoundedSlot,
- List<UnlinkedParamBuilder> parameters,
- EntityRefBuilder returnType,
- idl.TypedefStyle style,
- List<UnlinkedTypeParamBuilder> typeParameters})
- : _annotations = annotations,
- _codeRange = codeRange,
- _documentationComment = documentationComment,
- _name = name,
- _nameOffset = nameOffset,
- _notSimplyBoundedSlot = notSimplyBoundedSlot,
- _parameters = parameters,
- _returnType = returnType,
- _style = style,
- _typeParameters = typeParameters;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _annotations?.forEach((b) => b.flushInformative());
- _codeRange = null;
- _documentationComment = null;
- _nameOffset = null;
- _parameters?.forEach((b) => b.flushInformative());
- _returnType?.flushInformative();
- _typeParameters?.forEach((b) => b.flushInformative());
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._name ?? '');
- signature.addBool(this._returnType != null);
- this._returnType?.collectApiSignature(signature);
- if (this._parameters == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._parameters.length);
- for (var x in this._parameters) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._annotations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._annotations.length);
- for (var x in this._annotations) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._typeParameters == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._typeParameters.length);
- for (var x in this._typeParameters) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addInt(this._style == null ? 0 : this._style.index);
- signature.addInt(this._notSimplyBoundedSlot ?? 0);
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_annotations;
- fb.Offset offset_codeRange;
- fb.Offset offset_documentationComment;
- fb.Offset offset_name;
- fb.Offset offset_parameters;
- fb.Offset offset_returnType;
- fb.Offset offset_typeParameters;
- if (!(_annotations == null || _annotations.isEmpty)) {
- offset_annotations = fbBuilder
- .writeList(_annotations.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_codeRange != null) {
- offset_codeRange = _codeRange.finish(fbBuilder);
- }
- if (_documentationComment != null) {
- offset_documentationComment = _documentationComment.finish(fbBuilder);
- }
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- if (!(_parameters == null || _parameters.isEmpty)) {
- offset_parameters = fbBuilder
- .writeList(_parameters.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_returnType != null) {
- offset_returnType = _returnType.finish(fbBuilder);
- }
- if (!(_typeParameters == null || _typeParameters.isEmpty)) {
- offset_typeParameters = fbBuilder
- .writeList(_typeParameters.map((b) => b.finish(fbBuilder)).toList());
- }
- fbBuilder.startTable();
- if (offset_annotations != null) {
- fbBuilder.addOffset(4, offset_annotations);
- }
- if (offset_codeRange != null) {
- fbBuilder.addOffset(7, offset_codeRange);
- }
- if (offset_documentationComment != null) {
- fbBuilder.addOffset(6, offset_documentationComment);
- }
- if (offset_name != null) {
- fbBuilder.addOffset(0, offset_name);
- }
- if (_nameOffset != null && _nameOffset != 0) {
- fbBuilder.addUint32(1, _nameOffset);
- }
- if (_notSimplyBoundedSlot != null && _notSimplyBoundedSlot != 0) {
- fbBuilder.addUint32(9, _notSimplyBoundedSlot);
- }
- if (offset_parameters != null) {
- fbBuilder.addOffset(3, offset_parameters);
- }
- if (offset_returnType != null) {
- fbBuilder.addOffset(2, offset_returnType);
- }
- if (_style != null && _style != idl.TypedefStyle.functionType) {
- fbBuilder.addUint8(8, _style.index);
- }
- if (offset_typeParameters != null) {
- fbBuilder.addOffset(5, offset_typeParameters);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedTypedefReader extends fb.TableReader<_UnlinkedTypedefImpl> {
- const _UnlinkedTypedefReader();
-
- @override
- _UnlinkedTypedefImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedTypedefImpl(bc, offset);
-}
-
-class _UnlinkedTypedefImpl extends Object
- with _UnlinkedTypedefMixin
- implements idl.UnlinkedTypedef {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedTypedefImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExpr> _annotations;
- idl.CodeRange _codeRange;
- idl.UnlinkedDocumentationComment _documentationComment;
- String _name;
- int _nameOffset;
- int _notSimplyBoundedSlot;
- List<idl.UnlinkedParam> _parameters;
- idl.EntityRef _returnType;
- idl.TypedefStyle _style;
- List<idl.UnlinkedTypeParam> _typeParameters;
-
- @override
- List<idl.UnlinkedExpr> get annotations {
- _annotations ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 4, const <idl.UnlinkedExpr>[]);
- return _annotations;
- }
-
- @override
- idl.CodeRange get codeRange {
- _codeRange ??= const _CodeRangeReader().vTableGet(_bc, _bcOffset, 7, null);
- return _codeRange;
- }
-
- @override
- idl.UnlinkedDocumentationComment get documentationComment {
- _documentationComment ??= const _UnlinkedDocumentationCommentReader()
- .vTableGet(_bc, _bcOffset, 6, null);
- return _documentationComment;
- }
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _name;
- }
-
- @override
- int get nameOffset {
- _nameOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0);
- return _nameOffset;
- }
-
- @override
- int get notSimplyBoundedSlot {
- _notSimplyBoundedSlot ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 9, 0);
- return _notSimplyBoundedSlot;
- }
-
- @override
- List<idl.UnlinkedParam> get parameters {
- _parameters ??=
- const fb.ListReader<idl.UnlinkedParam>(const _UnlinkedParamReader())
- .vTableGet(_bc, _bcOffset, 3, const <idl.UnlinkedParam>[]);
- return _parameters;
- }
-
- @override
- idl.EntityRef get returnType {
- _returnType ??= const _EntityRefReader().vTableGet(_bc, _bcOffset, 2, null);
- return _returnType;
- }
-
- @override
- idl.TypedefStyle get style {
- _style ??= const _TypedefStyleReader()
- .vTableGet(_bc, _bcOffset, 8, idl.TypedefStyle.functionType);
- return _style;
- }
-
- @override
- List<idl.UnlinkedTypeParam> get typeParameters {
- _typeParameters ??= const fb.ListReader<idl.UnlinkedTypeParam>(
- const _UnlinkedTypeParamReader())
- .vTableGet(_bc, _bcOffset, 5, const <idl.UnlinkedTypeParam>[]);
- return _typeParameters;
- }
-}
-
-abstract class _UnlinkedTypedefMixin implements idl.UnlinkedTypedef {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (annotations.isNotEmpty)
- _result["annotations"] =
- annotations.map((_value) => _value.toJson()).toList();
- if (codeRange != null) _result["codeRange"] = codeRange.toJson();
- if (documentationComment != null)
- _result["documentationComment"] = documentationComment.toJson();
- if (name != '') _result["name"] = name;
- if (nameOffset != 0) _result["nameOffset"] = nameOffset;
- if (notSimplyBoundedSlot != 0)
- _result["notSimplyBoundedSlot"] = notSimplyBoundedSlot;
- if (parameters.isNotEmpty)
- _result["parameters"] =
- parameters.map((_value) => _value.toJson()).toList();
- if (returnType != null) _result["returnType"] = returnType.toJson();
- if (style != idl.TypedefStyle.functionType)
- _result["style"] = style.toString().split('.')[1];
- if (typeParameters.isNotEmpty)
- _result["typeParameters"] =
- typeParameters.map((_value) => _value.toJson()).toList();
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "annotations": annotations,
- "codeRange": codeRange,
- "documentationComment": documentationComment,
- "name": name,
- "nameOffset": nameOffset,
- "notSimplyBoundedSlot": notSimplyBoundedSlot,
- "parameters": parameters,
- "returnType": returnType,
- "style": style,
- "typeParameters": typeParameters,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
-
-class UnlinkedTypeParamBuilder extends Object
- with _UnlinkedTypeParamMixin
- implements idl.UnlinkedTypeParam {
- List<UnlinkedExprBuilder> _annotations;
- EntityRefBuilder _bound;
- CodeRangeBuilder _codeRange;
- String _name;
- int _nameOffset;
-
- @override
- List<UnlinkedExprBuilder> get annotations =>
- _annotations ??= <UnlinkedExprBuilder>[];
-
- /// Annotations for this type parameter.
- set annotations(List<UnlinkedExprBuilder> value) {
- this._annotations = value;
- }
-
- @override
- EntityRefBuilder get bound => _bound;
-
- /// Bound of the type parameter, if a bound is explicitly declared. Otherwise
- /// null.
- set bound(EntityRefBuilder value) {
- this._bound = value;
- }
-
- @override
- CodeRangeBuilder get codeRange => _codeRange;
-
- /// Code range of the type parameter.
- set codeRange(CodeRangeBuilder value) {
- this._codeRange = value;
- }
-
- @override
- String get name => _name ??= '';
-
- /// Name of the type parameter.
- set name(String value) {
- this._name = value;
- }
-
- @override
- int get nameOffset => _nameOffset ??= 0;
-
- /// Offset of the type parameter name relative to the beginning of the file.
- set nameOffset(int value) {
- assert(value == null || value >= 0);
- this._nameOffset = value;
- }
-
- UnlinkedTypeParamBuilder(
- {List<UnlinkedExprBuilder> annotations,
- EntityRefBuilder bound,
- CodeRangeBuilder codeRange,
- String name,
- int nameOffset})
- : _annotations = annotations,
- _bound = bound,
- _codeRange = codeRange,
- _name = name,
- _nameOffset = nameOffset;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _annotations?.forEach((b) => b.flushInformative());
- _bound?.flushInformative();
- _codeRange = null;
- _nameOffset = null;
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._name ?? '');
- signature.addBool(this._bound != null);
- this._bound?.collectApiSignature(signature);
- if (this._annotations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._annotations.length);
- for (var x in this._annotations) {
- x?.collectApiSignature(signature);
- }
- }
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_annotations;
- fb.Offset offset_bound;
- fb.Offset offset_codeRange;
- fb.Offset offset_name;
- if (!(_annotations == null || _annotations.isEmpty)) {
- offset_annotations = fbBuilder
- .writeList(_annotations.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_bound != null) {
- offset_bound = _bound.finish(fbBuilder);
- }
- if (_codeRange != null) {
- offset_codeRange = _codeRange.finish(fbBuilder);
- }
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- fbBuilder.startTable();
- if (offset_annotations != null) {
- fbBuilder.addOffset(3, offset_annotations);
- }
- if (offset_bound != null) {
- fbBuilder.addOffset(2, offset_bound);
- }
- if (offset_codeRange != null) {
- fbBuilder.addOffset(4, offset_codeRange);
- }
- if (offset_name != null) {
- fbBuilder.addOffset(0, offset_name);
- }
- if (_nameOffset != null && _nameOffset != 0) {
- fbBuilder.addUint32(1, _nameOffset);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedTypeParamReader extends fb.TableReader<_UnlinkedTypeParamImpl> {
- const _UnlinkedTypeParamReader();
-
- @override
- _UnlinkedTypeParamImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedTypeParamImpl(bc, offset);
-}
-
-class _UnlinkedTypeParamImpl extends Object
- with _UnlinkedTypeParamMixin
- implements idl.UnlinkedTypeParam {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedTypeParamImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExpr> _annotations;
- idl.EntityRef _bound;
- idl.CodeRange _codeRange;
- String _name;
- int _nameOffset;
-
- @override
- List<idl.UnlinkedExpr> get annotations {
- _annotations ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 3, const <idl.UnlinkedExpr>[]);
- return _annotations;
- }
-
- @override
- idl.EntityRef get bound {
- _bound ??= const _EntityRefReader().vTableGet(_bc, _bcOffset, 2, null);
- return _bound;
- }
-
- @override
- idl.CodeRange get codeRange {
- _codeRange ??= const _CodeRangeReader().vTableGet(_bc, _bcOffset, 4, null);
- return _codeRange;
- }
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _name;
- }
-
- @override
- int get nameOffset {
- _nameOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0);
- return _nameOffset;
- }
-}
-
-abstract class _UnlinkedTypeParamMixin implements idl.UnlinkedTypeParam {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (annotations.isNotEmpty)
- _result["annotations"] =
- annotations.map((_value) => _value.toJson()).toList();
- if (bound != null) _result["bound"] = bound.toJson();
- if (codeRange != null) _result["codeRange"] = codeRange.toJson();
- if (name != '') _result["name"] = name;
- if (nameOffset != 0) _result["nameOffset"] = nameOffset;
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "annotations": annotations,
- "bound": bound,
- "codeRange": codeRange,
- "name": name,
- "nameOffset": nameOffset,
+ "placeholder": placeholder,
};
@override
@@ -27412,582 +18392,35 @@
class UnlinkedUnitBuilder extends Object
with _UnlinkedUnitMixin
implements idl.UnlinkedUnit {
- List<int> _apiSignature;
- List<UnlinkedClassBuilder> _classes;
- CodeRangeBuilder _codeRange;
- List<UnlinkedEnumBuilder> _enums;
- List<UnlinkedExecutableBuilder> _executables;
- List<UnlinkedExportNonPublicBuilder> _exports;
- List<UnlinkedExtensionBuilder> _extensions;
- List<UnlinkedImportBuilder> _imports;
- bool _isNNBD;
- bool _isPartOf;
- List<UnlinkedExprBuilder> _libraryAnnotations;
- UnlinkedDocumentationCommentBuilder _libraryDocumentationComment;
- String _libraryName;
- int _libraryNameLength;
- int _libraryNameOffset;
- List<int> _lineStarts;
- List<UnlinkedClassBuilder> _mixins;
- List<UnlinkedPartBuilder> _parts;
- UnlinkedPublicNamespaceBuilder _publicNamespace;
- List<UnlinkedReferenceBuilder> _references;
- List<UnlinkedTypedefBuilder> _typedefs;
- List<UnlinkedVariableBuilder> _variables;
+ int _placeholder;
@override
- List<int> get apiSignature => _apiSignature ??= <int>[];
+ int get placeholder => _placeholder ??= 0;
- /// MD5 hash of the non-informative fields of the [UnlinkedUnit] (not
- /// including this one) as 16 unsigned 8-bit integer values. This can be used
- /// to identify when the API of a unit may have changed.
- set apiSignature(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._apiSignature = value;
- }
-
- @override
- List<UnlinkedClassBuilder> get classes =>
- _classes ??= <UnlinkedClassBuilder>[];
-
- /// Classes declared in the compilation unit.
- set classes(List<UnlinkedClassBuilder> value) {
- this._classes = value;
- }
-
- @override
- CodeRangeBuilder get codeRange => _codeRange;
-
- /// Code range of the unit.
- set codeRange(CodeRangeBuilder value) {
- this._codeRange = value;
- }
-
- @override
- List<UnlinkedEnumBuilder> get enums => _enums ??= <UnlinkedEnumBuilder>[];
-
- /// Enums declared in the compilation unit.
- set enums(List<UnlinkedEnumBuilder> value) {
- this._enums = value;
- }
-
- @override
- List<UnlinkedExecutableBuilder> get executables =>
- _executables ??= <UnlinkedExecutableBuilder>[];
-
- /// Top level executable objects (functions, getters, and setters) declared in
- /// the compilation unit.
- set executables(List<UnlinkedExecutableBuilder> value) {
- this._executables = value;
- }
-
- @override
- List<UnlinkedExportNonPublicBuilder> get exports =>
- _exports ??= <UnlinkedExportNonPublicBuilder>[];
-
- /// Export declarations in the compilation unit.
- set exports(List<UnlinkedExportNonPublicBuilder> value) {
- this._exports = value;
- }
-
- @override
- List<UnlinkedExtensionBuilder> get extensions =>
- _extensions ??= <UnlinkedExtensionBuilder>[];
-
- /// Extensions declared in the compilation unit.
- set extensions(List<UnlinkedExtensionBuilder> value) {
- this._extensions = value;
- }
-
- @override
- Null get fallbackModePath =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- List<UnlinkedImportBuilder> get imports =>
- _imports ??= <UnlinkedImportBuilder>[];
-
- /// Import declarations in the compilation unit.
- set imports(List<UnlinkedImportBuilder> value) {
- this._imports = value;
- }
-
- @override
- bool get isNNBD => _isNNBD ??= false;
-
- /// Indicates whether this compilation unit is opted into NNBD.
- set isNNBD(bool value) {
- this._isNNBD = value;
- }
-
- @override
- bool get isPartOf => _isPartOf ??= false;
-
- /// Indicates whether the unit contains a "part of" declaration.
- set isPartOf(bool value) {
- this._isPartOf = value;
- }
-
- @override
- List<UnlinkedExprBuilder> get libraryAnnotations =>
- _libraryAnnotations ??= <UnlinkedExprBuilder>[];
-
- /// Annotations for the library declaration, or the empty list if there is no
- /// library declaration.
- set libraryAnnotations(List<UnlinkedExprBuilder> value) {
- this._libraryAnnotations = value;
- }
-
- @override
- UnlinkedDocumentationCommentBuilder get libraryDocumentationComment =>
- _libraryDocumentationComment;
-
- /// Documentation comment for the library, or `null` if there is no
- /// documentation comment.
- set libraryDocumentationComment(UnlinkedDocumentationCommentBuilder value) {
- this._libraryDocumentationComment = value;
- }
-
- @override
- String get libraryName => _libraryName ??= '';
-
- /// Name of the library (from a "library" declaration, if present).
- set libraryName(String value) {
- this._libraryName = value;
- }
-
- @override
- int get libraryNameLength => _libraryNameLength ??= 0;
-
- /// Length of the library name as it appears in the source code (or 0 if the
- /// library has no name).
- set libraryNameLength(int value) {
+ set placeholder(int value) {
assert(value == null || value >= 0);
- this._libraryNameLength = value;
+ this._placeholder = value;
}
- @override
- int get libraryNameOffset => _libraryNameOffset ??= 0;
-
- /// Offset of the library name relative to the beginning of the file (or 0 if
- /// the library has no name).
- set libraryNameOffset(int value) {
- assert(value == null || value >= 0);
- this._libraryNameOffset = value;
- }
-
- @override
- List<int> get lineStarts => _lineStarts ??= <int>[];
-
- /// Offsets of the first character of each line in the source code.
- set lineStarts(List<int> value) {
- assert(value == null || value.every((e) => e >= 0));
- this._lineStarts = value;
- }
-
- @override
- List<UnlinkedClassBuilder> get mixins => _mixins ??= <UnlinkedClassBuilder>[];
-
- /// Mixins declared in the compilation unit.
- set mixins(List<UnlinkedClassBuilder> value) {
- this._mixins = value;
- }
-
- @override
- List<UnlinkedPartBuilder> get parts => _parts ??= <UnlinkedPartBuilder>[];
-
- /// Part declarations in the compilation unit.
- set parts(List<UnlinkedPartBuilder> value) {
- this._parts = value;
- }
-
- @override
- UnlinkedPublicNamespaceBuilder get publicNamespace => _publicNamespace;
-
- /// Unlinked public namespace of this compilation unit.
- set publicNamespace(UnlinkedPublicNamespaceBuilder value) {
- this._publicNamespace = value;
- }
-
- @override
- List<UnlinkedReferenceBuilder> get references =>
- _references ??= <UnlinkedReferenceBuilder>[];
-
- /// Top level and prefixed names referred to by this compilation unit. The
- /// zeroth element of this array is always populated and is used to represent
- /// the absence of a reference in places where a reference is optional (for
- /// example [UnlinkedReference.prefixReference or
- /// UnlinkedImport.prefixReference]).
- set references(List<UnlinkedReferenceBuilder> value) {
- this._references = value;
- }
-
- @override
- List<UnlinkedTypedefBuilder> get typedefs =>
- _typedefs ??= <UnlinkedTypedefBuilder>[];
-
- /// Typedefs declared in the compilation unit.
- set typedefs(List<UnlinkedTypedefBuilder> value) {
- this._typedefs = value;
- }
-
- @override
- List<UnlinkedVariableBuilder> get variables =>
- _variables ??= <UnlinkedVariableBuilder>[];
-
- /// Top level variables declared in the compilation unit.
- set variables(List<UnlinkedVariableBuilder> value) {
- this._variables = value;
- }
-
- UnlinkedUnitBuilder(
- {List<int> apiSignature,
- List<UnlinkedClassBuilder> classes,
- CodeRangeBuilder codeRange,
- List<UnlinkedEnumBuilder> enums,
- List<UnlinkedExecutableBuilder> executables,
- List<UnlinkedExportNonPublicBuilder> exports,
- List<UnlinkedExtensionBuilder> extensions,
- List<UnlinkedImportBuilder> imports,
- bool isNNBD,
- bool isPartOf,
- List<UnlinkedExprBuilder> libraryAnnotations,
- UnlinkedDocumentationCommentBuilder libraryDocumentationComment,
- String libraryName,
- int libraryNameLength,
- int libraryNameOffset,
- List<int> lineStarts,
- List<UnlinkedClassBuilder> mixins,
- List<UnlinkedPartBuilder> parts,
- UnlinkedPublicNamespaceBuilder publicNamespace,
- List<UnlinkedReferenceBuilder> references,
- List<UnlinkedTypedefBuilder> typedefs,
- List<UnlinkedVariableBuilder> variables})
- : _apiSignature = apiSignature,
- _classes = classes,
- _codeRange = codeRange,
- _enums = enums,
- _executables = executables,
- _exports = exports,
- _extensions = extensions,
- _imports = imports,
- _isNNBD = isNNBD,
- _isPartOf = isPartOf,
- _libraryAnnotations = libraryAnnotations,
- _libraryDocumentationComment = libraryDocumentationComment,
- _libraryName = libraryName,
- _libraryNameLength = libraryNameLength,
- _libraryNameOffset = libraryNameOffset,
- _lineStarts = lineStarts,
- _mixins = mixins,
- _parts = parts,
- _publicNamespace = publicNamespace,
- _references = references,
- _typedefs = typedefs,
- _variables = variables;
+ UnlinkedUnitBuilder({int placeholder}) : _placeholder = placeholder;
/// Flush [informative] data recursively.
- void flushInformative() {
- _classes?.forEach((b) => b.flushInformative());
- _codeRange = null;
- _enums?.forEach((b) => b.flushInformative());
- _executables?.forEach((b) => b.flushInformative());
- _exports?.forEach((b) => b.flushInformative());
- _extensions?.forEach((b) => b.flushInformative());
- _imports?.forEach((b) => b.flushInformative());
- _libraryAnnotations?.forEach((b) => b.flushInformative());
- _libraryDocumentationComment = null;
- _libraryNameLength = null;
- _libraryNameOffset = null;
- _lineStarts = null;
- _mixins?.forEach((b) => b.flushInformative());
- _parts?.forEach((b) => b.flushInformative());
- _publicNamespace?.flushInformative();
- _references?.forEach((b) => b.flushInformative());
- _typedefs?.forEach((b) => b.flushInformative());
- _variables?.forEach((b) => b.flushInformative());
- }
+ void flushInformative() {}
/// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addBool(this._publicNamespace != null);
- this._publicNamespace?.collectApiSignature(signature);
- if (this._references == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._references.length);
- for (var x in this._references) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._classes == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._classes.length);
- for (var x in this._classes) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._variables == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._variables.length);
- for (var x in this._variables) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._executables == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._executables.length);
- for (var x in this._executables) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._imports == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._imports.length);
- for (var x in this._imports) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addString(this._libraryName ?? '');
- if (this._typedefs == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._typedefs.length);
- for (var x in this._typedefs) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._parts == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._parts.length);
- for (var x in this._parts) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._enums == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._enums.length);
- for (var x in this._enums) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._exports == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._exports.length);
- for (var x in this._exports) {
- x?.collectApiSignature(signature);
- }
- }
- if (this._libraryAnnotations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._libraryAnnotations.length);
- for (var x in this._libraryAnnotations) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addBool(this._isPartOf == true);
- if (this._apiSignature == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._apiSignature.length);
- for (var x in this._apiSignature) {
- signature.addInt(x);
- }
- }
- if (this._mixins == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._mixins.length);
- for (var x in this._mixins) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addBool(this._isNNBD == true);
- if (this._extensions == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._extensions.length);
- for (var x in this._extensions) {
- x?.collectApiSignature(signature);
- }
- }
- }
-
- List<int> toBuffer() {
- fb.Builder fbBuilder = new fb.Builder();
- return fbBuilder.finish(finish(fbBuilder), "UUnt");
+ signature.addInt(this._placeholder ?? 0);
}
fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_apiSignature;
- fb.Offset offset_classes;
- fb.Offset offset_codeRange;
- fb.Offset offset_enums;
- fb.Offset offset_executables;
- fb.Offset offset_exports;
- fb.Offset offset_extensions;
- fb.Offset offset_imports;
- fb.Offset offset_libraryAnnotations;
- fb.Offset offset_libraryDocumentationComment;
- fb.Offset offset_libraryName;
- fb.Offset offset_lineStarts;
- fb.Offset offset_mixins;
- fb.Offset offset_parts;
- fb.Offset offset_publicNamespace;
- fb.Offset offset_references;
- fb.Offset offset_typedefs;
- fb.Offset offset_variables;
- if (!(_apiSignature == null || _apiSignature.isEmpty)) {
- offset_apiSignature = fbBuilder.writeListUint32(_apiSignature);
- }
- if (!(_classes == null || _classes.isEmpty)) {
- offset_classes = fbBuilder
- .writeList(_classes.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_codeRange != null) {
- offset_codeRange = _codeRange.finish(fbBuilder);
- }
- if (!(_enums == null || _enums.isEmpty)) {
- offset_enums =
- fbBuilder.writeList(_enums.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_executables == null || _executables.isEmpty)) {
- offset_executables = fbBuilder
- .writeList(_executables.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_exports == null || _exports.isEmpty)) {
- offset_exports = fbBuilder
- .writeList(_exports.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_extensions == null || _extensions.isEmpty)) {
- offset_extensions = fbBuilder
- .writeList(_extensions.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_imports == null || _imports.isEmpty)) {
- offset_imports = fbBuilder
- .writeList(_imports.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_libraryAnnotations == null || _libraryAnnotations.isEmpty)) {
- offset_libraryAnnotations = fbBuilder.writeList(
- _libraryAnnotations.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_libraryDocumentationComment != null) {
- offset_libraryDocumentationComment =
- _libraryDocumentationComment.finish(fbBuilder);
- }
- if (_libraryName != null) {
- offset_libraryName = fbBuilder.writeString(_libraryName);
- }
- if (!(_lineStarts == null || _lineStarts.isEmpty)) {
- offset_lineStarts = fbBuilder.writeListUint32(_lineStarts);
- }
- if (!(_mixins == null || _mixins.isEmpty)) {
- offset_mixins =
- fbBuilder.writeList(_mixins.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_parts == null || _parts.isEmpty)) {
- offset_parts =
- fbBuilder.writeList(_parts.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_publicNamespace != null) {
- offset_publicNamespace = _publicNamespace.finish(fbBuilder);
- }
- if (!(_references == null || _references.isEmpty)) {
- offset_references = fbBuilder
- .writeList(_references.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_typedefs == null || _typedefs.isEmpty)) {
- offset_typedefs = fbBuilder
- .writeList(_typedefs.map((b) => b.finish(fbBuilder)).toList());
- }
- if (!(_variables == null || _variables.isEmpty)) {
- offset_variables = fbBuilder
- .writeList(_variables.map((b) => b.finish(fbBuilder)).toList());
- }
fbBuilder.startTable();
- if (offset_apiSignature != null) {
- fbBuilder.addOffset(19, offset_apiSignature);
- }
- if (offset_classes != null) {
- fbBuilder.addOffset(2, offset_classes);
- }
- if (offset_codeRange != null) {
- fbBuilder.addOffset(15, offset_codeRange);
- }
- if (offset_enums != null) {
- fbBuilder.addOffset(12, offset_enums);
- }
- if (offset_executables != null) {
- fbBuilder.addOffset(4, offset_executables);
- }
- if (offset_exports != null) {
- fbBuilder.addOffset(13, offset_exports);
- }
- if (offset_extensions != null) {
- fbBuilder.addOffset(22, offset_extensions);
- }
- if (offset_imports != null) {
- fbBuilder.addOffset(5, offset_imports);
- }
- if (_isNNBD == true) {
- fbBuilder.addBool(21, true);
- }
- if (_isPartOf == true) {
- fbBuilder.addBool(18, true);
- }
- if (offset_libraryAnnotations != null) {
- fbBuilder.addOffset(14, offset_libraryAnnotations);
- }
- if (offset_libraryDocumentationComment != null) {
- fbBuilder.addOffset(9, offset_libraryDocumentationComment);
- }
- if (offset_libraryName != null) {
- fbBuilder.addOffset(6, offset_libraryName);
- }
- if (_libraryNameLength != null && _libraryNameLength != 0) {
- fbBuilder.addUint32(7, _libraryNameLength);
- }
- if (_libraryNameOffset != null && _libraryNameOffset != 0) {
- fbBuilder.addUint32(8, _libraryNameOffset);
- }
- if (offset_lineStarts != null) {
- fbBuilder.addOffset(17, offset_lineStarts);
- }
- if (offset_mixins != null) {
- fbBuilder.addOffset(20, offset_mixins);
- }
- if (offset_parts != null) {
- fbBuilder.addOffset(11, offset_parts);
- }
- if (offset_publicNamespace != null) {
- fbBuilder.addOffset(0, offset_publicNamespace);
- }
- if (offset_references != null) {
- fbBuilder.addOffset(1, offset_references);
- }
- if (offset_typedefs != null) {
- fbBuilder.addOffset(10, offset_typedefs);
- }
- if (offset_variables != null) {
- fbBuilder.addOffset(3, offset_variables);
+ if (_placeholder != null && _placeholder != 0) {
+ fbBuilder.addUint32(0, _placeholder);
}
return fbBuilder.endTable();
}
}
-idl.UnlinkedUnit readUnlinkedUnit(List<int> buffer) {
- fb.BufferContext rootRef = new fb.BufferContext.fromBytes(buffer);
- return const _UnlinkedUnitReader().read(rootRef, 0);
-}
-
class _UnlinkedUnitReader extends fb.TableReader<_UnlinkedUnitImpl> {
const _UnlinkedUnitReader();
@@ -28004,193 +18437,12 @@
_UnlinkedUnitImpl(this._bc, this._bcOffset);
- List<int> _apiSignature;
- List<idl.UnlinkedClass> _classes;
- idl.CodeRange _codeRange;
- List<idl.UnlinkedEnum> _enums;
- List<idl.UnlinkedExecutable> _executables;
- List<idl.UnlinkedExportNonPublic> _exports;
- List<idl.UnlinkedExtension> _extensions;
- List<idl.UnlinkedImport> _imports;
- bool _isNNBD;
- bool _isPartOf;
- List<idl.UnlinkedExpr> _libraryAnnotations;
- idl.UnlinkedDocumentationComment _libraryDocumentationComment;
- String _libraryName;
- int _libraryNameLength;
- int _libraryNameOffset;
- List<int> _lineStarts;
- List<idl.UnlinkedClass> _mixins;
- List<idl.UnlinkedPart> _parts;
- idl.UnlinkedPublicNamespace _publicNamespace;
- List<idl.UnlinkedReference> _references;
- List<idl.UnlinkedTypedef> _typedefs;
- List<idl.UnlinkedVariable> _variables;
+ int _placeholder;
@override
- List<int> get apiSignature {
- _apiSignature ??= const fb.Uint32ListReader()
- .vTableGet(_bc, _bcOffset, 19, const <int>[]);
- return _apiSignature;
- }
-
- @override
- List<idl.UnlinkedClass> get classes {
- _classes ??=
- const fb.ListReader<idl.UnlinkedClass>(const _UnlinkedClassReader())
- .vTableGet(_bc, _bcOffset, 2, const <idl.UnlinkedClass>[]);
- return _classes;
- }
-
- @override
- idl.CodeRange get codeRange {
- _codeRange ??= const _CodeRangeReader().vTableGet(_bc, _bcOffset, 15, null);
- return _codeRange;
- }
-
- @override
- List<idl.UnlinkedEnum> get enums {
- _enums ??=
- const fb.ListReader<idl.UnlinkedEnum>(const _UnlinkedEnumReader())
- .vTableGet(_bc, _bcOffset, 12, const <idl.UnlinkedEnum>[]);
- return _enums;
- }
-
- @override
- List<idl.UnlinkedExecutable> get executables {
- _executables ??= const fb.ListReader<idl.UnlinkedExecutable>(
- const _UnlinkedExecutableReader())
- .vTableGet(_bc, _bcOffset, 4, const <idl.UnlinkedExecutable>[]);
- return _executables;
- }
-
- @override
- List<idl.UnlinkedExportNonPublic> get exports {
- _exports ??= const fb.ListReader<idl.UnlinkedExportNonPublic>(
- const _UnlinkedExportNonPublicReader())
- .vTableGet(_bc, _bcOffset, 13, const <idl.UnlinkedExportNonPublic>[]);
- return _exports;
- }
-
- @override
- List<idl.UnlinkedExtension> get extensions {
- _extensions ??= const fb.ListReader<idl.UnlinkedExtension>(
- const _UnlinkedExtensionReader())
- .vTableGet(_bc, _bcOffset, 22, const <idl.UnlinkedExtension>[]);
- return _extensions;
- }
-
- @override
- Null get fallbackModePath =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- List<idl.UnlinkedImport> get imports {
- _imports ??=
- const fb.ListReader<idl.UnlinkedImport>(const _UnlinkedImportReader())
- .vTableGet(_bc, _bcOffset, 5, const <idl.UnlinkedImport>[]);
- return _imports;
- }
-
- @override
- bool get isNNBD {
- _isNNBD ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 21, false);
- return _isNNBD;
- }
-
- @override
- bool get isPartOf {
- _isPartOf ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 18, false);
- return _isPartOf;
- }
-
- @override
- List<idl.UnlinkedExpr> get libraryAnnotations {
- _libraryAnnotations ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 14, const <idl.UnlinkedExpr>[]);
- return _libraryAnnotations;
- }
-
- @override
- idl.UnlinkedDocumentationComment get libraryDocumentationComment {
- _libraryDocumentationComment ??= const _UnlinkedDocumentationCommentReader()
- .vTableGet(_bc, _bcOffset, 9, null);
- return _libraryDocumentationComment;
- }
-
- @override
- String get libraryName {
- _libraryName ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 6, '');
- return _libraryName;
- }
-
- @override
- int get libraryNameLength {
- _libraryNameLength ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 7, 0);
- return _libraryNameLength;
- }
-
- @override
- int get libraryNameOffset {
- _libraryNameOffset ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 8, 0);
- return _libraryNameOffset;
- }
-
- @override
- List<int> get lineStarts {
- _lineStarts ??= const fb.Uint32ListReader()
- .vTableGet(_bc, _bcOffset, 17, const <int>[]);
- return _lineStarts;
- }
-
- @override
- List<idl.UnlinkedClass> get mixins {
- _mixins ??=
- const fb.ListReader<idl.UnlinkedClass>(const _UnlinkedClassReader())
- .vTableGet(_bc, _bcOffset, 20, const <idl.UnlinkedClass>[]);
- return _mixins;
- }
-
- @override
- List<idl.UnlinkedPart> get parts {
- _parts ??=
- const fb.ListReader<idl.UnlinkedPart>(const _UnlinkedPartReader())
- .vTableGet(_bc, _bcOffset, 11, const <idl.UnlinkedPart>[]);
- return _parts;
- }
-
- @override
- idl.UnlinkedPublicNamespace get publicNamespace {
- _publicNamespace ??= const _UnlinkedPublicNamespaceReader()
- .vTableGet(_bc, _bcOffset, 0, null);
- return _publicNamespace;
- }
-
- @override
- List<idl.UnlinkedReference> get references {
- _references ??= const fb.ListReader<idl.UnlinkedReference>(
- const _UnlinkedReferenceReader())
- .vTableGet(_bc, _bcOffset, 1, const <idl.UnlinkedReference>[]);
- return _references;
- }
-
- @override
- List<idl.UnlinkedTypedef> get typedefs {
- _typedefs ??=
- const fb.ListReader<idl.UnlinkedTypedef>(const _UnlinkedTypedefReader())
- .vTableGet(_bc, _bcOffset, 10, const <idl.UnlinkedTypedef>[]);
- return _typedefs;
- }
-
- @override
- List<idl.UnlinkedVariable> get variables {
- _variables ??= const fb.ListReader<idl.UnlinkedVariable>(
- const _UnlinkedVariableReader())
- .vTableGet(_bc, _bcOffset, 3, const <idl.UnlinkedVariable>[]);
- return _variables;
+ int get placeholder {
+ _placeholder ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 0, 0);
+ return _placeholder;
}
}
@@ -28198,77 +18450,13 @@
@override
Map<String, Object> toJson() {
Map<String, Object> _result = <String, Object>{};
- if (apiSignature.isNotEmpty) _result["apiSignature"] = apiSignature;
- if (classes.isNotEmpty)
- _result["classes"] = classes.map((_value) => _value.toJson()).toList();
- if (codeRange != null) _result["codeRange"] = codeRange.toJson();
- if (enums.isNotEmpty)
- _result["enums"] = enums.map((_value) => _value.toJson()).toList();
- if (executables.isNotEmpty)
- _result["executables"] =
- executables.map((_value) => _value.toJson()).toList();
- if (exports.isNotEmpty)
- _result["exports"] = exports.map((_value) => _value.toJson()).toList();
- if (extensions.isNotEmpty)
- _result["extensions"] =
- extensions.map((_value) => _value.toJson()).toList();
- if (imports.isNotEmpty)
- _result["imports"] = imports.map((_value) => _value.toJson()).toList();
- if (isNNBD != false) _result["isNNBD"] = isNNBD;
- if (isPartOf != false) _result["isPartOf"] = isPartOf;
- if (libraryAnnotations.isNotEmpty)
- _result["libraryAnnotations"] =
- libraryAnnotations.map((_value) => _value.toJson()).toList();
- if (libraryDocumentationComment != null)
- _result["libraryDocumentationComment"] =
- libraryDocumentationComment.toJson();
- if (libraryName != '') _result["libraryName"] = libraryName;
- if (libraryNameLength != 0)
- _result["libraryNameLength"] = libraryNameLength;
- if (libraryNameOffset != 0)
- _result["libraryNameOffset"] = libraryNameOffset;
- if (lineStarts.isNotEmpty) _result["lineStarts"] = lineStarts;
- if (mixins.isNotEmpty)
- _result["mixins"] = mixins.map((_value) => _value.toJson()).toList();
- if (parts.isNotEmpty)
- _result["parts"] = parts.map((_value) => _value.toJson()).toList();
- if (publicNamespace != null)
- _result["publicNamespace"] = publicNamespace.toJson();
- if (references.isNotEmpty)
- _result["references"] =
- references.map((_value) => _value.toJson()).toList();
- if (typedefs.isNotEmpty)
- _result["typedefs"] = typedefs.map((_value) => _value.toJson()).toList();
- if (variables.isNotEmpty)
- _result["variables"] =
- variables.map((_value) => _value.toJson()).toList();
+ if (placeholder != 0) _result["placeholder"] = placeholder;
return _result;
}
@override
Map<String, Object> toMap() => {
- "apiSignature": apiSignature,
- "classes": classes,
- "codeRange": codeRange,
- "enums": enums,
- "executables": executables,
- "exports": exports,
- "extensions": extensions,
- "imports": imports,
- "isNNBD": isNNBD,
- "isPartOf": isPartOf,
- "libraryAnnotations": libraryAnnotations,
- "libraryDocumentationComment": libraryDocumentationComment,
- "libraryName": libraryName,
- "libraryNameLength": libraryNameLength,
- "libraryNameOffset": libraryNameOffset,
- "lineStarts": lineStarts,
- "mixins": mixins,
- "parts": parts,
- "publicNamespace": publicNamespace,
- "references": references,
- "typedefs": typedefs,
- "variables": variables,
+ "placeholder": placeholder,
};
@override
@@ -28609,507 +18797,3 @@
@override
String toString() => convert.json.encode(toJson());
}
-
-class UnlinkedVariableBuilder extends Object
- with _UnlinkedVariableMixin
- implements idl.UnlinkedVariable {
- List<UnlinkedExprBuilder> _annotations;
- CodeRangeBuilder _codeRange;
- UnlinkedDocumentationCommentBuilder _documentationComment;
- int _inferredTypeSlot;
- int _inheritsCovariantSlot;
- UnlinkedExecutableBuilder _initializer;
- bool _isConst;
- bool _isCovariant;
- bool _isFinal;
- bool _isLate;
- bool _isStatic;
- String _name;
- int _nameOffset;
- int _propagatedTypeSlot;
- EntityRefBuilder _type;
-
- @override
- List<UnlinkedExprBuilder> get annotations =>
- _annotations ??= <UnlinkedExprBuilder>[];
-
- /// Annotations for this variable.
- set annotations(List<UnlinkedExprBuilder> value) {
- this._annotations = value;
- }
-
- @override
- CodeRangeBuilder get codeRange => _codeRange;
-
- /// Code range of the variable.
- set codeRange(CodeRangeBuilder value) {
- this._codeRange = value;
- }
-
- @override
- UnlinkedDocumentationCommentBuilder get documentationComment =>
- _documentationComment;
-
- /// Documentation comment for the variable, or `null` if there is no
- /// documentation comment.
- set documentationComment(UnlinkedDocumentationCommentBuilder value) {
- this._documentationComment = value;
- }
-
- @override
- int get inferredTypeSlot => _inferredTypeSlot ??= 0;
-
- /// If this variable is inferable, nonzero slot id identifying which entry in
- /// [LinkedLibrary.types] contains the inferred type for this variable. If
- /// there is no matching entry in [LinkedLibrary.types], then no type was
- /// inferred for this variable, so its static type is `dynamic`.
- set inferredTypeSlot(int value) {
- assert(value == null || value >= 0);
- this._inferredTypeSlot = value;
- }
-
- @override
- int get inheritsCovariantSlot => _inheritsCovariantSlot ??= 0;
-
- /// If this is an instance non-final field, a nonzero slot id which is unique
- /// within this compilation unit. If this id is found in
- /// [LinkedUnit.parametersInheritingCovariant], then the parameter of the
- /// synthetic setter inherits `@covariant` behavior from a base class.
- ///
- /// Otherwise, zero.
- set inheritsCovariantSlot(int value) {
- assert(value == null || value >= 0);
- this._inheritsCovariantSlot = value;
- }
-
- @override
- UnlinkedExecutableBuilder get initializer => _initializer;
-
- /// The synthetic initializer function of the variable. Absent if the
- /// variable does not have an initializer.
- set initializer(UnlinkedExecutableBuilder value) {
- this._initializer = value;
- }
-
- @override
- bool get isConst => _isConst ??= false;
-
- /// Indicates whether the variable is declared using the `const` keyword.
- set isConst(bool value) {
- this._isConst = value;
- }
-
- @override
- bool get isCovariant => _isCovariant ??= false;
-
- /// Indicates whether this variable is declared using the `covariant` keyword.
- /// This should be false for everything except instance fields.
- set isCovariant(bool value) {
- this._isCovariant = value;
- }
-
- @override
- bool get isFinal => _isFinal ??= false;
-
- /// Indicates whether the variable is declared using the `final` keyword.
- set isFinal(bool value) {
- this._isFinal = value;
- }
-
- @override
- bool get isLate => _isLate ??= false;
-
- /// Indicates whether the variable is declared using the `late` keyword.
- set isLate(bool value) {
- this._isLate = value;
- }
-
- @override
- bool get isStatic => _isStatic ??= false;
-
- /// Indicates whether the variable is declared using the `static` keyword.
- ///
- /// Note that for top level variables, this flag is false, since they are not
- /// declared using the `static` keyword (even though they are considered
- /// static for semantic purposes).
- set isStatic(bool value) {
- this._isStatic = value;
- }
-
- @override
- String get name => _name ??= '';
-
- /// Name of the variable.
- set name(String value) {
- this._name = value;
- }
-
- @override
- int get nameOffset => _nameOffset ??= 0;
-
- /// Offset of the variable name relative to the beginning of the file.
- set nameOffset(int value) {
- assert(value == null || value >= 0);
- this._nameOffset = value;
- }
-
- @override
- int get propagatedTypeSlot => _propagatedTypeSlot ??= 0;
-
- /// If this variable is propagable, nonzero slot id identifying which entry in
- /// [LinkedLibrary.types] contains the propagated type for this variable. If
- /// there is no matching entry in [LinkedLibrary.types], then this variable's
- /// propagated type is the same as its declared type.
- ///
- /// Non-propagable variables have a [propagatedTypeSlot] of zero.
- set propagatedTypeSlot(int value) {
- assert(value == null || value >= 0);
- this._propagatedTypeSlot = value;
- }
-
- @override
- EntityRefBuilder get type => _type;
-
- /// Declared type of the variable. Absent if the type is implicit.
- set type(EntityRefBuilder value) {
- this._type = value;
- }
-
- @override
- Null get visibleLength =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- Null get visibleOffset =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- UnlinkedVariableBuilder(
- {List<UnlinkedExprBuilder> annotations,
- CodeRangeBuilder codeRange,
- UnlinkedDocumentationCommentBuilder documentationComment,
- int inferredTypeSlot,
- int inheritsCovariantSlot,
- UnlinkedExecutableBuilder initializer,
- bool isConst,
- bool isCovariant,
- bool isFinal,
- bool isLate,
- bool isStatic,
- String name,
- int nameOffset,
- int propagatedTypeSlot,
- EntityRefBuilder type})
- : _annotations = annotations,
- _codeRange = codeRange,
- _documentationComment = documentationComment,
- _inferredTypeSlot = inferredTypeSlot,
- _inheritsCovariantSlot = inheritsCovariantSlot,
- _initializer = initializer,
- _isConst = isConst,
- _isCovariant = isCovariant,
- _isFinal = isFinal,
- _isLate = isLate,
- _isStatic = isStatic,
- _name = name,
- _nameOffset = nameOffset,
- _propagatedTypeSlot = propagatedTypeSlot,
- _type = type;
-
- /// Flush [informative] data recursively.
- void flushInformative() {
- _annotations?.forEach((b) => b.flushInformative());
- _codeRange = null;
- _documentationComment = null;
- _initializer?.flushInformative();
- _nameOffset = null;
- _type?.flushInformative();
- }
-
- /// Accumulate non-[informative] data into [signature].
- void collectApiSignature(api_sig.ApiSignature signature) {
- signature.addString(this._name ?? '');
- signature.addInt(this._propagatedTypeSlot ?? 0);
- signature.addBool(this._type != null);
- this._type?.collectApiSignature(signature);
- signature.addBool(this._isStatic == true);
- signature.addBool(this._isConst == true);
- signature.addBool(this._isFinal == true);
- if (this._annotations == null) {
- signature.addInt(0);
- } else {
- signature.addInt(this._annotations.length);
- for (var x in this._annotations) {
- x?.collectApiSignature(signature);
- }
- }
- signature.addInt(this._inferredTypeSlot ?? 0);
- signature.addBool(this._initializer != null);
- this._initializer?.collectApiSignature(signature);
- signature.addBool(this._isCovariant == true);
- signature.addInt(this._inheritsCovariantSlot ?? 0);
- signature.addBool(this._isLate == true);
- }
-
- fb.Offset finish(fb.Builder fbBuilder) {
- fb.Offset offset_annotations;
- fb.Offset offset_codeRange;
- fb.Offset offset_documentationComment;
- fb.Offset offset_initializer;
- fb.Offset offset_name;
- fb.Offset offset_type;
- if (!(_annotations == null || _annotations.isEmpty)) {
- offset_annotations = fbBuilder
- .writeList(_annotations.map((b) => b.finish(fbBuilder)).toList());
- }
- if (_codeRange != null) {
- offset_codeRange = _codeRange.finish(fbBuilder);
- }
- if (_documentationComment != null) {
- offset_documentationComment = _documentationComment.finish(fbBuilder);
- }
- if (_initializer != null) {
- offset_initializer = _initializer.finish(fbBuilder);
- }
- if (_name != null) {
- offset_name = fbBuilder.writeString(_name);
- }
- if (_type != null) {
- offset_type = _type.finish(fbBuilder);
- }
- fbBuilder.startTable();
- if (offset_annotations != null) {
- fbBuilder.addOffset(8, offset_annotations);
- }
- if (offset_codeRange != null) {
- fbBuilder.addOffset(5, offset_codeRange);
- }
- if (offset_documentationComment != null) {
- fbBuilder.addOffset(10, offset_documentationComment);
- }
- if (_inferredTypeSlot != null && _inferredTypeSlot != 0) {
- fbBuilder.addUint32(9, _inferredTypeSlot);
- }
- if (_inheritsCovariantSlot != null && _inheritsCovariantSlot != 0) {
- fbBuilder.addUint32(15, _inheritsCovariantSlot);
- }
- if (offset_initializer != null) {
- fbBuilder.addOffset(13, offset_initializer);
- }
- if (_isConst == true) {
- fbBuilder.addBool(6, true);
- }
- if (_isCovariant == true) {
- fbBuilder.addBool(14, true);
- }
- if (_isFinal == true) {
- fbBuilder.addBool(7, true);
- }
- if (_isLate == true) {
- fbBuilder.addBool(16, true);
- }
- if (_isStatic == true) {
- fbBuilder.addBool(4, true);
- }
- if (offset_name != null) {
- fbBuilder.addOffset(0, offset_name);
- }
- if (_nameOffset != null && _nameOffset != 0) {
- fbBuilder.addUint32(1, _nameOffset);
- }
- if (_propagatedTypeSlot != null && _propagatedTypeSlot != 0) {
- fbBuilder.addUint32(2, _propagatedTypeSlot);
- }
- if (offset_type != null) {
- fbBuilder.addOffset(3, offset_type);
- }
- return fbBuilder.endTable();
- }
-}
-
-class _UnlinkedVariableReader extends fb.TableReader<_UnlinkedVariableImpl> {
- const _UnlinkedVariableReader();
-
- @override
- _UnlinkedVariableImpl createObject(fb.BufferContext bc, int offset) =>
- new _UnlinkedVariableImpl(bc, offset);
-}
-
-class _UnlinkedVariableImpl extends Object
- with _UnlinkedVariableMixin
- implements idl.UnlinkedVariable {
- final fb.BufferContext _bc;
- final int _bcOffset;
-
- _UnlinkedVariableImpl(this._bc, this._bcOffset);
-
- List<idl.UnlinkedExpr> _annotations;
- idl.CodeRange _codeRange;
- idl.UnlinkedDocumentationComment _documentationComment;
- int _inferredTypeSlot;
- int _inheritsCovariantSlot;
- idl.UnlinkedExecutable _initializer;
- bool _isConst;
- bool _isCovariant;
- bool _isFinal;
- bool _isLate;
- bool _isStatic;
- String _name;
- int _nameOffset;
- int _propagatedTypeSlot;
- idl.EntityRef _type;
-
- @override
- List<idl.UnlinkedExpr> get annotations {
- _annotations ??=
- const fb.ListReader<idl.UnlinkedExpr>(const _UnlinkedExprReader())
- .vTableGet(_bc, _bcOffset, 8, const <idl.UnlinkedExpr>[]);
- return _annotations;
- }
-
- @override
- idl.CodeRange get codeRange {
- _codeRange ??= const _CodeRangeReader().vTableGet(_bc, _bcOffset, 5, null);
- return _codeRange;
- }
-
- @override
- idl.UnlinkedDocumentationComment get documentationComment {
- _documentationComment ??= const _UnlinkedDocumentationCommentReader()
- .vTableGet(_bc, _bcOffset, 10, null);
- return _documentationComment;
- }
-
- @override
- int get inferredTypeSlot {
- _inferredTypeSlot ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 9, 0);
- return _inferredTypeSlot;
- }
-
- @override
- int get inheritsCovariantSlot {
- _inheritsCovariantSlot ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 15, 0);
- return _inheritsCovariantSlot;
- }
-
- @override
- idl.UnlinkedExecutable get initializer {
- _initializer ??=
- const _UnlinkedExecutableReader().vTableGet(_bc, _bcOffset, 13, null);
- return _initializer;
- }
-
- @override
- bool get isConst {
- _isConst ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 6, false);
- return _isConst;
- }
-
- @override
- bool get isCovariant {
- _isCovariant ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 14, false);
- return _isCovariant;
- }
-
- @override
- bool get isFinal {
- _isFinal ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 7, false);
- return _isFinal;
- }
-
- @override
- bool get isLate {
- _isLate ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 16, false);
- return _isLate;
- }
-
- @override
- bool get isStatic {
- _isStatic ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 4, false);
- return _isStatic;
- }
-
- @override
- String get name {
- _name ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 0, '');
- return _name;
- }
-
- @override
- int get nameOffset {
- _nameOffset ??= const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 1, 0);
- return _nameOffset;
- }
-
- @override
- int get propagatedTypeSlot {
- _propagatedTypeSlot ??=
- const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 2, 0);
- return _propagatedTypeSlot;
- }
-
- @override
- idl.EntityRef get type {
- _type ??= const _EntityRefReader().vTableGet(_bc, _bcOffset, 3, null);
- return _type;
- }
-
- @override
- Null get visibleLength =>
- throw new UnimplementedError('attempt to access deprecated field');
-
- @override
- Null get visibleOffset =>
- throw new UnimplementedError('attempt to access deprecated field');
-}
-
-abstract class _UnlinkedVariableMixin implements idl.UnlinkedVariable {
- @override
- Map<String, Object> toJson() {
- Map<String, Object> _result = <String, Object>{};
- if (annotations.isNotEmpty)
- _result["annotations"] =
- annotations.map((_value) => _value.toJson()).toList();
- if (codeRange != null) _result["codeRange"] = codeRange.toJson();
- if (documentationComment != null)
- _result["documentationComment"] = documentationComment.toJson();
- if (inferredTypeSlot != 0) _result["inferredTypeSlot"] = inferredTypeSlot;
- if (inheritsCovariantSlot != 0)
- _result["inheritsCovariantSlot"] = inheritsCovariantSlot;
- if (initializer != null) _result["initializer"] = initializer.toJson();
- if (isConst != false) _result["isConst"] = isConst;
- if (isCovariant != false) _result["isCovariant"] = isCovariant;
- if (isFinal != false) _result["isFinal"] = isFinal;
- if (isLate != false) _result["isLate"] = isLate;
- if (isStatic != false) _result["isStatic"] = isStatic;
- if (name != '') _result["name"] = name;
- if (nameOffset != 0) _result["nameOffset"] = nameOffset;
- if (propagatedTypeSlot != 0)
- _result["propagatedTypeSlot"] = propagatedTypeSlot;
- if (type != null) _result["type"] = type.toJson();
- return _result;
- }
-
- @override
- Map<String, Object> toMap() => {
- "annotations": annotations,
- "codeRange": codeRange,
- "documentationComment": documentationComment,
- "inferredTypeSlot": inferredTypeSlot,
- "inheritsCovariantSlot": inheritsCovariantSlot,
- "initializer": initializer,
- "isConst": isConst,
- "isCovariant": isCovariant,
- "isFinal": isFinal,
- "isLate": isLate,
- "isStatic": isStatic,
- "name": name,
- "nameOffset": nameOffset,
- "propagatedTypeSlot": propagatedTypeSlot,
- "type": type,
- };
-
- @override
- String toString() => convert.json.encode(toJson());
-}
diff --git a/pkg/analyzer/lib/src/summary/format.fbs b/pkg/analyzer/lib/src/summary/format.fbs
index 25ebd97..9f3bf60 100644
--- a/pkg/analyzer/lib/src/summary/format.fbs
+++ b/pkg/analyzer/lib/src/summary/format.fbs
@@ -39,19 +39,6 @@
VARIABLE
}
-/// Enum used to indicate the kind of an entity reference.
-enum EntityRefKind : byte {
- /// The entity represents a named type.
- named,
-
- /// The entity represents a generic function type.
- genericFunctionType,
-
- /// The entity represents a function type that was synthesized by a LUB
- /// computation.
- syntheticFunction
-}
-
/// Enum representing nullability suffixes in summaries.
///
/// This enum is similar to [NullabilitySuffix], but the order is different so
@@ -76,15 +63,6 @@
none
}
-/// Enum used to indicate the kind of a name in index.
-enum IndexNameKind : byte {
- /// A top-level element.
- topLevel,
-
- /// A class member.
- classMember
-}
-
/// Enum used to indicate the kind of an index relation.
enum IndexRelationKind : byte {
/// Left: class.
@@ -449,48 +427,6 @@
void_
}
-/// Enum used to indicate the kind of entity referred to by a
-/// [LinkedReference].
-enum ReferenceKind : byte {
- /// The entity is a class or enum.
- classOrEnum,
-
- /// The entity is a constructor.
- constructor,
-
- /// The entity is a getter or setter inside a class. Note: this is used in
- /// the case where a constant refers to a static const declared inside a
- /// class.
- propertyAccessor,
-
- /// The entity is a method.
- method,
-
- /// The entity is a typedef.
- typedef,
-
- /// The entity is a local function.
- function,
-
- /// The entity is a local variable.
- variable,
-
- /// The entity is a top level function.
- topLevelFunction,
-
- /// The entity is a top level getter or setter.
- topLevelPropertyAccessor,
-
- /// The entity is a prefix.
- prefix,
-
- /// The entity being referred to does not exist.
- unresolved,
-
- /// The entity is a typedef expressed using generic function type syntax.
- genericFunctionTypedef
-}
-
/// Enum used to indicate the kind of the error during top-level inference.
enum TopLevelInferenceErrorKind : byte {
assignment,
@@ -506,633 +442,6 @@
overrideConflictParameterType
}
-/// Enum used to indicate the style of a typedef.
-enum TypedefStyle : byte {
- /// A typedef that defines a non-generic function type. The syntax is
- /// ```
- /// 'typedef' returnType? identifier typeParameters? formalParameterList ';'
- /// ```
- /// The typedef can have type parameters associated with it, but the function
- /// type that results from applying type arguments does not.
- functionType,
-
- /// A typedef expressed using generic function type syntax. The syntax is
- /// ```
- /// typeAlias ::=
- /// 'typedef' identifier typeParameters? '=' genericFunctionType ';'
- /// genericFunctionType ::=
- /// returnType? 'Function' typeParameters? parameterTypeList
- /// ```
- /// Both the typedef itself and the function type that results from applying
- /// type arguments can have type parameters.
- genericFunctionType
-}
-
-/// Enum used to indicate the kind of an constructor initializer.
-enum UnlinkedConstructorInitializerKind : byte {
- /// Initialization of a field.
- field,
-
- /// Invocation of a constructor in the same class.
- thisInvocation,
-
- /// Invocation of a superclass' constructor.
- superInvocation,
-
- /// Invocation of `assert`.
- assertInvocation
-}
-
-/// Enum used to indicate the kind of an executable.
-enum UnlinkedExecutableKind : byte {
- /// Executable is a function or method.
- functionOrMethod,
-
- /// Executable is a getter.
- getter,
-
- /// Executable is a setter.
- setter,
-
- /// Executable is a constructor.
- constructor
-}
-
-/// Enum representing the various kinds of assignment operations combined
-/// with:
-/// [UnlinkedExprOperation.assignToRef],
-/// [UnlinkedExprOperation.assignToProperty],
-/// [UnlinkedExprOperation.assignToIndex].
-enum UnlinkedExprAssignOperator : byte {
- /// Perform simple assignment `target = operand`.
- assign,
-
- /// Perform `target ??= operand`.
- ifNull,
-
- /// Perform `target *= operand`.
- multiply,
-
- /// Perform `target /= operand`.
- divide,
-
- /// Perform `target ~/= operand`.
- floorDivide,
-
- /// Perform `target %= operand`.
- modulo,
-
- /// Perform `target += operand`.
- plus,
-
- /// Perform `target -= operand`.
- minus,
-
- /// Perform `target <<= operand`.
- shiftLeft,
-
- /// Perform `target >>= operand`.
- shiftRight,
-
- /// Perform `target &= operand`.
- bitAnd,
-
- /// Perform `target ^= operand`.
- bitXor,
-
- /// Perform `target |= operand`.
- bitOr,
-
- /// Perform `++target`.
- prefixIncrement,
-
- /// Perform `--target`.
- prefixDecrement,
-
- /// Perform `target++`.
- postfixIncrement,
-
- /// Perform `target++`.
- postfixDecrement
-}
-
-/// Enum representing the various kinds of operations which may be performed to
-/// in an expression. These options are assumed to execute in the
-/// context of a stack which is initially empty.
-enum UnlinkedExprOperation : byte {
- /// Push the next value from [UnlinkedExpr.ints] (a 32-bit unsigned integer)
- /// onto the stack.
- ///
- /// Note that Dart supports integers larger than 32 bits; these are
- /// represented by composing 32-bit values using the [pushLongInt] operation.
- pushInt,
-
- /// Get the number of components from [UnlinkedExpr.ints], then do this number
- /// of times the following operations: multiple the current value by 2^32,
- /// "or" it with the next value in [UnlinkedExpr.ints]. The initial value is
- /// zero. Push the result into the stack.
- pushLongInt,
-
- /// Push the next value from [UnlinkedExpr.doubles] (a double precision
- /// floating point value) onto the stack.
- pushDouble,
-
- /// Push the constant `true` onto the stack.
- pushTrue,
-
- /// Push the constant `false` onto the stack.
- pushFalse,
-
- /// Push the next value from [UnlinkedExpr.strings] onto the stack.
- pushString,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), convert them to strings (if they aren't already),
- /// concatenate them into a single string, and push it back onto the stack.
- ///
- /// This operation is used to represent constants whose value is a literal
- /// string containing string interpolations.
- concatenate,
-
- /// Get the next value from [UnlinkedExpr.strings], convert it to a symbol,
- /// and push it onto the stack.
- makeSymbol,
-
- /// Push the constant `null` onto the stack.
- pushNull,
-
- /// Push the value of the function parameter with the name obtained from
- /// [UnlinkedExpr.strings].
- pushParameter,
-
- /// Evaluate a (potentially qualified) identifier expression and push the
- /// resulting value onto the stack. The identifier to be evaluated is
- /// obtained from [UnlinkedExpr.references].
- ///
- /// This operation is used to represent the following kinds of constants
- /// (which are indistinguishable from an unresolved AST alone):
- ///
- /// - A qualified reference to a static constant variable (e.g. `C.v`, where
- /// C is a class and `v` is a constant static variable in `C`).
- /// - An identifier expression referring to a constant variable.
- /// - A simple or qualified identifier denoting a class or type alias.
- /// - A simple or qualified identifier denoting a top-level function or a
- /// static method.
- pushReference,
-
- /// Pop the top value from the stack, extract the value of the property with
- /// the name obtained from [UnlinkedExpr.strings], and push the result back
- /// onto the stack.
- extractProperty,
-
- /// Pop the top `n` values from the stack (where `n` is obtained from
- /// [UnlinkedExpr.ints]) into a list (filled from the end) and take the next
- /// `n` values from [UnlinkedExpr.strings] and use the lists of names and
- /// values to create named arguments. Then pop the top `m` values from the
- /// stack (where `m` is obtained from [UnlinkedExpr.ints]) into a list (filled
- /// from the end) and use them as positional arguments. Use the lists of
- /// positional and names arguments to invoke a constant constructor obtained
- /// from [UnlinkedExpr.references], and push the resulting value back onto the
- /// stack.
- ///
- /// Arguments are skipped, and `0` are specified as the numbers of arguments
- /// on the stack, if the expression is not a constant. We store expression of
- /// variable initializers to perform top-level inference, and arguments are
- /// never used to infer types.
- ///
- /// Note that for an invocation of the form `const a.b(...)` (where no type
- /// arguments are specified), it is impossible to tell from the unresolved AST
- /// alone whether `a` is a class name and `b` is a constructor name, or `a` is
- /// a prefix name and `b` is a class name. For consistency between AST based
- /// and elements based summaries, references to default constructors are
- /// always recorded as references to corresponding classes.
- invokeConstructor,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), place them in a [List], and push the result back
- /// onto the stack. The type parameter for the [List] is implicitly
- /// `dynamic`.
- makeUntypedList,
-
- /// Pop the top 2*n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), interpret them as key/value pairs, place them in a
- /// [Map], and push the result back onto the stack. The two type parameters
- /// for the [Map] are implicitly `dynamic`.
- ///
- /// To be replaced with [makeUntypedSetOrMap] for unified collections.
- makeUntypedMap,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), place them in a [List], and push the result back
- /// onto the stack. The type parameter for the [List] is obtained from
- /// [UnlinkedExpr.references].
- makeTypedList,
-
- /// Pop the top 2*n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), interpret them as key/value pairs, place them in a
- /// [Map], and push the result back onto the stack. The two type parameters
- /// for the [Map] are obtained from [UnlinkedExpr.references].
- ///
- /// To be replaced with [makeTypedMap2] for unified collections. This is not
- /// forwards compatible with [makeTypedMap2] because it expects
- /// [CollectionElement]s instead of pairs of [Expression]s.
- makeTypedMap,
-
- /// Pop the top 2 values from the stack, evaluate `v1 == v2`, and push the
- /// result back onto the stack.
- equal,
-
- /// Pop the top 2 values from the stack, evaluate `v1 != v2`, and push the
- /// result back onto the stack.
- notEqual,
-
- /// Pop the top value from the stack, compute its boolean negation, and push
- /// the result back onto the stack.
- not,
-
- /// Pop the top 2 values from the stack, compute `v1 && v2`, and push the
- /// result back onto the stack.
- and,
-
- /// Pop the top 2 values from the stack, compute `v1 || v2`, and push the
- /// result back onto the stack.
- or,
-
- /// Pop the top value from the stack, compute its integer complement, and push
- /// the result back onto the stack.
- complement,
-
- /// Pop the top 2 values from the stack, compute `v1 ^ v2`, and push the
- /// result back onto the stack.
- bitXor,
-
- /// Pop the top 2 values from the stack, compute `v1 & v2`, and push the
- /// result back onto the stack.
- bitAnd,
-
- /// Pop the top 2 values from the stack, compute `v1 | v2`, and push the
- /// result back onto the stack.
- bitOr,
-
- /// Pop the top 2 values from the stack, compute `v1 >> v2`, and push the
- /// result back onto the stack.
- bitShiftRight,
-
- /// Pop the top 2 values from the stack, compute `v1 << v2`, and push the
- /// result back onto the stack.
- bitShiftLeft,
-
- /// Pop the top 2 values from the stack, compute `v1 + v2`, and push the
- /// result back onto the stack.
- add,
-
- /// Pop the top value from the stack, compute its integer negation, and push
- /// the result back onto the stack.
- negate,
-
- /// Pop the top 2 values from the stack, compute `v1 - v2`, and push the
- /// result back onto the stack.
- subtract,
-
- /// Pop the top 2 values from the stack, compute `v1 * v2`, and push the
- /// result back onto the stack.
- multiply,
-
- /// Pop the top 2 values from the stack, compute `v1 / v2`, and push the
- /// result back onto the stack.
- divide,
-
- /// Pop the top 2 values from the stack, compute `v1 ~/ v2`, and push the
- /// result back onto the stack.
- floorDivide,
-
- /// Pop the top 2 values from the stack, compute `v1 > v2`, and push the
- /// result back onto the stack.
- greater,
-
- /// Pop the top 2 values from the stack, compute `v1 < v2`, and push the
- /// result back onto the stack.
- less,
-
- /// Pop the top 2 values from the stack, compute `v1 >= v2`, and push the
- /// result back onto the stack.
- greaterEqual,
-
- /// Pop the top 2 values from the stack, compute `v1 <= v2`, and push the
- /// result back onto the stack.
- lessEqual,
-
- /// Pop the top 2 values from the stack, compute `v1 % v2`, and push the
- /// result back onto the stack.
- modulo,
-
- /// Pop the top 3 values from the stack, compute `v1 ? v2 : v3`, and push the
- /// result back onto the stack.
- conditional,
-
- /// Pop from the stack `value` and get the next `target` reference from
- /// [UnlinkedExpr.references] - a top-level variable (prefixed or not), an
- /// assignable field of a class (prefixed or not), or a sequence of getters
- /// ending with an assignable property `a.b.b.c.d.e`. In general `a.b` cannot
- /// not be distinguished between: `a` is a prefix and `b` is a top-level
- /// variable; or `a` is an object and `b` is the name of a property. Perform
- /// `reference op= value` where `op` is the next assignment operator from
- /// [UnlinkedExpr.assignmentOperators]. Push `value` back into the stack.
- ///
- /// If the assignment operator is a prefix/postfix increment/decrement, then
- /// `value` is not present in the stack, so it should not be popped and the
- /// corresponding value of the `target` after/before update is pushed into the
- /// stack instead.
- assignToRef,
-
- /// Pop from the stack `target` and `value`. Get the name of the property
- /// from `UnlinkedConst.strings` and assign the `value` to the named property
- /// of the `target`. This operation is used when we know that the `target`
- /// is an object reference expression, e.g. `new Foo().a.b.c` or `a.b[0].c.d`.
- /// Perform `target.property op= value` where `op` is the next assignment
- /// operator from [UnlinkedExpr.assignmentOperators]. Push `value` back into
- /// the stack.
- ///
- /// If the assignment operator is a prefix/postfix increment/decrement, then
- /// `value` is not present in the stack, so it should not be popped and the
- /// corresponding value of the `target` after/before update is pushed into the
- /// stack instead.
- assignToProperty,
-
- /// Pop from the stack `index`, `target` and `value`. Perform
- /// `target[index] op= value` where `op` is the next assignment operator from
- /// [UnlinkedExpr.assignmentOperators]. Push `value` back into the stack.
- ///
- /// If the assignment operator is a prefix/postfix increment/decrement, then
- /// `value` is not present in the stack, so it should not be popped and the
- /// corresponding value of the `target` after/before update is pushed into the
- /// stack instead.
- assignToIndex,
-
- /// Pop from the stack `index` and `target`. Push into the stack the result
- /// of evaluation of `target[index]`.
- extractIndex,
-
- /// Pop the top `n` values from the stack (where `n` is obtained from
- /// [UnlinkedExpr.ints]) into a list (filled from the end) and take the next
- /// `n` values from [UnlinkedExpr.strings] and use the lists of names and
- /// values to create named arguments. Then pop the top `m` values from the
- /// stack (where `m` is obtained from [UnlinkedExpr.ints]) into a list (filled
- /// from the end) and use them as positional arguments. Use the lists of
- /// positional and names arguments to invoke a method (or a function) with
- /// the reference from [UnlinkedExpr.references]. If `k` is nonzero (where
- /// `k` is obtained from [UnlinkedExpr.ints]), obtain `k` type arguments from
- /// [UnlinkedExpr.references] and use them as generic type arguments for the
- /// aforementioned method or function. Push the result of the invocation onto
- /// the stack.
- ///
- /// Arguments are skipped, and `0` are specified as the numbers of arguments
- /// on the stack, if the expression is not a constant. We store expression of
- /// variable initializers to perform top-level inference, and arguments are
- /// never used to infer types.
- ///
- /// In general `a.b` cannot not be distinguished between: `a` is a prefix and
- /// `b` is a top-level function; or `a` is an object and `b` is the name of a
- /// method. This operation should be used for a sequence of identifiers
- /// `a.b.b.c.d.e` ending with an invokable result.
- invokeMethodRef,
-
- /// Pop the top `n` values from the stack (where `n` is obtained from
- /// [UnlinkedExpr.ints]) into a list (filled from the end) and take the next
- /// `n` values from [UnlinkedExpr.strings] and use the lists of names and
- /// values to create named arguments. Then pop the top `m` values from the
- /// stack (where `m` is obtained from [UnlinkedExpr.ints]) into a list (filled
- /// from the end) and use them as positional arguments. Use the lists of
- /// positional and names arguments to invoke the method with the name from
- /// [UnlinkedExpr.strings] of the target popped from the stack. If `k` is
- /// nonzero (where `k` is obtained from [UnlinkedExpr.ints]), obtain `k` type
- /// arguments from [UnlinkedExpr.references] and use them as generic type
- /// arguments for the aforementioned method. Push the result of the
- /// invocation onto the stack.
- ///
- /// Arguments are skipped, and `0` are specified as the numbers of arguments
- /// on the stack, if the expression is not a constant. We store expression of
- /// variable initializers to perform top-level inference, and arguments are
- /// never used to infer types.
- ///
- /// This operation should be used for invocation of a method invocation
- /// where `target` is known to be an object instance.
- invokeMethod,
-
- /// Begin a new cascade section. Duplicate the top value of the stack.
- cascadeSectionBegin,
-
- /// End a new cascade section. Pop the top value from the stack and throw it
- /// away.
- cascadeSectionEnd,
-
- /// Pop the top value from the stack and cast it to the type with reference
- /// from [UnlinkedExpr.references], push the result into the stack.
- typeCast,
-
- /// Pop the top value from the stack and check whether it is a subclass of the
- /// type with reference from [UnlinkedExpr.references], push the result into
- /// the stack.
- typeCheck,
-
- /// Pop the top value from the stack and raise an exception with this value.
- throwException,
-
- /// Obtain two values `n` and `m` from [UnlinkedExpr.ints]. Then, starting at
- /// the executable element for the expression being evaluated, if n > 0, pop
- /// to the nth enclosing function element. Then, push the mth local function
- /// of that element onto the stack.
- pushLocalFunctionReference,
-
- /// Pop the top two values from the stack. If the first value is non-null,
- /// keep it and discard the second. Otherwise, keep the second and discard
- /// the first.
- ifNull,
-
- /// Pop the top value from the stack. Treat it as a Future and await its
- /// completion. Then push the awaited value onto the stack.
- await,
-
- /// Push an abstract value onto the stack. Abstract values mark the presence
- /// of a value, but whose details are not included.
- ///
- /// This is not used by the summary generators today, but it will be used to
- /// experiment with prunning the initializer expression tree, so only
- /// information that is necessary gets included in the output summary file.
- pushUntypedAbstract,
-
- /// Get the next type reference from [UnlinkedExpr.references] and push an
- /// abstract value onto the stack that has that type.
- ///
- /// Like [pushUntypedAbstract], this is also not used by the summary
- /// generators today. The plan is to experiment with prunning the initializer
- /// expression tree, and include just enough type information to perform
- /// strong-mode type inference, but not all the details of how this type was
- /// obtained.
- pushTypedAbstract,
-
- /// Push an error onto the stack.
- ///
- /// Like [pushUntypedAbstract], this is not used by summary generators today.
- /// This will be used to experiment with prunning the const expression tree.
- /// If a constant has an error, we can omit the subexpression containing the
- /// error and only include a marker that an error was detected.
- pushError,
-
- /// Push `this` expression onto the stack.
- pushThis,
-
- /// Push `super` expression onto the stack.
- pushSuper,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), place them in a [Set], and push the result back
- /// onto the stack. The type parameter for the [Set] is implicitly
- /// `dynamic`.
- makeUntypedSet,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), place them in a [Set], and push the result back
- /// onto the stack. The type parameter for the [Set] is obtained from
- /// [UnlinkedExpr.references].
- makeTypedSet,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), which should be [CollectionElement]s, place them in
- /// a [SetOrMap], and push the result back onto the stack.
- makeUntypedSetOrMap,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), which should be [CollectionElement]s, place them in
- /// a [Map], and push the result back onto the stack. The two type parameters
- /// for the [Map] are obtained from [UnlinkedExpr.references].
- ///
- /// To replace [makeTypedMap] for unified collections. This is not backwards
- /// compatible with [makeTypedMap] because it expects [CollectionElement]s
- /// instead of pairs of [Expression]s.
- makeTypedMap2,
-
- /// Pop the top 2 values from the stack, place them in a [MapLiteralEntry],
- /// and push the result back onto the stack.
- makeMapLiteralEntry,
-
- /// Pop the top value from the stack, convert it to a spread element of type
- /// `...`, and push the result back onto the stack.
- spreadElement,
-
- /// Pop the top value from the stack, convert it to a spread element of type
- /// `...?`, and push the result back onto the stack.
- nullAwareSpreadElement,
-
- /// Pop the top two values from the stack. The first is a condition
- /// and the second is a collection element. Push an "if" element having the
- /// given condition, with the collection element as its "then" clause.
- ifElement,
-
- /// Pop the top three values from the stack. The first is a condition and the
- /// other two are collection elements. Push an "if" element having the given
- /// condition, with the two collection elements as its "then" and "else"
- /// clauses, respectively.
- ifElseElement,
-
- /// Pop the top n+2 values from the stack, where n is obtained from
- /// [UnlinkedExpr.ints]. The first two are the initialization and condition
- /// of the for-loop; the remainder are the updaters.
- forParts,
-
- /// Pop the top 2 values from the stack. The first is the for loop parts.
- /// The second is the body.
- forElement,
-
- /// Push the empty expression (used for missing initializers and conditions in
- /// `for` loops)
- pushEmptyExpression,
-
- /// Add a variable to the current scope whose name is obtained from
- /// [UnlinkedExpr.strings]. This is separate from [variableDeclaration]
- /// because the scope of the variable includes its own initializer.
- variableDeclarationStart,
-
- /// Pop the top value from the stack, and use it as the initializer for a
- /// variable declaration; the variable being declared is obtained by looking
- /// at the nth variable most recently added to the scope (where n counts from
- /// zero and is obtained from [UnlinkedExpr.ints]).
- variableDeclaration,
-
- /// Pop the top n values from the stack, which should all be variable
- /// declarations, and use them to create an untyped for-initializer
- /// declaration. The value of n is obtained from [UnlinkedExpr.ints].
- forInitializerDeclarationsUntyped,
-
- /// Pop the top n values from the stack, which should all be variable
- /// declarations, and use them to create a typed for-initializer
- /// declaration. The value of n is obtained from [UnlinkedExpr.ints]. The
- /// type is obtained from [UnlinkedExpr.references].
- forInitializerDeclarationsTyped,
-
- /// Pop from the stack `value` and get a string from [UnlinkedExpr.strings].
- /// Use this string to look up a parameter. Perform `parameter op= value`,
- /// where `op` is the next assignment operator from
- /// [UnlinkedExpr.assignmentOperators]. Push `value` back onto the stack.
- ///
- /// If the assignment operator is a prefix/postfix increment/decrement, then
- /// `value` is not present in the stack, so it should not be popped and the
- /// corresponding value of the parameter after/before update is pushed onto
- /// the stack instead.
- assignToParameter,
-
- /// Pop from the stack an identifier and an expression, and create for-each
- /// parts of the form `identifier in expression`.
- forEachPartsWithIdentifier,
-
- /// Pop the top 2 values from the stack. The first is the for loop parts.
- /// The second is the body.
- forElementWithAwait,
-
- /// Pop an expression from the stack, and create for-each parts of the form
- /// `var name in expression`, where `name` is obtained from
- /// [UnlinkedExpr.strings].
- forEachPartsWithUntypedDeclaration,
-
- /// Pop an expression from the stack, and create for-each parts of the form
- /// `Type name in expression`, where `name` is obtained from
- /// [UnlinkedExpr.strings], and `Type` is obtained from
- /// [UnlinkedExpr.references].
- forEachPartsWithTypedDeclaration,
-
- /// Pop the top 2 values from the stack, compute `v1 >>> v2`, and push the
- /// result back onto the stack.
- bitShiftRightLogical
-}
-
-/// Enum used to indicate the kind of a parameter.
-enum UnlinkedParamKind : byte {
- /// Parameter is required and positional.
- requiredPositional,
-
- /// Parameter is optional and positional (enclosed in `[]`)
- optionalPositional,
-
- /// Parameter is optional and named (enclosed in `{}`)
- optionalNamed,
-
- /// Parameter is required and named (enclosed in `{}`).
- requiredNamed
-}
-
-/// TODO(scheglov) document
-enum UnlinkedTokenKind : byte {
- nothing,
-
- comment,
-
- keyword,
-
- simple,
-
- string
-}
-
/// TODO(scheglov) document
enum UnlinkedTokenType : byte {
NOTHING,
@@ -1700,15 +1009,6 @@
shows:[string] (id: 0);
}
-/// Information about an element code range.
-table CodeRange {
- /// Length of the element code.
- length:uint (id: 1);
-
- /// Offset of the element code relative to the beginning of the file.
- offset:uint (id: 0);
-}
-
table DiagnosticMessage {
/// The absolute and normalized path of the file associated with this message.
filePath:string (id: 0);
@@ -1733,185 +1033,9 @@
templateValues:[string] (id: 1);
}
-/// Summary information about a reference to an entity such as a type, top level
-/// executable, or executable within a class.
-table EntityRef {
- /// The kind of entity being represented.
- entityKind:EntityRefKind (id: 8);
-
- /// Notice: This will be deprecated. However, its not deprecated yet, as we're
- /// keeping it for backwards compatibilty, and marking it deprecated makes it
- /// unreadable.
- ///
- /// TODO(mfairhurst) mark this deprecated, and remove its logic.
- ///
- /// If this is a reference to a function type implicitly defined by a
- /// function-typed parameter, a list of zero-based indices indicating the path
- /// from the entity referred to by [reference] to the appropriate type
- /// parameter. Otherwise the empty list.
- ///
- /// If there are N indices in this list, then the entity being referred to is
- /// the function type implicitly defined by a function-typed parameter of a
- /// function-typed parameter, to N levels of nesting. The first index in the
- /// list refers to the outermost level of nesting; for example if [reference]
- /// refers to the entity defined by:
- ///
- /// void f(x, void g(y, z, int h(String w))) { ... }
- ///
- /// Then to refer to the function type implicitly defined by parameter `h`
- /// (which is parameter 2 of parameter 1 of `f`), then
- /// [implicitFunctionTypeIndices] should be [1, 2].
- ///
- /// Note that if the entity being referred to is a generic method inside a
- /// generic class, then the type arguments in [typeArguments] are applied
- /// first to the class and then to the method.
- implicitFunctionTypeIndices:[uint] (id: 4);
-
- /// If the reference represents a type, the nullability of the type.
- nullabilitySuffix:EntityRefNullabilitySuffix (id: 10);
-
- /// If this is a reference to a type parameter, one-based index into the list
- /// of [UnlinkedTypeParam]s currently in effect. Indexing is done using De
- /// Bruijn index conventions; that is, innermost parameters come first, and
- /// if a class or method has multiple parameters, they are indexed from right
- /// to left. So for instance, if the enclosing declaration is
- ///
- /// class C<T,U> {
- /// m<V,W> {
- /// ...
- /// }
- /// }
- ///
- /// Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T,
- /// respectively.
- ///
- /// If the type being referred to is not a type parameter, [paramReference] is
- /// zero.
- paramReference:uint (id: 3);
-
- /// Index into [UnlinkedUnit.references] for the entity being referred to, or
- /// zero if this is a reference to a type parameter.
- reference:uint (id: 0);
-
- /// If this [EntityRef] appears in a syntactic context where its type
- /// arguments might need to be inferred by a method other than
- /// instantiate-to-bounds, and [typeArguments] is empty, a slot id (which is
- /// unique within the compilation unit). If an entry appears in
- /// [LinkedUnit.types] whose [slot] matches this value, that entry will
- /// contain the complete inferred type.
- ///
- /// This is called `refinedSlot` to clarify that if it points to an inferred
- /// type, it points to a type that is a "refinement" of this one (one in which
- /// some type arguments have been inferred).
- refinedSlot:uint (id: 9);
-
- /// If this [EntityRef] is contained within [LinkedUnit.types], slot id (which
- /// is unique within the compilation unit) identifying the target of type
- /// propagation or type inference with which this [EntityRef] is associated.
- ///
- /// Otherwise zero.
- slot:uint (id: 2);
-
- /// If this [EntityRef] is a reference to a function type whose
- /// [FunctionElement] is not in any library (e.g. a function type that was
- /// synthesized by a LUB computation), the function parameters. Otherwise
- /// empty.
- syntheticParams:[UnlinkedParam] (id: 6);
-
- /// If this [EntityRef] is a reference to a function type whose
- /// [FunctionElement] is not in any library (e.g. a function type that was
- /// synthesized by a LUB computation), the return type of the function.
- /// Otherwise `null`.
- syntheticReturnType:EntityRef (id: 5);
-
- /// If this is an instantiation of a generic type or generic executable, the
- /// type arguments used to instantiate it (if any).
- typeArguments:[EntityRef] (id: 1);
-
- /// If this is a function type, the type parameters defined for the function
- /// type (if any).
- typeParameters:[UnlinkedTypeParam] (id: 7);
-}
-
-/// Information about a dependency that exists between one library and another
-/// due to an "import" declaration.
-table LinkedDependency {
- /// Absolute URI for the compilation units listed in the library's `part`
- /// declarations, empty string for invalid URI.
- parts:[string] (id: 1);
-
- /// The absolute URI of the dependent library, e.g. `package:foo/bar.dart`.
- uri:string (id: 0);
-}
-
-/// Information about a single name in the export namespace of the library that
-/// is not in the public namespace.
-table LinkedExportName {
- /// Index into [LinkedLibrary.dependencies] for the library in which the
- /// entity is defined.
- dependency:uint (id: 0);
-
- /// The kind of the entity being referred to.
- kind:ReferenceKind (id: 3);
-
- /// Name of the exported entity. For an exported setter, this name includes
- /// the trailing '='.
- name:string (id: 1);
-
- /// Integer index indicating which unit in the exported library contains the
- /// definition of the entity. As with indices into [LinkedLibrary.units],
- /// zero represents the defining compilation unit, and nonzero values
- /// represent parts in the order of the corresponding `part` declarations.
- unit:uint (id: 2);
-}
-
-/// Linked summary of a library.
+/// TODO(scheglov) Remove it.
table LinkedLibrary {
- /// The libraries that this library depends on (either via an explicit import
- /// statement or via the implicit dependencies on `dart:core` and
- /// `dart:async`). The first element of this array is a pseudo-dependency
- /// representing the library itself (it is also used for `dynamic` and
- /// `void`). This is followed by elements representing "prelinked"
- /// dependencies (direct imports and the transitive closure of exports).
- /// After the prelinked dependencies are elements representing "linked"
- /// dependencies.
- ///
- /// A library is only included as a "linked" dependency if it is a true
- /// dependency (e.g. a propagated or inferred type or constant value
- /// implicitly refers to an element declared in the library) or
- /// anti-dependency (e.g. the result of type propagation or type inference
- /// depends on the lack of a certain declaration in the library).
- dependencies:[LinkedDependency] (id: 0);
-
- /// For each export in [UnlinkedUnit.exports], an index into [dependencies]
- /// of the library being exported.
- exportDependencies:[uint] (id: 6);
-
- /// Information about entities in the export namespace of the library that are
- /// not in the public namespace of the library (that is, entities that are
- /// brought into the namespace via `export` directives).
- ///
- /// Sorted by name.
- exportNames:[LinkedExportName] (id: 4);
-
- /// Indicates whether this library was summarized in "fallback mode". If
- /// true, all other fields in the data structure have their default values.
- fallbackMode:bool (id: 5, deprecated);
-
- /// For each import in [UnlinkedUnit.imports], an index into [dependencies]
- /// of the library being imported.
- importDependencies:[uint] (id: 1);
-
- /// The number of elements in [dependencies] which are not "linked"
- /// dependencies (that is, the number of libraries in the direct imports plus
- /// the transitive closure of exports, plus the library itself).
- numPrelinkedDependencies:uint (id: 2);
-
- /// The linked summary of all the compilation units constituting the
- /// library. The summary of the defining compilation unit is listed first,
- /// followed by the summary of each part, in the order of the `part`
- /// declarations in the defining compilation unit.
- units:[LinkedUnit] (id: 3);
+ placeholder:uint (id: 0);
}
/// Information about a linked AST node.
@@ -2097,87 +1221,6 @@
uriStr:string (id: 0);
}
-/// Information about the resolution of an [UnlinkedReference].
-table LinkedReference {
- /// If this [LinkedReference] doesn't have an associated [UnlinkedReference],
- /// and the entity being referred to is contained within another entity, index
- /// of the containing entity. This behaves similarly to
- /// [UnlinkedReference.prefixReference], however it is only used for class
- /// members, not for prefixed imports.
- ///
- /// Containing references must always point backward; that is, for all i, if
- /// LinkedUnit.references[i].containingReference != 0, then
- /// LinkedUnit.references[i].containingReference < i.
- containingReference:uint (id: 5);
-
- /// Index into [LinkedLibrary.dependencies] indicating which imported library
- /// declares the entity being referred to.
- ///
- /// Zero if this entity is contained within another entity (e.g. a class
- /// member), or if [kind] is [ReferenceKind.prefix].
- dependency:uint (id: 1);
-
- /// The kind of the entity being referred to. For the pseudo-types `dynamic`
- /// and `void`, the kind is [ReferenceKind.classOrEnum].
- kind:ReferenceKind (id: 2);
-
- /// If [kind] is [ReferenceKind.function] (that is, the entity being referred
- /// to is a local function), the index of the function within
- /// [UnlinkedExecutable.localFunctions]. Otherwise zero.
- localIndex:uint (id: 6, deprecated);
-
- /// If this [LinkedReference] doesn't have an associated [UnlinkedReference],
- /// name of the entity being referred to. For the pseudo-type `dynamic`, the
- /// string is "dynamic". For the pseudo-type `void`, the string is "void".
- name:string (id: 3);
-
- /// If the entity being referred to is generic, the number of type parameters
- /// it declares (does not include type parameters of enclosing entities).
- /// Otherwise zero.
- numTypeParameters:uint (id: 4);
-
- /// Integer index indicating which unit in the imported library contains the
- /// definition of the entity. As with indices into [LinkedLibrary.units],
- /// zero represents the defining compilation unit, and nonzero values
- /// represent parts in the order of the corresponding `part` declarations.
- ///
- /// Zero if this entity is contained within another entity (e.g. a class
- /// member).
- unit:uint (id: 0);
-}
-
-/// Linked summary of a compilation unit.
-table LinkedUnit {
- /// List of slot ids (referring to [UnlinkedExecutable.constCycleSlot])
- /// corresponding to const constructors that are part of cycles.
- constCycles:[uint] (id: 2);
-
- /// List of slot ids (referring to [UnlinkedClass.notSimplyBoundedSlot] or
- /// [UnlinkedTypedef.notSimplyBoundedSlot]) corresponding to classes and
- /// typedefs that are not simply bounded.
- notSimplyBounded:[uint] (id: 5);
-
- /// List of slot ids (referring to [UnlinkedParam.inheritsCovariantSlot] or
- /// [UnlinkedVariable.inheritsCovariantSlot]) corresponding to parameters
- /// that inherit `@covariant` behavior from a base class.
- parametersInheritingCovariant:[uint] (id: 3);
-
- /// Information about the resolution of references within the compilation
- /// unit. Each element of [UnlinkedUnit.references] has a corresponding
- /// element in this list (at the same index). If this list has additional
- /// elements beyond the number of elements in [UnlinkedUnit.references], those
- /// additional elements are references that are only referred to implicitly
- /// (e.g. elements involved in inferred or propagated types).
- references:[LinkedReference] (id: 0);
-
- /// The list of type inference errors.
- topLevelInferenceErrors:[TopLevelInferenceError] (id: 4);
-
- /// List associating slot ids found inside the unlinked summary for the
- /// compilation unit with propagated and inferred types.
- types:[EntityRef] (id: 1);
-}
-
/// Summary information about a package.
table PackageBundle {
/// MD5 hash of the non-informative fields of the [PackageBundle] (not
@@ -2192,11 +1235,11 @@
dependencies:[PackageDependencyInfo] (id: 8, deprecated);
/// Linked libraries.
- linkedLibraries:[LinkedLibrary] (id: 0);
+ linkedLibraries:[LinkedLibrary] (id: 0, deprecated);
/// The list of URIs of items in [linkedLibraries], e.g. `dart:core` or
/// `package:foo/bar.dart`.
- linkedLibraryUris:[string] (id: 1);
+ linkedLibraryUris:[string] (id: 1, deprecated);
/// Major version of the summary format. See
/// [PackageBundleAssembler.currentMajorVersion].
@@ -2211,89 +1254,15 @@
unlinkedUnitHashes:[string] (id: 4, deprecated);
/// Unlinked information for the compilation units constituting the package.
- unlinkedUnits:[UnlinkedUnit] (id: 2);
+ unlinkedUnits:[UnlinkedUnit] (id: 2, deprecated);
/// The list of URIs of items in [unlinkedUnits], e.g. `dart:core/bool.dart`.
- unlinkedUnitUris:[string] (id: 3);
+ unlinkedUnitUris:[string] (id: 3, deprecated);
}
-/// Information about a single dependency of a summary package.
+/// TODO(scheglov) Remove it.
table PackageDependencyInfo {
- /// API signature of this dependency.
- apiSignature:string (id: 0);
-
- /// If this dependency summarizes any files whose URI takes the form
- /// "package:<package_name>/...", a list of all such package names, sorted
- /// lexicographically. Otherwise empty.
- includedPackageNames:[string] (id: 2);
-
- /// Indicates whether this dependency summarizes any files whose URI takes the
- /// form "dart:...".
- includesDartUris:bool (id: 4);
-
- /// Indicates whether this dependency summarizes any files whose URI takes the
- /// form "file:...".
- includesFileUris:bool (id: 3);
-
- /// Relative path to the summary file for this dependency. This is intended
- /// as a hint to help the analysis server locate summaries of dependencies.
- /// We don't specify precisely what this path is relative to, but we expect
- /// it to be relative to a directory the analysis server can find (e.g. for
- /// projects built using Bazel, it would be relative to the "bazel-bin"
- /// directory).
- ///
- /// Absent if the path is not known.
- summaryPath:string (id: 1);
-}
-
-/// Index information about a package.
-table PackageIndex {
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the kind of the synthetic element.
- elementKinds:[IndexSyntheticElementKind] (id: 5);
-
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the identifier of the class member element name, or `null` if the element
- /// is a top-level element. The list is sorted in ascending order, so that
- /// the client can quickly check whether an element is referenced in this
- /// [PackageIndex].
- elementNameClassMemberIds:[uint] (id: 7);
-
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the identifier of the named parameter name, or `null` if the element is
- /// not a named parameter. The list is sorted in ascending order, so that the
- /// client can quickly check whether an element is referenced in this
- /// [PackageIndex].
- elementNameParameterIds:[uint] (id: 8);
-
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the identifier of the top-level element name, or `null` if the element is
- /// the unit. The list is sorted in ascending order, so that the client can
- /// quickly check whether an element is referenced in this [PackageIndex].
- elementNameUnitMemberIds:[uint] (id: 1);
-
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the index into [unitLibraryUris] and [unitUnitUris] for the library
- /// specific unit where the element is declared.
- elementUnits:[uint] (id: 0);
-
- /// List of unique element strings used in this [PackageIndex]. The list is
- /// sorted in ascending order, so that the client can quickly check the
- /// presence of a string in this [PackageIndex].
- strings:[string] (id: 6);
-
- /// Each item of this list corresponds to the library URI of a unique library
- /// specific unit referenced in the [PackageIndex]. It is an index into
- /// [strings] list.
- unitLibraryUris:[uint] (id: 2);
-
- /// List of indexes of each unit in this [PackageIndex].
- units:[UnitIndex] (id: 4);
-
- /// Each item of this list corresponds to the unit URI of a unique library
- /// specific unit referenced in the [PackageIndex]. It is an index into
- /// [strings] list.
- unitUnitUris:[uint] (id: 3);
+ placeholder:uint (id: 0);
}
/// Summary information about a top-level type inference error.
@@ -2310,521 +1279,6 @@
slot:uint (id: 0);
}
-/// Index information about a unit in a [PackageIndex].
-table UnitIndex {
- /// Each item of this list is the kind of an element defined in this unit.
- definedNameKinds:[IndexNameKind] (id: 6);
-
- /// Each item of this list is the name offset of an element defined in this
- /// unit relative to the beginning of the file.
- definedNameOffsets:[uint] (id: 7);
-
- /// Each item of this list corresponds to an element defined in this unit. It
- /// is an index into [PackageIndex.strings] list. The list is sorted in
- /// ascending order, so that the client can quickly find name definitions in
- /// this [UnitIndex].
- definedNames:[uint] (id: 5);
-
- /// Index into [PackageIndex.unitLibraryUris] and [PackageIndex.unitUnitUris]
- /// for the library specific unit that corresponds to this [UnitIndex].
- unit:uint (id: 0);
-
- /// Each item of this list is the `true` if the corresponding element usage
- /// is qualified with some prefix.
- usedElementIsQualifiedFlags:[ubyte] (id: 11);
-
- /// Each item of this list is the kind of the element usage.
- usedElementKinds:[IndexRelationKind] (id: 4);
-
- /// Each item of this list is the length of the element usage.
- usedElementLengths:[uint] (id: 1);
-
- /// Each item of this list is the offset of the element usage relative to the
- /// beginning of the file.
- usedElementOffsets:[uint] (id: 2);
-
- /// Each item of this list is the index into [PackageIndex.elementUnits] and
- /// [PackageIndex.elementOffsets]. The list is sorted in ascending order, so
- /// that the client can quickly find element references in this [UnitIndex].
- usedElements:[uint] (id: 3);
-
- /// Each item of this list is the `true` if the corresponding name usage
- /// is qualified with some prefix.
- usedNameIsQualifiedFlags:[ubyte] (id: 12);
-
- /// Each item of this list is the kind of the name usage.
- usedNameKinds:[IndexRelationKind] (id: 10);
-
- /// Each item of this list is the offset of the name usage relative to the
- /// beginning of the file.
- usedNameOffsets:[uint] (id: 9);
-
- /// Each item of this list is the index into [PackageIndex.strings] for a
- /// used name. The list is sorted in ascending order, so that the client can
- /// quickly find name uses in this [UnitIndex].
- usedNames:[uint] (id: 8);
-}
-
-/// Unlinked summary information about a class declaration.
-table UnlinkedClass {
- /// Annotations for this class.
- annotations:[UnlinkedExpr] (id: 5);
-
- /// Code range of the class.
- codeRange:CodeRange (id: 13);
-
- /// Documentation comment for the class, or `null` if there is no
- /// documentation comment.
- documentationComment:UnlinkedDocumentationComment (id: 6);
-
- /// Executable objects (methods, getters, and setters) contained in the class.
- executables:[UnlinkedExecutable] (id: 2);
-
- /// Field declarations contained in the class.
- fields:[UnlinkedVariable] (id: 4);
-
- /// Indicates whether this class is the core "Object" class (and hence has no
- /// supertype)
- hasNoSupertype:bool (id: 12);
-
- /// Interfaces appearing in an `implements` clause, if any.
- interfaces:[EntityRef] (id: 7);
-
- /// Indicates whether the class is declared with the `abstract` keyword.
- isAbstract:bool (id: 8);
-
- /// Indicates whether the class is declared using mixin application syntax.
- isMixinApplication:bool (id: 11);
-
- /// Mixins appearing in a `with` clause, if any.
- mixins:[EntityRef] (id: 10);
-
- /// Name of the class.
- name:string (id: 0);
-
- /// Offset of the class name relative to the beginning of the file.
- nameOffset:uint (id: 1);
-
- /// If the class might not be simply bounded, a nonzero slot id which is unique
- /// within this compilation unit. If this id is found in
- /// [LinkedUnit.notSimplyBounded], then at least one of this class's type
- /// parameters is not simply bounded, hence this class can't be used as a raw
- /// type when specifying the bound of a type parameter.
- ///
- /// Otherwise, zero.
- notSimplyBoundedSlot:uint (id: 16);
-
- /// Superclass constraints for this mixin declaration. The list will be empty
- /// if this class is not a mixin declaration, or if the declaration does not
- /// have an `on` clause (in which case the type `Object` is implied).
- superclassConstraints:[EntityRef] (id: 14);
-
- /// Names of methods, getters, setters, and operators that this mixin
- /// declaration super-invokes. For setters this includes the trailing "=".
- /// The list will be empty if this class is not a mixin declaration.
- superInvokedNames:[string] (id: 15);
-
- /// Supertype of the class, or `null` if either (a) the class doesn't
- /// explicitly declare a supertype (and hence has supertype `Object`), or (b)
- /// the class *is* `Object` (and hence has no supertype).
- supertype:EntityRef (id: 3);
-
- /// Type parameters of the class, if any.
- typeParameters:[UnlinkedTypeParam] (id: 9);
-}
-
-/// Unlinked summary information about a `show` or `hide` combinator in an
-/// import or export declaration.
-table UnlinkedCombinator {
- /// If this is a `show` combinator, offset of the end of the list of shown
- /// names. Otherwise zero.
- end:uint (id: 3);
-
- /// List of names which are hidden. Empty if this is a `show` combinator.
- hides:[string] (id: 1);
-
- /// If this is a `show` combinator, offset of the `show` keyword. Otherwise
- /// zero.
- offset:uint (id: 2);
-
- /// List of names which are shown. Empty if this is a `hide` combinator.
- shows:[string] (id: 0);
-}
-
-/// Unlinked summary information about a single import or export configuration.
-table UnlinkedConfiguration {
- /// The name of the declared variable whose value is being used in the
- /// condition.
- name:string (id: 0);
-
- /// The URI of the implementation library to be used if the condition is true.
- uri:string (id: 2);
-
- /// The value to which the value of the declared variable will be compared,
- /// or `true` if the condition does not include an equality test.
- value:string (id: 1);
-}
-
-/// Unlinked summary information about a constructor initializer.
-table UnlinkedConstructorInitializer {
- /// If there are `m` [arguments] and `n` [argumentNames], then each argument
- /// from [arguments] with index `i` such that `n + i - m >= 0`, should be used
- /// with the name at `n + i - m`.
- argumentNames:[string] (id: 4);
-
- /// If [kind] is `thisInvocation` or `superInvocation`, the arguments of the
- /// invocation. Otherwise empty.
- arguments:[UnlinkedExpr] (id: 3);
-
- /// If [kind] is `field`, the expression of the field initializer.
- /// Otherwise `null`.
- expression:UnlinkedExpr (id: 1);
-
- /// The kind of the constructor initializer (field, redirect, super).
- kind:UnlinkedConstructorInitializerKind (id: 2);
-
- /// If [kind] is `field`, the name of the field declared in the class. If
- /// [kind] is `thisInvocation`, the name of the constructor, declared in this
- /// class, to redirect to. If [kind] is `superInvocation`, the name of the
- /// constructor, declared in the superclass, to invoke.
- name:string (id: 0);
-}
-
-/// Unlinked summary information about a documentation comment.
-table UnlinkedDocumentationComment {
- /// Length of the documentation comment (prior to replacing '\r\n' with '\n').
- length:uint (id: 0, deprecated);
-
- /// Offset of the beginning of the documentation comment relative to the
- /// beginning of the file.
- offset:uint (id: 2, deprecated);
-
- /// Text of the documentation comment, with '\r\n' replaced by '\n'.
- ///
- /// References appearing within the doc comment in square brackets are not
- /// specially encoded.
- text:string (id: 1);
-}
-
-/// Unlinked summary information about an enum declaration.
-table UnlinkedEnum {
- /// Annotations for this enum.
- annotations:[UnlinkedExpr] (id: 4);
-
- /// Code range of the enum.
- codeRange:CodeRange (id: 5);
-
- /// Documentation comment for the enum, or `null` if there is no documentation
- /// comment.
- documentationComment:UnlinkedDocumentationComment (id: 3);
-
- /// Name of the enum type.
- name:string (id: 0);
-
- /// Offset of the enum name relative to the beginning of the file.
- nameOffset:uint (id: 1);
-
- /// Values listed in the enum declaration, in declaration order.
- values:[UnlinkedEnumValue] (id: 2);
-}
-
-/// Unlinked summary information about a single enumerated value in an enum
-/// declaration.
-table UnlinkedEnumValue {
- /// Annotations for this value.
- annotations:[UnlinkedExpr] (id: 3);
-
- /// Documentation comment for the enum value, or `null` if there is no
- /// documentation comment.
- documentationComment:UnlinkedDocumentationComment (id: 2);
-
- /// Name of the enumerated value.
- name:string (id: 0);
-
- /// Offset of the enum value name relative to the beginning of the file.
- nameOffset:uint (id: 1);
-}
-
-/// Unlinked summary information about a function, method, getter, or setter
-/// declaration.
-table UnlinkedExecutable {
- /// Annotations for this executable.
- annotations:[UnlinkedExpr] (id: 6);
-
- /// If this executable's function body is declared using `=>`, the expression
- /// to the right of the `=>`. May be omitted if neither type inference nor
- /// constant evaluation depends on the function body.
- bodyExpr:UnlinkedExpr (id: 29);
-
- /// Code range of the executable.
- codeRange:CodeRange (id: 26);
-
- /// If a constant [UnlinkedExecutableKind.constructor], the constructor
- /// initializers. Otherwise empty.
- constantInitializers:[UnlinkedConstructorInitializer] (id: 14);
-
- /// If [kind] is [UnlinkedExecutableKind.constructor] and [isConst] is `true`,
- /// a nonzero slot id which is unique within this compilation unit. If this
- /// id is found in [LinkedUnit.constCycles], then this constructor is part of
- /// a cycle.
- ///
- /// Otherwise, zero.
- constCycleSlot:uint (id: 25);
-
- /// Documentation comment for the executable, or `null` if there is no
- /// documentation comment.
- documentationComment:UnlinkedDocumentationComment (id: 7);
-
- /// If this executable's return type is inferable, nonzero slot id
- /// identifying which entry in [LinkedUnit.types] contains the inferred
- /// return type. If there is no matching entry in [LinkedUnit.types], then
- /// no return type was inferred for this variable, so its static type is
- /// `dynamic`.
- inferredReturnTypeSlot:uint (id: 5);
-
- /// Indicates whether the executable is declared using the `abstract` keyword.
- isAbstract:bool (id: 10);
-
- /// Indicates whether the executable has body marked as being asynchronous.
- isAsynchronous:bool (id: 27);
-
- /// Indicates whether the executable is declared using the `const` keyword.
- isConst:bool (id: 12);
-
- /// Indicates whether the executable is declared using the `external` keyword.
- isExternal:bool (id: 11);
-
- /// Indicates whether the executable is declared using the `factory` keyword.
- isFactory:bool (id: 8);
-
- /// Indicates whether the executable has body marked as being a generator.
- isGenerator:bool (id: 28);
-
- /// Indicates whether the executable is a redirected constructor.
- isRedirectedConstructor:bool (id: 13);
-
- /// Indicates whether the executable is declared using the `static` keyword.
- ///
- /// Note that for top level executables, this flag is false, since they are
- /// not declared using the `static` keyword (even though they are considered
- /// static for semantic purposes).
- isStatic:bool (id: 9);
-
- /// The kind of the executable (function/method, getter, setter, or
- /// constructor).
- kind:UnlinkedExecutableKind (id: 4);
-
- /// The list of local functions.
- localFunctions:[UnlinkedExecutable] (id: 18);
-
- /// The list of local labels.
- localLabels:[string] (id: 22, deprecated);
-
- /// The list of local variables.
- localVariables:[UnlinkedVariable] (id: 19, deprecated);
-
- /// Name of the executable. For setters, this includes the trailing "=". For
- /// named constructors, this excludes the class name and excludes the ".".
- /// For unnamed constructors, this is the empty string.
- name:string (id: 1);
-
- /// If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty,
- /// the offset of the end of the constructor name. Otherwise zero.
- nameEnd:uint (id: 23);
-
- /// Offset of the executable name relative to the beginning of the file. For
- /// named constructors, this excludes the class name and excludes the ".".
- /// For unnamed constructors, this is the offset of the class name (i.e. the
- /// offset of the second "C" in "class C { C(); }").
- nameOffset:uint (id: 0);
-
- /// Parameters of the executable, if any. Note that getters have no
- /// parameters (hence this will be the empty list), and setters have a single
- /// parameter.
- parameters:[UnlinkedParam] (id: 2);
-
- /// If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty,
- /// the offset of the period before the constructor name. Otherwise zero.
- periodOffset:uint (id: 24);
-
- /// If [isRedirectedConstructor] and [isFactory] are both `true`, the
- /// constructor to which this constructor redirects; otherwise empty.
- redirectedConstructor:EntityRef (id: 15);
-
- /// If [isRedirectedConstructor] is `true` and [isFactory] is `false`, the
- /// name of the constructor that this constructor redirects to; otherwise
- /// empty.
- redirectedConstructorName:string (id: 17);
-
- /// Declared return type of the executable. Absent if the executable is a
- /// constructor or the return type is implicit. Absent for executables
- /// associated with variable initializers and closures, since these
- /// executables may have return types that are not accessible via direct
- /// imports.
- returnType:EntityRef (id: 3);
-
- /// Type parameters of the executable, if any. Empty if support for generic
- /// method syntax is disabled.
- typeParameters:[UnlinkedTypeParam] (id: 16);
-
- /// If a local function, the length of the visible range; zero otherwise.
- visibleLength:uint (id: 20);
-
- /// If a local function, the beginning of the visible range; zero otherwise.
- visibleOffset:uint (id: 21);
-}
-
-/// Unlinked summary information about an export declaration (stored outside
-/// [UnlinkedPublicNamespace]).
-table UnlinkedExportNonPublic {
- /// Annotations for this export directive.
- annotations:[UnlinkedExpr] (id: 3);
-
- /// Offset of the "export" keyword.
- offset:uint (id: 0);
-
- /// End of the URI string (including quotes) relative to the beginning of the
- /// file.
- uriEnd:uint (id: 1);
-
- /// Offset of the URI string (including quotes) relative to the beginning of
- /// the file.
- uriOffset:uint (id: 2);
-}
-
-/// Unlinked summary information about an export declaration (stored inside
-/// [UnlinkedPublicNamespace]).
-table UnlinkedExportPublic {
- /// Combinators contained in this export declaration.
- combinators:[UnlinkedCombinator] (id: 1);
-
- /// Configurations used to control which library will actually be loaded at
- /// run-time.
- configurations:[UnlinkedConfiguration] (id: 2);
-
- /// URI used in the source code to reference the exported library.
- uri:string (id: 0);
-}
-
-/// Unlinked summary information about an expression.
-///
-/// Expressions are represented using a simple stack-based language
-/// where [operations] is a sequence of operations to execute starting with an
-/// empty stack. Once all operations have been executed, the stack should
-/// contain a single value which is the value of the constant. Note that some
-/// operations consume additional data from the other fields of this class.
-table UnlinkedExpr {
- /// Sequence of operators used by assignment operations.
- assignmentOperators:[UnlinkedExprAssignOperator] (id: 6);
-
- /// Sequence of 64-bit doubles consumed by the operation `pushDouble`.
- doubles:[double] (id: 4);
-
- /// Sequence of unsigned 32-bit integers consumed by the operations
- /// `pushArgument`, `pushInt`, `shiftOr`, `concatenate`, `invokeConstructor`,
- /// `makeList`, and `makeMap`.
- ints:[uint] (id: 1);
-
- /// Indicates whether the expression is a valid potentially constant
- /// expression.
- isValidConst:bool (id: 5);
-
- /// Sequence of operations to execute (starting with an empty stack) to form
- /// the constant value.
- operations:[UnlinkedExprOperation] (id: 0);
-
- /// Sequence of language constructs consumed by the operations
- /// `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note
- /// that in the case of `pushReference` (and sometimes `invokeConstructor` the
- /// actual entity being referred to may be something other than a type.
- references:[EntityRef] (id: 2);
-
- /// String representation of the expression in a form suitable to be tokenized
- /// and parsed.
- sourceRepresentation:string (id: 7);
-
- /// Sequence of strings consumed by the operations `pushString` and
- /// `invokeConstructor`.
- strings:[string] (id: 3);
-}
-
-/// Unlinked summary information about an extension declaration.
-table UnlinkedExtension {
- /// Annotations for this extension.
- annotations:[UnlinkedExpr] (id: 4);
-
- /// Code range of the extension.
- codeRange:CodeRange (id: 7);
-
- /// Documentation comment for the extension, or `null` if there is no
- /// documentation comment.
- documentationComment:UnlinkedDocumentationComment (id: 5);
-
- /// Executable objects (methods, getters, and setters) contained in the
- /// extension.
- executables:[UnlinkedExecutable] (id: 2);
-
- /// The type being extended.
- extendedType:EntityRef (id: 3);
-
- /// Field declarations contained in the extension.
- fields:[UnlinkedVariable] (id: 8);
-
- /// Name of the extension, or an empty string if there is no name.
- name:string (id: 0);
-
- /// Offset of the extension name relative to the beginning of the file, or
- /// zero if there is no name.
- nameOffset:uint (id: 1);
-
- /// Type parameters of the extension, if any.
- typeParameters:[UnlinkedTypeParam] (id: 6);
-}
-
-/// Unlinked summary information about an import declaration.
-table UnlinkedImport {
- /// Annotations for this import declaration.
- annotations:[UnlinkedExpr] (id: 8);
-
- /// Combinators contained in this import declaration.
- combinators:[UnlinkedCombinator] (id: 4);
-
- /// Configurations used to control which library will actually be loaded at
- /// run-time.
- configurations:[UnlinkedConfiguration] (id: 10);
-
- /// Indicates whether the import declaration uses the `deferred` keyword.
- isDeferred:bool (id: 9);
-
- /// Indicates whether the import declaration is implicit.
- isImplicit:bool (id: 5);
-
- /// If [isImplicit] is false, offset of the "import" keyword. If [isImplicit]
- /// is true, zero.
- offset:uint (id: 0);
-
- /// Offset of the prefix name relative to the beginning of the file, or zero
- /// if there is no prefix.
- prefixOffset:uint (id: 6);
-
- /// Index into [UnlinkedUnit.references] of the prefix declared by this
- /// import declaration, or zero if this import declaration declares no prefix.
- ///
- /// Note that multiple imports can declare the same prefix.
- prefixReference:uint (id: 7);
-
- /// URI used in the source code to reference the imported library.
- uri:string (id: 1);
-
- /// End of the URI string (including quotes) relative to the beginning of the
- /// file. If [isImplicit] is true, zero.
- uriEnd:uint (id: 2);
-
- /// Offset of the URI string (including quotes) relative to the beginning of
- /// the file. If [isImplicit] is true, zero.
- uriOffset:uint (id: 3);
-}
-
table UnlinkedInformativeData {
variantField_2:uint (id: 2);
@@ -2853,337 +1307,14 @@
kind:LinkedNodeKind (id: 0);
}
-/// Unlinked summary information about a function parameter.
-table UnlinkedParam {
- /// Annotations for this parameter.
- annotations:[UnlinkedExpr] (id: 9);
-
- /// Code range of the parameter.
- codeRange:CodeRange (id: 7);
-
- /// If the parameter has a default value, the source text of the constant
- /// expression in the default value. Otherwise the empty string.
- defaultValueCode:string (id: 13);
-
- /// If this parameter's type is inferable, nonzero slot id identifying which
- /// entry in [LinkedLibrary.types] contains the inferred type. If there is no
- /// matching entry in [LinkedLibrary.types], then no type was inferred for
- /// this variable, so its static type is `dynamic`.
- ///
- /// Note that although strong mode considers initializing formals to be
- /// inferable, they are not marked as such in the summary; if their type is
- /// not specified, they always inherit the static type of the corresponding
- /// field.
- inferredTypeSlot:uint (id: 2);
-
- /// If this is a parameter of an instance method, a nonzero slot id which is
- /// unique within this compilation unit. If this id is found in
- /// [LinkedUnit.parametersInheritingCovariant], then this parameter inherits
- /// `@covariant` behavior from a base class.
- ///
- /// Otherwise, zero.
- inheritsCovariantSlot:uint (id: 14);
-
- /// The synthetic initializer function of the parameter. Absent if the
- /// variable does not have an initializer.
- initializer:UnlinkedExecutable (id: 12);
-
- /// Indicates whether this parameter is explicitly marked as being covariant.
- isExplicitlyCovariant:bool (id: 15);
-
- /// Indicates whether the parameter is declared using the `final` keyword.
- isFinal:bool (id: 16);
-
- /// Indicates whether this is a function-typed parameter. A parameter is
- /// function-typed if the declaration of the parameter has explicit formal
- /// parameters
- /// ```
- /// int functionTyped(int p)
- /// ```
- /// but is not function-typed if it does not, even if the type of the
- /// parameter is a function type.
- isFunctionTyped:bool (id: 5);
-
- /// Indicates whether this is an initializing formal parameter (i.e. it is
- /// declared using `this.` syntax).
- isInitializingFormal:bool (id: 6);
-
- /// Kind of the parameter.
- kind:UnlinkedParamKind (id: 4);
-
- /// Name of the parameter.
- name:string (id: 0);
-
- /// Offset of the parameter name relative to the beginning of the file.
- nameOffset:uint (id: 1);
-
- /// If [isFunctionTyped] is `true`, the parameters of the function type.
- parameters:[UnlinkedParam] (id: 8);
-
- /// If [isFunctionTyped] is `true`, the declared return type. If
- /// [isFunctionTyped] is `false`, the declared type. Absent if the type is
- /// implicit.
- type:EntityRef (id: 3);
-
- /// The length of the visible range.
- visibleLength:uint (id: 10);
-
- /// The beginning of the visible range.
- visibleOffset:uint (id: 11);
-}
-
-/// Unlinked summary information about a part declaration.
-table UnlinkedPart {
- /// Annotations for this part declaration.
- annotations:[UnlinkedExpr] (id: 2);
-
- /// End of the URI string (including quotes) relative to the beginning of the
- /// file.
- uriEnd:uint (id: 0);
-
- /// Offset of the URI string (including quotes) relative to the beginning of
- /// the file.
- uriOffset:uint (id: 1);
-}
-
-/// Unlinked summary information about a specific name contributed by a
-/// compilation unit to a library's public namespace.
-///
-/// TODO(paulberry): some of this information is redundant with information
-/// elsewhere in the summary. Consider reducing the redundancy to reduce
-/// summary size.
-table UnlinkedPublicName {
- /// The kind of object referred to by the name.
- kind:ReferenceKind (id: 1);
-
- /// If this [UnlinkedPublicName] is a class, the list of members which can be
- /// referenced statically - static fields, static methods, and constructors.
- /// Otherwise empty.
- ///
- /// Unnamed constructors are not included since they do not constitute a
- /// separate name added to any namespace.
- members:[UnlinkedPublicName] (id: 2);
-
- /// The name itself.
- name:string (id: 0);
-
- /// If the entity being referred to is generic, the number of type parameters
- /// it accepts. Otherwise zero.
- numTypeParameters:uint (id: 3);
-}
-
-/// Unlinked summary information about what a compilation unit contributes to a
-/// library's public namespace. This is the subset of [UnlinkedUnit] that is
-/// required from dependent libraries in order to perform prelinking.
-table UnlinkedPublicNamespace {
- /// Export declarations in the compilation unit.
- exports:[UnlinkedExportPublic] (id: 2);
-
- /// Public names defined in the compilation unit.
- ///
- /// TODO(paulberry): consider sorting these names to reduce unnecessary
- /// relinking.
- names:[UnlinkedPublicName] (id: 0);
-
- /// URIs referenced by part declarations in the compilation unit.
- parts:[string] (id: 1);
-}
-
-/// Unlinked summary information about a name referred to in one library that
-/// might be defined in another.
-table UnlinkedReference {
- /// Name of the entity being referred to. For the pseudo-type `dynamic`, the
- /// string is "dynamic". For the pseudo-type `void`, the string is "void".
- /// For the pseudo-type `bottom`, the string is "*bottom*".
- name:string (id: 0);
-
- /// Prefix used to refer to the entity, or zero if no prefix is used. This is
- /// an index into [UnlinkedUnit.references].
- ///
- /// Prefix references must always point backward; that is, for all i, if
- /// UnlinkedUnit.references[i].prefixReference != 0, then
- /// UnlinkedUnit.references[i].prefixReference < i.
- prefixReference:uint (id: 1);
-}
-
-/// TODO(scheglov) document
+/// TODO(scheglov) Remove it.
table UnlinkedTokens {
- /// The token that corresponds to this token, or `0` if this token is not
- /// the first of a pair of matching tokens (such as parentheses).
- endGroup:[uint] (id: 0);
-
- /// Return `true` if this token is a synthetic token. A synthetic token is a
- /// token that was introduced by the parser in order to recover from an error
- /// in the code.
- isSynthetic:[ubyte] (id: 1);
-
- kind:[UnlinkedTokenKind] (id: 2);
-
- length:[uint] (id: 3);
-
- lexeme:[string] (id: 4);
-
- /// The next token in the token stream, `0` for [UnlinkedTokenType.EOF] or
- /// the last comment token.
- next:[uint] (id: 5);
-
- offset:[uint] (id: 6);
-
- /// The first comment token in the list of comments that precede this token,
- /// or `0` if there are no comments preceding this token. Additional comments
- /// can be reached by following the token stream using [next] until `0` is
- /// reached.
- precedingComment:[uint] (id: 7);
-
- type:[UnlinkedTokenType] (id: 8);
+ placeholder:uint (id: 0);
}
-/// Unlinked summary information about a typedef declaration.
-table UnlinkedTypedef {
- /// Annotations for this typedef.
- annotations:[UnlinkedExpr] (id: 4);
-
- /// Code range of the typedef.
- codeRange:CodeRange (id: 7);
-
- /// Documentation comment for the typedef, or `null` if there is no
- /// documentation comment.
- documentationComment:UnlinkedDocumentationComment (id: 6);
-
- /// Name of the typedef.
- name:string (id: 0);
-
- /// Offset of the typedef name relative to the beginning of the file.
- nameOffset:uint (id: 1);
-
- /// If the typedef might not be simply bounded, a nonzero slot id which is
- /// unique within this compilation unit. If this id is found in
- /// [LinkedUnit.notSimplyBounded], then at least one of this typedef's type
- /// parameters is not simply bounded, hence this typedef can't be used as a
- /// raw type when specifying the bound of a type parameter.
- ///
- /// Otherwise, zero.
- notSimplyBoundedSlot:uint (id: 9);
-
- /// Parameters of the executable, if any.
- parameters:[UnlinkedParam] (id: 3);
-
- /// If [style] is [TypedefStyle.functionType], the return type of the typedef.
- /// If [style] is [TypedefStyle.genericFunctionType], the function type being
- /// defined.
- returnType:EntityRef (id: 2);
-
- /// The style of the typedef.
- style:TypedefStyle (id: 8);
-
- /// Type parameters of the typedef, if any.
- typeParameters:[UnlinkedTypeParam] (id: 5);
-}
-
-/// Unlinked summary information about a type parameter declaration.
-table UnlinkedTypeParam {
- /// Annotations for this type parameter.
- annotations:[UnlinkedExpr] (id: 3);
-
- /// Bound of the type parameter, if a bound is explicitly declared. Otherwise
- /// null.
- bound:EntityRef (id: 2);
-
- /// Code range of the type parameter.
- codeRange:CodeRange (id: 4);
-
- /// Name of the type parameter.
- name:string (id: 0);
-
- /// Offset of the type parameter name relative to the beginning of the file.
- nameOffset:uint (id: 1);
-}
-
-/// Unlinked summary information about a compilation unit ("part file").
+/// TODO(scheglov) Remove it.
table UnlinkedUnit {
- /// MD5 hash of the non-informative fields of the [UnlinkedUnit] (not
- /// including this one) as 16 unsigned 8-bit integer values. This can be used
- /// to identify when the API of a unit may have changed.
- apiSignature:[uint] (id: 19);
-
- /// Classes declared in the compilation unit.
- classes:[UnlinkedClass] (id: 2);
-
- /// Code range of the unit.
- codeRange:CodeRange (id: 15);
-
- /// Enums declared in the compilation unit.
- enums:[UnlinkedEnum] (id: 12);
-
- /// Top level executable objects (functions, getters, and setters) declared in
- /// the compilation unit.
- executables:[UnlinkedExecutable] (id: 4);
-
- /// Export declarations in the compilation unit.
- exports:[UnlinkedExportNonPublic] (id: 13);
-
- /// Extensions declared in the compilation unit.
- extensions:[UnlinkedExtension] (id: 22);
-
- /// If this compilation unit was summarized in fallback mode, the path where
- /// the compilation unit may be found on disk. Otherwise empty.
- ///
- /// When this field is non-empty, all other fields in the data structure have
- /// their default values.
- fallbackModePath:string (id: 16, deprecated);
-
- /// Import declarations in the compilation unit.
- imports:[UnlinkedImport] (id: 5);
-
- /// Indicates whether this compilation unit is opted into NNBD.
- isNNBD:bool (id: 21);
-
- /// Indicates whether the unit contains a "part of" declaration.
- isPartOf:bool (id: 18);
-
- /// Annotations for the library declaration, or the empty list if there is no
- /// library declaration.
- libraryAnnotations:[UnlinkedExpr] (id: 14);
-
- /// Documentation comment for the library, or `null` if there is no
- /// documentation comment.
- libraryDocumentationComment:UnlinkedDocumentationComment (id: 9);
-
- /// Name of the library (from a "library" declaration, if present).
- libraryName:string (id: 6);
-
- /// Length of the library name as it appears in the source code (or 0 if the
- /// library has no name).
- libraryNameLength:uint (id: 7);
-
- /// Offset of the library name relative to the beginning of the file (or 0 if
- /// the library has no name).
- libraryNameOffset:uint (id: 8);
-
- /// Offsets of the first character of each line in the source code.
- lineStarts:[uint] (id: 17);
-
- /// Mixins declared in the compilation unit.
- mixins:[UnlinkedClass] (id: 20);
-
- /// Part declarations in the compilation unit.
- parts:[UnlinkedPart] (id: 11);
-
- /// Unlinked public namespace of this compilation unit.
- publicNamespace:UnlinkedPublicNamespace (id: 0);
-
- /// Top level and prefixed names referred to by this compilation unit. The
- /// zeroth element of this array is always populated and is used to represent
- /// the absence of a reference in places where a reference is optional (for
- /// example [UnlinkedReference.prefixReference or
- /// UnlinkedImport.prefixReference]).
- references:[UnlinkedReference] (id: 1);
-
- /// Typedefs declared in the compilation unit.
- typedefs:[UnlinkedTypedef] (id: 10);
-
- /// Top level variables declared in the compilation unit.
- variables:[UnlinkedVariable] (id: 3);
+ placeholder:uint (id: 0);
}
/// Unlinked summary information about a compilation unit.
@@ -3213,81 +1344,6 @@
parts:[string] (id: 4);
}
-/// Unlinked summary information about a top level variable, local variable, or
-/// a field.
-table UnlinkedVariable {
- /// Annotations for this variable.
- annotations:[UnlinkedExpr] (id: 8);
-
- /// Code range of the variable.
- codeRange:CodeRange (id: 5);
-
- /// Documentation comment for the variable, or `null` if there is no
- /// documentation comment.
- documentationComment:UnlinkedDocumentationComment (id: 10);
-
- /// If this variable is inferable, nonzero slot id identifying which entry in
- /// [LinkedLibrary.types] contains the inferred type for this variable. If
- /// there is no matching entry in [LinkedLibrary.types], then no type was
- /// inferred for this variable, so its static type is `dynamic`.
- inferredTypeSlot:uint (id: 9);
-
- /// If this is an instance non-final field, a nonzero slot id which is unique
- /// within this compilation unit. If this id is found in
- /// [LinkedUnit.parametersInheritingCovariant], then the parameter of the
- /// synthetic setter inherits `@covariant` behavior from a base class.
- ///
- /// Otherwise, zero.
- inheritsCovariantSlot:uint (id: 15);
-
- /// The synthetic initializer function of the variable. Absent if the
- /// variable does not have an initializer.
- initializer:UnlinkedExecutable (id: 13);
-
- /// Indicates whether the variable is declared using the `const` keyword.
- isConst:bool (id: 6);
-
- /// Indicates whether this variable is declared using the `covariant` keyword.
- /// This should be false for everything except instance fields.
- isCovariant:bool (id: 14);
-
- /// Indicates whether the variable is declared using the `final` keyword.
- isFinal:bool (id: 7);
-
- /// Indicates whether the variable is declared using the `late` keyword.
- isLate:bool (id: 16);
-
- /// Indicates whether the variable is declared using the `static` keyword.
- ///
- /// Note that for top level variables, this flag is false, since they are not
- /// declared using the `static` keyword (even though they are considered
- /// static for semantic purposes).
- isStatic:bool (id: 4);
-
- /// Name of the variable.
- name:string (id: 0);
-
- /// Offset of the variable name relative to the beginning of the file.
- nameOffset:uint (id: 1);
-
- /// If this variable is propagable, nonzero slot id identifying which entry in
- /// [LinkedLibrary.types] contains the propagated type for this variable. If
- /// there is no matching entry in [LinkedLibrary.types], then this variable's
- /// propagated type is the same as its declared type.
- ///
- /// Non-propagable variables have a [propagatedTypeSlot] of zero.
- propagatedTypeSlot:uint (id: 2);
-
- /// Declared type of the variable. Absent if the type is implicit.
- type:EntityRef (id: 3);
-
- /// If a local variable, the length of the visible range; zero otherwise.
- visibleLength:uint (id: 11, deprecated);
-
- /// If a local variable, the beginning of the visible range; zero otherwise.
- visibleOffset:uint (id: 12, deprecated);
-}
-
root_type PackageBundle;
file_identifier "PBdl";
diff --git a/pkg/analyzer/lib/src/summary/idl.dart b/pkg/analyzer/lib/src/summary/idl.dart
index de1760a..be60016 100644
--- a/pkg/analyzer/lib/src/summary/idl.dart
+++ b/pkg/analyzer/lib/src/summary/idl.dart
@@ -2,45 +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.
-/// This file is an "idl" style description of the summary format. It
-/// contains abstract classes which declare the interface for reading data from
-/// summaries. It is parsed and transformed into code that implements the
-/// summary format.
-///
-/// The code generation process introduces the following semantics:
-/// - Getters of type List never return null, and have a default value of the
-/// empty list.
-/// - Getters of type int return unsigned 32-bit integers, never null, and have
-/// a default value of zero.
-/// - Getters of type String never return null, and have a default value of ''.
-/// - Getters of type bool never return null, and have a default value of false.
-/// - Getters of type double never return null, and have a default value of
-/// `0.0`.
-/// - Getters whose type is an enum never return null, and have a default value
-/// of the first value declared in the enum.
-///
-/// Terminology used in this document:
-/// - "Unlinked" refers to information that can be determined from reading a
-/// single .dart file in isolation.
-/// - "Prelinked" refers to information that can be determined from the defining
-/// compilation unit of a library, plus direct imports, plus the transitive
-/// closure of exports reachable from those libraries, plus all part files
-/// constituting those libraries.
-/// - "Linked" refers to all other information; in theory, this information may
-/// depend on all files in the transitive import/export closure. However, in
-/// practice we expect that the number of additional dependencies will usually
-/// be small, since the additional dependencies only need to be consulted for
-/// type propagation, type inference, and constant evaluation, which typically
-/// have short dependency chains.
-///
-/// Since we expect "linked" and "prelinked" dependencies to be similar, we only
-/// rarely distinguish between them; most information is that is not "unlinked"
-/// is typically considered "linked" for simplicity.
-///
-/// Except as otherwise noted, synthetic elements are not stored in the summary;
-/// they are re-synthesized at the time the summary is read.
-import 'package:analyzer/dart/element/element.dart';
-
import 'base.dart' as base;
import 'base.dart' show Id, TopLevel, Variant, VariantId;
import 'format.dart' as generated;
@@ -451,17 +412,6 @@
List<String> get shows;
}
-/// Information about an element code range.
-abstract class CodeRange extends base.SummaryClass {
- /// Length of the element code.
- @Id(1)
- int get length;
-
- /// Offset of the element code relative to the beginning of the file.
- @Id(0)
- int get offset;
-}
-
abstract class DiagnosticMessage extends base.SummaryClass {
/// The absolute and normalized path of the file associated with this message.
@Id(0)
@@ -492,130 +442,6 @@
List<String> get templateValues;
}
-/// Summary information about a reference to an entity such as a type, top level
-/// executable, or executable within a class.
-abstract class EntityRef extends base.SummaryClass {
- /// The kind of entity being represented.
- @Id(8)
- EntityRefKind get entityKind;
-
- /// Notice: This will be deprecated. However, its not deprecated yet, as we're
- /// keeping it for backwards compatibilty, and marking it deprecated makes it
- /// unreadable.
- ///
- /// TODO(mfairhurst) mark this deprecated, and remove its logic.
- ///
- /// If this is a reference to a function type implicitly defined by a
- /// function-typed parameter, a list of zero-based indices indicating the path
- /// from the entity referred to by [reference] to the appropriate type
- /// parameter. Otherwise the empty list.
- ///
- /// If there are N indices in this list, then the entity being referred to is
- /// the function type implicitly defined by a function-typed parameter of a
- /// function-typed parameter, to N levels of nesting. The first index in the
- /// list refers to the outermost level of nesting; for example if [reference]
- /// refers to the entity defined by:
- ///
- /// void f(x, void g(y, z, int h(String w))) { ... }
- ///
- /// Then to refer to the function type implicitly defined by parameter `h`
- /// (which is parameter 2 of parameter 1 of `f`), then
- /// [implicitFunctionTypeIndices] should be [1, 2].
- ///
- /// Note that if the entity being referred to is a generic method inside a
- /// generic class, then the type arguments in [typeArguments] are applied
- /// first to the class and then to the method.
- @Id(4)
- List<int> get implicitFunctionTypeIndices;
-
- /// If the reference represents a type, the nullability of the type.
- @Id(10)
- EntityRefNullabilitySuffix get nullabilitySuffix;
-
- /// If this is a reference to a type parameter, one-based index into the list
- /// of [UnlinkedTypeParam]s currently in effect. Indexing is done using De
- /// Bruijn index conventions; that is, innermost parameters come first, and
- /// if a class or method has multiple parameters, they are indexed from right
- /// to left. So for instance, if the enclosing declaration is
- ///
- /// class C<T,U> {
- /// m<V,W> {
- /// ...
- /// }
- /// }
- ///
- /// Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T,
- /// respectively.
- ///
- /// If the type being referred to is not a type parameter, [paramReference] is
- /// zero.
- @Id(3)
- int get paramReference;
-
- /// Index into [UnlinkedUnit.references] for the entity being referred to, or
- /// zero if this is a reference to a type parameter.
- @Id(0)
- int get reference;
-
- /// If this [EntityRef] appears in a syntactic context where its type
- /// arguments might need to be inferred by a method other than
- /// instantiate-to-bounds, and [typeArguments] is empty, a slot id (which is
- /// unique within the compilation unit). If an entry appears in
- /// [LinkedUnit.types] whose [slot] matches this value, that entry will
- /// contain the complete inferred type.
- ///
- /// This is called `refinedSlot` to clarify that if it points to an inferred
- /// type, it points to a type that is a "refinement" of this one (one in which
- /// some type arguments have been inferred).
- @Id(9)
- int get refinedSlot;
-
- /// If this [EntityRef] is contained within [LinkedUnit.types], slot id (which
- /// is unique within the compilation unit) identifying the target of type
- /// propagation or type inference with which this [EntityRef] is associated.
- ///
- /// Otherwise zero.
- @Id(2)
- int get slot;
-
- /// If this [EntityRef] is a reference to a function type whose
- /// [FunctionElement] is not in any library (e.g. a function type that was
- /// synthesized by a LUB computation), the function parameters. Otherwise
- /// empty.
- @Id(6)
- List<UnlinkedParam> get syntheticParams;
-
- /// If this [EntityRef] is a reference to a function type whose
- /// [FunctionElement] is not in any library (e.g. a function type that was
- /// synthesized by a LUB computation), the return type of the function.
- /// Otherwise `null`.
- @Id(5)
- EntityRef get syntheticReturnType;
-
- /// If this is an instantiation of a generic type or generic executable, the
- /// type arguments used to instantiate it (if any).
- @Id(1)
- List<EntityRef> get typeArguments;
-
- /// If this is a function type, the type parameters defined for the function
- /// type (if any).
- @Id(7)
- List<UnlinkedTypeParam> get typeParameters;
-}
-
-/// Enum used to indicate the kind of an entity reference.
-enum EntityRefKind {
- /// The entity represents a named type.
- named,
-
- /// The entity represents a generic function type.
- genericFunctionType,
-
- /// The entity represents a function type that was synthesized by a LUB
- /// computation.
- syntheticFunction
-}
-
/// Enum representing nullability suffixes in summaries.
///
/// This enum is similar to [NullabilitySuffix], but the order is different so
@@ -640,15 +466,6 @@
none,
}
-/// Enum used to indicate the kind of a name in index.
-enum IndexNameKind {
- /// A top-level element.
- topLevel,
-
- /// A class member.
- classMember
-}
-
/// Enum used to indicate the kind of an index relation.
enum IndexRelationKind {
/// Left: class.
@@ -735,103 +552,10 @@
unit
}
-/// Information about a dependency that exists between one library and another
-/// due to an "import" declaration.
-abstract class LinkedDependency extends base.SummaryClass {
- /// Absolute URI for the compilation units listed in the library's `part`
- /// declarations, empty string for invalid URI.
- @Id(1)
- List<String> get parts;
-
- /// The absolute URI of the dependent library, e.g. `package:foo/bar.dart`.
- @Id(0)
- String get uri;
-}
-
-/// Information about a single name in the export namespace of the library that
-/// is not in the public namespace.
-abstract class LinkedExportName extends base.SummaryClass {
- /// Index into [LinkedLibrary.dependencies] for the library in which the
- /// entity is defined.
- @Id(0)
- int get dependency;
-
- /// The kind of the entity being referred to.
- @Id(3)
- ReferenceKind get kind;
-
- /// Name of the exported entity. For an exported setter, this name includes
- /// the trailing '='.
- @Id(1)
- String get name;
-
- /// Integer index indicating which unit in the exported library contains the
- /// definition of the entity. As with indices into [LinkedLibrary.units],
- /// zero represents the defining compilation unit, and nonzero values
- /// represent parts in the order of the corresponding `part` declarations.
- @Id(2)
- int get unit;
-}
-
-/// Linked summary of a library.
-@TopLevel('LLib')
+/// TODO(scheglov) Remove it.
abstract class LinkedLibrary extends base.SummaryClass {
- factory LinkedLibrary.fromBuffer(List<int> buffer) =>
- generated.readLinkedLibrary(buffer);
-
- /// The libraries that this library depends on (either via an explicit import
- /// statement or via the implicit dependencies on `dart:core` and
- /// `dart:async`). The first element of this array is a pseudo-dependency
- /// representing the library itself (it is also used for `dynamic` and
- /// `void`). This is followed by elements representing "prelinked"
- /// dependencies (direct imports and the transitive closure of exports).
- /// After the prelinked dependencies are elements representing "linked"
- /// dependencies.
- ///
- /// A library is only included as a "linked" dependency if it is a true
- /// dependency (e.g. a propagated or inferred type or constant value
- /// implicitly refers to an element declared in the library) or
- /// anti-dependency (e.g. the result of type propagation or type inference
- /// depends on the lack of a certain declaration in the library).
@Id(0)
- List<LinkedDependency> get dependencies;
-
- /// For each export in [UnlinkedUnit.exports], an index into [dependencies]
- /// of the library being exported.
- @Id(6)
- List<int> get exportDependencies;
-
- /// Information about entities in the export namespace of the library that are
- /// not in the public namespace of the library (that is, entities that are
- /// brought into the namespace via `export` directives).
- ///
- /// Sorted by name.
- @Id(4)
- List<LinkedExportName> get exportNames;
-
- /// Indicates whether this library was summarized in "fallback mode". If
- /// true, all other fields in the data structure have their default values.
- @deprecated
- @Id(5)
- bool get fallbackMode;
-
- /// For each import in [UnlinkedUnit.imports], an index into [dependencies]
- /// of the library being imported.
- @Id(1)
- List<int> get importDependencies;
-
- /// The number of elements in [dependencies] which are not "linked"
- /// dependencies (that is, the number of libraries in the direct imports plus
- /// the transitive closure of exports, plus the library itself).
- @Id(2)
- int get numPrelinkedDependencies;
-
- /// The linked summary of all the compilation units constituting the
- /// library. The summary of the defining compilation unit is listed first,
- /// followed by the summary of each part, in the order of the `part`
- /// declarations in the defining compilation unit.
- @Id(3)
- List<LinkedUnit> get units;
+ int get placeholder;
}
/// Information about a linked AST node.
@@ -1150,6 +874,7 @@
LinkedNodeKind.functionExpressionInvocation,
LinkedNodeKind.indexExpression,
LinkedNodeKind.instanceCreationExpression,
+ LinkedNodeKind.integerLiteral,
LinkedNodeKind.listLiteral,
LinkedNodeKind.methodInvocation,
LinkedNodeKind.nullLiteral,
@@ -2064,101 +1789,6 @@
String get uriStr;
}
-/// Information about the resolution of an [UnlinkedReference].
-abstract class LinkedReference extends base.SummaryClass {
- /// If this [LinkedReference] doesn't have an associated [UnlinkedReference],
- /// and the entity being referred to is contained within another entity, index
- /// of the containing entity. This behaves similarly to
- /// [UnlinkedReference.prefixReference], however it is only used for class
- /// members, not for prefixed imports.
- ///
- /// Containing references must always point backward; that is, for all i, if
- /// LinkedUnit.references[i].containingReference != 0, then
- /// LinkedUnit.references[i].containingReference < i.
- @Id(5)
- int get containingReference;
-
- /// Index into [LinkedLibrary.dependencies] indicating which imported library
- /// declares the entity being referred to.
- ///
- /// Zero if this entity is contained within another entity (e.g. a class
- /// member), or if [kind] is [ReferenceKind.prefix].
- @Id(1)
- int get dependency;
-
- /// The kind of the entity being referred to. For the pseudo-types `dynamic`
- /// and `void`, the kind is [ReferenceKind.classOrEnum].
- @Id(2)
- ReferenceKind get kind;
-
- /// If [kind] is [ReferenceKind.function] (that is, the entity being referred
- /// to is a local function), the index of the function within
- /// [UnlinkedExecutable.localFunctions]. Otherwise zero.
- @deprecated
- @Id(6)
- int get localIndex;
-
- /// If this [LinkedReference] doesn't have an associated [UnlinkedReference],
- /// name of the entity being referred to. For the pseudo-type `dynamic`, the
- /// string is "dynamic". For the pseudo-type `void`, the string is "void".
- @Id(3)
- String get name;
-
- /// If the entity being referred to is generic, the number of type parameters
- /// it declares (does not include type parameters of enclosing entities).
- /// Otherwise zero.
- @Id(4)
- int get numTypeParameters;
-
- /// Integer index indicating which unit in the imported library contains the
- /// definition of the entity. As with indices into [LinkedLibrary.units],
- /// zero represents the defining compilation unit, and nonzero values
- /// represent parts in the order of the corresponding `part` declarations.
- ///
- /// Zero if this entity is contained within another entity (e.g. a class
- /// member).
- @Id(0)
- int get unit;
-}
-
-/// Linked summary of a compilation unit.
-abstract class LinkedUnit extends base.SummaryClass {
- /// List of slot ids (referring to [UnlinkedExecutable.constCycleSlot])
- /// corresponding to const constructors that are part of cycles.
- @Id(2)
- List<int> get constCycles;
-
- /// List of slot ids (referring to [UnlinkedClass.notSimplyBoundedSlot] or
- /// [UnlinkedTypedef.notSimplyBoundedSlot]) corresponding to classes and
- /// typedefs that are not simply bounded.
- @Id(5)
- List<int> get notSimplyBounded;
-
- /// List of slot ids (referring to [UnlinkedParam.inheritsCovariantSlot] or
- /// [UnlinkedVariable.inheritsCovariantSlot]) corresponding to parameters
- /// that inherit `@covariant` behavior from a base class.
- @Id(3)
- List<int> get parametersInheritingCovariant;
-
- /// Information about the resolution of references within the compilation
- /// unit. Each element of [UnlinkedUnit.references] has a corresponding
- /// element in this list (at the same index). If this list has additional
- /// elements beyond the number of elements in [UnlinkedUnit.references], those
- /// additional elements are references that are only referred to implicitly
- /// (e.g. elements involved in inferred or propagated types).
- @Id(0)
- List<LinkedReference> get references;
-
- /// The list of type inference errors.
- @Id(4)
- List<TopLevelInferenceError> get topLevelInferenceErrors;
-
- /// List associating slot ids found inside the unlinked summary for the
- /// compilation unit with propagated and inferred types.
- @Id(1)
- List<EntityRef> get types;
-}
-
/// Summary information about a package.
@TopLevel('PBdl')
abstract class PackageBundle extends base.SummaryClass {
@@ -2184,11 +1814,13 @@
/// Linked libraries.
@Id(0)
+ @deprecated
List<LinkedLibrary> get linkedLibraries;
/// The list of URIs of items in [linkedLibraries], e.g. `dart:core` or
/// `package:foo/bar.dart`.
@Id(1)
+ @deprecated
List<String> get linkedLibraryUris;
/// Major version of the summary format. See
@@ -2210,151 +1842,19 @@
/// Unlinked information for the compilation units constituting the package.
@Id(2)
+ @deprecated
List<UnlinkedUnit> get unlinkedUnits;
/// The list of URIs of items in [unlinkedUnits], e.g. `dart:core/bool.dart`.
@Id(3)
+ @deprecated
List<String> get unlinkedUnitUris;
}
-/// Information about a single dependency of a summary package.
-@deprecated
+/// TODO(scheglov) Remove it.
abstract class PackageDependencyInfo extends base.SummaryClass {
- /// API signature of this dependency.
@Id(0)
- String get apiSignature;
-
- /// If this dependency summarizes any files whose URI takes the form
- /// "package:<package_name>/...", a list of all such package names, sorted
- /// lexicographically. Otherwise empty.
- @Id(2)
- List<String> get includedPackageNames;
-
- /// Indicates whether this dependency summarizes any files whose URI takes the
- /// form "dart:...".
- @Id(4)
- bool get includesDartUris;
-
- /// Indicates whether this dependency summarizes any files whose URI takes the
- /// form "file:...".
- @Id(3)
- bool get includesFileUris;
-
- /// Relative path to the summary file for this dependency. This is intended
- /// as a hint to help the analysis server locate summaries of dependencies.
- /// We don't specify precisely what this path is relative to, but we expect
- /// it to be relative to a directory the analysis server can find (e.g. for
- /// projects built using Bazel, it would be relative to the "bazel-bin"
- /// directory).
- ///
- /// Absent if the path is not known.
- @Id(1)
- String get summaryPath;
-}
-
-/// Index information about a package.
-@TopLevel('Indx')
-abstract class PackageIndex extends base.SummaryClass {
- factory PackageIndex.fromBuffer(List<int> buffer) =>
- generated.readPackageIndex(buffer);
-
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the kind of the synthetic element.
- @Id(5)
- List<IndexSyntheticElementKind> get elementKinds;
-
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the identifier of the class member element name, or `null` if the element
- /// is a top-level element. The list is sorted in ascending order, so that
- /// the client can quickly check whether an element is referenced in this
- /// [PackageIndex].
- @Id(7)
- List<int> get elementNameClassMemberIds;
-
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the identifier of the named parameter name, or `null` if the element is
- /// not a named parameter. The list is sorted in ascending order, so that the
- /// client can quickly check whether an element is referenced in this
- /// [PackageIndex].
- @Id(8)
- List<int> get elementNameParameterIds;
-
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the identifier of the top-level element name, or `null` if the element is
- /// the unit. The list is sorted in ascending order, so that the client can
- /// quickly check whether an element is referenced in this [PackageIndex].
- @Id(1)
- List<int> get elementNameUnitMemberIds;
-
- /// Each item of this list corresponds to a unique referenced element. It is
- /// the index into [unitLibraryUris] and [unitUnitUris] for the library
- /// specific unit where the element is declared.
- @Id(0)
- List<int> get elementUnits;
-
- /// List of unique element strings used in this [PackageIndex]. The list is
- /// sorted in ascending order, so that the client can quickly check the
- /// presence of a string in this [PackageIndex].
- @Id(6)
- List<String> get strings;
-
- /// Each item of this list corresponds to the library URI of a unique library
- /// specific unit referenced in the [PackageIndex]. It is an index into
- /// [strings] list.
- @Id(2)
- List<int> get unitLibraryUris;
-
- /// List of indexes of each unit in this [PackageIndex].
- @Id(4)
- List<UnitIndex> get units;
-
- /// Each item of this list corresponds to the unit URI of a unique library
- /// specific unit referenced in the [PackageIndex]. It is an index into
- /// [strings] list.
- @Id(3)
- List<int> get unitUnitUris;
-}
-
-/// Enum used to indicate the kind of entity referred to by a
-/// [LinkedReference].
-enum ReferenceKind {
- /// The entity is a class or enum.
- classOrEnum,
-
- /// The entity is a constructor.
- constructor,
-
- /// The entity is a getter or setter inside a class. Note: this is used in
- /// the case where a constant refers to a static const declared inside a
- /// class.
- propertyAccessor,
-
- /// The entity is a method.
- method,
-
- /// The entity is a typedef.
- typedef,
-
- /// The entity is a local function.
- function,
-
- /// The entity is a local variable.
- variable,
-
- /// The entity is a top level function.
- topLevelFunction,
-
- /// The entity is a top level getter or setter.
- topLevelPropertyAccessor,
-
- /// The entity is a prefix.
- prefix,
-
- /// The entity being referred to does not exist.
- unresolved,
-
- /// The entity is a typedef expressed using generic function type syntax.
- genericFunctionTypedef
+ int get placeholder;
}
/// Summary information about a top-level type inference error.
@@ -2384,1275 +1884,6 @@
overrideConflictParameterType
}
-/// Enum used to indicate the style of a typedef.
-enum TypedefStyle {
- /// A typedef that defines a non-generic function type. The syntax is
- /// ```
- /// 'typedef' returnType? identifier typeParameters? formalParameterList ';'
- /// ```
- /// The typedef can have type parameters associated with it, but the function
- /// type that results from applying type arguments does not.
- functionType,
-
- /// A typedef expressed using generic function type syntax. The syntax is
- /// ```
- /// typeAlias ::=
- /// 'typedef' identifier typeParameters? '=' genericFunctionType ';'
- /// genericFunctionType ::=
- /// returnType? 'Function' typeParameters? parameterTypeList
- /// ```
- /// Both the typedef itself and the function type that results from applying
- /// type arguments can have type parameters.
- genericFunctionType
-}
-
-/// Index information about a unit in a [PackageIndex].
-abstract class UnitIndex extends base.SummaryClass {
- /// Each item of this list is the kind of an element defined in this unit.
- @Id(6)
- List<IndexNameKind> get definedNameKinds;
-
- /// Each item of this list is the name offset of an element defined in this
- /// unit relative to the beginning of the file.
- @Id(7)
- List<int> get definedNameOffsets;
-
- /// Each item of this list corresponds to an element defined in this unit. It
- /// is an index into [PackageIndex.strings] list. The list is sorted in
- /// ascending order, so that the client can quickly find name definitions in
- /// this [UnitIndex].
- @Id(5)
- List<int> get definedNames;
-
- /// Index into [PackageIndex.unitLibraryUris] and [PackageIndex.unitUnitUris]
- /// for the library specific unit that corresponds to this [UnitIndex].
- @Id(0)
- int get unit;
-
- /// Each item of this list is the `true` if the corresponding element usage
- /// is qualified with some prefix.
- @Id(11)
- List<bool> get usedElementIsQualifiedFlags;
-
- /// Each item of this list is the kind of the element usage.
- @Id(4)
- List<IndexRelationKind> get usedElementKinds;
-
- /// Each item of this list is the length of the element usage.
- @Id(1)
- List<int> get usedElementLengths;
-
- /// Each item of this list is the offset of the element usage relative to the
- /// beginning of the file.
- @Id(2)
- List<int> get usedElementOffsets;
-
- /// Each item of this list is the index into [PackageIndex.elementUnits] and
- /// [PackageIndex.elementOffsets]. The list is sorted in ascending order, so
- /// that the client can quickly find element references in this [UnitIndex].
- @Id(3)
- List<int> get usedElements;
-
- /// Each item of this list is the `true` if the corresponding name usage
- /// is qualified with some prefix.
- @Id(12)
- List<bool> get usedNameIsQualifiedFlags;
-
- /// Each item of this list is the kind of the name usage.
- @Id(10)
- List<IndexRelationKind> get usedNameKinds;
-
- /// Each item of this list is the offset of the name usage relative to the
- /// beginning of the file.
- @Id(9)
- List<int> get usedNameOffsets;
-
- /// Each item of this list is the index into [PackageIndex.strings] for a
- /// used name. The list is sorted in ascending order, so that the client can
- /// quickly find name uses in this [UnitIndex].
- @Id(8)
- List<int> get usedNames;
-}
-
-/// Unlinked summary information about a class declaration.
-abstract class UnlinkedClass extends base.SummaryClass {
- /// Annotations for this class.
- @Id(5)
- List<UnlinkedExpr> get annotations;
-
- /// Code range of the class.
- @informative
- @Id(13)
- CodeRange get codeRange;
-
- /// Documentation comment for the class, or `null` if there is no
- /// documentation comment.
- @informative
- @Id(6)
- UnlinkedDocumentationComment get documentationComment;
-
- /// Executable objects (methods, getters, and setters) contained in the class.
- @Id(2)
- List<UnlinkedExecutable> get executables;
-
- /// Field declarations contained in the class.
- @Id(4)
- List<UnlinkedVariable> get fields;
-
- /// Indicates whether this class is the core "Object" class (and hence has no
- /// supertype)
- @Id(12)
- bool get hasNoSupertype;
-
- /// Interfaces appearing in an `implements` clause, if any.
- @Id(7)
- List<EntityRef> get interfaces;
-
- /// Indicates whether the class is declared with the `abstract` keyword.
- @Id(8)
- bool get isAbstract;
-
- /// Indicates whether the class is declared using mixin application syntax.
- @Id(11)
- bool get isMixinApplication;
-
- /// Mixins appearing in a `with` clause, if any.
- @Id(10)
- List<EntityRef> get mixins;
-
- /// Name of the class.
- @Id(0)
- String get name;
-
- /// Offset of the class name relative to the beginning of the file.
- @informative
- @Id(1)
- int get nameOffset;
-
- /// If the class might not be simply bounded, a nonzero slot id which is unique
- /// within this compilation unit. If this id is found in
- /// [LinkedUnit.notSimplyBounded], then at least one of this class's type
- /// parameters is not simply bounded, hence this class can't be used as a raw
- /// type when specifying the bound of a type parameter.
- ///
- /// Otherwise, zero.
- @Id(16)
- int get notSimplyBoundedSlot;
-
- /// Superclass constraints for this mixin declaration. The list will be empty
- /// if this class is not a mixin declaration, or if the declaration does not
- /// have an `on` clause (in which case the type `Object` is implied).
- @Id(14)
- List<EntityRef> get superclassConstraints;
-
- /// Names of methods, getters, setters, and operators that this mixin
- /// declaration super-invokes. For setters this includes the trailing "=".
- /// The list will be empty if this class is not a mixin declaration.
- @Id(15)
- List<String> get superInvokedNames;
-
- /// Supertype of the class, or `null` if either (a) the class doesn't
- /// explicitly declare a supertype (and hence has supertype `Object`), or (b)
- /// the class *is* `Object` (and hence has no supertype).
- @Id(3)
- EntityRef get supertype;
-
- /// Type parameters of the class, if any.
- @Id(9)
- List<UnlinkedTypeParam> get typeParameters;
-}
-
-/// Unlinked summary information about a `show` or `hide` combinator in an
-/// import or export declaration.
-abstract class UnlinkedCombinator extends base.SummaryClass {
- /// If this is a `show` combinator, offset of the end of the list of shown
- /// names. Otherwise zero.
- @informative
- @Id(3)
- int get end;
-
- /// List of names which are hidden. Empty if this is a `show` combinator.
- @Id(1)
- List<String> get hides;
-
- /// If this is a `show` combinator, offset of the `show` keyword. Otherwise
- /// zero.
- @informative
- @Id(2)
- int get offset;
-
- /// List of names which are shown. Empty if this is a `hide` combinator.
- @Id(0)
- List<String> get shows;
-}
-
-/// Unlinked summary information about a single import or export configuration.
-abstract class UnlinkedConfiguration extends base.SummaryClass {
- /// The name of the declared variable whose value is being used in the
- /// condition.
- @Id(0)
- String get name;
-
- /// The URI of the implementation library to be used if the condition is true.
- @Id(2)
- String get uri;
-
- /// The value to which the value of the declared variable will be compared,
- /// or `true` if the condition does not include an equality test.
- @Id(1)
- String get value;
-}
-
-/// Unlinked summary information about a constructor initializer.
-abstract class UnlinkedConstructorInitializer extends base.SummaryClass {
- /// If there are `m` [arguments] and `n` [argumentNames], then each argument
- /// from [arguments] with index `i` such that `n + i - m >= 0`, should be used
- /// with the name at `n + i - m`.
- @Id(4)
- List<String> get argumentNames;
-
- /// If [kind] is `thisInvocation` or `superInvocation`, the arguments of the
- /// invocation. Otherwise empty.
- @Id(3)
- List<UnlinkedExpr> get arguments;
-
- /// If [kind] is `field`, the expression of the field initializer.
- /// Otherwise `null`.
- @Id(1)
- UnlinkedExpr get expression;
-
- /// The kind of the constructor initializer (field, redirect, super).
- @Id(2)
- UnlinkedConstructorInitializerKind get kind;
-
- /// If [kind] is `field`, the name of the field declared in the class. If
- /// [kind] is `thisInvocation`, the name of the constructor, declared in this
- /// class, to redirect to. If [kind] is `superInvocation`, the name of the
- /// constructor, declared in the superclass, to invoke.
- @Id(0)
- String get name;
-}
-
-/// Enum used to indicate the kind of an constructor initializer.
-enum UnlinkedConstructorInitializerKind {
- /// Initialization of a field.
- field,
-
- /// Invocation of a constructor in the same class.
- thisInvocation,
-
- /// Invocation of a superclass' constructor.
- superInvocation,
-
- /// Invocation of `assert`.
- assertInvocation
-}
-
-/// Unlinked summary information about a documentation comment.
-abstract class UnlinkedDocumentationComment extends base.SummaryClass {
- /// Length of the documentation comment (prior to replacing '\r\n' with '\n').
- @Id(0)
- @deprecated
- int get length;
-
- /// Offset of the beginning of the documentation comment relative to the
- /// beginning of the file.
- @Id(2)
- @deprecated
- int get offset;
-
- /// Text of the documentation comment, with '\r\n' replaced by '\n'.
- ///
- /// References appearing within the doc comment in square brackets are not
- /// specially encoded.
- @Id(1)
- String get text;
-}
-
-/// Unlinked summary information about an enum declaration.
-abstract class UnlinkedEnum extends base.SummaryClass {
- /// Annotations for this enum.
- @Id(4)
- List<UnlinkedExpr> get annotations;
-
- /// Code range of the enum.
- @informative
- @Id(5)
- CodeRange get codeRange;
-
- /// Documentation comment for the enum, or `null` if there is no documentation
- /// comment.
- @informative
- @Id(3)
- UnlinkedDocumentationComment get documentationComment;
-
- /// Name of the enum type.
- @Id(0)
- String get name;
-
- /// Offset of the enum name relative to the beginning of the file.
- @informative
- @Id(1)
- int get nameOffset;
-
- /// Values listed in the enum declaration, in declaration order.
- @Id(2)
- List<UnlinkedEnumValue> get values;
-}
-
-/// Unlinked summary information about a single enumerated value in an enum
-/// declaration.
-abstract class UnlinkedEnumValue extends base.SummaryClass {
- /// Annotations for this value.
- @Id(3)
- List<UnlinkedExpr> get annotations;
-
- /// Documentation comment for the enum value, or `null` if there is no
- /// documentation comment.
- @informative
- @Id(2)
- UnlinkedDocumentationComment get documentationComment;
-
- /// Name of the enumerated value.
- @Id(0)
- String get name;
-
- /// Offset of the enum value name relative to the beginning of the file.
- @informative
- @Id(1)
- int get nameOffset;
-}
-
-/// Unlinked summary information about a function, method, getter, or setter
-/// declaration.
-abstract class UnlinkedExecutable extends base.SummaryClass {
- /// Annotations for this executable.
- @Id(6)
- List<UnlinkedExpr> get annotations;
-
- /// If this executable's function body is declared using `=>`, the expression
- /// to the right of the `=>`. May be omitted if neither type inference nor
- /// constant evaluation depends on the function body.
- @Id(29)
- UnlinkedExpr get bodyExpr;
-
- /// Code range of the executable.
- @informative
- @Id(26)
- CodeRange get codeRange;
-
- /// If a constant [UnlinkedExecutableKind.constructor], the constructor
- /// initializers. Otherwise empty.
- @Id(14)
- List<UnlinkedConstructorInitializer> get constantInitializers;
-
- /// If [kind] is [UnlinkedExecutableKind.constructor] and [isConst] is `true`,
- /// a nonzero slot id which is unique within this compilation unit. If this
- /// id is found in [LinkedUnit.constCycles], then this constructor is part of
- /// a cycle.
- ///
- /// Otherwise, zero.
- @Id(25)
- int get constCycleSlot;
-
- /// Documentation comment for the executable, or `null` if there is no
- /// documentation comment.
- @informative
- @Id(7)
- UnlinkedDocumentationComment get documentationComment;
-
- /// If this executable's return type is inferable, nonzero slot id
- /// identifying which entry in [LinkedUnit.types] contains the inferred
- /// return type. If there is no matching entry in [LinkedUnit.types], then
- /// no return type was inferred for this variable, so its static type is
- /// `dynamic`.
- @Id(5)
- int get inferredReturnTypeSlot;
-
- /// Indicates whether the executable is declared using the `abstract` keyword.
- @Id(10)
- bool get isAbstract;
-
- /// Indicates whether the executable has body marked as being asynchronous.
- @informative
- @Id(27)
- bool get isAsynchronous;
-
- /// Indicates whether the executable is declared using the `const` keyword.
- @Id(12)
- bool get isConst;
-
- /// Indicates whether the executable is declared using the `external` keyword.
- @Id(11)
- bool get isExternal;
-
- /// Indicates whether the executable is declared using the `factory` keyword.
- @Id(8)
- bool get isFactory;
-
- /// Indicates whether the executable has body marked as being a generator.
- @informative
- @Id(28)
- bool get isGenerator;
-
- /// Indicates whether the executable is a redirected constructor.
- @Id(13)
- bool get isRedirectedConstructor;
-
- /// Indicates whether the executable is declared using the `static` keyword.
- ///
- /// Note that for top level executables, this flag is false, since they are
- /// not declared using the `static` keyword (even though they are considered
- /// static for semantic purposes).
- @Id(9)
- bool get isStatic;
-
- /// The kind of the executable (function/method, getter, setter, or
- /// constructor).
- @Id(4)
- UnlinkedExecutableKind get kind;
-
- /// The list of local functions.
- @Id(18)
- List<UnlinkedExecutable> get localFunctions;
-
- /// The list of local labels.
- @informative
- @deprecated
- @Id(22)
- List<String> get localLabels;
-
- /// The list of local variables.
- @informative
- @deprecated
- @Id(19)
- List<UnlinkedVariable> get localVariables;
-
- /// Name of the executable. For setters, this includes the trailing "=". For
- /// named constructors, this excludes the class name and excludes the ".".
- /// For unnamed constructors, this is the empty string.
- @Id(1)
- String get name;
-
- /// If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty,
- /// the offset of the end of the constructor name. Otherwise zero.
- @informative
- @Id(23)
- int get nameEnd;
-
- /// Offset of the executable name relative to the beginning of the file. For
- /// named constructors, this excludes the class name and excludes the ".".
- /// For unnamed constructors, this is the offset of the class name (i.e. the
- /// offset of the second "C" in "class C { C(); }").
- @informative
- @Id(0)
- int get nameOffset;
-
- /// Parameters of the executable, if any. Note that getters have no
- /// parameters (hence this will be the empty list), and setters have a single
- /// parameter.
- @Id(2)
- List<UnlinkedParam> get parameters;
-
- /// If [kind] is [UnlinkedExecutableKind.constructor] and [name] is not empty,
- /// the offset of the period before the constructor name. Otherwise zero.
- @informative
- @Id(24)
- int get periodOffset;
-
- /// If [isRedirectedConstructor] and [isFactory] are both `true`, the
- /// constructor to which this constructor redirects; otherwise empty.
- @Id(15)
- EntityRef get redirectedConstructor;
-
- /// If [isRedirectedConstructor] is `true` and [isFactory] is `false`, the
- /// name of the constructor that this constructor redirects to; otherwise
- /// empty.
- @Id(17)
- String get redirectedConstructorName;
-
- /// Declared return type of the executable. Absent if the executable is a
- /// constructor or the return type is implicit. Absent for executables
- /// associated with variable initializers and closures, since these
- /// executables may have return types that are not accessible via direct
- /// imports.
- @Id(3)
- EntityRef get returnType;
-
- /// Type parameters of the executable, if any. Empty if support for generic
- /// method syntax is disabled.
- @Id(16)
- List<UnlinkedTypeParam> get typeParameters;
-
- /// If a local function, the length of the visible range; zero otherwise.
- @informative
- @Id(20)
- int get visibleLength;
-
- /// If a local function, the beginning of the visible range; zero otherwise.
- @informative
- @Id(21)
- int get visibleOffset;
-}
-
-/// Enum used to indicate the kind of an executable.
-enum UnlinkedExecutableKind {
- /// Executable is a function or method.
- functionOrMethod,
-
- /// Executable is a getter.
- getter,
-
- /// Executable is a setter.
- setter,
-
- /// Executable is a constructor.
- constructor
-}
-
-/// Unlinked summary information about an export declaration (stored outside
-/// [UnlinkedPublicNamespace]).
-abstract class UnlinkedExportNonPublic extends base.SummaryClass {
- /// Annotations for this export directive.
- @Id(3)
- List<UnlinkedExpr> get annotations;
-
- /// Offset of the "export" keyword.
- @informative
- @Id(0)
- int get offset;
-
- /// End of the URI string (including quotes) relative to the beginning of the
- /// file.
- @informative
- @Id(1)
- int get uriEnd;
-
- /// Offset of the URI string (including quotes) relative to the beginning of
- /// the file.
- @informative
- @Id(2)
- int get uriOffset;
-}
-
-/// Unlinked summary information about an export declaration (stored inside
-/// [UnlinkedPublicNamespace]).
-abstract class UnlinkedExportPublic extends base.SummaryClass {
- /// Combinators contained in this export declaration.
- @Id(1)
- List<UnlinkedCombinator> get combinators;
-
- /// Configurations used to control which library will actually be loaded at
- /// run-time.
- @Id(2)
- List<UnlinkedConfiguration> get configurations;
-
- /// URI used in the source code to reference the exported library.
- @Id(0)
- String get uri;
-}
-
-/// Unlinked summary information about an expression.
-///
-/// Expressions are represented using a simple stack-based language
-/// where [operations] is a sequence of operations to execute starting with an
-/// empty stack. Once all operations have been executed, the stack should
-/// contain a single value which is the value of the constant. Note that some
-/// operations consume additional data from the other fields of this class.
-abstract class UnlinkedExpr extends base.SummaryClass {
- /// Sequence of operators used by assignment operations.
- @Id(6)
- List<UnlinkedExprAssignOperator> get assignmentOperators;
-
- /// Sequence of 64-bit doubles consumed by the operation `pushDouble`.
- @Id(4)
- List<double> get doubles;
-
- /// Sequence of unsigned 32-bit integers consumed by the operations
- /// `pushArgument`, `pushInt`, `shiftOr`, `concatenate`, `invokeConstructor`,
- /// `makeList`, and `makeMap`.
- @Id(1)
- List<int> get ints;
-
- /// Indicates whether the expression is a valid potentially constant
- /// expression.
- @Id(5)
- bool get isValidConst;
-
- /// Sequence of operations to execute (starting with an empty stack) to form
- /// the constant value.
- @Id(0)
- List<UnlinkedExprOperation> get operations;
-
- /// Sequence of language constructs consumed by the operations
- /// `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note
- /// that in the case of `pushReference` (and sometimes `invokeConstructor` the
- /// actual entity being referred to may be something other than a type.
- @Id(2)
- List<EntityRef> get references;
-
- /// String representation of the expression in a form suitable to be tokenized
- /// and parsed.
- @Id(7)
- String get sourceRepresentation;
-
- /// Sequence of strings consumed by the operations `pushString` and
- /// `invokeConstructor`.
- @Id(3)
- List<String> get strings;
-}
-
-/// Enum representing the various kinds of assignment operations combined
-/// with:
-/// [UnlinkedExprOperation.assignToRef],
-/// [UnlinkedExprOperation.assignToProperty],
-/// [UnlinkedExprOperation.assignToIndex].
-enum UnlinkedExprAssignOperator {
- /// Perform simple assignment `target = operand`.
- assign,
-
- /// Perform `target ??= operand`.
- ifNull,
-
- /// Perform `target *= operand`.
- multiply,
-
- /// Perform `target /= operand`.
- divide,
-
- /// Perform `target ~/= operand`.
- floorDivide,
-
- /// Perform `target %= operand`.
- modulo,
-
- /// Perform `target += operand`.
- plus,
-
- /// Perform `target -= operand`.
- minus,
-
- /// Perform `target <<= operand`.
- shiftLeft,
-
- /// Perform `target >>= operand`.
- shiftRight,
-
- /// Perform `target &= operand`.
- bitAnd,
-
- /// Perform `target ^= operand`.
- bitXor,
-
- /// Perform `target |= operand`.
- bitOr,
-
- /// Perform `++target`.
- prefixIncrement,
-
- /// Perform `--target`.
- prefixDecrement,
-
- /// Perform `target++`.
- postfixIncrement,
-
- /// Perform `target++`.
- postfixDecrement,
-}
-
-/// Enum representing the various kinds of operations which may be performed to
-/// in an expression. These options are assumed to execute in the
-/// context of a stack which is initially empty.
-enum UnlinkedExprOperation {
- /// Push the next value from [UnlinkedExpr.ints] (a 32-bit unsigned integer)
- /// onto the stack.
- ///
- /// Note that Dart supports integers larger than 32 bits; these are
- /// represented by composing 32-bit values using the [pushLongInt] operation.
- pushInt,
-
- /// Get the number of components from [UnlinkedExpr.ints], then do this number
- /// of times the following operations: multiple the current value by 2^32,
- /// "or" it with the next value in [UnlinkedExpr.ints]. The initial value is
- /// zero. Push the result into the stack.
- pushLongInt,
-
- /// Push the next value from [UnlinkedExpr.doubles] (a double precision
- /// floating point value) onto the stack.
- pushDouble,
-
- /// Push the constant `true` onto the stack.
- pushTrue,
-
- /// Push the constant `false` onto the stack.
- pushFalse,
-
- /// Push the next value from [UnlinkedExpr.strings] onto the stack.
- pushString,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), convert them to strings (if they aren't already),
- /// concatenate them into a single string, and push it back onto the stack.
- ///
- /// This operation is used to represent constants whose value is a literal
- /// string containing string interpolations.
- concatenate,
-
- /// Get the next value from [UnlinkedExpr.strings], convert it to a symbol,
- /// and push it onto the stack.
- makeSymbol,
-
- /// Push the constant `null` onto the stack.
- pushNull,
-
- /// Push the value of the function parameter with the name obtained from
- /// [UnlinkedExpr.strings].
- pushParameter,
-
- /// Evaluate a (potentially qualified) identifier expression and push the
- /// resulting value onto the stack. The identifier to be evaluated is
- /// obtained from [UnlinkedExpr.references].
- ///
- /// This operation is used to represent the following kinds of constants
- /// (which are indistinguishable from an unresolved AST alone):
- ///
- /// - A qualified reference to a static constant variable (e.g. `C.v`, where
- /// C is a class and `v` is a constant static variable in `C`).
- /// - An identifier expression referring to a constant variable.
- /// - A simple or qualified identifier denoting a class or type alias.
- /// - A simple or qualified identifier denoting a top-level function or a
- /// static method.
- pushReference,
-
- /// Pop the top value from the stack, extract the value of the property with
- /// the name obtained from [UnlinkedExpr.strings], and push the result back
- /// onto the stack.
- extractProperty,
-
- /// Pop the top `n` values from the stack (where `n` is obtained from
- /// [UnlinkedExpr.ints]) into a list (filled from the end) and take the next
- /// `n` values from [UnlinkedExpr.strings] and use the lists of names and
- /// values to create named arguments. Then pop the top `m` values from the
- /// stack (where `m` is obtained from [UnlinkedExpr.ints]) into a list (filled
- /// from the end) and use them as positional arguments. Use the lists of
- /// positional and names arguments to invoke a constant constructor obtained
- /// from [UnlinkedExpr.references], and push the resulting value back onto the
- /// stack.
- ///
- /// Arguments are skipped, and `0` are specified as the numbers of arguments
- /// on the stack, if the expression is not a constant. We store expression of
- /// variable initializers to perform top-level inference, and arguments are
- /// never used to infer types.
- ///
- /// Note that for an invocation of the form `const a.b(...)` (where no type
- /// arguments are specified), it is impossible to tell from the unresolved AST
- /// alone whether `a` is a class name and `b` is a constructor name, or `a` is
- /// a prefix name and `b` is a class name. For consistency between AST based
- /// and elements based summaries, references to default constructors are
- /// always recorded as references to corresponding classes.
- invokeConstructor,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), place them in a [List], and push the result back
- /// onto the stack. The type parameter for the [List] is implicitly
- /// `dynamic`.
- makeUntypedList,
-
- /// Pop the top 2*n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), interpret them as key/value pairs, place them in a
- /// [Map], and push the result back onto the stack. The two type parameters
- /// for the [Map] are implicitly `dynamic`.
- ///
- /// To be replaced with [makeUntypedSetOrMap] for unified collections.
- makeUntypedMap,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), place them in a [List], and push the result back
- /// onto the stack. The type parameter for the [List] is obtained from
- /// [UnlinkedExpr.references].
- makeTypedList,
-
- /// Pop the top 2*n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), interpret them as key/value pairs, place them in a
- /// [Map], and push the result back onto the stack. The two type parameters
- /// for the [Map] are obtained from [UnlinkedExpr.references].
- ///
- /// To be replaced with [makeTypedMap2] for unified collections. This is not
- /// forwards compatible with [makeTypedMap2] because it expects
- /// [CollectionElement]s instead of pairs of [Expression]s.
- makeTypedMap,
-
- /// Pop the top 2 values from the stack, evaluate `v1 == v2`, and push the
- /// result back onto the stack.
- equal,
-
- /// Pop the top 2 values from the stack, evaluate `v1 != v2`, and push the
- /// result back onto the stack.
- notEqual,
-
- /// Pop the top value from the stack, compute its boolean negation, and push
- /// the result back onto the stack.
- not,
-
- /// Pop the top 2 values from the stack, compute `v1 && v2`, and push the
- /// result back onto the stack.
- and,
-
- /// Pop the top 2 values from the stack, compute `v1 || v2`, and push the
- /// result back onto the stack.
- or,
-
- /// Pop the top value from the stack, compute its integer complement, and push
- /// the result back onto the stack.
- complement,
-
- /// Pop the top 2 values from the stack, compute `v1 ^ v2`, and push the
- /// result back onto the stack.
- bitXor,
-
- /// Pop the top 2 values from the stack, compute `v1 & v2`, and push the
- /// result back onto the stack.
- bitAnd,
-
- /// Pop the top 2 values from the stack, compute `v1 | v2`, and push the
- /// result back onto the stack.
- bitOr,
-
- /// Pop the top 2 values from the stack, compute `v1 >> v2`, and push the
- /// result back onto the stack.
- bitShiftRight,
-
- /// Pop the top 2 values from the stack, compute `v1 << v2`, and push the
- /// result back onto the stack.
- bitShiftLeft,
-
- /// Pop the top 2 values from the stack, compute `v1 + v2`, and push the
- /// result back onto the stack.
- add,
-
- /// Pop the top value from the stack, compute its integer negation, and push
- /// the result back onto the stack.
- negate,
-
- /// Pop the top 2 values from the stack, compute `v1 - v2`, and push the
- /// result back onto the stack.
- subtract,
-
- /// Pop the top 2 values from the stack, compute `v1 * v2`, and push the
- /// result back onto the stack.
- multiply,
-
- /// Pop the top 2 values from the stack, compute `v1 / v2`, and push the
- /// result back onto the stack.
- divide,
-
- /// Pop the top 2 values from the stack, compute `v1 ~/ v2`, and push the
- /// result back onto the stack.
- floorDivide,
-
- /// Pop the top 2 values from the stack, compute `v1 > v2`, and push the
- /// result back onto the stack.
- greater,
-
- /// Pop the top 2 values from the stack, compute `v1 < v2`, and push the
- /// result back onto the stack.
- less,
-
- /// Pop the top 2 values from the stack, compute `v1 >= v2`, and push the
- /// result back onto the stack.
- greaterEqual,
-
- /// Pop the top 2 values from the stack, compute `v1 <= v2`, and push the
- /// result back onto the stack.
- lessEqual,
-
- /// Pop the top 2 values from the stack, compute `v1 % v2`, and push the
- /// result back onto the stack.
- modulo,
-
- /// Pop the top 3 values from the stack, compute `v1 ? v2 : v3`, and push the
- /// result back onto the stack.
- conditional,
-
- /// Pop from the stack `value` and get the next `target` reference from
- /// [UnlinkedExpr.references] - a top-level variable (prefixed or not), an
- /// assignable field of a class (prefixed or not), or a sequence of getters
- /// ending with an assignable property `a.b.b.c.d.e`. In general `a.b` cannot
- /// not be distinguished between: `a` is a prefix and `b` is a top-level
- /// variable; or `a` is an object and `b` is the name of a property. Perform
- /// `reference op= value` where `op` is the next assignment operator from
- /// [UnlinkedExpr.assignmentOperators]. Push `value` back into the stack.
- ///
- /// If the assignment operator is a prefix/postfix increment/decrement, then
- /// `value` is not present in the stack, so it should not be popped and the
- /// corresponding value of the `target` after/before update is pushed into the
- /// stack instead.
- assignToRef,
-
- /// Pop from the stack `target` and `value`. Get the name of the property
- /// from `UnlinkedConst.strings` and assign the `value` to the named property
- /// of the `target`. This operation is used when we know that the `target`
- /// is an object reference expression, e.g. `new Foo().a.b.c` or `a.b[0].c.d`.
- /// Perform `target.property op= value` where `op` is the next assignment
- /// operator from [UnlinkedExpr.assignmentOperators]. Push `value` back into
- /// the stack.
- ///
- /// If the assignment operator is a prefix/postfix increment/decrement, then
- /// `value` is not present in the stack, so it should not be popped and the
- /// corresponding value of the `target` after/before update is pushed into the
- /// stack instead.
- assignToProperty,
-
- /// Pop from the stack `index`, `target` and `value`. Perform
- /// `target[index] op= value` where `op` is the next assignment operator from
- /// [UnlinkedExpr.assignmentOperators]. Push `value` back into the stack.
- ///
- /// If the assignment operator is a prefix/postfix increment/decrement, then
- /// `value` is not present in the stack, so it should not be popped and the
- /// corresponding value of the `target` after/before update is pushed into the
- /// stack instead.
- assignToIndex,
-
- /// Pop from the stack `index` and `target`. Push into the stack the result
- /// of evaluation of `target[index]`.
- extractIndex,
-
- /// Pop the top `n` values from the stack (where `n` is obtained from
- /// [UnlinkedExpr.ints]) into a list (filled from the end) and take the next
- /// `n` values from [UnlinkedExpr.strings] and use the lists of names and
- /// values to create named arguments. Then pop the top `m` values from the
- /// stack (where `m` is obtained from [UnlinkedExpr.ints]) into a list (filled
- /// from the end) and use them as positional arguments. Use the lists of
- /// positional and names arguments to invoke a method (or a function) with
- /// the reference from [UnlinkedExpr.references]. If `k` is nonzero (where
- /// `k` is obtained from [UnlinkedExpr.ints]), obtain `k` type arguments from
- /// [UnlinkedExpr.references] and use them as generic type arguments for the
- /// aforementioned method or function. Push the result of the invocation onto
- /// the stack.
- ///
- /// Arguments are skipped, and `0` are specified as the numbers of arguments
- /// on the stack, if the expression is not a constant. We store expression of
- /// variable initializers to perform top-level inference, and arguments are
- /// never used to infer types.
- ///
- /// In general `a.b` cannot not be distinguished between: `a` is a prefix and
- /// `b` is a top-level function; or `a` is an object and `b` is the name of a
- /// method. This operation should be used for a sequence of identifiers
- /// `a.b.b.c.d.e` ending with an invokable result.
- invokeMethodRef,
-
- /// Pop the top `n` values from the stack (where `n` is obtained from
- /// [UnlinkedExpr.ints]) into a list (filled from the end) and take the next
- /// `n` values from [UnlinkedExpr.strings] and use the lists of names and
- /// values to create named arguments. Then pop the top `m` values from the
- /// stack (where `m` is obtained from [UnlinkedExpr.ints]) into a list (filled
- /// from the end) and use them as positional arguments. Use the lists of
- /// positional and names arguments to invoke the method with the name from
- /// [UnlinkedExpr.strings] of the target popped from the stack. If `k` is
- /// nonzero (where `k` is obtained from [UnlinkedExpr.ints]), obtain `k` type
- /// arguments from [UnlinkedExpr.references] and use them as generic type
- /// arguments for the aforementioned method. Push the result of the
- /// invocation onto the stack.
- ///
- /// Arguments are skipped, and `0` are specified as the numbers of arguments
- /// on the stack, if the expression is not a constant. We store expression of
- /// variable initializers to perform top-level inference, and arguments are
- /// never used to infer types.
- ///
- /// This operation should be used for invocation of a method invocation
- /// where `target` is known to be an object instance.
- invokeMethod,
-
- /// Begin a new cascade section. Duplicate the top value of the stack.
- cascadeSectionBegin,
-
- /// End a new cascade section. Pop the top value from the stack and throw it
- /// away.
- cascadeSectionEnd,
-
- /// Pop the top value from the stack and cast it to the type with reference
- /// from [UnlinkedExpr.references], push the result into the stack.
- typeCast,
-
- /// Pop the top value from the stack and check whether it is a subclass of the
- /// type with reference from [UnlinkedExpr.references], push the result into
- /// the stack.
- typeCheck,
-
- /// Pop the top value from the stack and raise an exception with this value.
- throwException,
-
- /// Obtain two values `n` and `m` from [UnlinkedExpr.ints]. Then, starting at
- /// the executable element for the expression being evaluated, if n > 0, pop
- /// to the nth enclosing function element. Then, push the mth local function
- /// of that element onto the stack.
- pushLocalFunctionReference,
-
- /// Pop the top two values from the stack. If the first value is non-null,
- /// keep it and discard the second. Otherwise, keep the second and discard
- /// the first.
- ifNull,
-
- /// Pop the top value from the stack. Treat it as a Future and await its
- /// completion. Then push the awaited value onto the stack.
- await,
-
- /// Push an abstract value onto the stack. Abstract values mark the presence
- /// of a value, but whose details are not included.
- ///
- /// This is not used by the summary generators today, but it will be used to
- /// experiment with prunning the initializer expression tree, so only
- /// information that is necessary gets included in the output summary file.
- pushUntypedAbstract,
-
- /// Get the next type reference from [UnlinkedExpr.references] and push an
- /// abstract value onto the stack that has that type.
- ///
- /// Like [pushUntypedAbstract], this is also not used by the summary
- /// generators today. The plan is to experiment with prunning the initializer
- /// expression tree, and include just enough type information to perform
- /// strong-mode type inference, but not all the details of how this type was
- /// obtained.
- pushTypedAbstract,
-
- /// Push an error onto the stack.
- ///
- /// Like [pushUntypedAbstract], this is not used by summary generators today.
- /// This will be used to experiment with prunning the const expression tree.
- /// If a constant has an error, we can omit the subexpression containing the
- /// error and only include a marker that an error was detected.
- pushError,
-
- /// Push `this` expression onto the stack.
- pushThis,
-
- /// Push `super` expression onto the stack.
- pushSuper,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), place them in a [Set], and push the result back
- /// onto the stack. The type parameter for the [Set] is implicitly
- /// `dynamic`.
- makeUntypedSet,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), place them in a [Set], and push the result back
- /// onto the stack. The type parameter for the [Set] is obtained from
- /// [UnlinkedExpr.references].
- makeTypedSet,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), which should be [CollectionElement]s, place them in
- /// a [SetOrMap], and push the result back onto the stack.
- makeUntypedSetOrMap,
-
- /// Pop the top n values from the stack (where n is obtained from
- /// [UnlinkedExpr.ints]), which should be [CollectionElement]s, place them in
- /// a [Map], and push the result back onto the stack. The two type parameters
- /// for the [Map] are obtained from [UnlinkedExpr.references].
- ///
- /// To replace [makeTypedMap] for unified collections. This is not backwards
- /// compatible with [makeTypedMap] because it expects [CollectionElement]s
- /// instead of pairs of [Expression]s.
- makeTypedMap2,
-
- /// Pop the top 2 values from the stack, place them in a [MapLiteralEntry],
- /// and push the result back onto the stack.
- makeMapLiteralEntry,
-
- /// Pop the top value from the stack, convert it to a spread element of type
- /// `...`, and push the result back onto the stack.
- spreadElement,
-
- /// Pop the top value from the stack, convert it to a spread element of type
- /// `...?`, and push the result back onto the stack.
- nullAwareSpreadElement,
-
- /// Pop the top two values from the stack. The first is a condition
- /// and the second is a collection element. Push an "if" element having the
- /// given condition, with the collection element as its "then" clause.
- ifElement,
-
- /// Pop the top three values from the stack. The first is a condition and the
- /// other two are collection elements. Push an "if" element having the given
- /// condition, with the two collection elements as its "then" and "else"
- /// clauses, respectively.
- ifElseElement,
-
- /// Pop the top n+2 values from the stack, where n is obtained from
- /// [UnlinkedExpr.ints]. The first two are the initialization and condition
- /// of the for-loop; the remainder are the updaters.
- forParts,
-
- /// Pop the top 2 values from the stack. The first is the for loop parts.
- /// The second is the body.
- forElement,
-
- /// Push the empty expression (used for missing initializers and conditions in
- /// `for` loops)
- pushEmptyExpression,
-
- /// Add a variable to the current scope whose name is obtained from
- /// [UnlinkedExpr.strings]. This is separate from [variableDeclaration]
- /// because the scope of the variable includes its own initializer.
- variableDeclarationStart,
-
- /// Pop the top value from the stack, and use it as the initializer for a
- /// variable declaration; the variable being declared is obtained by looking
- /// at the nth variable most recently added to the scope (where n counts from
- /// zero and is obtained from [UnlinkedExpr.ints]).
- variableDeclaration,
-
- /// Pop the top n values from the stack, which should all be variable
- /// declarations, and use them to create an untyped for-initializer
- /// declaration. The value of n is obtained from [UnlinkedExpr.ints].
- forInitializerDeclarationsUntyped,
-
- /// Pop the top n values from the stack, which should all be variable
- /// declarations, and use them to create a typed for-initializer
- /// declaration. The value of n is obtained from [UnlinkedExpr.ints]. The
- /// type is obtained from [UnlinkedExpr.references].
- forInitializerDeclarationsTyped,
-
- /// Pop from the stack `value` and get a string from [UnlinkedExpr.strings].
- /// Use this string to look up a parameter. Perform `parameter op= value`,
- /// where `op` is the next assignment operator from
- /// [UnlinkedExpr.assignmentOperators]. Push `value` back onto the stack.
- ///
- /// If the assignment operator is a prefix/postfix increment/decrement, then
- /// `value` is not present in the stack, so it should not be popped and the
- /// corresponding value of the parameter after/before update is pushed onto
- /// the stack instead.
- assignToParameter,
-
- /// Pop from the stack an identifier and an expression, and create for-each
- /// parts of the form `identifier in expression`.
- forEachPartsWithIdentifier,
-
- /// Pop the top 2 values from the stack. The first is the for loop parts.
- /// The second is the body.
- forElementWithAwait,
-
- /// Pop an expression from the stack, and create for-each parts of the form
- /// `var name in expression`, where `name` is obtained from
- /// [UnlinkedExpr.strings].
- forEachPartsWithUntypedDeclaration,
-
- /// Pop an expression from the stack, and create for-each parts of the form
- /// `Type name in expression`, where `name` is obtained from
- /// [UnlinkedExpr.strings], and `Type` is obtained from
- /// [UnlinkedExpr.references].
- forEachPartsWithTypedDeclaration,
-
- /// Pop the top 2 values from the stack, compute `v1 >>> v2`, and push the
- /// result back onto the stack.
- bitShiftRightLogical,
-}
-
-/// Unlinked summary information about an extension declaration.
-abstract class UnlinkedExtension extends base.SummaryClass {
- /// Annotations for this extension.
- @Id(4)
- List<UnlinkedExpr> get annotations;
-
- /// Code range of the extension.
- @informative
- @Id(7)
- CodeRange get codeRange;
-
- /// Documentation comment for the extension, or `null` if there is no
- /// documentation comment.
- @informative
- @Id(5)
- UnlinkedDocumentationComment get documentationComment;
-
- /// Executable objects (methods, getters, and setters) contained in the
- /// extension.
- @Id(2)
- List<UnlinkedExecutable> get executables;
-
- /// The type being extended.
- @Id(3)
- EntityRef get extendedType;
-
- /// Field declarations contained in the extension.
- @Id(8)
- List<UnlinkedVariable> get fields;
-
- /// Name of the extension, or an empty string if there is no name.
- @Id(0)
- String get name;
-
- /// Offset of the extension name relative to the beginning of the file, or
- /// zero if there is no name.
- @informative
- @Id(1)
- int get nameOffset;
-
- /// Type parameters of the extension, if any.
- @Id(6)
- List<UnlinkedTypeParam> get typeParameters;
-}
-
-/// Unlinked summary information about an import declaration.
-abstract class UnlinkedImport extends base.SummaryClass {
- /// Annotations for this import declaration.
- @Id(8)
- List<UnlinkedExpr> get annotations;
-
- /// Combinators contained in this import declaration.
- @Id(4)
- List<UnlinkedCombinator> get combinators;
-
- /// Configurations used to control which library will actually be loaded at
- /// run-time.
- @Id(10)
- List<UnlinkedConfiguration> get configurations;
-
- /// Indicates whether the import declaration uses the `deferred` keyword.
- @Id(9)
- bool get isDeferred;
-
- /// Indicates whether the import declaration is implicit.
- @Id(5)
- bool get isImplicit;
-
- /// If [isImplicit] is false, offset of the "import" keyword. If [isImplicit]
- /// is true, zero.
- @informative
- @Id(0)
- int get offset;
-
- /// Offset of the prefix name relative to the beginning of the file, or zero
- /// if there is no prefix.
- @informative
- @Id(6)
- int get prefixOffset;
-
- /// Index into [UnlinkedUnit.references] of the prefix declared by this
- /// import declaration, or zero if this import declaration declares no prefix.
- ///
- /// Note that multiple imports can declare the same prefix.
- @Id(7)
- int get prefixReference;
-
- /// URI used in the source code to reference the imported library.
- @Id(1)
- String get uri;
-
- /// End of the URI string (including quotes) relative to the beginning of the
- /// file. If [isImplicit] is true, zero.
- @informative
- @Id(2)
- int get uriEnd;
-
- /// Offset of the URI string (including quotes) relative to the beginning of
- /// the file. If [isImplicit] is true, zero.
- @informative
- @Id(3)
- int get uriOffset;
-}
-
@Variant('kind')
abstract class UnlinkedInformativeData extends base.SummaryClass {
@VariantId(2, variantList: [
@@ -3781,256 +2012,10 @@
int get nameOffset;
}
-/// Unlinked summary information about a function parameter.
-abstract class UnlinkedParam extends base.SummaryClass {
- /// Annotations for this parameter.
- @Id(9)
- List<UnlinkedExpr> get annotations;
-
- /// Code range of the parameter.
- @informative
- @Id(7)
- CodeRange get codeRange;
-
- /// If the parameter has a default value, the source text of the constant
- /// expression in the default value. Otherwise the empty string.
- @informative
- @Id(13)
- String get defaultValueCode;
-
- /// If this parameter's type is inferable, nonzero slot id identifying which
- /// entry in [LinkedLibrary.types] contains the inferred type. If there is no
- /// matching entry in [LinkedLibrary.types], then no type was inferred for
- /// this variable, so its static type is `dynamic`.
- ///
- /// Note that although strong mode considers initializing formals to be
- /// inferable, they are not marked as such in the summary; if their type is
- /// not specified, they always inherit the static type of the corresponding
- /// field.
- @Id(2)
- int get inferredTypeSlot;
-
- /// If this is a parameter of an instance method, a nonzero slot id which is
- /// unique within this compilation unit. If this id is found in
- /// [LinkedUnit.parametersInheritingCovariant], then this parameter inherits
- /// `@covariant` behavior from a base class.
- ///
- /// Otherwise, zero.
- @Id(14)
- int get inheritsCovariantSlot;
-
- /// The synthetic initializer function of the parameter. Absent if the
- /// variable does not have an initializer.
- @Id(12)
- UnlinkedExecutable get initializer;
-
- /// Indicates whether this parameter is explicitly marked as being covariant.
- @Id(15)
- bool get isExplicitlyCovariant;
-
- /// Indicates whether the parameter is declared using the `final` keyword.
- @Id(16)
- bool get isFinal;
-
- /// Indicates whether this is a function-typed parameter. A parameter is
- /// function-typed if the declaration of the parameter has explicit formal
- /// parameters
- /// ```
- /// int functionTyped(int p)
- /// ```
- /// but is not function-typed if it does not, even if the type of the
- /// parameter is a function type.
- @Id(5)
- bool get isFunctionTyped;
-
- /// Indicates whether this is an initializing formal parameter (i.e. it is
- /// declared using `this.` syntax).
- @Id(6)
- bool get isInitializingFormal;
-
- /// Kind of the parameter.
- @Id(4)
- UnlinkedParamKind get kind;
-
- /// Name of the parameter.
- @Id(0)
- String get name;
-
- /// Offset of the parameter name relative to the beginning of the file.
- @informative
- @Id(1)
- int get nameOffset;
-
- /// If [isFunctionTyped] is `true`, the parameters of the function type.
- @Id(8)
- List<UnlinkedParam> get parameters;
-
- /// If [isFunctionTyped] is `true`, the declared return type. If
- /// [isFunctionTyped] is `false`, the declared type. Absent if the type is
- /// implicit.
- @Id(3)
- EntityRef get type;
-
- /// The length of the visible range.
- @informative
- @Id(10)
- int get visibleLength;
-
- /// The beginning of the visible range.
- @informative
- @Id(11)
- int get visibleOffset;
-}
-
-/// Enum used to indicate the kind of a parameter.
-enum UnlinkedParamKind {
- /// Parameter is required and positional.
- requiredPositional,
-
- /// Parameter is optional and positional (enclosed in `[]`)
- optionalPositional,
-
- /// Parameter is optional and named (enclosed in `{}`)
- optionalNamed,
-
- /// Parameter is required and named (enclosed in `{}`).
- requiredNamed
-}
-
-/// Unlinked summary information about a part declaration.
-abstract class UnlinkedPart extends base.SummaryClass {
- /// Annotations for this part declaration.
- @Id(2)
- List<UnlinkedExpr> get annotations;
-
- /// End of the URI string (including quotes) relative to the beginning of the
- /// file.
- @informative
- @Id(0)
- int get uriEnd;
-
- /// Offset of the URI string (including quotes) relative to the beginning of
- /// the file.
- @informative
- @Id(1)
- int get uriOffset;
-}
-
-/// Unlinked summary information about a specific name contributed by a
-/// compilation unit to a library's public namespace.
-///
-/// TODO(paulberry): some of this information is redundant with information
-/// elsewhere in the summary. Consider reducing the redundancy to reduce
-/// summary size.
-abstract class UnlinkedPublicName extends base.SummaryClass {
- /// The kind of object referred to by the name.
- @Id(1)
- ReferenceKind get kind;
-
- /// If this [UnlinkedPublicName] is a class, the list of members which can be
- /// referenced statically - static fields, static methods, and constructors.
- /// Otherwise empty.
- ///
- /// Unnamed constructors are not included since they do not constitute a
- /// separate name added to any namespace.
- @Id(2)
- List<UnlinkedPublicName> get members;
-
- /// The name itself.
- @Id(0)
- String get name;
-
- /// If the entity being referred to is generic, the number of type parameters
- /// it accepts. Otherwise zero.
- @Id(3)
- int get numTypeParameters;
-}
-
-/// Unlinked summary information about what a compilation unit contributes to a
-/// library's public namespace. This is the subset of [UnlinkedUnit] that is
-/// required from dependent libraries in order to perform prelinking.
-@TopLevel('UPNS')
-abstract class UnlinkedPublicNamespace extends base.SummaryClass {
- factory UnlinkedPublicNamespace.fromBuffer(List<int> buffer) =>
- generated.readUnlinkedPublicNamespace(buffer);
-
- /// Export declarations in the compilation unit.
- @Id(2)
- List<UnlinkedExportPublic> get exports;
-
- /// Public names defined in the compilation unit.
- ///
- /// TODO(paulberry): consider sorting these names to reduce unnecessary
- /// relinking.
- @Id(0)
- List<UnlinkedPublicName> get names;
-
- /// URIs referenced by part declarations in the compilation unit.
- @Id(1)
- List<String> get parts;
-}
-
-/// Unlinked summary information about a name referred to in one library that
-/// might be defined in another.
-abstract class UnlinkedReference extends base.SummaryClass {
- /// Name of the entity being referred to. For the pseudo-type `dynamic`, the
- /// string is "dynamic". For the pseudo-type `void`, the string is "void".
- /// For the pseudo-type `bottom`, the string is "*bottom*".
- @Id(0)
- String get name;
-
- /// Prefix used to refer to the entity, or zero if no prefix is used. This is
- /// an index into [UnlinkedUnit.references].
- ///
- /// Prefix references must always point backward; that is, for all i, if
- /// UnlinkedUnit.references[i].prefixReference != 0, then
- /// UnlinkedUnit.references[i].prefixReference < i.
- @Id(1)
- int get prefixReference;
-}
-
-/// TODO(scheglov) document
-enum UnlinkedTokenKind { nothing, comment, keyword, simple, string }
-
-/// TODO(scheglov) document
+/// TODO(scheglov) Remove it.
abstract class UnlinkedTokens extends base.SummaryClass {
- /// The token that corresponds to this token, or `0` if this token is not
- /// the first of a pair of matching tokens (such as parentheses).
@Id(0)
- List<int> get endGroup;
-
- /// Return `true` if this token is a synthetic token. A synthetic token is a
- /// token that was introduced by the parser in order to recover from an error
- /// in the code.
- @Id(1)
- List<bool> get isSynthetic;
-
- @Id(2)
- List<UnlinkedTokenKind> get kind;
-
- @Id(3)
- List<int> get length;
-
- @Id(4)
- List<String> get lexeme;
-
- /// The next token in the token stream, `0` for [UnlinkedTokenType.EOF] or
- /// the last comment token.
- @Id(5)
- List<int> get next;
-
- @Id(6)
- List<int> get offset;
-
- /// The first comment token in the list of comments that precede this token,
- /// or `0` if there are no comments preceding this token. Additional comments
- /// can be reached by following the token stream using [next] until `0` is
- /// reached.
- @Id(7)
- List<int> get precedingComment;
-
- @Id(8)
- List<UnlinkedTokenType> get type;
+ int get placeholder;
}
/// TODO(scheglov) document
@@ -4178,205 +2163,10 @@
YIELD,
}
-/// Unlinked summary information about a typedef declaration.
-abstract class UnlinkedTypedef extends base.SummaryClass {
- /// Annotations for this typedef.
- @Id(4)
- List<UnlinkedExpr> get annotations;
-
- /// Code range of the typedef.
- @informative
- @Id(7)
- CodeRange get codeRange;
-
- /// Documentation comment for the typedef, or `null` if there is no
- /// documentation comment.
- @informative
- @Id(6)
- UnlinkedDocumentationComment get documentationComment;
-
- /// Name of the typedef.
- @Id(0)
- String get name;
-
- /// Offset of the typedef name relative to the beginning of the file.
- @informative
- @Id(1)
- int get nameOffset;
-
- /// If the typedef might not be simply bounded, a nonzero slot id which is
- /// unique within this compilation unit. If this id is found in
- /// [LinkedUnit.notSimplyBounded], then at least one of this typedef's type
- /// parameters is not simply bounded, hence this typedef can't be used as a
- /// raw type when specifying the bound of a type parameter.
- ///
- /// Otherwise, zero.
- @Id(9)
- int get notSimplyBoundedSlot;
-
- /// Parameters of the executable, if any.
- @Id(3)
- List<UnlinkedParam> get parameters;
-
- /// If [style] is [TypedefStyle.functionType], the return type of the typedef.
- /// If [style] is [TypedefStyle.genericFunctionType], the function type being
- /// defined.
- @Id(2)
- EntityRef get returnType;
-
- /// The style of the typedef.
- @Id(8)
- TypedefStyle get style;
-
- /// Type parameters of the typedef, if any.
- @Id(5)
- List<UnlinkedTypeParam> get typeParameters;
-}
-
-/// Unlinked summary information about a type parameter declaration.
-abstract class UnlinkedTypeParam extends base.SummaryClass {
- /// Annotations for this type parameter.
- @Id(3)
- List<UnlinkedExpr> get annotations;
-
- /// Bound of the type parameter, if a bound is explicitly declared. Otherwise
- /// null.
- @Id(2)
- EntityRef get bound;
-
- /// Code range of the type parameter.
- @informative
- @Id(4)
- CodeRange get codeRange;
-
- /// Name of the type parameter.
- @Id(0)
- String get name;
-
- /// Offset of the type parameter name relative to the beginning of the file.
- @informative
- @Id(1)
- int get nameOffset;
-}
-
-/// Unlinked summary information about a compilation unit ("part file").
-@TopLevel('UUnt')
+/// TODO(scheglov) Remove it.
abstract class UnlinkedUnit extends base.SummaryClass {
- factory UnlinkedUnit.fromBuffer(List<int> buffer) =>
- generated.readUnlinkedUnit(buffer);
-
- /// MD5 hash of the non-informative fields of the [UnlinkedUnit] (not
- /// including this one) as 16 unsigned 8-bit integer values. This can be used
- /// to identify when the API of a unit may have changed.
- @Id(19)
- List<int> get apiSignature;
-
- /// Classes declared in the compilation unit.
- @Id(2)
- List<UnlinkedClass> get classes;
-
- /// Code range of the unit.
- @informative
- @Id(15)
- CodeRange get codeRange;
-
- /// Enums declared in the compilation unit.
- @Id(12)
- List<UnlinkedEnum> get enums;
-
- /// Top level executable objects (functions, getters, and setters) declared in
- /// the compilation unit.
- @Id(4)
- List<UnlinkedExecutable> get executables;
-
- /// Export declarations in the compilation unit.
- @Id(13)
- List<UnlinkedExportNonPublic> get exports;
-
- /// Extensions declared in the compilation unit.
- @Id(22)
- List<UnlinkedExtension> get extensions;
-
- /// If this compilation unit was summarized in fallback mode, the path where
- /// the compilation unit may be found on disk. Otherwise empty.
- ///
- /// When this field is non-empty, all other fields in the data structure have
- /// their default values.
- @deprecated
- @Id(16)
- String get fallbackModePath;
-
- /// Import declarations in the compilation unit.
- @Id(5)
- List<UnlinkedImport> get imports;
-
- /// Indicates whether this compilation unit is opted into NNBD.
- @Id(21)
- bool get isNNBD;
-
- /// Indicates whether the unit contains a "part of" declaration.
- @Id(18)
- bool get isPartOf;
-
- /// Annotations for the library declaration, or the empty list if there is no
- /// library declaration.
- @Id(14)
- List<UnlinkedExpr> get libraryAnnotations;
-
- /// Documentation comment for the library, or `null` if there is no
- /// documentation comment.
- @informative
- @Id(9)
- UnlinkedDocumentationComment get libraryDocumentationComment;
-
- /// Name of the library (from a "library" declaration, if present).
- @Id(6)
- String get libraryName;
-
- /// Length of the library name as it appears in the source code (or 0 if the
- /// library has no name).
- @informative
- @Id(7)
- int get libraryNameLength;
-
- /// Offset of the library name relative to the beginning of the file (or 0 if
- /// the library has no name).
- @informative
- @Id(8)
- int get libraryNameOffset;
-
- /// Offsets of the first character of each line in the source code.
- @informative
- @Id(17)
- List<int> get lineStarts;
-
- /// Mixins declared in the compilation unit.
- @Id(20)
- List<UnlinkedClass> get mixins;
-
- /// Part declarations in the compilation unit.
- @Id(11)
- List<UnlinkedPart> get parts;
-
- /// Unlinked public namespace of this compilation unit.
@Id(0)
- UnlinkedPublicNamespace get publicNamespace;
-
- /// Top level and prefixed names referred to by this compilation unit. The
- /// zeroth element of this array is always populated and is used to represent
- /// the absence of a reference in places where a reference is optional (for
- /// example [UnlinkedReference.prefixReference or
- /// UnlinkedImport.prefixReference]).
- @Id(1)
- List<UnlinkedReference> get references;
-
- /// Typedefs declared in the compilation unit.
- @Id(10)
- List<UnlinkedTypedef> get typedefs;
-
- /// Top level variables declared in the compilation unit.
- @Id(3)
- List<UnlinkedVariable> get variables;
+ int get placeholder;
}
/// Unlinked summary information about a compilation unit.
@@ -4418,102 +2208,3 @@
@Id(4)
List<String> get parts;
}
-
-/// Unlinked summary information about a top level variable, local variable, or
-/// a field.
-abstract class UnlinkedVariable extends base.SummaryClass {
- /// Annotations for this variable.
- @Id(8)
- List<UnlinkedExpr> get annotations;
-
- /// Code range of the variable.
- @informative
- @Id(5)
- CodeRange get codeRange;
-
- /// Documentation comment for the variable, or `null` if there is no
- /// documentation comment.
- @informative
- @Id(10)
- UnlinkedDocumentationComment get documentationComment;
-
- /// If this variable is inferable, nonzero slot id identifying which entry in
- /// [LinkedLibrary.types] contains the inferred type for this variable. If
- /// there is no matching entry in [LinkedLibrary.types], then no type was
- /// inferred for this variable, so its static type is `dynamic`.
- @Id(9)
- int get inferredTypeSlot;
-
- /// If this is an instance non-final field, a nonzero slot id which is unique
- /// within this compilation unit. If this id is found in
- /// [LinkedUnit.parametersInheritingCovariant], then the parameter of the
- /// synthetic setter inherits `@covariant` behavior from a base class.
- ///
- /// Otherwise, zero.
- @Id(15)
- int get inheritsCovariantSlot;
-
- /// The synthetic initializer function of the variable. Absent if the
- /// variable does not have an initializer.
- @Id(13)
- UnlinkedExecutable get initializer;
-
- /// Indicates whether the variable is declared using the `const` keyword.
- @Id(6)
- bool get isConst;
-
- /// Indicates whether this variable is declared using the `covariant` keyword.
- /// This should be false for everything except instance fields.
- @Id(14)
- bool get isCovariant;
-
- /// Indicates whether the variable is declared using the `final` keyword.
- @Id(7)
- bool get isFinal;
-
- /// Indicates whether the variable is declared using the `late` keyword.
- @Id(16)
- bool get isLate;
-
- /// Indicates whether the variable is declared using the `static` keyword.
- ///
- /// Note that for top level variables, this flag is false, since they are not
- /// declared using the `static` keyword (even though they are considered
- /// static for semantic purposes).
- @Id(4)
- bool get isStatic;
-
- /// Name of the variable.
- @Id(0)
- String get name;
-
- /// Offset of the variable name relative to the beginning of the file.
- @informative
- @Id(1)
- int get nameOffset;
-
- /// If this variable is propagable, nonzero slot id identifying which entry in
- /// [LinkedLibrary.types] contains the propagated type for this variable. If
- /// there is no matching entry in [LinkedLibrary.types], then this variable's
- /// propagated type is the same as its declared type.
- ///
- /// Non-propagable variables have a [propagatedTypeSlot] of zero.
- @Id(2)
- int get propagatedTypeSlot;
-
- /// Declared type of the variable. Absent if the type is implicit.
- @Id(3)
- EntityRef get type;
-
- /// If a local variable, the length of the visible range; zero otherwise.
- @deprecated
- @informative
- @Id(11)
- int get visibleLength;
-
- /// If a local variable, the beginning of the visible range; zero otherwise.
- @deprecated
- @informative
- @Id(12)
- int get visibleOffset;
-}
diff --git a/pkg/analyzer/lib/src/summary/name_filter.dart b/pkg/analyzer/lib/src/summary/name_filter.dart
index 62633ef..2d98dcf0 100644
--- a/pkg/analyzer/lib/src/summary/name_filter.dart
+++ b/pkg/analyzer/lib/src/summary/name_filter.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/src/summary/idl.dart';
/**
* A [NameFilter] represents the set of filtering rules implied by zero or more
@@ -29,6 +28,13 @@
*/
final Set<String> hiddenNames;
+ factory NameFilter({List<String> shows, List<String> hides}) {
+ return NameFilter._(
+ shownNames: shows?.toSet(),
+ hiddenNames: hides?.toSet(),
+ );
+ }
+
/**
* Create a [NameFilter] based on the given [combinator].
*/
@@ -56,30 +62,6 @@
return result;
}
- /**
- * Create a [NameFilter] based on the given [combinator].
- */
- factory NameFilter.forUnlinkedCombinator(UnlinkedCombinator combinator) {
- if (combinator.shows.isNotEmpty) {
- return new NameFilter._(shownNames: combinator.shows.toSet());
- } else {
- return new NameFilter._(hiddenNames: combinator.hides.toSet());
- }
- }
-
- /**
- * Create a [NameFilter] based on the given (possibly empty) sequence of
- * [combinators].
- */
- factory NameFilter.forUnlinkedCombinators(
- List<UnlinkedCombinator> combinators) {
- NameFilter result = identity;
- for (UnlinkedCombinator combinator in combinators) {
- result = result.merge(new NameFilter.forUnlinkedCombinator(combinator));
- }
- return result;
- }
-
const NameFilter._({this.shownNames, this.hiddenNames});
/**
diff --git a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
index ca70dd2..bab03db 100644
--- a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
+++ b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
@@ -9,7 +9,6 @@
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/source_io.dart';
-import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/summary/idl.dart';
/**
@@ -63,29 +62,6 @@
}
/**
- * The [UriResolver] that knows about sources that are served from their
- * summaries.
- */
-@deprecated
-class InSummaryPackageUriResolver extends UriResolver {
- final SummaryDataStore _dataStore;
-
- InSummaryPackageUriResolver(this._dataStore);
-
- @override
- Source resolveAbsolute(Uri uri, [Uri actualUri]) {
- actualUri ??= uri;
- String uriString = uri.toString();
- UnlinkedUnit unit = _dataStore.unlinkedMap[uriString];
- if (unit != null) {
- String summaryPath = _dataStore.uriToSummaryPath[uriString];
- return new InSummarySource(actualUri, summaryPath);
- }
- return null;
- }
-}
-
-/**
* A placeholder of a source that is part of a package whose analysis results
* are served from its summary. This source uses its URI as [fullName] and has
* empty contents.
@@ -148,17 +124,6 @@
final List<PackageBundle> bundles = <PackageBundle>[];
/**
- * Map from the URI of a compilation unit to the unlinked summary of that
- * compilation unit.
- */
- final Map<String, UnlinkedUnit> unlinkedMap = <String, UnlinkedUnit>{};
-
- /**
- * Map from the URI of a library to the linked summary of that library.
- */
- final Map<String, LinkedLibrary> linkedMap = <String, LinkedLibrary>{};
-
- /**
* Map from the URI of a unit to the summary path that contained it.
*/
final Map<String, String> uriToSummaryPath = <String, String>{};
@@ -167,24 +132,11 @@
final Set<String> _partUris = Set<String>();
/**
- * List of summary paths.
- */
- final Iterable<String> _summaryPaths;
-
- /**
- * If true, do not accept multiple summaries that contain the same Dart uri.
- */
- bool _disallowOverlappingSummaries;
-
- /**
* Create a [SummaryDataStore] and populate it with the summaries in
* [summaryPaths].
*/
SummaryDataStore(Iterable<String> summaryPaths,
- {bool disallowOverlappingSummaries: false,
- ResourceProvider resourceProvider})
- : _summaryPaths = summaryPaths,
- _disallowOverlappingSummaries = disallowOverlappingSummaries {
+ {ResourceProvider resourceProvider}) {
summaryPaths.forEach((String path) => _fillMaps(path, resourceProvider));
}
@@ -194,22 +146,6 @@
void addBundle(String path, PackageBundle bundle) {
bundles.add(bundle);
- for (int i = 0; i < bundle.unlinkedUnitUris.length; i++) {
- String uri = bundle.unlinkedUnitUris[i];
- if (_disallowOverlappingSummaries &&
- uriToSummaryPath.containsKey(uri) &&
- (uriToSummaryPath[uri] != path)) {
- throw new ConflictingSummaryException(
- _summaryPaths, uri, uriToSummaryPath[uri], path);
- }
- uriToSummaryPath[uri] = path;
- addUnlinkedUnit(uri, bundle.unlinkedUnits[i]);
- }
- for (int i = 0; i < bundle.linkedLibraryUris.length; i++) {
- String uri = bundle.linkedLibraryUris[i];
- addLinkedLibrary(uri, bundle.linkedLibraries[i]);
- }
-
if (bundle.bundle2 != null) {
for (var library in bundle.bundle2.libraries) {
var libraryUri = library.uriStr;
@@ -226,53 +162,6 @@
}
/**
- * Add the given [linkedLibrary] with the given [uri].
- */
- void addLinkedLibrary(String uri, LinkedLibrary linkedLibrary) {
- linkedMap[uri] = linkedLibrary;
- }
-
- /**
- * Add into this store the unlinked units and linked libraries of [other].
- */
- void addStore(SummaryDataStore other) {
- unlinkedMap.addAll(other.unlinkedMap);
- linkedMap.addAll(other.linkedMap);
- }
-
- /**
- * Add the given [unlinkedUnit] with the given [uri].
- */
- void addUnlinkedUnit(String uri, UnlinkedUnit unlinkedUnit) {
- unlinkedMap[uri] = unlinkedUnit;
- }
-
- /**
- * Return a list of absolute URIs of the libraries that contain the unit with
- * the given [unitUriString], or `null` if no such library is in the store.
- */
- List<String> getContainingLibraryUris(String unitUriString) {
- // The unit is the defining unit of a library.
- if (linkedMap.containsKey(unitUriString)) {
- return <String>[unitUriString];
- }
- // Check every unlinked unit whether it uses [unitUri] as a part.
- List<String> libraryUriStrings = <String>[];
- unlinkedMap.forEach((unlinkedUnitUriString, unlinkedUnit) {
- Uri libraryUri = Uri.parse(unlinkedUnitUriString);
- for (String partUriString in unlinkedUnit.publicNamespace.parts) {
- Uri partUri = Uri.parse(partUriString);
- String partAbsoluteUriString =
- resolveRelativeUri(libraryUri, partUri).toString();
- if (partAbsoluteUriString == unitUriString) {
- libraryUriStrings.add(unlinkedUnitUriString);
- }
- }
- });
- return libraryUriStrings.isNotEmpty ? libraryUriStrings : null;
- }
-
- /**
* Return `true` if the store contains the linked summary for the library
* with the given absolute [uri].
*/
diff --git a/pkg/analyzer/lib/src/summary/summarize_elements.dart b/pkg/analyzer/lib/src/summary/summarize_elements.dart
index 08732d5..95911cd 100644
--- a/pkg/analyzer/lib/src/summary/summarize_elements.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_elements.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:analyzer/src/generated/source.dart';
import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/idl.dart';
@@ -28,39 +27,13 @@
*/
static const int currentMinorVersion = 1;
- final List<String> _linkedLibraryUris = <String>[];
- final List<LinkedLibraryBuilder> _linkedLibraries = <LinkedLibraryBuilder>[];
- final List<String> _unlinkedUnitUris = <String>[];
- final List<UnlinkedUnitBuilder> _unlinkedUnits = <UnlinkedUnitBuilder>[];
- final Map<String, UnlinkedUnitBuilder> _unlinkedUnitMap =
- <String, UnlinkedUnitBuilder>{};
-
LinkedNodeBundleBuilder _bundle2;
- void addLinkedLibrary(String uri, LinkedLibraryBuilder library) {
- _linkedLibraries.add(library);
- _linkedLibraryUris.add(uri);
- }
-
- void addUnlinkedUnit(Source source, UnlinkedUnitBuilder unit) {
- addUnlinkedUnitViaUri(source.uri.toString(), unit);
- }
-
- void addUnlinkedUnitViaUri(String uri, UnlinkedUnitBuilder unit) {
- _unlinkedUnitUris.add(uri);
- _unlinkedUnits.add(unit);
- _unlinkedUnitMap[uri] = unit;
- }
-
/**
* Assemble a new [PackageBundleBuilder] using the gathered information.
*/
PackageBundleBuilder assemble() {
return new PackageBundleBuilder(
- linkedLibraryUris: _linkedLibraryUris,
- linkedLibraries: _linkedLibraries,
- unlinkedUnitUris: _unlinkedUnitUris,
- unlinkedUnits: _unlinkedUnits,
majorVersion: currentMajorVersion,
minorVersion: currentMinorVersion,
bundle2: _bundle2);
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
index a0a089c..6509d9c 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
@@ -1041,8 +1041,9 @@
}
IntegerLiteral _read_integerLiteral(LinkedNode data) {
+ // TODO(scheglov) Remove `?? _intType` after internal SDK roll.
return AstTestFactory.integer(data.integerLiteral_value)
- ..staticType = _intType;
+ ..staticType = _readType(data.expression_type) ?? _intType;
}
InterpolationExpression _read_interpolationExpression(LinkedNode data) {
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
index c85acd5..58fcfec 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
@@ -850,6 +850,7 @@
@override
LinkedNodeBuilder visitIntegerLiteral(IntegerLiteral node) {
return LinkedNodeBuilder.integerLiteral(
+ expression_type: _writeType(node.staticType),
integerLiteral_value: node.value,
);
}
diff --git a/pkg/analyzer/lib/src/summary2/lazy_ast.dart b/pkg/analyzer/lib/src/summary2/lazy_ast.dart
index 1ab9a95..179133d 100644
--- a/pkg/analyzer/lib/src/summary2/lazy_ast.dart
+++ b/pkg/analyzer/lib/src/summary2/lazy_ast.dart
@@ -19,6 +19,7 @@
static const _hasOverrideInferenceKey = 'lazyAst_hasOverrideInference';
static const _inheritsCovariantKey = 'lazyAst_isCovariant';
static const _isSimplyBoundedKey = 'lazyAst_simplyBounded';
+ static const _rawFunctionTypeKey = 'lazyAst_rawFunctionType';
static const _returnTypeKey = 'lazyAst_returnType';
static const _typeInferenceErrorKey = 'lazyAst_typeInferenceError';
static const _typeKey = 'lazyAst_type';
@@ -39,6 +40,10 @@
return node.getProperty(_inheritsCovariantKey) ?? false;
}
+ static DartType getRawFunctionType(AstNode node) {
+ return node.getProperty(_rawFunctionTypeKey);
+ }
+
static DartType getReturnType(AstNode node) {
return node.getProperty(_returnTypeKey);
}
@@ -75,6 +80,10 @@
node.setProperty(_hasOverrideInferenceKey, true);
}
+ static void setRawFunctionType(AstNode node, DartType type) {
+ node.setProperty(_rawFunctionTypeKey, type);
+ }
+
static void setReturnType(AstNode node, DartType type) {
node.setProperty(_returnTypeKey, type);
}
diff --git a/pkg/analyzer/lib/src/summary2/named_type_builder.dart b/pkg/analyzer/lib/src/summary2/named_type_builder.dart
index 1aaa1cc..e33f2ad 100644
--- a/pkg/analyzer/lib/src/summary2/named_type_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/named_type_builder.dart
@@ -9,6 +9,7 @@
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/element/type_algebra.dart';
+import 'package:analyzer/src/summary2/lazy_ast.dart';
import 'package:analyzer/src/summary2/type_builder.dart';
/// The type builder for a [TypeName].
@@ -64,18 +65,22 @@
nullabilitySuffix: nullabilitySuffix,
);
} else if (element is GenericTypeAliasElement) {
- // Break a possible recursion.
- _type = _dynamicType;
-
var rawType = _getRawFunctionType(element);
-
- var parameters = element.typeParameters;
- if (parameters.isEmpty) {
- _type = rawType;
- } else {
+ if (rawType is FunctionType) {
+ var parameters = element.typeParameters;
var arguments = _buildArguments(parameters);
var substitution = Substitution.fromPairs(parameters, arguments);
- _type = substitution.substituteType(rawType);
+ var instantiated = substitution.substituteType(rawType) as FunctionType;
+ _type = FunctionTypeImpl.synthetic(
+ instantiated.returnType,
+ instantiated.typeFormals,
+ instantiated.parameters,
+ element: element,
+ typeArguments: arguments,
+ nullabilitySuffix: nullabilitySuffix,
+ );
+ } else {
+ _type = _dynamicType;
}
} else if (element is NeverElementImpl) {
_type = BottomTypeImpl.instance.withNullability(nullabilitySuffix);
@@ -136,8 +141,6 @@
return _buildFormalParameterType(node.parameter);
} else if (node is FunctionTypedFormalParameter) {
return _buildFunctionType(
- null,
- null,
node.typeParameters,
node.returnType,
node.parameters,
@@ -150,8 +153,6 @@
}
FunctionType _buildFunctionType(
- GenericTypeAliasElement typedefElement,
- List<DartType> typedefTypeParameterTypes,
TypeParameterList typeParameterList,
TypeAnnotation returnTypeNode,
FormalParameterList parameterList,
@@ -172,8 +173,6 @@
returnType,
typeParameters,
formalParameters,
- element: typedefElement,
- typeArguments: typedefTypeParameterTypes,
);
}
@@ -199,27 +198,28 @@
}
var typedefNode = element.linkedNode;
+
+ // Break a possible recursion.
+ var existing = LazyAst.getRawFunctionType(typedefNode);
+ if (existing != null) {
+ return existing;
+ } else {
+ LazyAst.setRawFunctionType(typedefNode, _dynamicType);
+ }
+
if (typedefNode is FunctionTypeAlias) {
- return _buildFunctionType(
- element,
- _typeParameterTypes(typedefNode.typeParameters),
+ var result = _buildFunctionType(
null,
typedefNode.returnType,
typedefNode.parameters,
);
+ LazyAst.setRawFunctionType(typedefNode, result);
+ return result;
} else if (typedefNode is GenericTypeAlias) {
var functionNode = typedefNode.functionType;
var functionType = _buildType(functionNode?.type);
- if (functionType is FunctionType) {
- return FunctionTypeImpl.synthetic(
- functionType.returnType,
- functionType.typeFormals,
- functionType.parameters,
- element: element,
- typeArguments: _typeParameterTypes(typedefNode.typeParameters),
- );
- }
- return _dynamicType;
+ LazyAst.setRawFunctionType(typedefNode, functionType);
+ return functionType;
} else {
throw StateError('(${element.runtimeType}) $element');
}
@@ -247,9 +247,4 @@
return const <TypeParameterElement>[];
}
}
-
- static List<DartType> _typeParameterTypes(TypeParameterList node) {
- var elements = _typeParameters(node);
- return TypeParameterTypeImpl.getTypes(elements);
- }
}
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index 58f6c69..655444f 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -1875,12 +1875,19 @@
@override
visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
+ if (node.typeArguments != null) {
+ return;
+ }
+
+ var function = node.function;
+ if (function is PropertyAccess) {
+ var propertyName = function.propertyName;
+ validateIdentifierElement(propertyName, propertyName.staticElement);
+ }
+
var functionType = node.function.staticType;
- if (node.typeArguments == null &&
- functionType is FunctionType &&
- functionType.typeFormals.isNotEmpty) {
- // Type inference might depend on the parameters
- super.visitFunctionExpressionInvocation(node);
+ if (functionType is FunctionType && functionType.typeFormals.isNotEmpty) {
+ node.argumentList.accept(this);
}
}
diff --git a/pkg/analyzer/lib/src/task/strong_mode.dart b/pkg/analyzer/lib/src/task/strong_mode.dart
index a57c953..b2439c3 100644
--- a/pkg/analyzer/lib/src/task/strong_mode.dart
+++ b/pkg/analyzer/lib/src/task/strong_mode.dart
@@ -10,7 +10,7 @@
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
-import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/type_algebra.dart';
import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/idl.dart';
@@ -476,16 +476,19 @@
*/
FunctionType _toOverriddenFunctionType(
ExecutableElement element, ExecutableElement overriddenElement) {
- List<DartType> typeFormals =
- TypeParameterTypeImpl.getTypes(element.type.typeFormals);
- FunctionType overriddenType = overriddenElement.type;
- if (overriddenType.typeFormals.isNotEmpty) {
- if (overriddenType.typeFormals.length != typeFormals.length) {
- return null;
- }
- overriddenType = overriddenType.instantiate(typeFormals);
+ var elementTypeParameters = element.typeParameters;
+ var overriddenTypeParameters = overriddenElement.typeParameters;
+
+ if (elementTypeParameters.length != overriddenTypeParameters.length) {
+ return null;
}
- return overriddenType;
+
+ var overriddenType = overriddenElement.type;
+ if (elementTypeParameters.isEmpty) {
+ return overriddenType;
+ }
+
+ return replaceTypeParameters(overriddenType, elementTypeParameters);
}
/**
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index a4345eb..08c9157 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -1,5 +1,5 @@
name: analyzer
-version: 0.38.5-dev
+version: 0.38.5
author: Dart Team <misc@dartlang.org>
description: This package provides a library that performs static analysis of Dart code.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/analyzer
@@ -13,10 +13,10 @@
collection: ^1.10.1
convert: ^2.0.0
crypto: '>=1.1.1 <3.0.0'
- front_end: 0.1.26
+ front_end: 0.1.27
glob: ^1.0.3
html: '>=0.13.4+1 <0.15.0'
- kernel: 0.3.26
+ kernel: 0.3.27
meta: ^1.0.2
package_config: '>=0.1.5 <2.0.0'
path: '>=0.9.0 <2.0.0'
diff --git a/pkg/analyzer/test/generated/compile_time_error_code.dart b/pkg/analyzer/test/generated/compile_time_error_code.dart
index 8a60f47..be17274 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code.dart
@@ -926,6 +926,27 @@
]);
}
+ @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/38352')
+ test_constWithNonConstantArgument_classShadowedBySetter() async {
+ // TODO(paulberry): once this is fixed, change this test to use
+ // assertErrorsInCode and verify the exact error message(s).
+ var code = '''
+class Annotation {
+ const Annotation(Object obj);
+}
+
+class Bar {}
+
+class Foo {
+ @Annotation(Bar)
+ set Bar(int value) {}
+}
+''';
+ addTestFile(code);
+ await resolveTestFile();
+ assertHasTestErrors();
+ }
+
test_constWithNonConstantArgument_instanceCreation() async {
await assertErrorsInCode(r'''
class A {
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index f7c425f..13b33eb 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -1015,7 +1015,9 @@
main() {
helper.toString();
}''');
- assertTypeDynamic(findNode.methodInvocation('helper.toString()'));
+ assertTypeDynamic(
+ findNode.functionExpressionInvocation('helper.toString()'),
+ );
}
test_objectMethodInference_disabled_for_local_function() async {
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
index 8746dc1..79b0843 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
@@ -99,6 +99,11 @@
expect(actual?.toString(), expected);
}
+ void assertInvokeTypeDynamic(InvocationExpression node) {
+ DartType actual = node.staticInvokeType;
+ expect(actual, isDynamicType);
+ }
+
void assertMember(
Expression node,
Element expectedBase,
@@ -2777,10 +2782,10 @@
await resolveTestFile();
expect(result.errors, isNotEmpty);
- var invocation = findNode.methodInvocation('id(');
- assertType(invocation, 'bool');
+ var invocation = findNode.functionExpressionInvocation('id(');
+ assertElement(invocation.function, findElement.topGet('id'));
assertInvokeType(invocation, 'bool Function(Object, Object)');
- assertElement(invocation.methodName, findElement.topGet('id'));
+ assertType(invocation, 'bool');
var aRef = invocation.argumentList.arguments[0];
assertElement(aRef, findElement.topGet('a'));
@@ -3545,9 +3550,9 @@
expect(result.errors, isNotEmpty);
var f = findElement.topGet('f');
- var invocation = findNode.methodInvocation('f(a)');
- assertElement(invocation.methodName, f);
- assertType(invocation.methodName, 'void Function()');
+ var invocation = findNode.functionExpressionInvocation('f(a)');
+ assertElement(invocation.function, f);
+ assertInvokeType(invocation, 'void Function()');
assertType(invocation, 'void');
var aRef = invocation.argumentList.arguments[0];
@@ -3591,18 +3596,12 @@
await resolveTestFile();
expect(result.errors, isNotEmpty);
- TopLevelVariableElement foo = _getTopLevelVariable(result, 'foo');
+ var invocation = findNode.functionExpressionInvocation('foo(1)');
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
- List<Statement> statements = _getMainStatements(result);
- ExpressionStatement statement = statements[0];
-
- MethodInvocation invocation = statement.expression;
- expect(invocation.staticType, isDynamicType);
- assertUnresolvedInvokeType(invocation.staticInvokeType);
-
- SimpleIdentifier name = invocation.methodName;
- expect(name.staticElement, same(foo.getter));
- expect(name.staticType, typeProvider.intType);
+ assertElement(invocation.function, findElement.topGet('foo'));
+ assertType(invocation.function, 'int');
}
@failingTest
@@ -5492,21 +5491,10 @@
''');
await resolveTestFile();
- ClassDeclaration cDeclaration = result.unit.declarations[0];
-
- FieldDeclaration fDeclaration = cDeclaration.members[0];
- VariableDeclaration fNode = fDeclaration.fields.variables[0];
- FieldElement fElement = fNode.declaredElement;
-
- MethodDeclaration fooDeclaration = cDeclaration.members[1];
- BlockFunctionBody fooBody = fooDeclaration.body;
- List<Statement> fooStatements = fooBody.block.statements;
-
- ExpressionStatement statement = fooStatements[0];
- MethodInvocation invocation = statement.expression;
- expect(invocation.methodName.staticElement, same(fElement.getter));
- expect(invocation.staticInvokeType, DynamicTypeImpl.instance);
- expect(invocation.staticType, DynamicTypeImpl.instance);
+ var invocation = findNode.functionExpressionInvocation('f(1)');
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+ assertElement(invocation.function, findElement.getter('f'));
List<Expression> arguments = invocation.argumentList.arguments;
expect(arguments[0].staticParameterElement, isNull);
@@ -5523,25 +5511,13 @@
''');
await resolveTestFile();
- ClassDeclaration cDeclaration = result.unit.declarations[0];
-
- MethodDeclaration fDeclaration = cDeclaration.members[0];
- PropertyAccessorElement fElement = fDeclaration.declaredElement;
-
- MethodDeclaration fooDeclaration = cDeclaration.members[1];
- BlockFunctionBody fooBody = fooDeclaration.body;
- List<Statement> fooStatements = fooBody.block.statements;
-
- ExpressionStatement statement = fooStatements[0];
- MethodInvocation invocation = statement.expression;
- expect(invocation.methodName.staticElement, same(fElement));
- expect(invocation.staticInvokeType, DynamicTypeImpl.instance);
- expect(invocation.staticType, DynamicTypeImpl.instance);
+ var invocation = findNode.functionExpressionInvocation('f(1)');
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+ assertElement(invocation.function, findElement.getter('f'));
List<Expression> arguments = invocation.argumentList.arguments;
-
- Expression argument = arguments[0];
- expect(argument.staticParameterElement, isNull);
+ expect(arguments[0].staticParameterElement, isNull);
}
test_methodInvocation_notFunction_getter_typedef() async {
@@ -5556,21 +5532,10 @@
''');
await resolveTestFile();
- ClassDeclaration cDeclaration = result.unit.declarations[1];
-
- MethodDeclaration fDeclaration = cDeclaration.members[0];
- PropertyAccessorElement fElement = fDeclaration.declaredElement;
-
- MethodDeclaration fooDeclaration = cDeclaration.members[1];
- BlockFunctionBody fooBody = fooDeclaration.body;
- List<Statement> fooStatements = fooBody.block.statements;
-
- ExpressionStatement statement = fooStatements[0];
- MethodInvocation invocation = statement.expression;
- expect(invocation.methodName.staticElement, same(fElement));
- expect(invocation.staticInvokeType.toString(),
- 'String Function(int, {b: int})');
- expect(invocation.staticType, typeProvider.stringType);
+ var invocation = findNode.functionExpressionInvocation('f(1');
+ assertElement(invocation.function, findElement.getter('f'));
+ assertInvokeType(invocation, 'String Function(int, {b: int})');
+ assertType(invocation, 'String');
List<Expression> arguments = invocation.argumentList.arguments;
_assertArgumentToParameter2(arguments[0], 'int');
@@ -5585,19 +5550,10 @@
''');
await resolveTestFile();
- FunctionDeclaration mainDeclaration = result.unit.declarations[0];
- FunctionExpression mainFunction = mainDeclaration.functionExpression;
- ParameterElement fElement =
- mainFunction.parameters.parameters[0].declaredElement;
-
- BlockFunctionBody mainBody = mainFunction.body;
- List<Statement> mainStatements = mainBody.block.statements;
-
- ExpressionStatement statement = mainStatements[0];
- MethodInvocation invocation = statement.expression;
- expect(invocation.methodName.staticElement, same(fElement));
- expect(invocation.staticInvokeType, isDynamicType);
- expect(invocation.staticType, DynamicTypeImpl.instance);
+ var invocation = findNode.functionExpressionInvocation('f(1)');
+ assertElement(invocation.function, findElement.parameter('f'));
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
List<Expression> arguments = invocation.argumentList.arguments;
@@ -5613,19 +5569,11 @@
''');
await resolveTestFile();
- FunctionDeclaration mainDeclaration = result.unit.declarations[0];
- FunctionExpression mainFunction = mainDeclaration.functionExpression;
- ParameterElement fElement =
- mainFunction.parameters.parameters[0].declaredElement;
-
- BlockFunctionBody mainBody = mainFunction.body;
- List<Statement> mainStatements = mainBody.block.statements;
-
- ExpressionStatement statement = mainStatements[0];
- MethodInvocation invocation = statement.expression;
- expect(invocation.methodName.staticElement, same(fElement));
- expect(invocation.staticInvokeType.toString(), 'String Function(int)');
- expect(invocation.staticType, typeProvider.stringType);
+ var fElement = findElement.parameter('f');
+ var invocation = findNode.functionExpressionInvocation('f(1)');
+ assertElement(invocation.function, fElement);
+ assertInvokeType(invocation, 'String Function(int)');
+ assertType(invocation, 'String');
List<Expression> arguments = invocation.argumentList.arguments;
_assertArgumentToParameter(
@@ -5641,17 +5589,10 @@
''');
await resolveTestFile();
- TopLevelVariableDeclaration fDeclaration = result.unit.declarations[0];
- VariableDeclaration fNode = fDeclaration.variables.variables[0];
- TopLevelVariableElement fElement = fNode.declaredElement;
-
- List<Statement> mainStatements = _getMainStatements(result);
-
- ExpressionStatement statement = mainStatements[0];
- MethodInvocation invocation = statement.expression;
- expect(invocation.methodName.staticElement, same(fElement.getter));
- expect(invocation.staticInvokeType, isDynamicType);
- expect(invocation.staticType, DynamicTypeImpl.instance);
+ var invocation = findNode.functionExpressionInvocation('f(1)');
+ assertElement(invocation.function, findElement.topGet('f'));
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
List<Expression> arguments = invocation.argumentList.arguments;
diff --git a/pkg/analyzer/test/src/dart/analysis/index_test.dart b/pkg/analyzer/test/src/dart/analysis/index_test.dart
index c83c483..d7b788f 100644
--- a/pkg/analyzer/test/src/dart/analysis/index_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/index_test.dart
@@ -256,21 +256,6 @@
..isReferencedAt('A {} // 2', false);
}
- test_isInvokedBy_FieldElement() async {
- await _indexTestUnit('''
-class A {
- var field;
- main() {
- this.field(); // q
- field(); // nq
- }
-}''');
- FieldElement field = findElement('field');
- assertThat(field.getter)
- ..isInvokedAt('field(); // q', true)
- ..isInvokedAt('field(); // nq', false);
- }
-
test_isInvokedBy_FunctionElement() async {
newFile('$testProject/lib.dart', content: '''
library lib;
@@ -382,21 +367,6 @@
assertThat(element).isInvokedAt('~a', true, length: 1);
}
- test_isInvokedBy_PropertyAccessorElement_getter() async {
- await _indexTestUnit('''
-class A {
- get ggg => null;
- main() {
- this.ggg(); // q
- ggg(); // nq
- }
-}''');
- PropertyAccessorElement element = findElement('ggg', ElementKind.GETTER);
- assertThat(element)
- ..isInvokedAt('ggg(); // q', true)
- ..isInvokedAt('ggg(); // nq', false);
- }
-
test_isMixedInBy_ClassDeclaration_class() async {
await _indexTestUnit('''
class A {} // 1
@@ -449,6 +419,36 @@
assertThat(elementA).isMixedInAt('A; // 2', false);
}
+ test_isReferencedAt_PropertyAccessorElement_field_call() async {
+ await _indexTestUnit('''
+class A {
+ var field;
+ main() {
+ this.field(); // q
+ field(); // nq
+ }
+}''');
+ FieldElement field = findElement('field');
+ assertThat(field.getter)
+ ..isReferencedAt('field(); // q', true)
+ ..isReferencedAt('field(); // nq', false);
+ }
+
+ test_isReferencedAt_PropertyAccessorElement_getter_call() async {
+ await _indexTestUnit('''
+class A {
+ get ggg => null;
+ main() {
+ this.ggg(); // q
+ ggg(); // nq
+ }
+}''');
+ PropertyAccessorElement element = findElement('ggg', ElementKind.GETTER);
+ assertThat(element)
+ ..isReferencedAt('ggg(); // q', true)
+ ..isReferencedAt('ggg(); // nq', false);
+ }
+
test_isReferencedBy_ClassElement() async {
await _indexTestUnit('''
class A {
diff --git a/pkg/analyzer/test/src/dart/analysis/search_test.dart b/pkg/analyzer/test/src/dart/analysis/search_test.dart
index f74da70..c6a0a66 100644
--- a/pkg/analyzer/test/src/dart/analysis/search_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/search_test.dart
@@ -418,8 +418,8 @@
_expectIdQ(main, SearchResultKind.REFERENCE, 'field: 1'),
_expectId(main, SearchResultKind.READ, 'field); // ref-nq'),
_expectIdQ(main, SearchResultKind.READ, 'field); // ref-q'),
- _expectId(main, SearchResultKind.INVOCATION, 'field(); // inv-nq'),
- _expectIdQ(main, SearchResultKind.INVOCATION, 'field(); // inv-q'),
+ _expectId(main, SearchResultKind.READ, 'field(); // inv-nq'),
+ _expectIdQ(main, SearchResultKind.READ, 'field(); // inv-q'),
_expectId(main, SearchResultKind.WRITE, 'field = 2; // ref-nq'),
_expectIdQ(main, SearchResultKind.WRITE, 'field = 3; // ref-q'),
];
@@ -474,8 +474,8 @@
var expected = [
_expectId(main, SearchResultKind.READ, 'field); // ref-nq'),
_expectIdQ(main, SearchResultKind.READ, 'field); // ref-q'),
- _expectId(main, SearchResultKind.INVOCATION, 'field(); // inv-nq'),
- _expectIdQ(main, SearchResultKind.INVOCATION, 'field(); // inv-q'),
+ _expectId(main, SearchResultKind.READ, 'field(); // inv-nq'),
+ _expectIdQ(main, SearchResultKind.READ, 'field(); // inv-q'),
_expectId(main, SearchResultKind.WRITE, 'field = 2; // ref-nq'),
_expectIdQ(main, SearchResultKind.WRITE, 'field = 3; // ref-q'),
];
@@ -703,7 +703,7 @@
_expectId(main, SearchResultKind.WRITE, 'v = 1;'),
_expectId(main, SearchResultKind.READ_WRITE, 'v += 2;'),
_expectId(main, SearchResultKind.READ, 'v);'),
- _expectId(main, SearchResultKind.INVOCATION, 'v();')
+ _expectId(main, SearchResultKind.READ, 'v();')
];
await _verifyReferences(element, expected);
}
@@ -725,7 +725,7 @@
_expectId(main, SearchResultKind.WRITE, 'v = 1;'),
_expectId(main, SearchResultKind.READ_WRITE, 'v += 2;'),
_expectId(main, SearchResultKind.READ, 'v);'),
- _expectId(main, SearchResultKind.INVOCATION, 'v();')
+ _expectId(main, SearchResultKind.READ, 'v();')
];
await _verifyReferences(element, expected);
}
@@ -749,7 +749,7 @@
_expectId(main, SearchResultKind.WRITE, 'v = 1;'),
_expectId(main, SearchResultKind.READ_WRITE, 'v += 2;'),
_expectId(main, SearchResultKind.READ, 'v);'),
- _expectId(main, SearchResultKind.INVOCATION, 'v();')
+ _expectId(main, SearchResultKind.READ, 'v();')
];
await _verifyReferences(element, expected);
}
@@ -813,7 +813,7 @@
_expectId(fooElement, SearchResultKind.WRITE, 'p = 1;'),
_expectId(fooElement, SearchResultKind.READ_WRITE, 'p += 2;'),
_expectId(fooElement, SearchResultKind.READ, 'p);'),
- _expectId(fooElement, SearchResultKind.INVOCATION, 'p();'),
+ _expectId(fooElement, SearchResultKind.READ, 'p();'),
_expectIdQ(mainElement, SearchResultKind.REFERENCE, 'p: 42')
];
await _verifyReferences(element, expected);
@@ -842,7 +842,7 @@
_expectId(constructorA, SearchResultKind.WRITE, 'p = 2;'),
_expectId(constructorA, SearchResultKind.READ_WRITE, 'p += 3;'),
_expectId(constructorA, SearchResultKind.READ, 'p);'),
- _expectId(constructorA, SearchResultKind.INVOCATION, 'p();')
+ _expectId(constructorA, SearchResultKind.READ, 'p();')
];
await _verifyReferences(element, expected);
}
@@ -866,7 +866,7 @@
_expectId(main, SearchResultKind.WRITE, 'p = 1;'),
_expectId(main, SearchResultKind.READ_WRITE, 'p += 2;'),
_expectId(main, SearchResultKind.READ, 'p);'),
- _expectId(main, SearchResultKind.INVOCATION, 'p();')
+ _expectId(main, SearchResultKind.READ, 'p();')
];
await _verifyReferences(element, expected);
}
@@ -891,7 +891,7 @@
_expectId(fooElement, SearchResultKind.WRITE, 'p = 1;'),
_expectId(fooElement, SearchResultKind.READ_WRITE, 'p += 2;'),
_expectId(fooElement, SearchResultKind.READ, 'p);'),
- _expectId(fooElement, SearchResultKind.INVOCATION, 'p();')
+ _expectId(fooElement, SearchResultKind.READ, 'p();')
];
await _verifyReferences(element, expected);
}
@@ -914,7 +914,7 @@
_expectId(fooElement, SearchResultKind.WRITE, 'p = 1;'),
_expectId(fooElement, SearchResultKind.READ_WRITE, 'p += 2;'),
_expectId(fooElement, SearchResultKind.READ, 'p);'),
- _expectId(fooElement, SearchResultKind.INVOCATION, 'p();')
+ _expectId(fooElement, SearchResultKind.READ, 'p();')
];
await _verifyReferences(element, expected);
}
@@ -938,7 +938,7 @@
_expectId(fooElement, SearchResultKind.WRITE, 'p = 1;'),
_expectId(fooElement, SearchResultKind.READ_WRITE, 'p += 2;'),
_expectId(fooElement, SearchResultKind.READ, 'p);'),
- _expectId(fooElement, SearchResultKind.INVOCATION, 'p();'),
+ _expectId(fooElement, SearchResultKind.READ, 'p();'),
_expectIdQ(mainElement, SearchResultKind.REFERENCE, '42', length: 0)
];
await _verifyReferences(element, expected);
@@ -1134,8 +1134,8 @@
var expected = [
_expectId(main, SearchResultKind.REFERENCE, 'ggg); // ref-nq'),
_expectIdQ(main, SearchResultKind.REFERENCE, 'ggg); // ref-q'),
- _expectId(main, SearchResultKind.INVOCATION, 'ggg(); // inv-nq'),
- _expectIdQ(main, SearchResultKind.INVOCATION, 'ggg(); // inv-q'),
+ _expectId(main, SearchResultKind.REFERENCE, 'ggg(); // inv-nq'),
+ _expectIdQ(main, SearchResultKind.REFERENCE, 'ggg(); // inv-q'),
];
await _verifyReferences(element, expected);
}
@@ -1185,10 +1185,10 @@
_expectIdQ(testUnitElement, SearchResultKind.REFERENCE, 'V; // imp'),
_expectIdQ(main, SearchResultKind.WRITE, 'V = 1; // q'),
_expectIdQ(main, SearchResultKind.READ, 'V); // q'),
- _expectIdQ(main, SearchResultKind.INVOCATION, 'V(); // q'),
+ _expectIdQ(main, SearchResultKind.READ, 'V(); // q'),
_expectId(main, SearchResultKind.WRITE, 'V = 1; // nq'),
_expectId(main, SearchResultKind.READ, 'V); // nq'),
- _expectId(main, SearchResultKind.INVOCATION, 'V(); // nq'),
+ _expectId(main, SearchResultKind.READ, 'V(); // nq'),
];
await _verifyReferences(variable, expected);
}
diff --git a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
index 1e9c3fb..96a7512 100644
--- a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/features.dart';
+import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
@@ -440,10 +441,14 @@
c(2);
}
''');
- var invocation = findNode.methodInvocation('c(2)');
- expect(invocation.staticInvokeType.element,
- same(findElement.method('call', of: 'C')));
+ var invocation = findNode.functionExpressionInvocation('c(2)');
+ assertElement(invocation, findElement.method('call', of: 'C'));
assertInvokeType(invocation, 'int Function(int)');
+ assertType(invocation, 'int');
+
+ var cRef = invocation.function as SimpleIdentifier;
+ assertElement(cRef, findElement.parameter('c'));
+ assertType(cRef, 'C');
}
test_instance_call_fromExtension() async {
@@ -458,10 +463,14 @@
c(2);
}
''');
- var invocation = findNode.methodInvocation('c(2)');
- expect(invocation.staticInvokeType.element,
- same(findElement.method('call', of: 'E')));
+ var invocation = findNode.functionExpressionInvocation('c(2)');
+ assertElement(invocation, findElement.method('call', of: 'E'));
assertInvokeType(invocation, 'int Function(int)');
+ assertType(invocation, 'int');
+
+ var cRef = invocation.function as SimpleIdentifier;
+ assertElement(cRef, findElement.parameter('c'));
+ assertType(cRef, 'C');
}
test_instance_call_fromExtension_int() async {
@@ -617,13 +626,14 @@
c.a(0);
}
''');
- var invocation = findNode.methodInvocation('a(0);');
- assertMethodInvocation(
- invocation,
- findElement.getter('a'),
- 'double Function(int)',
- expectedMethodNameType: 'double Function(int) Function()',
- );
+ var invocation = findNode.functionExpressionInvocation('c.a(0)');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'double Function(int)');
+ assertType(invocation, 'double');
+
+ var function = invocation.function as PropertyAccess;
+ assertElement(function.propertyName, findElement.getter('a', of: 'E'));
+ assertType(function.propertyName, 'double Function(int)');
}
test_instance_getter_specificSubtypeMatchLocal() async {
@@ -656,9 +666,14 @@
f.a();
}
''');
- var invocation = findNode.methodInvocation('f.a()');
- assertElement(invocation, findElement.getter('a'));
+ var invocation = findNode.functionExpressionInvocation('f.a()');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'String Function()');
assertType(invocation, 'String');
+
+ var function = invocation.function as PropertyAccess;
+ assertElement(function.propertyName, findElement.getter('a', of: 'E'));
+ assertType(function.propertyName, 'String Function()');
}
test_instance_method_fromDifferentExtension_usingBounds() async {
diff --git a/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart b/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart
index e9b17ee..e9efa53 100644
--- a/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/extension_override_test.dart
@@ -134,7 +134,7 @@
validatePropertyAccess();
}
- test_getter_noPrefix_noTypeArguments_methodInvocation() async {
+ test_getter_noPrefix_noTypeArguments_functionExpressionInvocation() async {
await assertNoErrorsInCode('''
class A {}
@@ -149,13 +149,14 @@
findDeclarationAndOverride(declarationName: 'E ', overrideSearch: 'E(a)');
validateOverride();
- var invocation = findNode.methodInvocation('g(0);');
- assertMethodInvocation(
- invocation,
- findElement.getter('g'),
- 'double Function(int)',
- expectedMethodNameType: 'double Function(int) Function()',
- );
+ var invocation = findNode.functionExpressionInvocation('g(0)');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'double Function(int)');
+ assertType(invocation, 'double');
+
+ var function = invocation.function as PropertyAccess;
+ assertElement(function.propertyName, findElement.getter('g', of: 'E'));
+ assertType(function.propertyName, 'double Function(int)');
}
test_getter_noPrefix_typeArguments() async {
diff --git a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
index f600ea3..9ca7b0d 100644
--- a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
@@ -238,7 +238,7 @@
}
test_error_invocationOfNonFunction_interface_hasCall_field() async {
- await resolveTestCode(r'''
+ await assertErrorsInCode(r'''
class C {
void Function() call;
}
@@ -246,46 +246,60 @@
main(C c) {
c();
}
-''');
- assertTestErrorsWithCodes([
- StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION,
+''', [
+ error(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 51, 1),
]);
- _assertInvalidInvocation(
- 'c()',
- findElement.parameter('c'),
- );
+
+ var invocation = findNode.functionExpressionInvocation('c();');
+ assertElementNull(invocation);
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+
+ var cRef = invocation.function as SimpleIdentifier;
+ assertElement(cRef, findElement.parameter('c'));
+ assertType(cRef, 'C');
}
test_error_invocationOfNonFunction_localVariable() async {
- await resolveTestCode(r'''
+ await assertErrorsInCode(r'''
main() {
Object foo;
foo();
}
-''');
- assertTestErrorsWithCodes([
- StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION,
+''', [
+ error(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 25, 3),
]);
- _assertInvalidInvocation(
- 'foo()',
- findElement.localVar('foo'),
- expectedNameType: 'Object',
- );
+
+ var invocation = findNode.functionExpressionInvocation('foo();');
+ assertElementNull(invocation);
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.localVar('foo'));
+ assertType(foo, 'Object');
}
test_error_invocationOfNonFunction_OK_dynamic_localVariable() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
main() {
var foo;
foo();
}
''');
- assertNoTestErrors();
- _assertInvalidInvocation('foo();', findElement.localVar('foo'));
+
+ var invocation = findNode.functionExpressionInvocation('foo();');
+ assertElementNull(invocation);
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.localVar('foo'));
+ assertTypeDynamic(foo);
}
test_error_invocationOfNonFunction_OK_dynamicGetter_instance() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
class C {
var foo;
}
@@ -294,16 +308,20 @@
c.foo();
}
''');
- assertNoTestErrors();
- _assertInvalidInvocation(
- 'c.foo();',
- findElement.getter('foo'),
- expectedMethodNameType: 'dynamic Function()',
- );
+
+ var invocation = findNode.functionExpressionInvocation('foo();');
+ assertElementNull(invocation);
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+
+ var foo = invocation.function as PropertyAccess;
+ assertTypeDynamic(foo);
+ assertElement(foo.propertyName, findElement.getter('foo'));
+ assertTypeDynamic(foo.propertyName);
}
test_error_invocationOfNonFunction_OK_dynamicGetter_superClass() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
class A {
var foo;
}
@@ -314,16 +332,19 @@
}
}
''');
- assertNoTestErrors();
- _assertInvalidInvocation(
- 'foo();',
- findElement.getter('foo'),
- expectedMethodNameType: 'dynamic Function()',
- );
+
+ var invocation = findNode.functionExpressionInvocation('foo();');
+ assertElementNull(invocation);
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.getter('foo'));
+ assertTypeDynamic(foo);
}
test_error_invocationOfNonFunction_OK_dynamicGetter_thisClass() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
class C {
var foo;
@@ -332,26 +353,35 @@
}
}
''');
- assertNoTestErrors();
- _assertInvalidInvocation(
- 'foo();',
- findElement.getter('foo'),
- expectedMethodNameType: 'dynamic Function()',
- );
+
+ var invocation = findNode.functionExpressionInvocation('foo();');
+ assertElementNull(invocation);
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.getter('foo'));
+ assertTypeDynamic(foo);
}
test_error_invocationOfNonFunction_OK_Function() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
f(Function foo) {
foo(1, 2);
}
''');
- assertNoTestErrors();
- _assertInvalidInvocation('foo(1, 2);', findElement.parameter('foo'));
+
+ var invocation = findNode.functionExpressionInvocation('foo(1, 2);');
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.parameter('foo'));
+ assertType(foo, 'Function');
}
test_error_invocationOfNonFunction_OK_functionTypeTypeParameter() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
typedef MyFunction = double Function(int _);
class C<T extends MyFunction> {
@@ -362,17 +392,19 @@
}
}
''');
- assertNoTestErrors();
- assertMethodInvocation(
- findNode.methodInvocation('foo(0)'),
- findElement.getter('foo'),
- 'double Function(int)',
- expectedMethodNameType: 'T Function()',
- );
+
+ var invocation = findNode.functionExpressionInvocation('foo(0);');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'double Function(int)');
+ assertType(invocation, 'double');
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.getter('foo'));
+ assertType(foo, 'double Function(int)');
}
test_error_invocationOfNonFunction_static_hasTarget() async {
- await resolveTestCode(r'''
+ await assertErrorsInCode(r'''
class C {
static int foo;
}
@@ -380,19 +412,23 @@
main() {
C.foo();
}
-''');
- assertTestErrorsWithCodes([
- StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION,
+''', [
+ error(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 42, 5),
]);
- _assertInvalidInvocation(
- 'foo()',
- findElement.getter('foo'),
- expectedMethodNameType: 'int Function()',
- );
+
+ var invocation = findNode.functionExpressionInvocation('foo();');
+ assertElementNull(invocation);
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+
+ var foo = invocation.function as PropertyAccess;
+ assertType(foo, 'int');
+ assertElement(foo.propertyName, findElement.getter('foo'));
+ assertType(foo.propertyName, 'int');
}
test_error_invocationOfNonFunction_static_noTarget() async {
- await resolveTestCode(r'''
+ await assertErrorsInCode(r'''
class C {
static int foo;
@@ -400,19 +436,22 @@
foo();
}
}
-''');
- assertTestErrorsWithCodes([
- StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION,
+''', [
+ error(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 46, 3),
]);
- _assertInvalidInvocation(
- 'foo()',
- findElement.getter('foo'),
- expectedMethodNameType: 'int Function()',
- );
+
+ var invocation = findNode.functionExpressionInvocation('foo();');
+ assertElementNull(invocation);
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.getter('foo'));
+ assertType(foo, 'int');
}
test_error_invocationOfNonFunction_super_getter() async {
- await resolveTestCode(r'''
+ await assertErrorsInCode(r'''
class A {
int get foo => 0;
}
@@ -422,15 +461,21 @@
super.foo();
}
}
-''');
- assertTestErrorsWithCodes([
- StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION,
+''', [
+ error(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 68, 9),
]);
- _assertInvalidInvocation(
- 'foo()',
- findElement.getter('foo'),
- expectedMethodNameType: 'int Function()',
- );
+
+ var invocation = findNode.functionExpressionInvocation('foo();');
+ assertElementNull(invocation);
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+
+ var foo = invocation.function as PropertyAccess;
+ assertType(foo, 'int');
+ assertElement(foo.propertyName, findElement.getter('foo'));
+ assertType(foo.propertyName, 'int');
+
+ assertSuperExpression(foo.target);
}
test_error_prefixIdentifierNotFollowedByDot() async {
@@ -807,7 +852,7 @@
}
test_error_useOfVoidResult_name_getter() async {
- await resolveTestCode(r'''
+ await assertErrorsInCode(r'''
class C<T>{
T foo;
}
@@ -815,33 +860,39 @@
main(C<void> c) {
c.foo();
}
-''');
- assertTestErrorsWithCodes([
- StaticWarningCode.USE_OF_VOID_RESULT,
+''', [
+ error(StaticWarningCode.USE_OF_VOID_RESULT, 44, 5),
]);
- _assertInvalidInvocation(
- 'c.foo()',
- findElement.getter('foo'),
- expectedNameType: 'void',
- expectedMethodNameType: 'void Function()',
- );
+
+ var invocation = findNode.functionExpressionInvocation('foo();');
+ assertElementNull(invocation);
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+
+ var foo = invocation.function as PropertyAccess;
+ assertType(foo, 'void');
+ assertMember(foo.propertyName, findElement.getter('foo'), {'T': 'void'});
+ assertType(foo.propertyName, 'void');
}
test_error_useOfVoidResult_name_localVariable() async {
- await resolveTestCode(r'''
+ await assertErrorsInCode(r'''
main() {
void foo;
foo();
}
-''');
- assertTestErrorsWithCodes([
- StaticWarningCode.USE_OF_VOID_RESULT,
+''', [
+ error(StaticWarningCode.USE_OF_VOID_RESULT, 23, 3),
]);
- _assertInvalidInvocation(
- 'foo()',
- findElement.localVar('foo'),
- expectedNameType: 'void',
- );
+
+ var invocation = findNode.functionExpressionInvocation('foo();');
+ assertElementNull(invocation);
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.localVar('foo'));
+ assertType(foo, 'void');
}
test_error_useOfVoidResult_name_topFunction() async {
@@ -863,22 +914,24 @@
}
test_error_useOfVoidResult_name_topVariable() async {
- await resolveTestCode(r'''
+ await assertErrorsInCode(r'''
void foo;
main() {
foo();
}
-''');
- assertTestErrorsWithCodes([
- StaticWarningCode.USE_OF_VOID_RESULT,
+''', [
+ error(StaticWarningCode.USE_OF_VOID_RESULT, 22, 3),
]);
- _assertInvalidInvocation(
- 'foo()',
- findElement.topGet('foo'),
- expectedNameType: 'void',
- expectedMethodNameType: 'void Function()',
- );
+
+ var invocation = findNode.functionExpressionInvocation('foo();');
+ assertElementNull(invocation);
+ assertInvokeTypeDynamic(invocation);
+ assertTypeDynamic(invocation);
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.topGet('foo'));
+ assertType(foo, 'void');
}
test_error_useOfVoidResult_receiver() async {
@@ -975,7 +1028,7 @@
}
test_hasReceiver_class_staticGetter() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
class C {
static double Function(int) get foo => null;
}
@@ -984,16 +1037,17 @@
C.foo(0);
}
''');
- assertNoTestErrors();
- var invocation = findNode.methodInvocation('foo(0);');
- assertMethodInvocation(
- invocation,
- findElement.getter('foo'),
- 'double Function(int)',
- expectedMethodNameType: 'double Function(int) Function()',
- );
- assertClassRef(invocation.target, findElement.class_('C'));
+ var invocation = findNode.functionExpressionInvocation('foo(0);');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'double Function(int)');
+ assertType(invocation, 'double');
+
+ var foo = invocation.function as PropertyAccess;
+ assertClassRef(foo.target, findElement.class_('C'));
+ assertType(foo, 'double Function(int)');
+ assertElement(foo.propertyName, findElement.getter('foo'));
+ assertType(foo.propertyName, 'double Function(int)');
}
test_hasReceiver_class_staticMethod() async {
@@ -1089,26 +1143,27 @@
T Function<T>(T a, T b) get foo => null;
''');
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
import 'a.dart' as prefix;
main() {
prefix.foo(1, 2);
}
''');
- assertNoTestErrors();
var import = findElement.importFind('package:test/a.dart');
- var invocation = findNode.methodInvocation('foo(1, 2)');
- assertMethodInvocation(
- invocation,
- import.topGetter('foo'),
- 'int Function(int, int)',
- expectedMethodNameType: 'T Function<T>(T, T) Function()',
- expectedTypeArguments: ['int'],
- );
- assertImportPrefix(invocation.target, import.prefix);
+ var invocation = findNode.functionExpressionInvocation('foo(1, 2);');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'int Function(int, int)');
+ assertType(invocation, 'int');
+
+ var foo = invocation.function as PrefixedIdentifier;
+ assertType(foo, 'T Function<T>(T, T)');
+ assertElement(foo.identifier, import.topGetter('foo'));
+ assertType(foo.identifier, 'T Function<T>(T, T)');
+
+ assertImportPrefix(foo.prefix, import.prefix);
}
test_hasReceiver_instance_Function_call_localVariable() async {
@@ -1136,7 +1191,7 @@
}
test_hasReceiver_instance_getter() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
class C {
double Function(int) get foo => null;
}
@@ -1145,15 +1200,16 @@
c.foo(0);
}
''');
- assertNoTestErrors();
- var invocation = findNode.methodInvocation('foo(0);');
- assertMethodInvocation(
- invocation,
- findElement.getter('foo'),
- 'double Function(int)',
- expectedMethodNameType: 'double Function(int) Function()',
- );
+ var invocation = findNode.functionExpressionInvocation('foo(0);');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'double Function(int)');
+ assertType(invocation, 'double');
+
+ var foo = invocation.function as PropertyAccess;
+ assertType(foo, 'double Function(int)');
+ assertElement(foo.propertyName, findElement.getter('foo'));
+ assertType(foo.propertyName, 'double Function(int)');
}
test_hasReceiver_instance_method() async {
@@ -1264,26 +1320,27 @@
}
''');
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
import 'a.dart' as prefix;
main() {
prefix.C.foo(0);
}
''');
- assertNoTestErrors();
var import = findElement.importFind('package:test/a.dart');
- var invocation = findNode.methodInvocation('foo(0)');
- assertMethodInvocation(
- invocation,
- import.class_('C').getGetter('foo'),
- 'double Function(int)',
- expectedMethodNameType: 'double Function(int) Function()',
- );
+ var invocation = findNode.functionExpressionInvocation('foo(0);');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'double Function(int)');
+ assertType(invocation, 'double');
- PrefixedIdentifier target = invocation.target;
+ var foo = invocation.function as PropertyAccess;
+ assertType(foo, 'double Function(int)');
+ assertElement(foo.propertyName, import.class_('C').getGetter('foo'));
+ assertType(foo.propertyName, 'double Function(int)');
+
+ PrefixedIdentifier target = foo.target;
assertImportPrefix(target.prefix, import.prefix);
assertClassRef(target.identifier, import.class_('C'));
}
@@ -1319,7 +1376,7 @@
}
test_hasReceiver_super_getter() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
class A {
double Function(int) get foo => null;
}
@@ -1330,16 +1387,18 @@
}
}
''');
- assertNoTestErrors();
- var invocation = findNode.methodInvocation('foo(0);');
- assertMethodInvocation(
- invocation,
- findElement.getter('foo', of: 'A'),
- 'double Function(int)',
- expectedMethodNameType: 'double Function(int) Function()',
- );
- assertSuperExpression(invocation.target);
+ var invocation = findNode.functionExpressionInvocation('foo(0);');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'double Function(int)');
+ assertType(invocation, 'double');
+
+ var foo = invocation.function as PropertyAccess;
+ assertType(foo, 'double Function(int)');
+ assertElement(foo.propertyName, findElement.getter('foo'));
+ assertType(foo.propertyName, 'double Function(int)');
+
+ assertSuperExpression(foo.target);
}
test_hasReceiver_super_method() async {
@@ -1386,7 +1445,7 @@
}
test_noReceiver_getter_superClass() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
class A {
double Function(int) get foo => null;
}
@@ -1397,19 +1456,19 @@
}
}
''');
- assertNoTestErrors();
- var invocation = findNode.methodInvocation('foo(0)');
- assertMethodInvocation(
- invocation,
- findElement.getter('foo'),
- 'double Function(int)',
- expectedMethodNameType: 'double Function(int) Function()',
- );
+ var invocation = findNode.functionExpressionInvocation('foo(0);');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'double Function(int)');
+ assertType(invocation, 'double');
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.getter('foo'));
+ assertType(foo, 'double Function(int)');
}
test_noReceiver_getter_thisClass() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
class C {
double Function(int) get foo => null;
@@ -1418,15 +1477,15 @@
}
}
''');
- assertNoTestErrors();
- var invocation = findNode.methodInvocation('foo(0)');
- assertMethodInvocation(
- invocation,
- findElement.getter('foo'),
- 'double Function(int)',
- expectedMethodNameType: 'double Function(int) Function()',
- );
+ var invocation = findNode.functionExpressionInvocation('foo(0);');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'double Function(int)');
+ assertType(invocation, 'double');
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.getter('foo'));
+ assertType(foo, 'double Function(int)');
}
test_noReceiver_importPrefix() async {
@@ -1462,21 +1521,22 @@
}
test_noReceiver_localVariable() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
main() {
void Function(int) foo;
foo(0);
}
''');
- assertNoTestErrors();
- var invocation = findNode.methodInvocation('foo(0)');
- assertMethodInvocation(
- invocation,
- findElement.localVar('foo'),
- 'void Function(int)',
- );
+ var invocation = findNode.functionExpressionInvocation('foo(0);');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'void Function(int)');
+ assertType(invocation, 'void');
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.localVar('foo'));
+ assertType(foo, 'void Function(int)');
}
test_noReceiver_localVariable_call() async {
@@ -1491,16 +1551,18 @@
''');
assertNoTestErrors();
- var invocation = findNode.methodInvocation('c(0);');
- assertMethodInvocation(
- invocation,
- findElement.parameter('c'),
- 'void Function(int)',
- );
+ var invocation = findNode.functionExpressionInvocation('c(0);');
+ assertElement(invocation, findElement.method('call', of: 'C'));
+ assertInvokeType(invocation, 'void Function(int)');
+ assertType(invocation, 'void');
+
+ var cRef = invocation.function as SimpleIdentifier;
+ assertElement(cRef, findElement.parameter('c'));
+ assertType(cRef, 'C');
}
test_noReceiver_localVariable_promoted() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
main() {
var foo;
if (foo is void Function(int)) {
@@ -1508,14 +1570,15 @@
}
}
''');
- assertNoTestErrors();
- var invocation = findNode.methodInvocation('foo(0)');
- assertMethodInvocation(
- invocation,
- findElement.localVar('foo'),
- 'void Function(int)',
- );
+ var invocation = findNode.functionExpressionInvocation('foo(0);');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'void Function(int)');
+ assertType(invocation, 'void');
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.localVar('foo'));
+ assertType(foo, 'void Function(int)');
}
test_noReceiver_method_superClass() async {
@@ -1580,41 +1643,41 @@
}
test_noReceiver_topGetter() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
double Function(int) get foo => null;
main() {
foo(0);
}
''');
- assertNoTestErrors();
- var invocation = findNode.methodInvocation('foo(0)');
- assertMethodInvocation(
- invocation,
- findElement.topGet('foo'),
- 'double Function(int)',
- expectedMethodNameType: 'double Function(int) Function()',
- );
+ var invocation = findNode.functionExpressionInvocation('foo(0);');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'double Function(int)');
+ assertType(invocation, 'double');
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.topGet('foo'));
+ assertType(foo, 'double Function(int)');
}
test_noReceiver_topVariable() async {
- await resolveTestCode(r'''
+ await assertNoErrorsInCode(r'''
void Function(int) foo;
main() {
foo(0);
}
''');
- assertNoTestErrors();
- var invocation = findNode.methodInvocation('foo(0)');
- assertMethodInvocation(
- invocation,
- findElement.topGet('foo'),
- 'void Function(int)',
- expectedMethodNameType: 'void Function(int) Function()',
- );
+ var invocation = findNode.functionExpressionInvocation('foo(0);');
+ assertElementNull(invocation);
+ assertInvokeType(invocation, 'void Function(int)');
+ assertType(invocation, 'void');
+
+ var foo = invocation.function as SimpleIdentifier;
+ assertElement(foo, findElement.topGet('foo'));
+ assertType(foo, 'void Function(int)');
}
test_objectMethodOnDynamic() async {
diff --git a/pkg/analyzer/test/src/dart/resolution/non_nullable_test.dart b/pkg/analyzer/test/src/dart/resolution/non_nullable_test.dart
index 68665ba..62ad0fc 100644
--- a/pkg/analyzer/test/src/dart/resolution/non_nullable_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/non_nullable_test.dart
@@ -221,7 +221,8 @@
}
''');
// Do not assert no test errors. Deliberately invokes nullable type.
- assertType(findNode.methodInvocation('first').methodName, 'Function?');
+ var invocation = findNode.functionExpressionInvocation('first()');
+ assertType(invocation.function, 'Function?');
}
test_mixin_hierarchy() async {
diff --git a/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart b/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart
index e9b7c6c..b71d2ab 100644
--- a/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/ambiguous_extension_member_access_test.dart
@@ -37,6 +37,8 @@
int f(A a) => a();
''', [
error(CompileTimeErrorCode.AMBIGUOUS_EXTENSION_MEMBER_ACCESS, 110, 1),
+ error(
+ StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 110, 1),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/assert_in_redirecting_constructor_test.dart b/pkg/analyzer/test/src/diagnostics/assert_in_redirecting_constructor_test.dart
new file mode 100644
index 0000000..76c31a4
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/assert_in_redirecting_constructor_test.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2019, 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:analyzer/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/driver_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(AssertInRedirectingConstructorTest);
+ });
+}
+
+@reflectiveTest
+class AssertInRedirectingConstructorTest extends DriverResolutionTest {
+ test_assertBeforeRedirection() async {
+ await assertErrorsInCode(r'''
+class A {}
+class B {
+ B(int x) : assert(x > 0), this.name();
+ B.name() {}
+}
+''', [error(CompileTimeErrorCode.ASSERT_IN_REDIRECTING_CONSTRUCTOR, 34, 13)]);
+ }
+
+ test_redirectionBeforeAssert() async {
+ await assertErrorsInCode(r'''
+class A {}
+class B {
+ B(int x) : this.name(), assert(x > 0);
+ B.name() {}
+}
+''', [error(CompileTimeErrorCode.ASSERT_IN_REDIRECTING_CONSTRUCTOR, 47, 13)]);
+ }
+
+ test_justRedirection() async {
+ await assertNoErrorsInCode(r'''
+class A {}
+class B {
+ B(int x) : this.name();
+ B.name() {}
+}
+''');
+ }
+
+ test_justAssert() async {
+ await assertNoErrorsInCode(r'''
+class A {}
+class B {
+ B(int x) : assert(x > 0);
+ B.name() {}
+}
+''');
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_use_of_never_value_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_use_of_never_value_test.dart
index 794d498..f0bc477 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_use_of_never_value_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_use_of_never_value_test.dart
@@ -105,7 +105,7 @@
c.x();
}
''', [
- error(StaticWarningCode.INVALID_USE_OF_NEVER_VALUE, 71, 1),
+ error(StaticWarningCode.INVALID_USE_OF_NEVER_VALUE, 69, 3),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
index fd2ef4e..71bef09 100644
--- a/pkg/analyzer/test/src/diagnostics/test_all.dart
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -10,6 +10,8 @@
import 'ambiguous_import_test.dart' as ambiguous_import;
import 'ambiguous_set_or_map_literal_test.dart' as ambiguous_set_or_map_literal;
import 'argument_type_not_assignable_test.dart' as argument_type_not_assignable;
+import 'assert_in_redirecting_constructor_test.dart'
+ as assert_in_redirecting_constructor;
import 'assignment_to_const_test.dart' as assignment_to_const;
import 'assignment_to_final_local_test.dart' as assignment_to_final_local;
import 'assignment_to_final_no_setter_test.dart'
@@ -338,6 +340,7 @@
ambiguous_import.main();
ambiguous_set_or_map_literal.main();
argument_type_not_assignable.main();
+ assert_in_redirecting_constructor.main();
assignment_to_const.main();
assignment_to_final_local.main();
assignment_to_final_no_setter.main();
diff --git a/pkg/analyzer/test/src/diagnostics/top_level_instance_getter_test.dart b/pkg/analyzer/test/src/diagnostics/top_level_instance_getter_test.dart
index ceb09b7..1571a3a 100644
--- a/pkg/analyzer/test/src/diagnostics/top_level_instance_getter_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/top_level_instance_getter_test.dart
@@ -107,7 +107,7 @@
var a = new A();
var b = a.g();
''', [
- error(StrongModeCode.TOP_LEVEL_INSTANCE_GETTER, 57, 5),
+ error(StrongModeCode.TOP_LEVEL_INSTANCE_GETTER, 59, 1),
]);
}
@@ -130,7 +130,7 @@
var a = new A();
var b = a.g();
''', [
- error(StrongModeCode.TOP_LEVEL_INSTANCE_GETTER, 56, 5),
+ error(StrongModeCode.TOP_LEVEL_INSTANCE_GETTER, 58, 1),
]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/unchecked_use_of_nullable_value_test.dart b/pkg/analyzer/test/src/diagnostics/unchecked_use_of_nullable_value_test.dart
index a5176b9..249a0f4 100644
--- a/pkg/analyzer/test/src/diagnostics/unchecked_use_of_nullable_value_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/unchecked_use_of_nullable_value_test.dart
@@ -437,7 +437,7 @@
x.first();
}
''', [
- error(StaticWarningCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 40, 5),
+ error(StaticWarningCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 38, 7),
]);
}
diff --git a/pkg/analyzer/test/src/summary/api_signature_test.dart b/pkg/analyzer/test/src/summary/api_signature_test.dart
index b302076..42c7caa 100644
--- a/pkg/analyzer/test/src/summary/api_signature_test.dart
+++ b/pkg/analyzer/test/src/summary/api_signature_test.dart
@@ -2,10 +2,9 @@
// 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:analyzer/src/summary/format.dart';
+import 'package:analyzer/src/summary/api_signature.dart';
import 'package:convert/convert.dart';
import 'package:crypto/crypto.dart';
-import 'package:analyzer/src/summary/api_signature.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -24,12 +23,6 @@
expect(sig.toHex(), hex.encode(md5.convert(bytes).bytes));
}
- String signUnlinkedCombinator(UnlinkedCombinatorBuilder combinator) {
- ApiSignature sig = new ApiSignature();
- combinator.collectApiSignature(sig);
- return sig.toHex();
- }
-
void test_addBool() {
sig.addBool(true);
sig.addBool(true);
@@ -70,30 +63,6 @@
checkBytes([3, 0, 0, 0, 0x61, 0x62, 0x63, 2, 0, 0, 0, 0xc3, 0xb8]);
}
- void test_excludesInformative() {
- // Verify that API signatures exclude informative data by checking that two
- // UnlinkedCombinator instances that differ only in their offset result in
- // the same signature.
- UnlinkedCombinatorBuilder combinator1 =
- new UnlinkedCombinatorBuilder(shows: ['foo'], offset: 1);
- UnlinkedCombinatorBuilder combinator2 =
- new UnlinkedCombinatorBuilder(shows: ['foo'], offset: 2);
- expect(signUnlinkedCombinator(combinator1),
- signUnlinkedCombinator(combinator2));
- }
-
- void test_includesSemantic() {
- // Verify that API signatures include semantic data by checking that two
- // UnlinkedCombinator instances that differ only in their "shows" lists
- // result in different signatures.
- UnlinkedCombinatorBuilder combinator1 =
- new UnlinkedCombinatorBuilder(shows: ['foo'], offset: 1);
- UnlinkedCombinatorBuilder combinator2 =
- new UnlinkedCombinatorBuilder(shows: ['bar'], offset: 1);
- expect(signUnlinkedCombinator(combinator1),
- isNot(signUnlinkedCombinator(combinator2)));
- }
-
void test_manyInts() {
// This verifies that the logic to extend the internal buffer works
// properly.
diff --git a/pkg/analyzer/test/src/summary/name_filter_test.dart b/pkg/analyzer/test/src/summary/name_filter_test.dart
index 73a80fe..3d15cd6 100644
--- a/pkg/analyzer/test/src/summary/name_filter_test.dart
+++ b/pkg/analyzer/test/src/summary/name_filter_test.dart
@@ -2,8 +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:analyzer/src/dart/element/element.dart';
-import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/name_filter.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -17,8 +15,7 @@
@reflectiveTest
class NameFilterTest {
test_accepts_accessors_hide() {
- NameFilter filter = new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(hides: ['bar']));
+ NameFilter filter = new NameFilter(hides: ['bar']);
expect(filter.accepts('foo'), isTrue);
expect(filter.accepts('foo='), isTrue);
expect(filter.accepts('bar'), isFalse);
@@ -26,84 +23,13 @@
}
test_accepts_accessors_show() {
- NameFilter filter = new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(shows: ['foo']));
+ NameFilter filter = new NameFilter(shows: ['foo']);
expect(filter.accepts('foo'), isTrue);
expect(filter.accepts('foo='), isTrue);
expect(filter.accepts('bar'), isFalse);
expect(filter.accepts('bar='), isFalse);
}
- test_forNamespaceCombinator_hide() {
- NameFilter filter = new NameFilter.forNamespaceCombinator(
- new HideElementCombinatorImpl()..hiddenNames = ['foo', 'bar']);
- expect(filter.accepts('foo'), isFalse);
- expect(filter.accepts('bar'), isFalse);
- expect(filter.accepts('baz'), isTrue);
- expect(filter.shownNames, isNull);
- expect(filter.hiddenNames, isNotNull);
- expect(filter.hiddenNames, ['foo', 'bar'].toSet());
- }
-
- test_forNamespaceCombinator_show() {
- NameFilter filter = new NameFilter.forNamespaceCombinator(
- new ShowElementCombinatorImpl()..shownNames = ['foo', 'bar']);
- expect(filter.accepts('foo'), isTrue);
- expect(filter.accepts('bar'), isTrue);
- expect(filter.accepts('baz'), isFalse);
- expect(filter.hiddenNames, isNull);
- expect(filter.shownNames, isNotNull);
- expect(filter.shownNames, ['foo', 'bar'].toSet());
- }
-
- test_forNamespaceCombinators() {
- NameFilter filter = new NameFilter.forNamespaceCombinators([
- new HideElementCombinatorImpl()..hiddenNames = ['foo'],
- new HideElementCombinatorImpl()..hiddenNames = ['bar']
- ]);
- expect(filter.accepts('foo'), isFalse);
- expect(filter.accepts('bar'), isFalse);
- expect(filter.accepts('baz'), isTrue);
- expect(filter.shownNames, isNull);
- expect(filter.hiddenNames, isNotNull);
- expect(filter.hiddenNames, ['foo', 'bar'].toSet());
- }
-
- test_forUnlinkedCombinator_hide() {
- NameFilter filter = new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(hides: ['foo', 'bar']));
- expect(filter.accepts('foo'), isFalse);
- expect(filter.accepts('bar'), isFalse);
- expect(filter.accepts('baz'), isTrue);
- expect(filter.shownNames, isNull);
- expect(filter.hiddenNames, isNotNull);
- expect(filter.hiddenNames, ['foo', 'bar'].toSet());
- }
-
- test_forUnlinkedCombinator_show() {
- NameFilter filter = new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(shows: ['foo', 'bar']));
- expect(filter.accepts('foo'), isTrue);
- expect(filter.accepts('bar'), isTrue);
- expect(filter.accepts('baz'), isFalse);
- expect(filter.hiddenNames, isNull);
- expect(filter.shownNames, isNotNull);
- expect(filter.shownNames, ['foo', 'bar'].toSet());
- }
-
- test_forUnlinkedCombinators() {
- NameFilter filter = new NameFilter.forUnlinkedCombinators([
- new UnlinkedCombinatorBuilder(hides: ['foo']),
- new UnlinkedCombinatorBuilder(hides: ['bar'])
- ]);
- expect(filter.accepts('foo'), isFalse);
- expect(filter.accepts('bar'), isFalse);
- expect(filter.accepts('baz'), isTrue);
- expect(filter.shownNames, isNull);
- expect(filter.hiddenNames, isNotNull);
- expect(filter.hiddenNames, ['foo', 'bar'].toSet());
- }
-
test_identity() {
expect(NameFilter.identity.accepts('foo'), isTrue);
expect(NameFilter.identity.hiddenNames, isNotNull);
@@ -112,10 +38,8 @@
}
test_merge_hides_hides() {
- NameFilter filter = new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(hides: ['foo']))
- .merge(new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(hides: ['bar'])));
+ NameFilter filter =
+ new NameFilter(hides: ['foo']).merge(new NameFilter(hides: ['bar']));
expect(filter.accepts('foo'), isFalse);
expect(filter.accepts('bar'), isFalse);
expect(filter.accepts('baz'), isTrue);
@@ -125,9 +49,8 @@
}
test_merge_hides_identity() {
- NameFilter filter = new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(hides: ['foo', 'bar']))
- .merge(NameFilter.identity);
+ NameFilter filter =
+ new NameFilter(hides: ['foo', 'bar']).merge(NameFilter.identity);
expect(filter.accepts('foo'), isFalse);
expect(filter.accepts('bar'), isFalse);
expect(filter.accepts('baz'), isTrue);
@@ -137,10 +60,8 @@
}
test_merge_hides_shows() {
- NameFilter filter = new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(hides: ['bar', 'baz']))
- .merge(new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(shows: ['foo', 'bar'])));
+ NameFilter filter = new NameFilter(hides: ['bar', 'baz'])
+ .merge(new NameFilter(shows: ['foo', 'bar']));
expect(filter.accepts('foo'), isTrue);
expect(filter.accepts('bar'), isFalse);
expect(filter.accepts('baz'), isFalse);
@@ -150,9 +71,8 @@
}
test_merge_identity_hides() {
- NameFilter filter = NameFilter.identity.merge(
- new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(hides: ['foo', 'bar'])));
+ NameFilter filter =
+ NameFilter.identity.merge(new NameFilter(hides: ['foo', 'bar']));
expect(filter.accepts('foo'), isFalse);
expect(filter.accepts('bar'), isFalse);
expect(filter.accepts('baz'), isTrue);
@@ -170,9 +90,8 @@
}
test_merge_identity_shows() {
- NameFilter filter = NameFilter.identity.merge(
- new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(shows: ['foo', 'bar'])));
+ NameFilter filter =
+ NameFilter.identity.merge(new NameFilter(shows: ['foo', 'bar']));
expect(filter.accepts('foo'), isTrue);
expect(filter.accepts('bar'), isTrue);
expect(filter.accepts('baz'), isFalse);
@@ -182,10 +101,8 @@
}
test_merge_shows_hides() {
- NameFilter filter = new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(shows: ['foo', 'bar']))
- .merge(new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(hides: ['bar', 'baz'])));
+ NameFilter filter = new NameFilter(shows: ['foo', 'bar'])
+ .merge(new NameFilter(hides: ['bar', 'baz']));
expect(filter.accepts('foo'), isTrue);
expect(filter.accepts('bar'), isFalse);
expect(filter.accepts('baz'), isFalse);
@@ -195,9 +112,8 @@
}
test_merge_shows_identity() {
- NameFilter filter = new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(shows: ['foo', 'bar']))
- .merge(NameFilter.identity);
+ NameFilter filter =
+ new NameFilter(shows: ['foo', 'bar']).merge(NameFilter.identity);
expect(filter.accepts('foo'), isTrue);
expect(filter.accepts('bar'), isTrue);
expect(filter.accepts('baz'), isFalse);
@@ -207,10 +123,8 @@
}
test_merge_shows_shows() {
- NameFilter filter = new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(shows: ['foo', 'bar']))
- .merge(new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(shows: ['bar', 'baz'])));
+ NameFilter filter = new NameFilter(shows: ['foo', 'bar'])
+ .merge(new NameFilter(shows: ['bar', 'baz']));
expect(filter.accepts('foo'), isFalse);
expect(filter.accepts('bar'), isTrue);
expect(filter.accepts('baz'), isFalse);
@@ -220,10 +134,8 @@
}
test_merge_shows_shows_emptyResult() {
- NameFilter filter = new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(shows: ['foo']))
- .merge(new NameFilter.forUnlinkedCombinator(
- new UnlinkedCombinatorBuilder(shows: ['bar'])));
+ NameFilter filter =
+ new NameFilter(shows: ['foo']).merge(new NameFilter(shows: ['bar']));
expect(filter.accepts('foo'), isFalse);
expect(filter.accepts('bar'), isFalse);
expect(filter.accepts('baz'), isFalse);
diff --git a/pkg/analyzer/test/src/summary/package_bundle_reader_test.dart b/pkg/analyzer/test/src/summary/package_bundle_reader_test.dart
deleted file mode 100644
index ff8a21e..0000000
--- a/pkg/analyzer/test/src/summary/package_bundle_reader_test.dart
+++ /dev/null
@@ -1,222 +0,0 @@
-// Copyright (c) 2016, 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:analyzer/src/summary/idl.dart';
-import 'package:analyzer/src/summary/package_bundle_reader.dart';
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(SummaryDataStoreTest);
- });
-}
-
-/// A matcher for ConflictingSummaryException.
-const isConflictingSummaryException =
- const TypeMatcher<ConflictingSummaryException>();
-
-UnlinkedPublicNamespace _namespaceWithParts(List<String> parts) {
- _UnlinkedPublicNamespaceMock namespace = new _UnlinkedPublicNamespaceMock();
- namespace.parts = parts;
- return namespace;
-}
-
-@reflectiveTest
-class SummaryDataStoreTest {
- SummaryDataStore dataStore =
- new SummaryDataStore(<String>[], disallowOverlappingSummaries: true);
-
- _PackageBundleMock bundle1 = new _PackageBundleMock();
- _PackageBundleMock bundle2 = new _PackageBundleMock();
- _UnlinkedUnitMock unlinkedUnit11 = new _UnlinkedUnitMock();
- _UnlinkedUnitMock unlinkedUnit12 = new _UnlinkedUnitMock();
- _UnlinkedUnitMock unlinkedUnit21 = new _UnlinkedUnitMock();
- _LinkedLibraryMock linkedLibrary1 = new _LinkedLibraryMock();
- _LinkedLibraryMock linkedLibrary2 = new _LinkedLibraryMock();
-
- void setUp() {
- _setupDataStore(dataStore);
- }
-
- test_addBundle() {
- expect(dataStore.bundles, unorderedEquals([bundle1, bundle2]));
- expect(dataStore.uriToSummaryPath,
- containsPair('package:p1/u1.dart', '/p1.ds'));
- // unlinkedMap
- expect(dataStore.unlinkedMap, hasLength(3));
- expect(dataStore.unlinkedMap,
- containsPair('package:p1/u1.dart', unlinkedUnit11));
- expect(dataStore.unlinkedMap,
- containsPair('package:p1/u2.dart', unlinkedUnit12));
- expect(dataStore.unlinkedMap,
- containsPair('package:p2/u1.dart', unlinkedUnit21));
- // linkedMap
- expect(dataStore.linkedMap, hasLength(2));
- expect(dataStore.linkedMap,
- containsPair('package:p1/u1.dart', linkedLibrary1));
- expect(dataStore.linkedMap,
- containsPair('package:p2/u1.dart', linkedLibrary2));
- }
-
- test_addBundle_dartUris() {
- _PackageBundleMock bundle = new _PackageBundleMock();
- bundle.unlinkedUnitUris = <String>['dart:core'];
- bundle.unlinkedUnits = <UnlinkedUnit>[unlinkedUnit11];
- bundle.linkedLibraryUris = <String>['dart:core'];
- bundle.linkedLibraries = <LinkedLibrary>[linkedLibrary1];
- bundle.apiSignature = 'signature';
- dataStore.addBundle('/p3.ds', bundle);
- }
-
- test_addBundle_fileUris() {
- _PackageBundleMock bundle = new _PackageBundleMock();
- bundle.unlinkedUnitUris = <String>['file:/foo.dart'];
- bundle.unlinkedUnits = <UnlinkedUnit>[unlinkedUnit11];
- bundle.linkedLibraryUris = <String>['file:/foo.dart'];
- bundle.linkedLibraries = <LinkedLibrary>[linkedLibrary1];
- bundle.apiSignature = 'signature';
- dataStore.addBundle('/p3.ds', bundle);
- }
-
- test_addBundle_multiProject() {
- _PackageBundleMock bundle = new _PackageBundleMock();
- bundle.unlinkedUnitUris = <String>[
- 'package:p2/u1.dart',
- 'package:p1/u1.dart'
- ];
- bundle.unlinkedUnits = <UnlinkedUnit>[unlinkedUnit21, unlinkedUnit11];
- bundle.linkedLibraryUris = <String>[
- 'package:p2/u1.dart',
- 'package:p1/u1.dart'
- ];
- bundle.linkedLibraries = <LinkedLibrary>[linkedLibrary2, linkedLibrary1];
- bundle.apiSignature = 'signature';
- // p3 conflicts (overlaps) with existing summaries.
- expect(() => dataStore.addBundle('/p3.ds', bundle),
- throwsA(isConflictingSummaryException));
- }
-
- test_addBundle_multiProjectOverlap() {
- SummaryDataStore dataStore2 =
- new SummaryDataStore(<String>[], disallowOverlappingSummaries: false);
- _setupDataStore(dataStore2);
-
- _PackageBundleMock bundle = new _PackageBundleMock();
- bundle.unlinkedUnitUris = <String>[
- 'package:p2/u1.dart',
- 'package:p1/u1.dart'
- ];
- bundle.unlinkedUnits = <UnlinkedUnit>[unlinkedUnit21, unlinkedUnit11];
- bundle.linkedLibraryUris = <String>[
- 'package:p2/u1.dart',
- 'package:p1/u1.dart'
- ];
- bundle.linkedLibraries = <LinkedLibrary>[linkedLibrary2, linkedLibrary1];
- bundle.apiSignature = 'signature';
- // p3 conflicts (overlaps) with existing summaries, but now allowed.
- dataStore2.addBundle('/p3.ds', bundle);
- }
-
- test_getContainingLibraryUris_libraryUri() {
- String partUri = 'package:p1/u1.dart';
- List<String> uris = dataStore.getContainingLibraryUris(partUri);
- expect(uris, unorderedEquals([partUri]));
- }
-
- test_getContainingLibraryUris_partUri() {
- String partUri = 'package:p1/u2.dart';
- List<String> uris = dataStore.getContainingLibraryUris(partUri);
- expect(uris, unorderedEquals(['package:p1/u1.dart']));
- }
-
- test_getContainingLibraryUris_unknownUri() {
- String partUri = 'package:notInStore/foo.dart';
- List<String> uris = dataStore.getContainingLibraryUris(partUri);
- expect(uris, isNull);
- }
-
- void _setupDataStore(SummaryDataStore store) {
- var namespace1 = _namespaceWithParts(['package:p1/u2.dart']);
- var namespace2 = _namespaceWithParts([]);
- // bundle1
- unlinkedUnit11.publicNamespace = namespace1;
- unlinkedUnit12.publicNamespace = namespace2;
- bundle1.unlinkedUnitUris = <String>[
- 'package:p1/u1.dart',
- 'package:p1/u2.dart'
- ];
- bundle1.unlinkedUnits = <UnlinkedUnit>[unlinkedUnit11, unlinkedUnit12];
- bundle1.linkedLibraryUris = <String>['package:p1/u1.dart'];
- bundle1.linkedLibraries = <LinkedLibrary>[linkedLibrary1];
- bundle1.apiSignature = 'signature1';
- store.addBundle('/p1.ds', bundle1);
- // bundle2
- unlinkedUnit21.publicNamespace = namespace2;
- bundle2.unlinkedUnitUris = <String>['package:p2/u1.dart'];
- bundle2.unlinkedUnits = <UnlinkedUnit>[unlinkedUnit21];
- bundle2.linkedLibraryUris = <String>['package:p2/u1.dart'];
- bundle2.linkedLibraries = <LinkedLibrary>[linkedLibrary2];
- bundle2.apiSignature = 'signature2';
- store.addBundle('/p2.ds', bundle2);
- }
-}
-
-class _LinkedLibraryMock implements LinkedLibrary {
- @override
- noSuchMethod(Invocation invocation) {
- throw new StateError('Unexpected invocation of ${invocation.memberName}');
- }
-}
-
-class _PackageBundleMock implements PackageBundle {
- @override
- String apiSignature;
-
- @override
- List<LinkedLibrary> linkedLibraries;
-
- @override
- List<String> linkedLibraryUris;
-
- @override
- List<UnlinkedUnit> unlinkedUnits;
-
- @override
- List<String> unlinkedUnitUris;
-
- @override
- LinkedNodeBundle bundle2;
-
- @override
- noSuchMethod(Invocation invocation) {
- throw new StateError('Unexpected invocation of ${invocation.memberName}');
- }
-}
-
-class _UnlinkedPublicNamespaceMock implements UnlinkedPublicNamespace {
- @override
- List<String> parts;
-
- @override
- noSuchMethod(Invocation invocation) {
- throw new StateError('Unexpected invocation of ${invocation.memberName}');
- }
-}
-
-class _UnlinkedUnitMock implements UnlinkedUnit {
- @override
- bool isPartOf;
-
- @override
- List<int> lineStarts;
-
- @override
- UnlinkedPublicNamespace publicNamespace;
-
- @override
- noSuchMethod(Invocation invocation) {
- throw new StateError('Unexpected invocation of ${invocation.memberName}');
- }
-}
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index 369d0fe..39cd771 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -1345,9 +1345,9 @@
typedef G(F value);
''');
checkElementText(library, r'''
-notSimplyBounded typedef F = dynamic Function(dynamic Function(dynamic Function(dynamic)) value);
-notSimplyBounded typedef G = dynamic Function(dynamic Function(dynamic) value);
-notSimplyBounded class C<T extends dynamic Function(dynamic Function(dynamic Function(dynamic)))> {
+notSimplyBounded typedef F = dynamic Function(dynamic Function(dynamic) value);
+notSimplyBounded typedef G = dynamic Function(dynamic value);
+notSimplyBounded class C<T extends dynamic Function(dynamic Function(dynamic))> {
}
''');
}
diff --git a/pkg/analyzer/test/src/summary/test_all.dart b/pkg/analyzer/test/src/summary/test_all.dart
index 40dd736..b372fdd 100644
--- a/pkg/analyzer/test/src/summary/test_all.dart
+++ b/pkg/analyzer/test/src/summary/test_all.dart
@@ -9,7 +9,6 @@
import 'flat_buffers_test.dart' as flat_buffers;
import 'in_summary_source_test.dart' as in_summary_source;
import 'name_filter_test.dart' as name_filter;
-import 'package_bundle_reader_test.dart' as package_bundle_reader;
import 'resynthesize_ast2_test.dart' as resynthesize_ast2;
import 'top_level_inference_test.dart' as top_level_inference;
@@ -20,7 +19,6 @@
flat_buffers.main();
in_summary_source.main();
name_filter.main();
- package_bundle_reader.main();
resynthesize_ast2.main();
top_level_inference.main();
}, name: 'summary');
diff --git a/pkg/analyzer/test/src/summary/test_strategies.dart b/pkg/analyzer/test/src/summary/test_strategies.dart
index 0fc7bdc..5f16bb4 100644
--- a/pkg/analyzer/test/src/summary/test_strategies.dart
+++ b/pkg/analyzer/test/src/summary/test_strategies.dart
@@ -13,9 +13,7 @@
import 'package:analyzer/src/generated/parser.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/summary/format.dart';
-import 'package:analyzer/src/summary/idl.dart';
import 'package:analyzer/src/summary/summarize_elements.dart';
-import 'package:analyzer/src/test_utilities/mock_sdk.dart';
import 'resynthesize_common.dart';
@@ -83,40 +81,3 @@
PackageBundleAssembler bundleAssembler = new PackageBundleAssembler();
}
-
-/// [SerializedMockSdk] is a singleton class representing the result of
-/// serializing the mock SDK to summaries. It is computed once and then shared
-/// among test invocations so that we don't bog down the tests.
-///
-/// Note: should an exception occur during computation of [instance], it will
-/// silently be set to null to allow other tests to complete quickly.
-class SerializedMockSdk {
- static final SerializedMockSdk instance = _serializeMockSdk();
-
- final Map<String, UnlinkedUnit> uriToUnlinkedUnit;
-
- final Map<String, LinkedLibrary> uriToLinkedLibrary;
-
- SerializedMockSdk._(this.uriToUnlinkedUnit, this.uriToLinkedLibrary);
-
- static SerializedMockSdk _serializeMockSdk() {
- try {
- Map<String, UnlinkedUnit> uriToUnlinkedUnit = <String, UnlinkedUnit>{};
- Map<String, LinkedLibrary> uriToLinkedLibrary = <String, LinkedLibrary>{};
- var resourceProvider = new MemoryResourceProvider();
- PackageBundle bundle =
- new MockSdk(resourceProvider: resourceProvider).getLinkedBundle();
- for (int i = 0; i < bundle.unlinkedUnitUris.length; i++) {
- String uri = bundle.unlinkedUnitUris[i];
- uriToUnlinkedUnit[uri] = bundle.unlinkedUnits[i];
- }
- for (int i = 0; i < bundle.linkedLibraryUris.length; i++) {
- String uri = bundle.linkedLibraryUris[i];
- uriToLinkedLibrary[uri] = bundle.linkedLibraries[i];
- }
- return new SerializedMockSdk._(uriToUnlinkedUnit, uriToLinkedLibrary);
- } catch (_) {
- return null;
- }
- }
-}
diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart
index 6948841..50455ea 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -3825,10 +3825,10 @@
/*info:DYNAMIC_INVOKE,error:UNDEFINED_OPERATOR*/-c;
/*info:DYNAMIC_INVOKE*/c /*error:UNDEFINED_OPERATOR*/+ 7;
/*info:DYNAMIC_INVOKE*/c /*error:UNDEFINED_OPERATOR*/[7];
- /*error:INVOCATION_OF_NON_FUNCTION,info:DYNAMIC_INVOKE*/c();
+ /*error:INVOCATION_OF_NON_FUNCTION_EXPRESSION,info:DYNAMIC_INVOKE*/c();
F f = new F();
- /*error:INVOCATION_OF_NON_FUNCTION,info:DYNAMIC_INVOKE*/f();
+ /*error:INVOCATION_OF_NON_FUNCTION_EXPRESSION,info:DYNAMIC_INVOKE*/f();
}
''');
}
diff --git a/pkg/analyzer/tool/summary/inspect.dart b/pkg/analyzer/tool/summary/inspect.dart
deleted file mode 100644
index b968118..0000000
--- a/pkg/analyzer/tool/summary/inspect.dart
+++ /dev/null
@@ -1,458 +0,0 @@
-// Copyright (c) 2016, 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';
-import 'dart:io';
-import 'dart:mirrors';
-
-import 'package:analyzer/src/generated/utilities_dart.dart';
-import 'package:analyzer/src/summary/base.dart';
-import 'package:analyzer/src/summary/format.dart';
-import 'package:analyzer/src/summary/idl.dart';
-import 'package:args/args.dart';
-
-main(List<String> args) {
- ArgParser argParser = new ArgParser()..addFlag('raw');
- ArgResults argResults = argParser.parse(args);
- if (argResults.rest.length != 1) {
- print(argParser.usage);
- exitCode = 1;
- return;
- }
- String path = argResults.rest[0];
- List<int> bytes = new File(path).readAsBytesSync();
- PackageBundle bundle = new PackageBundle.fromBuffer(bytes);
- SummaryInspector inspector = new SummaryInspector(argResults['raw']);
- print(inspector.dumpPackageBundle(bundle).join('\n'));
-}
-
-const int MAX_LINE_LENGTH = 80;
-
-/**
- * Cache used to speed up [isEnum].
- */
-Map<Type, bool> _isEnumCache = <Type, bool>{};
-
-/**
- * Determine if the given [obj] has an enumerated type.
- */
-bool isEnum(Object obj) {
- return _isEnumCache.putIfAbsent(
- obj.runtimeType, () => reflect(obj).type.isEnum);
-}
-
-/**
- * Decoded reprensentation of a part of a summary that occupies multiple lines
- * of output.
- */
-class BrokenEntity implements DecodedEntity {
- final String opener;
- final Map<String, DecodedEntity> parts;
- final String closer;
-
- BrokenEntity(this.opener, this.parts, this.closer);
-
- @override
- List<String> getLines() {
- List<String> result = <String>[opener];
- bool first = true;
- for (String key in parts.keys) {
- if (first) {
- first = false;
- } else {
- result[result.length - 1] += ',';
- }
- List<String> subResult = parts[key].getLines();
- subResult[0] = '$key: ${subResult[0]}';
- result.addAll(subResult.map((String s) => ' $s'));
- }
- result.add(closer);
- return result;
- }
-}
-
-/**
- * Decoded representation of a part of a summary.
- */
-abstract class DecodedEntity {
- /**
- * Create a representation of a part of the summary that consists of a group
- * of entities (represented by [parts]) contained between [opener] and
- * [closer].
- *
- * If [forceKeys] is `true`, the keys in [parts] will always be shown. If
- * [forceKeys] is `false`, they keys will only be shown if the output is
- * broken into multiple lines.
- */
- factory DecodedEntity.group(String opener, Map<String, DecodedEntity> parts,
- String closer, bool forceKeys) {
- // Attempt to format the entity in a single line; if not bail out and
- // construct a _BrokenEntity.
- DecodedEntity bailout() => new BrokenEntity(opener, parts, closer);
- String short = opener;
- bool first = true;
- for (String key in parts.keys) {
- if (first) {
- first = false;
- } else {
- short += ', ';
- }
- DecodedEntity value = parts[key];
- if (forceKeys) {
- short += '$key: ';
- }
- if (value is UnbrokenEntity) {
- short += value._s;
- } else {
- return bailout();
- }
- if (short.length > MAX_LINE_LENGTH) {
- return bailout();
- }
- }
- return new DecodedEntity.short(short + closer);
- }
-
- /**
- * Create a representation of a part of the summary that is represented by a
- * single unbroken string.
- */
- factory DecodedEntity.short(String s) = UnbrokenEntity;
-
- /**
- * Format this entity into a sequence of strings (one per output line).
- */
- List<String> getLines();
-}
-
-/**
- * Wrapper around a [LinkedLibrary] and its constituent [UnlinkedUnit]s.
- */
-class LibraryWrapper {
- final LinkedLibrary _linked;
- final List<UnlinkedUnit> _unlinked;
-
- LibraryWrapper(this._linked, this._unlinked);
-}
-
-/**
- * Wrapper around a [LinkedReference] and its corresponding [UnlinkedReference].
- */
-class ReferenceWrapper {
- final LinkedReference _linked;
- final UnlinkedReference _unlinked;
-
- ReferenceWrapper(this._linked, this._unlinked);
-
- String get name {
- if (_linked != null && _linked.name.isNotEmpty) {
- return _linked.name;
- } else if (_unlinked != null && _unlinked.name.isNotEmpty) {
- return _unlinked.name;
- } else {
- return '???';
- }
- }
-}
-
-/**
- * Instances of [SummaryInspector] are capable of traversing a summary and
- * converting it to semi-human-readable output.
- */
-class SummaryInspector {
- /**
- * The dependencies of the library currently being visited.
- */
- List<LinkedDependency> _dependencies;
-
- /**
- * The references of the unit currently being visited.
- */
- List<ReferenceWrapper> _references;
-
- /**
- * Indicates whether summary inspection should operate in "raw" mode. In this
- * mode, the structure of the summary file is not altered for easier
- * readability; everything is output in exactly the form in which it appears
- * in the file.
- */
- final bool raw;
-
- SummaryInspector(this.raw);
-
- /**
- * Decode the object [obj], which was reached by examining [key] inside
- * another object.
- */
- DecodedEntity decode(Object obj, String key) {
- if (!raw && obj is PackageBundle) {
- return decodePackageBundle(obj);
- }
- if (obj is LibraryWrapper) {
- return decodeLibrary(obj);
- }
- if (obj is UnitWrapper) {
- return decodeUnit(obj);
- }
- if (obj is ReferenceWrapper) {
- return decodeReference(obj);
- }
- if (obj is DecodedEntity) {
- return obj;
- }
- if (obj is SummaryClass) {
- Map<String, Object> map = obj.toMap();
- return decodeMap(map);
- } else if (obj is List) {
- Map<String, DecodedEntity> parts = <String, DecodedEntity>{};
- for (int i = 0; i < obj.length; i++) {
- parts[i.toString()] = decode(obj[i], key);
- }
- return new DecodedEntity.group('[', parts, ']', false);
- } else if (obj is String) {
- return new DecodedEntity.short(json.encode(obj));
- } else if (isEnum(obj)) {
- return new DecodedEntity.short(obj.toString().split('.')[1]);
- } else if (obj is int &&
- key == 'dependency' &&
- _dependencies != null &&
- obj < _dependencies.length) {
- return new DecodedEntity.short('$obj (${_dependencies[obj].uri})');
- } else if (obj is int &&
- key == 'reference' &&
- _references != null &&
- obj < _references.length) {
- return new DecodedEntity.short('$obj (${_references[obj].name})');
- } else {
- return new DecodedEntity.short(obj.toString());
- }
- }
-
- /**
- * Decode the given [LibraryWrapper].
- */
- DecodedEntity decodeLibrary(LibraryWrapper obj) {
- try {
- LinkedLibrary linked = obj._linked;
- List<UnlinkedUnit> unlinked = obj._unlinked;
- _dependencies = linked.dependencies;
- Map<String, Object> result = linked.toMap();
- result.remove('units');
- result['defining compilation unit'] =
- new UnitWrapper(linked.units[0], unlinked[0]);
- for (int i = 1; i < linked.units.length; i++) {
- String partUri = unlinked[0].publicNamespace.parts[i - 1];
- result['part ${json.encode(partUri)}'] =
- new UnitWrapper(linked.units[i], unlinked[i]);
- }
- return decodeMap(result);
- } finally {
- _dependencies = null;
- }
- }
-
- /**
- * Decode the given [map].
- */
- DecodedEntity decodeMap(Map<String, Object> map) {
- Map<String, DecodedEntity> parts = <String, DecodedEntity>{};
- map = reorderMap(map);
- map.forEach((String key, Object value) {
- if (value is String && value.isEmpty) {
- return;
- }
- if (isEnum(value) && (value as dynamic).index == 0) {
- return;
- }
- if (value is int && value == 0) {
- return;
- }
- if (value is bool && value == false) {
- return;
- }
- if (value == null) {
- return;
- }
- if (value is List) {
- if (value.isEmpty) {
- return;
- }
- DecodedEntity entity = decode(value, key);
- if (entity is BrokenEntity) {
- for (int i = 0; i < value.length; i++) {
- parts['$key[$i]'] = decode(value[i], key);
- }
- return;
- } else {
- parts[key] = entity;
- }
- }
- parts[key] = decode(value, key);
- });
- return new DecodedEntity.group('{', parts, '}', true);
- }
-
- /**
- * Decode the given [PackageBundle].
- */
- DecodedEntity decodePackageBundle(PackageBundle bundle) {
- Map<String, UnlinkedUnit> units = <String, UnlinkedUnit>{};
- Set<String> seenUnits = new Set<String>();
- for (int i = 0; i < bundle.unlinkedUnits.length; i++) {
- units[bundle.unlinkedUnitUris[i]] = bundle.unlinkedUnits[i];
- }
- Map<String, Object> restOfMap = bundle.toMap();
- Map<String, Object> result = <String, Object>{};
- result['version'] = new DecodedEntity.short(
- '${bundle.majorVersion}.${bundle.minorVersion}');
- restOfMap.remove('majorVersion');
- restOfMap.remove('minorVersion');
- result['linkedLibraryUris'] = restOfMap['linkedLibraryUris'];
- result['unlinkedUnitUris'] = restOfMap['unlinkedUnitUris'];
- for (int i = 0; i < bundle.linkedLibraries.length; i++) {
- String libraryUriString = bundle.linkedLibraryUris[i];
- Uri libraryUri = Uri.parse(libraryUriString);
- UnlinkedUnit unlinkedDefiningUnit = units[libraryUriString];
- seenUnits.add(libraryUriString);
- List<UnlinkedUnit> libraryUnits = <UnlinkedUnit>[unlinkedDefiningUnit];
- LinkedLibrary linkedLibrary = bundle.linkedLibraries[i];
- for (int j = 1; j < linkedLibrary.units.length; j++) {
- String partUriString = resolveRelativeUri(libraryUri,
- Uri.parse(unlinkedDefiningUnit.publicNamespace.parts[j - 1]))
- .toString();
- libraryUnits.add(units[partUriString]);
- seenUnits.add(partUriString);
- }
- result['library ${json.encode(libraryUriString)}'] =
- new LibraryWrapper(linkedLibrary, libraryUnits);
- }
- for (String uriString in units.keys) {
- if (seenUnits.contains(uriString)) {
- continue;
- }
- result['orphan unit ${json.encode(uriString)}'] =
- new UnitWrapper(null, units[uriString]);
- }
- restOfMap.remove('linkedLibraries');
- restOfMap.remove('linkedLibraryUris');
- restOfMap.remove('unlinkedUnits');
- restOfMap.remove('unlinkedUnitUris');
- result.addAll(restOfMap);
- return decodeMap(result);
- }
-
- /**
- * Decode the given [ReferenceWrapper].
- */
- DecodedEntity decodeReference(ReferenceWrapper obj) {
- Map<String, Object> result = obj._unlinked != null
- ? obj._unlinked.toMap()
- : <String, Object>{'linkedOnly': true};
- if (obj._linked != null) {
- mergeMaps(result, obj._linked.toMap());
- }
- return decodeMap(result);
- }
-
- /**
- * Decode the given [UnitWrapper].
- */
- DecodedEntity decodeUnit(UnitWrapper obj) {
- try {
- LinkedUnit linked = obj._linked;
- UnlinkedUnit unlinked = obj._unlinked ?? new UnlinkedUnitBuilder();
- Map<String, Object> unlinkedMap = unlinked.toMap();
- Map<String, Object> linkedMap =
- linked != null ? linked.toMap() : <String, Object>{};
- Map<String, Object> result = <String, Object>{};
- List<ReferenceWrapper> references = <ReferenceWrapper>[];
- int numReferences = linked != null
- ? linked.references.length
- : unlinked.references.length;
- for (int i = 0; i < numReferences; i++) {
- references.add(new ReferenceWrapper(
- linked != null ? linked.references[i] : null,
- i < unlinked.references.length ? unlinked.references[i] : null));
- }
- result['references'] = references;
- _references = references;
- unlinkedMap.remove('references');
- linkedMap.remove('references');
- linkedMap.forEach((String key, Object value) {
- result['linked $key'] = value;
- });
- unlinkedMap.forEach((String key, Object value) {
- result[key] = value;
- });
- return decodeMap(result);
- } finally {
- _references = null;
- }
- }
-
- /**
- * Decode the given [PackageBundle] and dump it to a list of strings.
- */
- List<String> dumpPackageBundle(PackageBundle bundle) {
- DecodedEntity decoded = decode(bundle, 'PackageBundle');
- return decoded.getLines();
- }
-
- /**
- * Merge the contents of [other] into [result], discarding empty entries.
- */
- void mergeMaps(Map<String, Object> result, Map<String, Object> other) {
- other.forEach((String key, Object value) {
- if (value is String && value.isEmpty) {
- return;
- }
- if (result.containsKey(key)) {
- Object oldValue = result[key];
- if (oldValue is String && oldValue.isEmpty) {
- result[key] = value;
- } else {
- throw new Exception(
- 'Duplicate values for $key: $oldValue and $value');
- }
- } else {
- result[key] = value;
- }
- });
- }
-
- /**
- * Reorder [map] for more intuitive display.
- */
- Map<String, Object> reorderMap(Map<String, Object> map) {
- Map<String, Object> result = <String, Object>{};
- if (map.containsKey('name')) {
- result['name'] = map['name'];
- }
- result.addAll(map);
- return result;
- }
-}
-
-/**
- * Decoded reprensentation of a part of a summary that occupies a single line of
- * output.
- */
-class UnbrokenEntity implements DecodedEntity {
- final String _s;
-
- UnbrokenEntity(this._s);
-
- @override
- List<String> getLines() => <String>[_s];
-}
-
-/**
- * Wrapper around a [LinkedUnit] and its corresponding [UnlinkedUnit].
- */
-class UnitWrapper {
- final LinkedUnit _linked;
- final UnlinkedUnit _unlinked;
-
- UnitWrapper(this._linked, this._unlinked);
-}
diff --git a/pkg/analyzer_cli/lib/src/build_mode.dart b/pkg/analyzer_cli/lib/src/build_mode.dart
index 57bedb4..2927eae 100644
--- a/pkg/analyzer_cli/lib/src/build_mode.dart
+++ b/pkg/analyzer_cli/lib/src/build_mode.dart
@@ -408,29 +408,10 @@
return bundle;
}
- int numInputs = options.buildSummaryInputs.length +
- options.buildSummaryUnlinkedInputs.length;
+ int numInputs = options.buildSummaryInputs.length;
logger.run('Add $numInputs input summaries', () {
for (var path in options.buildSummaryInputs) {
- var bundle = addBundle(path);
- if (bundle.linkedLibraryUris.isEmpty &&
- bundle.unlinkedUnitUris.isNotEmpty) {
- throw new ArgumentError(
- 'Got an unlinked summary for --build-summary-input at `$path`. '
- 'Unlinked summaries should be provided with the '
- '--build-summary-unlinked-input argument.');
- }
- }
-
- for (var path in options.buildSummaryUnlinkedInputs) {
- var bundle = addBundle(path);
- unlinkedBundles.add(bundle);
- if (bundle.linkedLibraryUris.isNotEmpty) {
- throw new ArgumentError(
- 'Got a linked summary for --build-summary-input-unlinked at `$path`'
- '. Linked bundles should be provided with the '
- '--build-summary-input argument.');
- }
+ addBundle(path);
}
});
@@ -538,10 +519,6 @@
* If the unit is in the input [summaryDataStore], do nothing.
*/
Future<void> _prepareUnit(String absoluteUri) async {
- // Maybe an input package contains the source.
- if (summaryDataStore.unlinkedMap[absoluteUri] != null) {
- return;
- }
// Parse the source and serialize its AST.
Uri uri = Uri.parse(absoluteUri);
Source source = sourceFactory.forUri2(uri);
diff --git a/pkg/analyzer_cli/lib/src/options.dart b/pkg/analyzer_cli/lib/src/options.dart
index 931c9ad..4aa34fc 100644
--- a/pkg/analyzer_cli/lib/src/options.dart
+++ b/pkg/analyzer_cli/lib/src/options.dart
@@ -48,16 +48,9 @@
/// List of summary file paths to use in build mode.
final List<String> buildSummaryInputs;
- /// List of unlinked summary file paths to use in build mode.
- final List<String> buildSummaryUnlinkedInputs;
-
/// Whether to skip analysis when creating summaries in build mode.
final bool buildSummaryOnly;
- /// Whether to only produce unlinked summaries instead of linked summaries.
- /// Must be used in combination with `buildSummaryOnly`.
- final bool buildSummaryOnlyUnlinked;
-
/// The path to output the summary when creating summaries in build mode.
final String buildSummaryOutput;
@@ -161,10 +154,7 @@
buildModePersistentWorker = cast(args['persistent_worker']),
buildSummaryInputs =
(args['build-summary-input'] as List).cast<String>(),
- buildSummaryUnlinkedInputs =
- (args['build-summary-unlinked-input'] as List).cast<String>(),
buildSummaryOnly = cast(args['build-summary-only']),
- buildSummaryOnlyUnlinked = cast(args['build-summary-only-unlinked']),
buildSummaryOutput = cast(args['build-summary-output']),
buildSummaryOutputSemantic =
cast(args['build-summary-output-semantic']),
@@ -268,11 +258,6 @@
return null; // Only reachable in testing.
}
- if (options.buildSummaryOnlyUnlinked) {
- printAndFail('The option --build-summary-only-unlinked is deprecated.');
- return null; // Only reachable in testing.
- }
-
return options;
}
@@ -370,10 +355,6 @@
help: 'Path to a linked summary file that contains information from '
'a previous analysis run; may be specified multiple times.',
hide: hide)
- ..addMultiOption('build-summary-unlinked-input',
- help: 'Path to an unlinked summary file that contains information '
- 'from a previous analysis run; may be specified multiple times.',
- hide: hide)
..addOption('build-summary-output',
help: 'Specifies the path to the file where the full summary '
'information should be written.',
@@ -387,11 +368,6 @@
defaultsTo: false,
negatable: false,
hide: hide)
- ..addFlag('build-summary-only-unlinked',
- help: 'Only output the unlinked summary.',
- defaultsTo: false,
- negatable: false,
- hide: hide)
..addFlag('build-suppress-exit-code',
help: 'Exit with code 0 even if errors are found.',
defaultsTo: false,
diff --git a/pkg/analyzer_cli/test/options_test.dart b/pkg/analyzer_cli/test/options_test.dart
index 040710e..489ff5e 100644
--- a/pkg/analyzer_cli/test/options_test.dart
+++ b/pkg/analyzer_cli/test/options_test.dart
@@ -52,7 +52,6 @@
expect(options.buildAnalysisOutput, isNull);
expect(options.buildSummaryInputs, isEmpty);
expect(options.buildSummaryOnly, isFalse);
- expect(options.buildSummaryOnlyUnlinked, isFalse);
expect(options.buildSummaryOutput, isNull);
expect(options.buildSummaryOutputSemantic, isNull);
expect(options.buildSuppressExitCode, isFalse);
@@ -410,22 +409,6 @@
expect(options.buildSummaryOnly, isTrue);
}
- test_buildSummaryOnlyUnlinked() {
- _parse([
- '--build-mode',
- '--build-summary-output=/path/to/aaa.sum',
- '--build-summary-only',
- '--build-summary-only-unlinked',
- 'package:p/foo.dart|/path/to/p/lib/foo.dart'
- ]);
- expect(
- errorStringBuffer.toString(),
- contains(
- 'The option --build-summary-only-unlinked is deprecated.',
- ),
- );
- }
-
test_buildSummaryOutput() {
_parse([
'--build-mode',
diff --git a/pkg/compiler/lib/src/kernel/dart2js_target.dart b/pkg/compiler/lib/src/kernel/dart2js_target.dart
index cd8c5b9..48f1dcb 100644
--- a/pkg/compiler/lib/src/kernel/dart2js_target.dart
+++ b/pkg/compiler/lib/src/kernel/dart2js_target.dart
@@ -151,7 +151,6 @@
// compile-platform should just specify which libraries to compile instead.
const _requiredLibraries = const <String, List<String>>{
'dart2js': const <String>[
- 'dart:_chrome',
'dart:_foreign_helper',
'dart:_interceptors',
'dart:_internal',
diff --git a/pkg/dev_compiler/lib/src/analyzer/driver.dart b/pkg/dev_compiler/lib/src/analyzer/driver.dart
index ad3e479..01bd34e 100644
--- a/pkg/dev_compiler/lib/src/analyzer/driver.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/driver.dart
@@ -71,10 +71,8 @@
var dartSdk = contextBuilder.findSdk(null, analysisOptions);
// Read the summaries.
- summaryData ??= SummaryDataStore(summaryPaths,
- resourceProvider: resourceProvider,
- // TODO(vsm): Reset this to true once we cleanup internal build rules.
- disallowOverlappingSummaries: false);
+ summaryData ??=
+ SummaryDataStore(summaryPaths, resourceProvider: resourceProvider);
return CompilerAnalysisDriver._(dartSdk, summaryPaths, summaryData,
analysisOptions, resourceProvider, options.dartSdkSummaryPath);
diff --git a/pkg/front_end/lib/src/fasta/flow_analysis/flow_analysis.dart b/pkg/front_end/lib/src/fasta/flow_analysis/flow_analysis.dart
index 765b78e..a2b1c4d 100644
--- a/pkg/front_end/lib/src/fasta/flow_analysis/flow_analysis.dart
+++ b/pkg/front_end/lib/src/fasta/flow_analysis/flow_analysis.dart
@@ -33,10 +33,6 @@
/// write is captured by a local function or closure inside that node.
final Map<Node, Set<Variable>> _capturedInNode = {};
- /// Set of local variables for which a potential write is captured by a local
- /// function or closure anywhere in the code being analyzed.
- final Set<Variable> _capturedAnywhere = {};
-
/// Stack of sets accumulating variables that are potentially written to.
///
/// A set is pushed onto the stack when a node is entered, and popped when
@@ -62,10 +58,6 @@
AssignedVariables();
- /// Queries the set of variables for which a potential write is captured by a
- /// local function or closure anywhere in the code being analyzed.
- Set<Variable> get capturedAnywhere => _capturedAnywhere;
-
/// This method should be called during pre-traversal, to mark the start of a
/// loop statement, switch statement, try statement, loop collection element,
/// local function, or closure which might need to be queried later.
@@ -114,7 +106,6 @@
_writtenStack[i].add(variable);
}
if (_closureIndexStack.isNotEmpty) {
- _capturedAnywhere.add(variable);
int closureIndex = _closureIndexStack.last;
for (int i = 0; i < closureIndex; ++i) {
_capturedStack[i].add(variable);
diff --git a/pkg/front_end/pubspec.yaml b/pkg/front_end/pubspec.yaml
index 83a7f7d..496a779 100644
--- a/pkg/front_end/pubspec.yaml
+++ b/pkg/front_end/pubspec.yaml
@@ -1,18 +1,18 @@
name: front_end
# Currently, front_end API is not stable and users should not
# depend on semver semantics when depending on this package.
-version: 0.1.26
+version: 0.1.27
author: Dart Team <misc@dartlang.org>
description: Front end for compilation of Dart code.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/front_end
environment:
sdk: '>=2.2.2 <3.0.0'
dependencies:
- kernel: 0.3.26
+ kernel: 0.3.27
package_config: '^1.1.0'
meta: ^1.0.2
dev_dependencies:
- analyzer: 0.38.4
+ analyzer: 0.38.5
args: '>=0.13.0 <2.0.0'
build_integration:
path: ../build_integration
diff --git a/pkg/front_end/test/fasta/flow_analysis/assigned_variables_test.dart b/pkg/front_end/test/fasta/flow_analysis/assigned_variables_test.dart
index 887559e..5a79729 100644
--- a/pkg/front_end/test/fasta/flow_analysis/assigned_variables_test.dart
+++ b/pkg/front_end/test/fasta/flow_analysis/assigned_variables_test.dart
@@ -6,19 +6,6 @@
import 'package:test/test.dart';
main() {
- test('capturedAnywhere records assignments in closures', () {
- var assignedVariables = AssignedVariables<_Node, _Variable>();
- var v1 = _Variable('v1');
- var v2 = _Variable('v2');
- var v3 = _Variable('v3');
- assignedVariables.write(v1);
- assignedVariables.beginNode(isClosure: true);
- assignedVariables.write(v2);
- assignedVariables.endNode(_Node(), isClosure: true);
- assignedVariables.write(v3);
- expect(assignedVariables.capturedAnywhere, {v2});
- });
-
test('writtenInNode ignores assignments outside the node', () {
var assignedVariables = AssignedVariables<_Node, _Variable>();
var v1 = _Variable('v1');
diff --git a/pkg/frontend_server/LICENSE b/pkg/frontend_server/LICENSE
new file mode 100644
index 0000000..f75d7c2
--- /dev/null
+++ b/pkg/frontend_server/LICENSE
@@ -0,0 +1,26 @@
+Copyright 2019, the Dart project authors. All rights reserved.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of Google Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/pkg/vm/bin/frontend_server_starter.dart b/pkg/frontend_server/bin/frontend_server_starter.dart
similarity index 100%
rename from pkg/vm/bin/frontend_server_starter.dart
rename to pkg/frontend_server/bin/frontend_server_starter.dart
diff --git a/pkg/vm/lib/frontend_server.dart b/pkg/frontend_server/lib/frontend_server.dart
similarity index 98%
rename from pkg/vm/lib/frontend_server.dart
rename to pkg/frontend_server/lib/frontend_server.dart
index 4329c60..c27f034 100644
--- a/pkg/vm/lib/frontend_server.dart
+++ b/pkg/frontend_server/lib/frontend_server.dart
@@ -60,7 +60,7 @@
..addFlag('aot',
help: 'Run compiler in AOT mode (enables whole-program transformations)',
defaultsTo: false)
- // TODO(alexmarkov): Cleanup uses in Flutter and remove these obsolete flags.
+// TODO(alexmarkov): Cleanup uses in Flutter and remove these obsolete flags.
..addFlag('strong', help: 'Obsolete', defaultsTo: true)
..addFlag('tfa',
help:
@@ -133,7 +133,7 @@
allowed: BytecodeOptions.commandLineFlags.keys,
allowedHelp: BytecodeOptions.commandLineFlags)
..addFlag('drop-ast',
- help: 'Include only bytecode into the output file', defaultsTo: false)
+ help: 'Include only bytecode into the output file', defaultsTo: true)
..addFlag('enable-asserts',
help: 'Whether asserts will be enabled.', defaultsTo: false)
..addMultiOption('enable-experiment',
@@ -398,14 +398,12 @@
sdkRoot.resolve(platformKernelDill)
];
}
+ // No bytecode at this step. Bytecode is generated later in _writePackage.
final results = await _runWithPrintRedirection(() => compileToKernel(
_mainSource, compilerOptions,
aot: options['aot'],
useGlobalTypeFlowAnalysis: options['tfa'],
environmentDefines: environmentDefines,
- genBytecode: compilerOptions.bytecode,
- bytecodeOptions: bytecodeOptions,
- dropAST: options['drop-ast'],
useProtobufTreeShaker: options['protobuf-tree-shaker']));
component = results.component;
compiledSources = results.compiledSources;
@@ -505,7 +503,10 @@
}
{
- // Generate AST as a cache.
+ // Generate AST as a cache. This goes to [_initializeFromDill] instead
+ // of [filename] so that a later invocation of frontend_server will the
+ // same arguments will use this to initialize its incremental kernel
+ // compiler.
final repository = new BinaryCacheMetadataRepository();
component.addMetadataRepository(repository);
for (var lib in component.libraries) {
@@ -515,7 +516,7 @@
}
}
- final IOSink sink = new File(filename + ".ast").openWrite();
+ final IOSink sink = new File(_initializeFromDill).openWrite();
final BinaryPrinter printer = filterExternal
? new LimitedBinaryPrinter(
sink, (lib) => !lib.isExternal, true /* excludeUriToSource */)
@@ -622,8 +623,8 @@
generateBytecode(partComponent,
options: _bytecodeOptions,
libraries: libraries,
- coreTypes: _generator.getCoreTypes(),
- hierarchy: _generator.getClassHierarchy());
+ coreTypes: _generator?.getCoreTypes(),
+ hierarchy: _generator?.getClassHierarchy());
if (_options['drop-ast']) {
partComponent = createFreshComponentWithBytecode(partComponent);
diff --git a/pkg/frontend_server/pubspec.yaml b/pkg/frontend_server/pubspec.yaml
new file mode 100644
index 0000000..35e2ecf
--- /dev/null
+++ b/pkg/frontend_server/pubspec.yaml
@@ -0,0 +1,13 @@
+# This package is not intended to be published.
+name: frontend_server
+# version: do-not-upload
+description: A resident kernel compiler
+
+dependencies:
+ build_integration:
+ path: ../build_integration
+ vm:
+ path: ../vm
+ front_end: ^0.1.6
+ kernel: ^0.3.6
+ args: ^1.4.4
diff --git a/pkg/vm/test/frontend_server_flutter.dart b/pkg/frontend_server/test/frontend_server_flutter.dart
similarity index 100%
rename from pkg/vm/test/frontend_server_flutter.dart
rename to pkg/frontend_server/test/frontend_server_flutter.dart
diff --git a/pkg/vm/test/frontend_server_test.dart b/pkg/frontend_server/test/frontend_server_test.dart
similarity index 100%
rename from pkg/vm/test/frontend_server_test.dart
rename to pkg/frontend_server/test/frontend_server_test.dart
diff --git a/pkg/kernel/pubspec.yaml b/pkg/kernel/pubspec.yaml
index f190364..51765de 100644
--- a/pkg/kernel/pubspec.yaml
+++ b/pkg/kernel/pubspec.yaml
@@ -1,7 +1,7 @@
name: kernel
# Currently, kernel API is not stable and users should
# not depend on semver semantics when depending on this package.
-version: 0.3.26
+version: 0.3.27
author: Dart Team <misc@dartlang.org>
description: Dart IR (Intermediate Representation)
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/kernel
diff --git a/pkg/nnbd_migration/lib/nnbd_migration.dart b/pkg/nnbd_migration/lib/nnbd_migration.dart
index f200e92..145054a 100644
--- a/pkg/nnbd_migration/lib/nnbd_migration.dart
+++ b/pkg/nnbd_migration/lib/nnbd_migration.dart
@@ -12,14 +12,20 @@
/// Description of fixes that might be performed by nullability migration.
class NullabilityFixDescription {
- /// An if-test or conditional expression needs to have its "then" branch
- /// discarded.
+ /// An if-test or conditional expression needs to have its condition and
+ /// "then" branch discarded.
static const discardThen = const NullabilityFixDescription._(
appliedMessage: 'Discarded an unreachable conditional then branch',
);
- /// An if-test or conditional expression needs to have its "else" branch
+ /// An if-test or conditional expression needs to have its condition
/// discarded.
+ static const discardCondition = const NullabilityFixDescription._(
+ appliedMessage: 'Discarded a condition which is always true',
+ );
+
+ /// An if-test or conditional expression needs to have its condition and
+ /// "else" branch discarded.
static const discardElse = const NullabilityFixDescription._(
appliedMessage: 'Discarded an unreachable conditional else branch',
);
diff --git a/pkg/nnbd_migration/lib/src/edge_builder.dart b/pkg/nnbd_migration/lib/src/edge_builder.dart
index 239a4ae..2952664 100644
--- a/pkg/nnbd_migration/lib/src/edge_builder.dart
+++ b/pkg/nnbd_migration/lib/src/edge_builder.dart
@@ -1643,8 +1643,9 @@
destination: _notNullType,
hard: _postDominatedLocals
.isReferenceInScope(destinationExpression));
- DecoratedType compoundOperatorType =
- getOrComputeElementType(compoundOperatorMethod);
+ DecoratedType compoundOperatorType = getOrComputeElementType(
+ compoundOperatorMethod,
+ targetType: destinationType);
assert(compoundOperatorType.positionalParameters.length > 0);
_checkAssignment(edgeOrigin,
source: sourceType,
diff --git a/pkg/nnbd_migration/lib/src/fix_builder.dart b/pkg/nnbd_migration/lib/src/fix_builder.dart
index 272fe5d..af058ad 100644
--- a/pkg/nnbd_migration/lib/src/fix_builder.dart
+++ b/pkg/nnbd_migration/lib/src/fix_builder.dart
@@ -19,6 +19,48 @@
import 'package:nnbd_migration/src/decorated_class_hierarchy.dart';
import 'package:nnbd_migration/src/variables.dart';
+/// Information about the target of an assignment expression analyzed by
+/// [FixBuilder].
+class AssignmentTargetInfo {
+ /// The type that the assignment target has when read. This is only relevant
+ /// for compound assignments (since they both read and write the assignment
+ /// target)
+ final DartType readType;
+
+ /// The type that the assignment target has when written to.
+ final DartType writeType;
+
+ AssignmentTargetInfo(this.readType, this.writeType);
+}
+
+/// Problem reported by [FixBuilder] when encountering a compound assignment
+/// for which the combination result is nullable. This occurs if the compound
+/// assignment resolves to a user-defined operator that returns a nullable type,
+/// but the target of the assignment expects a non-nullable type. We need to
+/// add a null check but it's nontrivial to do so because we would have to
+/// rewrite the assignment as an ordinary assignment (e.g. change `x += y` to
+/// `x = (x + y)!`), but that might change semantics by causing subexpressions
+/// of the target to be evaluated twice.
+///
+/// TODO(paulberry): consider alternatives.
+/// See https://github.com/dart-lang/sdk/issues/38675.
+class CompoundAssignmentCombinedNullable implements Problem {
+ const CompoundAssignmentCombinedNullable();
+}
+
+/// Problem reported by [FixBuilder] when encountering a compound assignment
+/// for which the value read from the target of the assignment has a nullable
+/// type. We need to add a null check but it's nontrivial to do so because we
+/// would have to rewrite the assignment as an ordinary assignment (e.g. change
+/// `x += y` to `x = x! + y`), but that might change semantics by causing
+/// subexpressions of the target to be evaluated twice.
+///
+/// TODO(paulberry): consider alternatives.
+/// See https://github.com/dart-lang/sdk/issues/38676.
+class CompoundAssignmentReadNullable implements Problem {
+ const CompoundAssignmentReadNullable();
+}
+
/// This class visits the AST of code being migrated, after graph propagation,
/// to figure out what changes need to be made to the code. It doesn't actually
/// make the changes; it simply reports what changes are necessary through
@@ -58,6 +100,9 @@
/// inserted.
void addNullCheck(Expression subexpression);
+ /// Called whenever code is found that can't be automatically fixed.
+ void addProblem(AstNode node, Problem problem);
+
/// Initializes flow analysis for a function node.
void createFlowAnalysis(AstNode node) {
assert(_flowAnalysis == null);
@@ -71,6 +116,61 @@
}
@override
+ DartType visitAssignmentExpression(AssignmentExpression node) {
+ var targetInfo = visitAssignmentTarget(node.leftHandSide);
+ if (node.operator.type == TokenType.EQ) {
+ return visitSubexpression(node.rightHandSide, targetInfo.writeType);
+ } else if (node.operator.type == TokenType.QUESTION_QUESTION_EQ) {
+ // TODO(paulberry): if targetInfo.readType is non-nullable, then the
+ // assignment is dead code.
+ // See https://github.com/dart-lang/sdk/issues/38678
+ // TODO(paulberry): once flow analysis supports `??=`, integrate it here.
+ // See https://github.com/dart-lang/sdk/issues/38680
+ var rhsType =
+ visitSubexpression(node.rightHandSide, targetInfo.writeType);
+ return _typeSystem.leastUpperBound(
+ _typeSystem.promoteToNonNull(targetInfo.readType as TypeImpl),
+ rhsType);
+ } else {
+ var combiner = node.staticElement;
+ DartType combinedType;
+ if (combiner == null) {
+ visitSubexpression(node.rightHandSide, _typeProvider.dynamicType);
+ combinedType = _typeProvider.dynamicType;
+ } else {
+ if (_typeSystem.isNullable(targetInfo.readType)) {
+ addProblem(node, const CompoundAssignmentReadNullable());
+ }
+ var combinerType = _computeMigratedType(combiner) as FunctionType;
+ visitSubexpression(node.rightHandSide, combinerType.parameters[0].type);
+ combinedType =
+ _fixNumericTypes(combinerType.returnType, node.staticType);
+ }
+ if (_doesAssignmentNeedCheck(
+ from: combinedType, to: targetInfo.writeType)) {
+ addProblem(node, const CompoundAssignmentCombinedNullable());
+ combinedType = _typeSystem.promoteToNonNull(combinedType as TypeImpl);
+ }
+ return combinedType;
+ }
+ }
+
+ /// Recursively visits an assignment target, returning information about the
+ /// target's read and write types.
+ AssignmentTargetInfo visitAssignmentTarget(Expression node) {
+ if (node is SimpleIdentifier) {
+ var writeType = _computeMigratedType(node.staticElement);
+ var auxiliaryElements = node.auxiliaryElements;
+ var readType = auxiliaryElements == null
+ ? writeType
+ : _computeMigratedType(auxiliaryElements.staticElement);
+ return AssignmentTargetInfo(readType, writeType);
+ } else {
+ throw UnimplementedError('TODO(paulberry)');
+ }
+ }
+
+ @override
DartType visitBinaryExpression(BinaryExpression node) {
var leftOperand = node.leftOperand;
var rightOperand = node.rightOperand;
@@ -101,6 +201,7 @@
// If `a ?? b` is used in a non-nullable context, we don't want to
// migrate it to `(a ?? b)!`. We want to migrate it to `a ?? b!`.
// TODO(paulberry): once flow analysis supports `??`, integrate it here.
+ // See https://github.com/dart-lang/sdk/issues/38680
var leftType = visitSubexpression(node.leftOperand,
_typeSystem.makeNullable(_contextType as TypeImpl));
var rightType = visitSubexpression(node.rightOperand, _contextType);
@@ -152,6 +253,8 @@
@override
DartType visitSimpleIdentifier(SimpleIdentifier node) {
+ assert(!node.inSetterContext(),
+ 'Should use visitAssignmentTarget in setter contexts');
var element = node.staticElement;
if (element == null) return _typeProvider.dynamicType;
if (element is PromotableElement) {
@@ -186,7 +289,6 @@
DartType _computeMigratedType(Element element, {DartType targetType}) {
Element baseElement;
if (element is Member) {
- assert(targetType != null);
baseElement = element.baseElement;
} else {
baseElement = element;
@@ -203,7 +305,7 @@
var functionType = _variables.decoratedElementType(baseElement);
var decoratedType = baseElement.isGetter
? functionType.returnType
- : throw UnimplementedError('TODO(paulberry)');
+ : functionType.positionalParameters[0];
type = decoratedType.toFinalType(_typeProvider);
}
} else {
@@ -252,3 +354,6 @@
}
}
}
+
+/// Common supertype for problems reported by [FixBuilder.addProblem].
+abstract class Problem {}
diff --git a/pkg/nnbd_migration/lib/src/potential_modification.dart b/pkg/nnbd_migration/lib/src/potential_modification.dart
index a36315d..522f58e 100644
--- a/pkg/nnbd_migration/lib/src/potential_modification.dart
+++ b/pkg/nnbd_migration/lib/src/potential_modification.dart
@@ -48,7 +48,9 @@
@override
NullabilityFixDescription get description => discard.keepFalse
? NullabilityFixDescription.discardThen
- : NullabilityFixDescription.discardElse;
+ : (elseStatement == null
+ ? NullabilityFixDescription.discardCondition
+ : NullabilityFixDescription.discardElse);
@override
bool get isEmpty => discard.keepTrue && discard.keepFalse;
diff --git a/pkg/nnbd_migration/test/edge_builder_test.dart b/pkg/nnbd_migration/test/edge_builder_test.dart
index 0959499..a7db1db 100644
--- a/pkg/nnbd_migration/test/edge_builder_test.dart
+++ b/pkg/nnbd_migration/test/edge_builder_test.dart
@@ -641,7 +641,6 @@
assertNullCheck(checkExpression('(y += z)'), fReturnEdge);
}
- @failingTest
test_assignmentExpression_compound_withSubstitution() async {
// Failing due to a side-cast from incorrectly instantiating the operator.
var code = '''
diff --git a/pkg/nnbd_migration/test/fix_builder_test.dart b/pkg/nnbd_migration/test/fix_builder_test.dart
index 820f271..c2096b2 100644
--- a/pkg/nnbd_migration/test/fix_builder_test.dart
+++ b/pkg/nnbd_migration/test/fix_builder_test.dart
@@ -40,6 +40,306 @@
return unit;
}
+ test_assignmentExpression_compound_combined_nullable_noProblem() async {
+ await analyze('''
+abstract class _C {
+ _D/*?*/ operator+(int/*!*/ value);
+}
+abstract class _D extends _C {}
+abstract class _E {
+ _C/*!*/ get x;
+ void set x(_C/*?*/ value);
+ f(int/*!*/ y) => x += y;
+}
+''');
+ visitSubexpression(findNode.assignment('+='), '_D?');
+ }
+
+ test_assignmentExpression_compound_combined_nullable_noProblem_dynamic() async {
+ await analyze('''
+abstract class _E {
+ dynamic get x;
+ void set x(Object/*!*/ value);
+ f(int/*!*/ y) => x += y;
+}
+''');
+ var assignment = findNode.assignment('+=');
+ visitSubexpression(assignment, 'dynamic');
+ }
+
+ test_assignmentExpression_compound_combined_nullable_problem() async {
+ await analyze('''
+abstract class _C {
+ _D/*?*/ operator+(int/*!*/ value);
+}
+abstract class _D extends _C {}
+abstract class _E {
+ _C/*!*/ get x;
+ void set x(_C/*!*/ value);
+ f(int/*!*/ y) => x += y;
+}
+''');
+ var assignment = findNode.assignment('+=');
+ visitSubexpression(assignment, '_D', problems: {
+ assignment: {const CompoundAssignmentCombinedNullable()}
+ });
+ }
+
+ test_assignmentExpression_compound_dynamic() async {
+ // To confirm that the RHS is visited, we check that a null check was
+ // properly inserted into a subexpression of the RHS.
+ await analyze('''
+_f(dynamic x, int/*?*/ y) => x += y + 1;
+''');
+ visitSubexpression(findNode.assignment('+='), 'dynamic',
+ nullChecked: {findNode.simple('y +')});
+ }
+
+ test_assignmentExpression_compound_intRules() async {
+ await analyze('''
+_f(int x, int y) => x += y;
+''');
+ visitSubexpression(findNode.assignment('+='), 'int');
+ }
+
+ test_assignmentExpression_compound_lhs_nullable_problem() async {
+ await analyze('''
+abstract class _C {
+ _D/*!*/ operator+(int/*!*/ value);
+}
+abstract class _D extends _C {}
+abstract class _E {
+ _C/*?*/ get x;
+ void set x(_C/*?*/ value);
+ f(int/*!*/ y) => x += y;
+}
+''');
+ var assignment = findNode.assignment('+=');
+ visitSubexpression(assignment, '_D', problems: {
+ assignment: {const CompoundAssignmentReadNullable()}
+ });
+ }
+
+ test_assignmentExpression_compound_promoted() async {
+ await analyze('''
+f(bool/*?*/ x, bool/*?*/ y) => x != null && (x = y);
+''');
+ // It is ok to assign a nullable value to `x` even though it is promoted to
+ // non-nullable, so `y` should not be null-checked. However, the whole
+ // assignment `x = y` should be null checked because the RHS of `&&` cannot
+ // be nullable.
+ visitSubexpression(findNode.binary('&&'), 'bool',
+ nullChecked: {findNode.parenthesized('x = y')});
+ }
+
+ test_assignmentExpression_compound_rhs_nonNullable() async {
+ await analyze('''
+abstract class _C {
+ _D/*!*/ operator+(int/*!*/ value);
+}
+abstract class _D extends _C {}
+_f(_C/*!*/ x, int/*!*/ y) => x += y;
+''');
+ visitSubexpression(findNode.assignment('+='), '_D');
+ }
+
+ test_assignmentExpression_compound_rhs_nullable_check() async {
+ await analyze('''
+abstract class _C {
+ _D/*!*/ operator+(int/*!*/ value);
+}
+abstract class _D extends _C {}
+_f(_C/*!*/ x, int/*?*/ y) => x += y;
+''');
+ visitSubexpression(findNode.assignment('+='), '_D',
+ nullChecked: {findNode.simple('y;')});
+ }
+
+ test_assignmentExpression_compound_rhs_nullable_noCheck() async {
+ await analyze('''
+abstract class _C {
+ _D/*!*/ operator+(int/*?*/ value);
+}
+abstract class _D extends _C {}
+_f(_C/*!*/ x, int/*?*/ y) => x += y;
+''');
+ visitSubexpression(findNode.assignment('+='), '_D');
+ }
+
+ test_assignmentExpression_null_aware_rhs_nonNullable() async {
+ await analyze('''
+abstract class _B {}
+abstract class _C extends _B {}
+abstract class _D extends _C {}
+abstract class _E extends _C {}
+abstract class _F {
+ _D/*?*/ get x;
+ void set x(_B/*?*/ value);
+ f(_E/*!*/ y) => x ??= y;
+}
+''');
+ visitSubexpression(findNode.assignment('??='), '_C');
+ }
+
+ test_assignmentExpression_null_aware_rhs_nullable() async {
+ await analyze('''
+abstract class _B {}
+abstract class _C extends _B {}
+abstract class _D extends _C {}
+abstract class _E extends _C {}
+abstract class _F {
+ _D/*?*/ get x;
+ void set x(_B/*?*/ value);
+ f(_E/*?*/ y) => x ??= y;
+}
+''');
+ visitSubexpression(findNode.assignment('??='), '_C?');
+ }
+
+ test_assignmentExpression_simple_nonNullable_to_nonNullable() async {
+ await analyze('''
+_f(int/*!*/ x, int/*!*/ y) => x = y;
+''');
+ visitSubexpression(findNode.assignment('= '), 'int');
+ }
+
+ test_assignmentExpression_simple_nonNullable_to_nullable() async {
+ await analyze('''
+_f(int/*?*/ x, int/*!*/ y) => x = y;
+''');
+ visitSubexpression(findNode.assignment('= '), 'int');
+ }
+
+ test_assignmentExpression_simple_nullable_to_nonNullable() async {
+ await analyze('''
+_f(int/*!*/ x, int/*?*/ y) => x = y;
+''');
+ visitSubexpression(findNode.assignment('= '), 'int',
+ contextType: objectType, nullChecked: {findNode.simple('y;')});
+ }
+
+ test_assignmentExpression_simple_nullable_to_nullable() async {
+ await analyze('''
+_f(int/*?*/ x, int/*?*/ y) => x = y;
+''');
+ visitSubexpression(findNode.assignment('= '), 'int?');
+ }
+
+ test_assignmentExpression_simple_promoted() async {
+ await analyze('''
+_f(bool/*?*/ x, bool/*?*/ y) => x != null && (x = y) != null;
+''');
+ // On the RHS of the `&&`, `x` is promoted to non-nullable, but it is still
+ // considered to be a nullable assignment target, so no null check is
+ // generated for `y`.
+ visitSubexpression(findNode.binary('&&'), 'bool');
+ }
+
+ test_assignmentTarget_simpleIdentifier_field_generic() async {
+ await analyze('''
+abstract class _C<T> {
+ _C<T> operator+(int i);
+}
+class _D<T> {
+ _D(this.x);
+ _C<T/*!*/>/*!*/ x;
+ _f() => x += 0;
+}
+''');
+ visitAssignmentTarget(findNode.simple('x +='), '_C<T>', '_C<T>');
+ }
+
+ test_assignmentTarget_simpleIdentifier_field_nonNullable() async {
+ await analyze('''
+class _C {
+ int/*!*/ x;
+ _f() => x += 0;
+}
+''');
+ visitAssignmentTarget(findNode.simple('x '), 'int', 'int');
+ }
+
+ test_assignmentTarget_simpleIdentifier_field_nullable() async {
+ await analyze('''
+class _C {
+ int/*?*/ x;
+ _f() => x += 0;
+}
+''');
+ visitAssignmentTarget(findNode.simple('x '), 'int?', 'int?');
+ }
+
+ test_assignmentTarget_simpleIdentifier_getset_generic() async {
+ await analyze('''
+abstract class _C<T> {
+ _C<T> operator+(int i);
+}
+abstract class _D<T> extends _C<T> {}
+abstract class _E<T> {
+ _D<T/*!*/>/*!*/ get x;
+ void set x(_C<T/*!*/>/*!*/ value);
+ _f() => x += 0;
+}
+''');
+ visitAssignmentTarget(findNode.simple('x +='), '_D<T>', '_C<T>');
+ }
+
+ test_assignmentTarget_simpleIdentifier_getset_getterNullable() async {
+ await analyze('''
+class _C {
+ int/*?*/ get x => 1;
+ void set x(int/*!*/ value) {}
+ _f() => x += 0;
+}
+''');
+ visitAssignmentTarget(findNode.simple('x +='), 'int?', 'int');
+ }
+
+ test_assignmentTarget_simpleIdentifier_getset_setterNullable() async {
+ await analyze('''
+class _C {
+ int/*!*/ get x => 1;
+ void set x(int/*?*/ value) {}
+ _f() => x += 0;
+}
+''');
+ visitAssignmentTarget(findNode.simple('x +='), 'int', 'int?');
+ }
+
+ test_assignmentTarget_simpleIdentifier_localVariable_nonNullable() async {
+ await analyze('''
+_f(int/*!*/ x) => x += 0;
+''');
+ visitAssignmentTarget(findNode.simple('x '), 'int', 'int');
+ }
+
+ test_assignmentTarget_simpleIdentifier_localVariable_nullable() async {
+ await analyze('''
+_f(int/*?*/ x) => x += 0;
+''');
+ visitAssignmentTarget(findNode.simple('x '), 'int?', 'int?');
+ }
+
+ test_assignmentTarget_simpleIdentifier_setter_nonNullable() async {
+ await analyze('''
+class _C {
+ void set x(int/*!*/ value) {}
+ _f() => x = 0;
+}
+''');
+ visitAssignmentTarget(findNode.simple('x '), 'int', 'int');
+ }
+
+ test_assignmentTarget_simpleIdentifier_setter_nullable() async {
+ await analyze('''
+class _C {
+ void set x(int/*?*/ value) {}
+ _f() => x = 0;
+}
+''');
+ visitAssignmentTarget(findNode.simple('x '), 'int?', 'int?');
+ }
+
test_binaryExpression_ampersand_ampersand() async {
await analyze('''
_f(bool x, bool y) => x && y;
@@ -341,9 +641,26 @@
visitSubexpression(findNode.binary('&&'), 'bool');
}
+ void visitAssignmentTarget(
+ Expression node, String expectedReadType, String expectedWriteType,
+ {Set<Expression> nullChecked = const <Expression>{},
+ Map<AstNode, Set<Problem>> problems = const <AstNode, Set<Problem>>{}}) {
+ var fixBuilder = _FixBuilder(
+ decoratedClassHierarchy, typeProvider, typeSystem, variables);
+ fixBuilder.createFlowAnalysis(node.thisOrAncestorOfType<FunctionBody>());
+ var targetInfo = fixBuilder.visitAssignmentTarget(node);
+ expect((targetInfo.readType as TypeImpl).toString(withNullability: true),
+ expectedReadType);
+ expect((targetInfo.writeType as TypeImpl).toString(withNullability: true),
+ expectedWriteType);
+ expect(fixBuilder.nullCheckedExpressions, nullChecked);
+ expect(fixBuilder.problems, problems);
+ }
+
void visitSubexpression(Expression node, String expectedType,
{DartType contextType,
- Set<Expression> nullChecked = const <Expression>{}}) {
+ Set<Expression> nullChecked = const <Expression>{},
+ Map<AstNode, Set<Problem>> problems = const <AstNode, Set<Problem>>{}}) {
contextType ??= dynamicType;
var fixBuilder = _FixBuilder(
decoratedClassHierarchy, typeProvider, typeSystem, variables);
@@ -351,12 +668,15 @@
var type = fixBuilder.visitSubexpression(node, contextType);
expect((type as TypeImpl).toString(withNullability: true), expectedType);
expect(fixBuilder.nullCheckedExpressions, nullChecked);
+ expect(fixBuilder.problems, problems);
}
}
class _FixBuilder extends FixBuilder {
final Set<Expression> nullCheckedExpressions = {};
+ final Map<AstNode, Set<Problem>> problems = {};
+
_FixBuilder(DecoratedClassHierarchy decoratedClassHierarchy,
TypeProvider typeProvider, TypeSystem typeSystem, Variables variables)
: super(decoratedClassHierarchy, typeProvider, typeSystem, variables);
@@ -366,4 +686,10 @@
var newlyAdded = nullCheckedExpressions.add(subexpression);
expect(newlyAdded, true);
}
+
+ @override
+ void addProblem(AstNode node, Problem problem) {
+ var newlyAdded = (problems[node] ??= {}).add(problem);
+ expect(newlyAdded, true);
+ }
}
diff --git a/pkg/smith/lib/configuration.dart b/pkg/smith/lib/configuration.dart
index 07653eb..74ff985 100644
--- a/pkg/smith/lib/configuration.dart
+++ b/pkg/smith/lib/configuration.dart
@@ -551,6 +551,7 @@
static const ia32 = Architecture._('ia32');
static const x64 = Architecture._('x64');
static const arm = Architecture._('arm');
+ static const arm_x64 = Architecture._('arm_x64');
static const armv6 = Architecture._('armv6');
static const armv5te = Architecture._('armv5te');
static const arm64 = Architecture._('arm64');
@@ -569,6 +570,7 @@
arm,
armv6,
armv5te,
+ arm_x64,
arm64,
simarm,
simarmv6,
diff --git a/pkg/test_runner/lib/src/compiler_configuration.dart b/pkg/test_runner/lib/src/compiler_configuration.dart
index 9feb36a..fd5142e 100644
--- a/pkg/test_runner/lib/src/compiler_configuration.dart
+++ b/pkg/test_runner/lib/src/compiler_configuration.dart
@@ -588,6 +588,8 @@
bool get _isSimArm => _configuration.architecture == Architecture.simarm;
+ bool get _isArmX64 => _configuration.architecture == Architecture.arm_x64;
+
bool get _isArm64 => _configuration.architecture == Architecture.arm64;
bool get _isX64 => _configuration.architecture == Architecture.x64;
@@ -674,7 +676,7 @@
if (_isAndroid) {
if (_isArm || _isIA32) {
exec = "$buildDir/clang_x86/gen_snapshot";
- } else if (_isArm64 || _isX64) {
+ } else if (_isArm64 || _isX64 || _isArmX64) {
exec = "$buildDir/clang_x64/gen_snapshot";
} else {
// Guaranteed by package:test_runner/src/configuration.dart's
@@ -710,7 +712,7 @@
}
static const String ndkPath = "third_party/android_tools/ndk";
- String get abiTriple => _isArm
+ String get abiTriple => _isArm || _isArmX64
? "arm-linux-androideabi"
: _isArm64 ? "aarch64-linux-android" : null;
String get host =>
@@ -748,6 +750,7 @@
case Architecture.ia32:
case Architecture.simarm:
case Architecture.arm:
+ case Architecture.arm_x64:
case Architecture.arm64:
ccFlags = null;
break;
diff --git a/pkg/test_runner/lib/src/configuration.dart b/pkg/test_runner/lib/src/configuration.dart
index ac08814..3f170e2 100644
--- a/pkg/test_runner/lib/src/configuration.dart
+++ b/pkg/test_runner/lib/src/configuration.dart
@@ -408,9 +408,10 @@
!(architecture == Architecture.ia32 ||
architecture == Architecture.x64 ||
architecture == Architecture.arm ||
+ architecture == Architecture.arm_x64 ||
architecture == Architecture.arm64)) {
print("Warning: Android only supports the following "
- "architectures: ia32/x64/arm/arm64.");
+ "architectures: ia32/x64/arm/arm64/arm_x64.");
isValid = false;
}
diff --git a/pkg/test_runner/lib/src/feature.dart b/pkg/test_runner/lib/src/feature.dart
index ae9d48b..d9a7c49 100644
--- a/pkg/test_runner/lib/src/feature.dart
+++ b/pkg/test_runner/lib/src/feature.dart
@@ -5,7 +5,7 @@
/// A capability that a Dart implementation may or may not provide that a test
/// may require.
///
-/// Each [TestConfiguration] specifies the set of features it supports. A test
+/// Each `TestConfiguration` specifies the set of features it supports. A test
/// can have a "// Requirements" comment indicating the names of features it
/// requires. If a test requires a feature not supported by the current
/// configution, the test runner automatically skips it.
diff --git a/pkg/test_runner/lib/src/options.dart b/pkg/test_runner/lib/src/options.dart
index ed972e7..9815950 100644
--- a/pkg/test_runner/lib/src/options.dart
+++ b/pkg/test_runner/lib/src/options.dart
@@ -144,7 +144,7 @@
ia32, x64
arm, armv6, armv5te, arm64,
simarm, simarmv6, simarmv5te, simarm64,
-simdbc, simdbc64''',
+simdbc, simdbc64, arm_x64''',
abbr: 'a',
values: ['all']..addAll(Architecture.names),
defaultsTo: Architecture.x64.name,
diff --git a/pkg/test_runner/lib/src/runtime_configuration.dart b/pkg/test_runner/lib/src/runtime_configuration.dart
index da7d327..7cb3cda 100644
--- a/pkg/test_runner/lib/src/runtime_configuration.dart
+++ b/pkg/test_runner/lib/src/runtime_configuration.dart
@@ -229,6 +229,7 @@
switch (arch) {
case Architecture.simarm:
case Architecture.arm:
+ case Architecture.arm_x64:
case Architecture.arm64:
case Architecture.simarmv6:
case Architecture.armv6:
diff --git a/pkg/vm/lib/bytecode/declarations.dart b/pkg/vm/lib/bytecode/declarations.dart
index 7dba88e..f4c4fc5 100644
--- a/pkg/vm/lib/bytecode/declarations.dart
+++ b/pkg/vm/lib/bytecode/declarations.dart
@@ -333,6 +333,8 @@
static const hasCustomScriptFlag = 1 << 12;
static const hasInitializerCodeFlag = 1 << 13;
static const hasAttributesFlag = 1 << 14;
+ static const isLateFlag = 1 << 15;
+ static const isExtensionMemberFlag = 1 << 16;
final int flags;
final ObjectHandle name;
@@ -456,6 +458,12 @@
if ((flags & isFinalFlag) != 0) {
sb.write(', final');
}
+ if ((flags & isLateFlag) != 0) {
+ sb.write(', is-late');
+ }
+ if ((flags & isExtensionMemberFlag) != 0) {
+ sb.write(', extension-member');
+ }
if ((flags & hasPragmaFlag) != 0) {
sb.write(', has-pragma');
}
@@ -507,6 +515,7 @@
static const hasPragmaFlag = 1 << 21;
static const hasCustomScriptFlag = 1 << 22;
static const hasAttributesFlag = 1 << 23;
+ static const isExtensionMemberFlag = 1 << 24;
final int flags;
final ObjectHandle name;
@@ -649,6 +658,9 @@
if ((flags & isConstFlag) != 0) {
sb.write(', const');
}
+ if ((flags & isExtensionMemberFlag) != 0) {
+ sb.write(', extension-member');
+ }
if ((flags & hasOptionalPositionalParamsFlag) != 0) {
sb.write(', has-optional-positional-params');
}
diff --git a/pkg/vm/lib/bytecode/gen_bytecode.dart b/pkg/vm/lib/bytecode/gen_bytecode.dart
index 6b64e85..cc6d413 100644
--- a/pkg/vm/lib/bytecode/gen_bytecode.dart
+++ b/pkg/vm/lib/bytecode/gen_bytecode.dart
@@ -584,6 +584,12 @@
if (field.isGenericCovariantImpl) {
flags |= FieldDeclaration.isGenericCovariantImplFlag;
}
+ if (field.isExtensionMember) {
+ flags |= FieldDeclaration.isExtensionMemberFlag;
+ }
+ if (field.isLate) {
+ flags |= FieldDeclaration.isLateFlag;
+ }
int position = TreeNode.noOffset;
int endPosition = TreeNode.noOffset;
if (options.emitSourcePositions && field.fileOffset != TreeNode.noOffset) {
@@ -654,6 +660,9 @@
if (member.isConst) {
flags |= FunctionDeclaration.isConstFlag;
}
+ if (member.isExtensionMember) {
+ flags |= FunctionDeclaration.isExtensionMemberFlag;
+ }
FunctionNode function = member.function;
if (function.requiredParameterCount !=
@@ -1757,7 +1766,6 @@
savedAssemblers = null;
hasErrors = false;
procedureAttributesMetadata = null;
- inferredTypeMetadata = null;
inferredTypesAttribute = null;
}
@@ -3145,8 +3153,10 @@
@override
visitMethodInvocation(MethodInvocation node) {
+ final directCall =
+ directCallMetadata != null ? directCallMetadata[node] : null;
final Opcode opcode = recognizedMethods.specializedBytecodeFor(node);
- if (opcode != null) {
+ if (opcode != null && directCall == null) {
_genMethodInvocationUsingSpecializedBytecode(opcode, node);
return;
}
@@ -3170,8 +3180,6 @@
return;
}
- final directCall =
- directCallMetadata != null ? directCallMetadata[node] : null;
if (directCall != null && directCall.checkReceiverForNull) {
final int receiverTemp = locals.tempIndexInFrame(node);
_genArguments(node.receiver, args, storeReceiverToLocal: receiverTemp);
diff --git a/pkg/vm/lib/metadata/bytecode.dart b/pkg/vm/lib/metadata/bytecode.dart
index 15781bd..83e4a8e 100644
--- a/pkg/vm/lib/metadata/bytecode.dart
+++ b/pkg/vm/lib/metadata/bytecode.dart
@@ -68,32 +68,3 @@
return new BytecodeMetadata(bytecodeComponent);
}
}
-
-class BinaryCacheMetadataRepository extends MetadataRepository<List<int>> {
- static const repositoryTag = 'vm.bytecode.cache';
-
- @override
- String get tag => repositoryTag;
-
- @override
- final Map<TreeNode, List<int>> mapping = <TreeNode, List<int>>{};
-
- @override
- void writeToBinary(List<int> metadata, Node node, BinarySink sink) {
- sink.writeByteList(metadata);
- }
-
- @override
- List<int> readFromBinary(Node node, BinarySource source) {
- List<int> result = source.readByteList();
- _weakMap[node] = result;
- return result;
- }
-
- static List<int> lookup(Node node) => _weakMap[node];
- static void insert(Node node, List<int> metadata) {
- _weakMap[node] = metadata;
- }
-
- static final _weakMap = new Expando<List<int>>();
-}
diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
index 41776f5..56eb2f6 100644
--- a/runtime/BUILD.gn
+++ b/runtime/BUILD.gn
@@ -186,6 +186,9 @@
if (defined(is_asan) && is_asan) {
ldflags += [ "-fsanitize=address" ]
}
+ if (defined(is_lsan) && is_lsan) {
+ ldflags += [ "-fsanitize=leak" ]
+ }
if (defined(is_msan) && is_msan) {
ldflags += [ "-fsanitize=memory" ]
}
diff --git a/runtime/bin/eventhandler.cc b/runtime/bin/eventhandler.cc
index d693d73..6a02a0f 100644
--- a/runtime/bin/eventhandler.cc
+++ b/runtime/bin/eventhandler.cc
@@ -66,6 +66,10 @@
shutdown_monitor = new Monitor();
event_handler = new EventHandler();
event_handler->delegate_.Start(event_handler);
+
+ if (!SocketBase::Initialize()) {
+ FATAL("Failed to initialize sockets");
+ }
}
void EventHandler::NotifyShutdownDone() {
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc
index 6ed0744..177ff33 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -1487,11 +1487,6 @@
ml.Wait();
}
}
-
- // Initialize Winsock32
- if (!SocketBase::Initialize()) {
- FATAL("Failed to initialized Windows sockets");
- }
}
void EventHandlerImplementation::Shutdown() {
diff --git a/runtime/bin/socket_base_fuchsia.cc b/runtime/bin/socket_base_fuchsia.cc
index 65a44805..ba90aa9 100644
--- a/runtime/bin/socket_base_fuchsia.cc
+++ b/runtime/bin/socket_base_fuchsia.cc
@@ -73,8 +73,9 @@
auto directory = sys::ServiceDirectory::CreateFromNamespace();
status = directory->Connect(netstack.NewRequest());
if (status != ZX_OK) {
- LOG_ERR("Initialize: connecting to fuchsia.netstack failed: %s\n",
- zx_status_get_string(status));
+ Syslog::PrintErr(
+ "Initialize: connecting to fuchsia.netstack failed: %s\n",
+ zx_status_get_string(status));
}
});
return status == ZX_OK;
diff --git a/runtime/platform/memory_sanitizer.h b/runtime/platform/memory_sanitizer.h
index 324d73e..f9e6f0d 100644
--- a/runtime/platform/memory_sanitizer.h
+++ b/runtime/platform/memory_sanitizer.h
@@ -11,16 +11,24 @@
// told about areas that are initialized by generated code.
#if defined(__has_feature)
#if __has_feature(memory_sanitizer)
+extern "C" void __msan_poison(const volatile void*, size_t);
extern "C" void __msan_unpoison(const volatile void*, size_t);
+#define MSAN_POISON(ptr, len) __msan_poison(ptr, len)
#define MSAN_UNPOISON(ptr, len) __msan_unpoison(ptr, len)
#define NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory))
#else // __has_feature(memory_sanitizer)
+#define MSAN_POISON(ptr, len) \
+ do { \
+ } while (false && (ptr) == 0 && (len) == 0)
#define MSAN_UNPOISON(ptr, len) \
do { \
} while (false && (ptr) == 0 && (len) == 0)
#define NO_SANITIZE_MEMORY
#endif // __has_feature(memory_sanitizer)
#else // defined(__has_feature)
+#define MSAN_POISON(ptr, len) \
+ do { \
+ } while (false && (ptr) == 0 && (len) == 0)
#define MSAN_UNPOISON(ptr, len) \
do { \
} while (false && (ptr) == 0 && (len) == 0)
diff --git a/runtime/platform/utils.cc b/runtime/platform/utils.cc
index 3f5091c..d6a0f96 100644
--- a/runtime/platform/utils.cc
+++ b/runtime/platform/utils.cc
@@ -21,6 +21,32 @@
return x + 1;
}
+int Utils::CountOneBits64(uint64_t x) {
+ // Apparently there are x64 chips without popcount.
+#if __GNUC__ && !defined(HOST_ARCH_IA32) && !defined(HOST_ARCH_X64)
+ return __builtin_popcountll(x);
+#else
+ return CountOneBits32(static_cast<uint32_t>(x)) +
+ CountOneBits32(static_cast<uint32_t>(x >> 32));
+#endif
+}
+
+int Utils::CountOneBits32(uint32_t x) {
+ // Apparently there are x64 chips without popcount.
+#if __GNUC__ && !defined(HOST_ARCH_IA32) && !defined(HOST_ARCH_X64)
+ return __builtin_popcount(x);
+#else
+ // Implementation is from "Hacker's Delight" by Henry S. Warren, Jr.,
+ // figure 5-2, page 66, where the function is called pop.
+ x = x - ((x >> 1) & 0x55555555);
+ x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
+ x = (x + (x >> 4)) & 0x0F0F0F0F;
+ x = x + (x >> 8);
+ x = x + (x >> 16);
+ return static_cast<int>(x & 0x0000003F);
+#endif
+}
+
// TODO(koda): Compare to flsll call/intrinsic.
int Utils::HighestBit(int64_t v) {
uint64_t x = static_cast<uint64_t>((v > 0) ? v : -v);
@@ -50,6 +76,58 @@
return r;
}
+int Utils::CountLeadingZeros64(uint64_t x) {
+#if defined(ARCH_IS_32_BIT)
+ const uint32_t x_hi = static_cast<uint32_t>(x >> 32);
+ if (x_hi != 0) {
+ return CountLeadingZeros32(x_hi);
+ }
+ return 32 + CountLeadingZeros32(static_cast<uint32_t>(x));
+#elif defined(HOST_OS_WINDOWS)
+ unsigned long position; // NOLINT
+ return (_BitScanReverse64(&position, x) == 0)
+ ? 64
+ : 63 - static_cast<int>(position);
+#else
+ return x == 0 ? 64 : __builtin_clzll(x);
+#endif
+}
+
+int Utils::CountLeadingZeros32(uint32_t x) {
+#if defined(HOST_OS_WINDOWS)
+ unsigned long position; // NOLINT
+ return (_BitScanReverse(&position, x) == 0) ? 32
+ : 31 - static_cast<int>(position);
+#else
+ return x == 0 ? 32 : __builtin_clz(x);
+#endif
+}
+
+int Utils::CountTrailingZeros64(uint64_t x) {
+#if defined(ARCH_IS_32_BIT)
+ const uint32_t x_lo = static_cast<uint32_t>(x);
+ if (x_lo != 0) {
+ return CountTrailingZeros32(x_lo);
+ }
+ return 32 + CountTrailingZeros32(static_cast<uint32_t>(x >> 32));
+#elif defined(HOST_OS_WINDOWS)
+ unsigned long position; // NOLINT
+ return (_BitScanForward64(&position, x) == 0) ? 64
+ : static_cast<int>(position);
+#else
+ return x == 0 ? 64 : __builtin_ctzll(x);
+#endif
+}
+
+int Utils::CountTrailingZeros32(uint32_t x) {
+#if defined(HOST_OS_WINDOWS)
+ unsigned long position; // NOLINT
+ return (_BitScanForward(&position, x) == 0) ? 32 : static_cast<int>(position);
+#else
+ return x == 0 ? 32 : __builtin_ctz(x);
+#endif
+}
+
uint64_t Utils::ReverseBits64(uint64_t x) {
const uint64_t one = static_cast<uint64_t>(1);
uint64_t result = 0;
diff --git a/runtime/platform/utils.h b/runtime/platform/utils.h
index 860c00b..819206f 100644
--- a/runtime/platform/utils.h
+++ b/runtime/platform/utils.h
@@ -105,31 +105,8 @@
static uintptr_t RoundUpToPowerOfTwo(uintptr_t x);
- static int CountOneBits32(uint32_t x) {
- // Apparently there are x64 chips without popcount.
-#if __GNUC__ && !defined(HOST_ARCH_IA32) && !defined(HOST_ARCH_X64)
- return __builtin_popcount(x);
-#else
- // Implementation is from "Hacker's Delight" by Henry S. Warren, Jr.,
- // figure 5-2, page 66, where the function is called pop.
- x = x - ((x >> 1) & 0x55555555);
- x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
- x = (x + (x >> 4)) & 0x0F0F0F0F;
- x = x + (x >> 8);
- x = x + (x >> 16);
- return static_cast<int>(x & 0x0000003F);
-#endif
- }
-
- static int CountOneBits64(uint64_t x) {
- // Apparently there are x64 chips without popcount.
-#if __GNUC__ && !defined(HOST_ARCH_IA32) && !defined(HOST_ARCH_X64)
- return __builtin_popcountll(x);
-#else
- return CountOneBits32(static_cast<uint32_t>(x)) +
- CountOneBits32(static_cast<uint32_t>(x >> 32));
-#endif
- }
+ static int CountOneBits64(uint64_t x);
+ static int CountOneBits32(uint32_t x);
static int CountOneBitsWord(uword x) {
#ifdef ARCH_IS_64_BIT
@@ -147,8 +124,27 @@
return (value == 0) ? 0 : (Utils::HighestBit(value) + 1);
}
- static int CountLeadingZeros(uword x);
- static int CountTrailingZeros(uword x);
+ static int CountLeadingZeros64(uint64_t x);
+ static int CountLeadingZeros32(uint32_t x);
+
+ static int CountLeadingZerosWord(uword x) {
+#ifdef ARCH_IS_64_BIT
+ return CountLeadingZeros64(x);
+#else
+ return CountLeadingZeros32(x);
+#endif
+ }
+
+ static int CountTrailingZeros64(uint64_t x);
+ static int CountTrailingZeros32(uint32_t x);
+
+ static int CountTrailingZerosWord(uword x) {
+#ifdef ARCH_IS_64_BIT
+ return CountTrailingZeros64(x);
+#else
+ return CountTrailingZeros32(x);
+#endif
+ }
static uint64_t ReverseBits64(uint64_t x);
static uint32_t ReverseBits32(uint32_t x);
diff --git a/runtime/platform/utils_android.h b/runtime/platform/utils_android.h
index 6d91415..a824443 100644
--- a/runtime/platform/utils_android.h
+++ b/runtime/platform/utils_android.h
@@ -13,26 +13,6 @@
namespace dart {
-inline int Utils::CountLeadingZeros(uword x) {
-#if defined(ARCH_IS_32_BIT)
- return __builtin_clzl(x);
-#elif defined(ARCH_IS_64_BIT)
- return __builtin_clzll(x);
-#else
-#error Architecture is not 32-bit or 64-bit.
-#endif
-}
-
-inline int Utils::CountTrailingZeros(uword x) {
-#if defined(ARCH_IS_32_BIT)
- return __builtin_ctzl(x);
-#elif defined(ARCH_IS_64_BIT)
- return __builtin_ctzll(x);
-#else
-#error Architecture is not 32-bit or 64-bit.
-#endif
-}
-
inline uint16_t Utils::HostToBigEndian16(uint16_t value) {
return htobe16(value);
}
diff --git a/runtime/platform/utils_fuchsia.h b/runtime/platform/utils_fuchsia.h
index c82c797..7cb3812 100644
--- a/runtime/platform/utils_fuchsia.h
+++ b/runtime/platform/utils_fuchsia.h
@@ -9,26 +9,6 @@
namespace dart {
-inline int Utils::CountLeadingZeros(uword x) {
-#if defined(ARCH_IS_32_BIT)
- return __builtin_clzl(x);
-#elif defined(ARCH_IS_64_BIT)
- return __builtin_clzll(x);
-#else
-#error Architecture is not 32-bit or 64-bit.
-#endif
-}
-
-inline int Utils::CountTrailingZeros(uword x) {
-#if defined(ARCH_IS_32_BIT)
- return __builtin_ctzl(x);
-#elif defined(ARCH_IS_64_BIT)
- return __builtin_ctzll(x);
-#else
-#error Architecture is not 32-bit or 64-bit.
-#endif
-}
-
inline uint16_t Utils::HostToBigEndian16(uint16_t value) {
return htobe16(value);
}
diff --git a/runtime/platform/utils_linux.h b/runtime/platform/utils_linux.h
index 4a49a6a..082e4ef 100644
--- a/runtime/platform/utils_linux.h
+++ b/runtime/platform/utils_linux.h
@@ -13,26 +13,6 @@
namespace dart {
-inline int Utils::CountLeadingZeros(uword x) {
-#if defined(ARCH_IS_32_BIT)
- return __builtin_clzl(x);
-#elif defined(ARCH_IS_64_BIT)
- return __builtin_clzll(x);
-#else
-#error Architecture is not 32-bit or 64-bit.
-#endif
-}
-
-inline int Utils::CountTrailingZeros(uword x) {
-#if defined(ARCH_IS_32_BIT)
- return __builtin_ctzl(x);
-#elif defined(ARCH_IS_64_BIT)
- return __builtin_ctzll(x);
-#else
-#error Architecture is not 32-bit or 64-bit.
-#endif
-}
-
inline uint16_t Utils::HostToBigEndian16(uint16_t value) {
return htobe16(value);
}
diff --git a/runtime/platform/utils_macos.h b/runtime/platform/utils_macos.h
index e64711b..2e3729b 100644
--- a/runtime/platform/utils_macos.h
+++ b/runtime/platform/utils_macos.h
@@ -74,26 +74,6 @@
DEFINE_IS_OS_FUNCS(15, IGNORE_DEPLOYMENT_TARGET)
#endif
-inline int Utils::CountLeadingZeros(uword x) {
-#if defined(ARCH_IS_32_BIT)
- return __builtin_clzl(x);
-#elif defined(ARCH_IS_64_BIT)
- return __builtin_clzll(x);
-#else
-#error Architecture is not 32-bit or 64-bit.
-#endif
-}
-
-inline int Utils::CountTrailingZeros(uword x) {
-#if defined(ARCH_IS_32_BIT)
- return __builtin_ctzl(x);
-#elif defined(ARCH_IS_64_BIT)
- return __builtin_ctzll(x);
-#else
-#error Architecture is not 32-bit or 64-bit.
-#endif
-}
-
inline uint16_t Utils::HostToBigEndian16(uint16_t value) {
return OSSwapHostToBigInt16(value);
}
diff --git a/runtime/platform/utils_win.h b/runtime/platform/utils_win.h
index 9df3f6d..c2c9023 100644
--- a/runtime/platform/utils_win.h
+++ b/runtime/platform/utils_win.h
@@ -14,30 +14,6 @@
namespace dart {
-inline int Utils::CountLeadingZeros(uword x) {
- unsigned long position; // NOLINT
-#if defined(ARCH_IS_32_BIT)
- _BitScanReverse(&position, x);
-#elif defined(ARCH_IS_64_BIT)
- _BitScanReverse64(&position, x);
-#else
-#error Architecture is not 32-bit or 64-bit.
-#endif
- return kBitsPerWord - static_cast<int>(position) - 1;
-}
-
-inline int Utils::CountTrailingZeros(uword x) {
- unsigned long result; // NOLINT
-#if defined(ARCH_IS_32_BIT)
- _BitScanForward(&result, x);
-#elif defined(ARCH_IS_64_BIT)
- _BitScanForward64(&result, x);
-#else
-#error Architecture is not 32-bit or 64-bit.
-#endif
- return static_cast<int>(result);
-}
-
// WARNING: The below functions assume host is always Little Endian!
inline uint16_t Utils::HostToBigEndian16(uint16_t value) {
diff --git a/runtime/tests/vm/dart/transferable_throws_oom_test.dart b/runtime/tests/vm/dart/transferable_throws_oom_test.dart
index c1b21f0..fcf9e08 100644
--- a/runtime/tests/vm/dart/transferable_throws_oom_test.dart
+++ b/runtime/tests/vm/dart/transferable_throws_oom_test.dart
@@ -2,6 +2,11 @@
// 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.
+// Customize ASAN options for this test with 'allocator_may_return_null=1' as
+// it tries to allocate a large memory buffer.
+// Environment=ASAN_OPTIONS=handle_segv=0:detect_stack_use_after_return=1:allocator_may_return_null=1
+// Environment=MSAN_OPTIONS=handle_segv=0:detect_stack_use_after_return=1:allocator_may_return_null=1
+
// Test that ensures correct exception when running out of memory for
// really large transferable.
diff --git a/runtime/vm/bit_set.h b/runtime/vm/bit_set.h
index 4e716c1..c16ccea 100644
--- a/runtime/vm/bit_set.h
+++ b/runtime/vm/bit_set.h
@@ -41,12 +41,13 @@
intptr_t w = i >> kBitsPerWordLog2;
uword mask = ~static_cast<uword>(0) << (i & (kBitsPerWord - 1));
if ((data_[w] & mask) != 0) {
- uword tz = Utils::CountTrailingZeros(data_[w] & mask);
+ uword tz = Utils::CountTrailingZerosWord(data_[w] & mask);
return (w << kBitsPerWordLog2) + tz;
}
while (++w < kLengthInWords) {
if (data_[w] != 0) {
- return (w << kBitsPerWordLog2) + Utils::CountTrailingZeros(data_[w]);
+ return (w << kBitsPerWordLog2) +
+ Utils::CountTrailingZerosWord(data_[w]);
}
}
return -1;
@@ -56,7 +57,8 @@
for (int w = kLengthInWords - 1; w >= 0; --w) {
uword d = data_[w];
if (d != 0) {
- return ((w + 1) << kBitsPerWordLog2) - Utils::CountLeadingZeros(d) - 1;
+ return ((w + 1) << kBitsPerWordLog2) - Utils::CountLeadingZerosWord(d) -
+ 1;
}
}
return -1;
@@ -79,7 +81,8 @@
return -1;
} else {
// Bitlength incl. w, minus leading zeroes of w, minus 1 to 0-based index.
- return ((w + 1) << kBitsPerWordLog2) - Utils::CountLeadingZeros(bits) - 1;
+ return ((w + 1) << kBitsPerWordLog2) -
+ Utils::CountLeadingZerosWord(bits) - 1;
}
}
diff --git a/runtime/vm/compiler/assembler/assembler_arm.cc b/runtime/vm/compiler/assembler/assembler_arm.cc
index 8ce6936..e2e07a3 100644
--- a/runtime/vm/compiler/assembler/assembler_arm.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm.cc
@@ -1732,7 +1732,7 @@
return (free == 0)
? kNoRegister
: UseRegister(
- static_cast<Register>(Utils::CountTrailingZeros(free)),
+ static_cast<Register>(Utils::CountTrailingZerosWord(free)),
used);
}
diff --git a/runtime/vm/compiler/assembler/assembler_arm64.cc b/runtime/vm/compiler/assembler/assembler_arm64.cc
index d973ac9..ad41da5 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm64.cc
@@ -281,8 +281,8 @@
int lead_zero = CountLeadingZeros(value, width);
int lead_one = CountLeadingZeros(~value, width);
- int trail_zero = Utils::CountTrailingZeros(value);
- int trail_one = Utils::CountTrailingZeros(~value);
+ int trail_zero = Utils::CountTrailingZerosWord(value);
+ int trail_one = Utils::CountTrailingZerosWord(~value);
int set_bits = CountOneBits(value, width);
// The fixed bits in the immediate s field.
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index b7adcf9..61eb977 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -283,6 +283,10 @@
qsort(cids_array, cids.length(), sizeof(intptr_t),
[](const void* a, const void* b) {
+ // MSAN seems unaware of allocations inside qsort. The linker flag
+ // -fsanitize=memory should give us a MSAN-aware version of libc...
+ MSAN_UNPOISON(static_cast<const intptr_t*>(a), sizeof(intptr_t));
+ MSAN_UNPOISON(static_cast<const intptr_t*>(b), sizeof(intptr_t));
return static_cast<int>(*static_cast<const intptr_t*>(a) -
*static_cast<const intptr_t*>(b));
});
diff --git a/runtime/vm/compiler/frontend/bytecode_reader.cc b/runtime/vm/compiler/frontend/bytecode_reader.cc
index a888b26..b72cb90 100644
--- a/runtime/vm/compiler/frontend/bytecode_reader.cc
+++ b/runtime/vm/compiler/frontend/bytecode_reader.cc
@@ -1941,6 +1941,8 @@
const int kHasCustomScriptFlag = 1 << 12;
const int kHasInitializerCodeFlag = 1 << 13;
const int kHasAttributesFlag = 1 << 14;
+ const int kIsLateFlag = 1 << 15;
+ const int kIsExtensionMemberFlag = 1 << 16;
const int num_fields = reader_.ReadListLength();
if ((num_fields == 0) && !cls.is_enum_class()) {
@@ -1963,6 +1965,7 @@
const bool is_const = (flags & kIsConstFlag) != 0;
const bool has_initializer = (flags & kHasInitializerFlag) != 0;
const bool has_pragma = (flags & kHasPragmaFlag) != 0;
+ const bool is_extension_member = (flags & kIsExtensionMemberFlag) != 0;
name ^= ReadObject();
type ^= ReadObject();
@@ -1991,6 +1994,8 @@
field.set_is_generic_covariant_impl((flags & kIsGenericCovariantImplFlag) !=
0);
field.set_has_initializer(has_initializer);
+ field.set_is_late((flags & kIsLateFlag) != 0);
+ field.set_is_extension_member(is_extension_member);
if (!has_initializer) {
value ^= ReadObject();
@@ -2042,6 +2047,7 @@
function.set_is_debuggable(false);
function.set_accessor_field(field);
function.set_is_declared_in_bytecode(true);
+ function.set_is_extension_member(is_extension_member);
if (is_const && has_initializer) {
function.set_bytecode_offset(field.bytecode_offset());
}
@@ -2064,6 +2070,7 @@
function.set_is_debuggable(false);
function.set_accessor_field(field);
function.set_is_declared_in_bytecode(true);
+ function.set_is_extension_member(is_extension_member);
H.SetupFieldAccessorFunction(cls, function, type);
functions_->SetAt(function_index_++, function);
}
@@ -2161,6 +2168,7 @@
const int kHasPragmaFlag = 1 << 21;
const int kHasCustomScriptFlag = 1 << 22;
const int kHasAttributesFlag = 1 << 23;
+ const int kIsExtensionMemberFlag = 1 << 24;
const intptr_t num_functions = reader_.ReadListLength();
ASSERT(function_index_ + num_functions == functions_->Length());
@@ -2183,6 +2191,7 @@
const bool is_factory = (flags & kIsFactoryFlag) != 0;
const bool is_native = (flags & kIsNativeFlag) != 0;
const bool has_pragma = (flags & kHasPragmaFlag) != 0;
+ const bool is_extension_member = (flags & kIsExtensionMemberFlag) != 0;
name ^= ReadObject();
@@ -2231,6 +2240,7 @@
(flags & kIsNoSuchMethodForwarderFlag) != 0);
function.set_is_reflectable((flags & kIsReflectableFlag) != 0);
function.set_is_debuggable((flags & kIsDebuggableFlag) != 0);
+ function.set_is_extension_member(is_extension_member);
if ((flags & kIsSyncStarFlag) != 0) {
function.set_modifier(RawFunction::kSyncGen);
diff --git a/runtime/vm/compiler/frontend/kernel_translation_helper.h b/runtime/vm/compiler/frontend/kernel_translation_helper.h
index 466bc18..4e83641 100644
--- a/runtime/vm/compiler/frontend/kernel_translation_helper.h
+++ b/runtime/vm/compiler/frontend/kernel_translation_helper.h
@@ -453,6 +453,8 @@
kStatic = 1 << 2,
kIsCovariant = 1 << 5,
kIsGenericCovariantImpl = 1 << 6,
+ kIsLate = 1 << 7,
+ kExtensionMember = 1 << 8,
};
explicit FieldHelper(KernelReaderHelper* helper)
@@ -476,6 +478,8 @@
bool IsGenericCovariantImpl() {
return (flags_ & kIsGenericCovariantImpl) != 0;
}
+ bool IsLate() const { return (flags_ & kIsLate) != 0; }
+ bool IsExtensionMember() const { return (flags_ & kExtensionMember) != 0; }
NameIndex canonical_name_;
TokenPosition position_;
@@ -535,6 +539,7 @@
// TODO(29841): Remove this line after the issue is resolved.
kRedirectingFactoryConstructor = 1 << 6,
kNoSuchMethodForwarder = 1 << 7,
+ kExtensionMember = 1 << 8,
};
explicit ProcedureHelper(KernelReaderHelper* helper)
@@ -560,6 +565,7 @@
bool IsNoSuchMethodForwarder() const {
return (flags_ & kNoSuchMethodForwarder) != 0;
}
+ bool IsExtensionMember() const { return (flags_ & kExtensionMember) != 0; }
NameIndex canonical_name_;
TokenPosition start_position_;
diff --git a/runtime/vm/heap/scavenger.cc b/runtime/vm/heap/scavenger.cc
index b92a870..e3be0fb 100644
--- a/runtime/vm/heap/scavenger.cc
+++ b/runtime/vm/heap/scavenger.cc
@@ -375,6 +375,8 @@
#ifdef DEBUG
result->reserved_->Protect(VirtualMemory::kReadWrite);
#endif
+ // Initialized by generated code.
+ MSAN_UNPOISON(result->reserved_->address(), size_in_words << kWordSizeLog2);
return result;
}
@@ -392,18 +394,21 @@
#if defined(DEBUG)
memset(memory->address(), Heap::kZapByte, size_in_bytes);
#endif // defined(DEBUG)
+ // Initialized by generated code.
+ MSAN_UNPOISON(memory->address(), size_in_bytes);
return new SemiSpace(memory);
}
}
void SemiSpace::Delete() {
-#ifdef DEBUG
if (reserved_ != nullptr) {
const intptr_t size_in_bytes = size_in_words() << kWordSizeLog2;
+#ifdef DEBUG
memset(reserved_->address(), Heap::kZapByte, size_in_bytes);
reserved_->Protect(VirtualMemory::kNoAccess);
- }
#endif
+ MSAN_POISON(reserved_->address(), size_in_bytes);
+ }
SemiSpace* old_cache = nullptr;
{
MutexLocker locker(mutex_);
diff --git a/runtime/vm/image_snapshot.cc b/runtime/vm/image_snapshot.cc
index 2649ca0..de688a1 100644
--- a/runtime/vm/image_snapshot.cc
+++ b/runtime/vm/image_snapshot.cc
@@ -925,16 +925,17 @@
// This header provides the gap to make the instructions snapshot look like a
// HeapPage.
- instructions_blob_stream_.WriteWord(instructions_length);
+ instructions_blob_stream_.WriteTargetWord(instructions_length);
#if defined(DART_PRECOMPILER)
- instructions_blob_stream_.WriteWord(elf_ != nullptr ? bss_base - segment_base
- : 0);
+ instructions_blob_stream_.WriteTargetWord(
+ elf_ != nullptr ? bss_base - segment_base : 0);
#else
- instructions_blob_stream_.WriteWord(0); // No relocations.
+ instructions_blob_stream_.WriteTargetWord(0); // No relocations.
#endif
- intptr_t header_words = Image::kHeaderSize / sizeof(uword);
+ const intptr_t header_words =
+ Image::kHeaderSize / sizeof(compiler::target::uword);
for (intptr_t i = Image::kHeaderFields; i < header_words; i++) {
- instructions_blob_stream_.WriteWord(0);
+ instructions_blob_stream_.WriteTargetWord(0);
}
intptr_t text_offset = 0;
diff --git a/runtime/vm/interpreter.h b/runtime/vm/interpreter.h
index e7fa7d6..c7e3445 100644
--- a/runtime/vm/interpreter.h
+++ b/runtime/vm/interpreter.h
@@ -263,7 +263,7 @@
}
#ifndef PRODUCT
- bool is_debugging_;
+ bool is_debugging_ = false;
#endif // !PRODUCT
bool supports_unboxed_doubles_;
diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc
index e0631b8..0b21e53 100644
--- a/runtime/vm/kernel_loader.cc
+++ b/runtime/vm/kernel_loader.cc
@@ -1200,12 +1200,16 @@
// Only instance fields could be covariant.
ASSERT(!field_helper.IsCovariant() &&
!field_helper.IsGenericCovariantImpl());
+ const bool is_late = field_helper.IsLate();
+ const bool is_extension_member = field_helper.IsExtensionMember();
const Field& field = Field::Handle(
Z,
Field::NewTopLevel(name, is_final, field_helper.IsConst(), script_class,
field_helper.position_, field_helper.end_position_));
field.set_kernel_offset(field_offset);
field.set_has_pragma(has_pragma_annotation);
+ field.set_is_late(is_late);
+ field.set_is_extension_member(is_extension_member);
const AbstractType& type = T.BuildType(); // read type.
field.SetFieldType(type);
ReadInferredType(field, field_offset + library_kernel_offset_);
@@ -1550,6 +1554,8 @@
// In the VM all const fields are implicitly final whereas in Kernel they
// are not final because they are not explicitly declared that way.
const bool is_final = field_helper.IsConst() || field_helper.IsFinal();
+ const bool is_late = field_helper.IsLate();
+ const bool is_extension_member = field_helper.IsExtensionMember();
Field& field = Field::Handle(
Z,
Field::New(name, field_helper.IsStatic(), is_final,
@@ -1560,6 +1566,8 @@
field.set_is_covariant(field_helper.IsCovariant());
field.set_is_generic_covariant_impl(
field_helper.IsGenericCovariantImpl());
+ field.set_is_late(is_late);
+ field.set_is_extension_member(is_extension_member);
ReadInferredType(field, field_offset + library_kernel_offset_);
CheckForInitializer(field);
field_helper.ReadUntilExcluding(FieldHelper::kInitializer);
@@ -1889,6 +1897,7 @@
bool is_method = in_class && !procedure_helper.IsStatic();
bool is_abstract = procedure_helper.IsAbstract();
bool is_external = procedure_helper.IsExternal();
+ bool is_extension_member = procedure_helper.IsExtensionMember();
String& native_name = String::Handle(Z);
bool is_potential_native;
bool has_pragma_annotation;
@@ -1925,6 +1934,7 @@
H.SetExpressionEvaluationFunction(function);
}
function.set_kernel_offset(procedure_offset);
+ function.set_is_extension_member(is_extension_member);
if ((library.is_dart_scheme() &&
H.IsPrivate(procedure_helper.canonical_name_)) ||
(function.is_static() && (library.raw() == Library::InternalLibrary()))) {
@@ -2147,6 +2157,7 @@
getter.set_result_type(field_type);
getter.set_is_debuggable(false);
getter.set_accessor_field(field);
+ getter.set_is_extension_member(field.is_extension_member());
H.SetupFieldAccessorFunction(klass, getter, field_type);
if (!field_helper->IsStatic() && !field_helper->IsFinal()) {
@@ -2167,6 +2178,7 @@
setter.set_result_type(Object::void_type());
setter.set_is_debuggable(false);
setter.set_accessor_field(field);
+ setter.set_is_extension_member(field.is_extension_member());
H.SetupFieldAccessorFunction(klass, setter, field_type);
}
}
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index c9daae0..853f502 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -3102,7 +3102,8 @@
V(GeneratedBody, is_generated_body) \
V(PolymorphicTarget, is_polymorphic_target) \
V(HasPragma, has_pragma) \
- V(IsNoSuchMethodForwarder, is_no_such_method_forwarder)
+ V(IsNoSuchMethodForwarder, is_no_such_method_forwarder) \
+ V(IsExtensionMember, is_extension_member)
#define DEFINE_ACCESSORS(name, accessor_name) \
void set_##accessor_name(bool value) const { \
@@ -3372,6 +3373,10 @@
bool is_instance() const { return !is_static(); }
bool is_final() const { return FinalBit::decode(raw_ptr()->kind_bits_); }
bool is_const() const { return ConstBit::decode(raw_ptr()->kind_bits_); }
+ bool is_late() const { return IsLateBit::decode(raw_ptr()->kind_bits_); }
+ bool is_extension_member() const {
+ return IsExtensionMemberBit::decode(raw_ptr()->kind_bits_);
+ }
bool is_reflectable() const {
return ReflectableBit::decode(raw_ptr()->kind_bits_);
}
@@ -3652,6 +3657,12 @@
kUnknownFixedLength = -1,
kNoFixedLength = -2,
};
+ void set_is_late(bool value) const {
+ set_kind_bits(IsLateBit::update(value, raw_ptr()->kind_bits_));
+ }
+ void set_is_extension_member(bool value) const {
+ set_kind_bits(IsExtensionMemberBit::update(value, raw_ptr()->kind_bits_));
+ }
// Returns false if any value read from this field is guaranteed to be
// not null.
// Internally we is_nullable_ field contains either kNullCid (nullable) or
@@ -3762,6 +3773,8 @@
kHasPragmaBit,
kCovariantBit,
kGenericCovariantImplBit,
+ kIsLateBit,
+ kIsExtensionMemberBit,
};
class ConstBit : public BitField<uint16_t, bool, kConstBit, 1> {};
class StaticBit : public BitField<uint16_t, bool, kStaticBit, 1> {};
@@ -3782,6 +3795,9 @@
class CovariantBit : public BitField<uint16_t, bool, kCovariantBit, 1> {};
class GenericCovariantImplBit
: public BitField<uint16_t, bool, kGenericCovariantImplBit, 1> {};
+ class IsLateBit : public BitField<uint16_t, bool, kIsLateBit, 1> {};
+ class IsExtensionMemberBit
+ : public BitField<uint16_t, bool, kIsExtensionMemberBit, 1> {};
// Update guarded cid and guarded length for this field. Returns true, if
// deoptimization of dependent code is required.
diff --git a/runtime/vm/utils_test.cc b/runtime/vm/utils_test.cc
index 03e18ef..a115a4f 100644
--- a/runtime/vm/utils_test.cc
+++ b/runtime/vm/utils_test.cc
@@ -116,7 +116,6 @@
EXPECT_EQ(4, Utils::CountOneBits64(DART_UINT64_C(0x10101010)));
EXPECT_EQ(8, Utils::CountOneBits64(DART_UINT64_C(0x03030303)));
EXPECT_EQ(32, Utils::CountOneBits64(DART_UINT64_C(0xFFFFFFFF)));
-
EXPECT_EQ(2, Utils::CountOneBits64(DART_UINT64_C(0x0000001000000010)));
EXPECT_EQ(2, Utils::CountOneBits64(DART_UINT64_C(0x0001000000010000)));
EXPECT_EQ(2, Utils::CountOneBits64(DART_UINT64_C(0x1000000010000000)));
@@ -133,7 +132,6 @@
EXPECT_EQ(4, Utils::CountOneBitsWord(0x10101010));
EXPECT_EQ(8, Utils::CountOneBitsWord(0x03030303));
EXPECT_EQ(32, Utils::CountOneBitsWord(0xFFFFFFFF));
-
#if defined(ARCH_IS_64_BIT)
EXPECT_EQ(2, Utils::CountOneBitsWord(0x0000001000000010));
EXPECT_EQ(2, Utils::CountOneBitsWord(0x0001000000010000));
@@ -144,20 +142,54 @@
#endif
}
-VM_UNIT_TEST_CASE(CountZeros) {
- EXPECT_EQ(0, Utils::CountTrailingZeros(0x1));
- EXPECT_EQ(kBitsPerWord - 1, Utils::CountLeadingZeros(0x1));
- EXPECT_EQ(1, Utils::CountTrailingZeros(0x2));
- EXPECT_EQ(kBitsPerWord - 2, Utils::CountLeadingZeros(0x2));
- EXPECT_EQ(0, Utils::CountTrailingZeros(0x3));
- EXPECT_EQ(kBitsPerWord - 2, Utils::CountLeadingZeros(0x3));
- EXPECT_EQ(2, Utils::CountTrailingZeros(0x4));
- EXPECT_EQ(kBitsPerWord - 3, Utils::CountLeadingZeros(0x4));
- EXPECT_EQ(0, Utils::CountTrailingZeros(kUwordMax));
- EXPECT_EQ(0, Utils::CountLeadingZeros(kUwordMax));
+VM_UNIT_TEST_CASE(CountTrailingZeros32) {
+ EXPECT_EQ(0, Utils::CountTrailingZeros32(0x1));
+ EXPECT_EQ(1, Utils::CountTrailingZeros32(0x2));
+ EXPECT_EQ(4, Utils::CountTrailingZeros32(0x0f0f0));
+ EXPECT_EQ(31, Utils::CountTrailingZeros32(0x80000000));
+ EXPECT_EQ(32, Utils::CountTrailingZeros32(0x0));
+}
+
+VM_UNIT_TEST_CASE(CountTrailingZeros64) {
+ EXPECT_EQ(0, Utils::CountTrailingZeros64(0x1));
+ EXPECT_EQ(1, Utils::CountTrailingZeros64(0x2));
+ EXPECT_EQ(4, Utils::CountTrailingZeros64(0x0f0f0));
+ EXPECT_EQ(63, Utils::CountTrailingZeros64(0x8000000000000000LLU));
+ EXPECT_EQ(64, Utils::CountTrailingZeros64(0x0));
+}
+
+VM_UNIT_TEST_CASE(CountLeadingZeros32) {
+ EXPECT_EQ(32, Utils::CountLeadingZeros32(0x0));
+ EXPECT_EQ(31, Utils::CountLeadingZeros32(0x1));
+ EXPECT_EQ(4, Utils::CountLeadingZeros32(0x0F0F0000));
+ EXPECT_EQ(1, Utils::CountLeadingZeros32(0x7FFFFFFF));
+ EXPECT_EQ(0, Utils::CountLeadingZeros32(0xFFFFFFFF));
+}
+
+VM_UNIT_TEST_CASE(CountLeadingZeros64) {
+ EXPECT_EQ(64, Utils::CountLeadingZeros64(0x0));
+ EXPECT_EQ(63, Utils::CountLeadingZeros64(0x1));
+ EXPECT_EQ(4, Utils::CountLeadingZeros64(0x0F0F000000000000LLU));
+ EXPECT_EQ(1, Utils::CountLeadingZeros64(0x7FFFFFFFFFFFFFFFLLU));
+ EXPECT_EQ(0, Utils::CountLeadingZeros64(0xFFFFFFFFFFFFFFFFLLU));
+}
+
+VM_UNIT_TEST_CASE(CountZerosWord) {
+ EXPECT_EQ(kBitsPerWord, Utils::CountTrailingZerosWord(0x0));
+ EXPECT_EQ(kBitsPerWord, Utils::CountLeadingZerosWord(0x0));
+ EXPECT_EQ(0, Utils::CountTrailingZerosWord(0x1));
+ EXPECT_EQ(kBitsPerWord - 1, Utils::CountLeadingZerosWord(0x1));
+ EXPECT_EQ(1, Utils::CountTrailingZerosWord(0x2));
+ EXPECT_EQ(kBitsPerWord - 2, Utils::CountLeadingZerosWord(0x2));
+ EXPECT_EQ(0, Utils::CountTrailingZerosWord(0x3));
+ EXPECT_EQ(kBitsPerWord - 2, Utils::CountLeadingZerosWord(0x3));
+ EXPECT_EQ(2, Utils::CountTrailingZerosWord(0x4));
+ EXPECT_EQ(kBitsPerWord - 3, Utils::CountLeadingZerosWord(0x4));
+ EXPECT_EQ(0, Utils::CountTrailingZerosWord(kUwordMax));
+ EXPECT_EQ(0, Utils::CountLeadingZerosWord(kUwordMax));
static const uword kTopBit = static_cast<uword>(1) << (kBitsPerWord - 1);
- EXPECT_EQ(kBitsPerWord - 1, Utils::CountTrailingZeros(kTopBit));
- EXPECT_EQ(0, Utils::CountLeadingZeros(kTopBit));
+ EXPECT_EQ(kBitsPerWord - 1, Utils::CountTrailingZerosWord(kTopBit));
+ EXPECT_EQ(0, Utils::CountLeadingZerosWord(kTopBit));
}
VM_UNIT_TEST_CASE(ReverseBits32) {
@@ -176,6 +208,13 @@
EXPECT_EQ(0x8f7b3d591e6a2c48LLU, Utils::ReverseBits64(0x123456789abcdef1LLU));
}
+VM_UNIT_TEST_CASE(ReverseBitsWord) {
+ const uword kOne = static_cast<uword>(1);
+ const uword kTopBit = kOne << (kBitsPerWord - 1);
+ EXPECT_EQ(kTopBit, Utils::ReverseBitsWord(kOne));
+ EXPECT_EQ(kOne, Utils::ReverseBitsWord(kTopBit));
+}
+
VM_UNIT_TEST_CASE(IsInt) {
EXPECT(Utils::IsInt(8, 16));
EXPECT(Utils::IsInt(8, 127));
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 22d6e0a..3a2e18e 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -195,7 +195,6 @@
# Libraries that go under lib/
_full_sdk_libraries = [
- "_chrome",
"_internal",
"async",
"cli",
diff --git a/sdk/lib/_chrome/dart2js/chrome_dart2js.dart b/sdk/lib/_chrome/dart2js/chrome_dart2js.dart
deleted file mode 100644
index 023afe4..0000000
--- a/sdk/lib/_chrome/dart2js/chrome_dart2js.dart
+++ /dev/null
@@ -1,1258 +0,0 @@
-/// Native wrappers for the Chrome packaged app APIs.
-///
-/// These functions allow direct access to the chrome.* APIs, allowing
-/// Chrome packaged apps to be written using Dart.
-///
-/// For more information on these APIs, see the
-/// [chrome.* API documentation](http://developer.chrome.com/apps/api_index.html).
-library _chrome;
-
-import 'dart:_foreign_helper' show JS;
-import 'dart:_js_helper';
-import 'dart:html_common';
-import 'dart:html';
-
-// Copyright (c) 2013, 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.
-
-// DO NOT EDIT
-// Auto-generated dart:_chrome library.
-
-/* TODO(sashab): Add "show convertDartClosureToJS" once 'show' works. */
-
-// Generated files below this line.
-// Copyright (c) 2013, 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.
-
-/**
- * A set of utilities for use with the Chrome Extension APIs.
- *
- * Allows for easy access to required JS objects.
- */
-
-/**
- * A dart object, that is convertible to JS. Used for creating objects in dart,
- * then passing them to JS.
- *
- * Objects that are passable to JS need to implement this interface.
- */
-abstract class ChromeObject {
- /*
- * Default Constructor
- *
- * Called by child objects during their regular construction.
- */
- ChromeObject() : _jsObject = JS('var', '{}');
-
- /*
- * Internal proxy constructor
- *
- * Creates a new Dart object using this existing proxy.
- */
- ChromeObject._proxy(this._jsObject);
-
- /*
- * JS Object Representation
- */
- final Object _jsObject;
-}
-
-/**
- * Useful functions for converting arguments.
- */
-
-/**
- * Converts the given map-type argument to js-friendly format, recursively.
- * Returns the new Map object.
- */
-Object _convertMapArgument(Map argument) {
- Map m = new Map();
- for (Object key in argument.keys) m[key] = convertArgument(argument[key]);
- return convertDartToNative_Dictionary(m);
-}
-
-/**
- * Converts the given list-type argument to js-friendly format, recursively.
- * Returns the new List object.
- */
-List _convertListArgument(List argument) {
- List l = new List();
- for (var i = 0; i < argument.length; i++) l.add(convertArgument(argument[i]));
- return l;
-}
-
-/**
- * Converts the given argument Object to js-friendly format, recursively.
- *
- * Flattens out all Chrome objects into their corresponding ._toMap()
- * definitions, then converts them to JS objects.
- *
- * Returns the new argument.
- *
- * Cannot be used for functions.
- */
-Object convertArgument(var argument) {
- if (argument == null) return argument;
-
- if (argument is num || argument is String || argument is bool)
- return argument;
-
- if (argument is ChromeObject) return argument._jsObject;
-
- if (argument is List) return _convertListArgument(argument);
-
- if (argument is Map) return _convertMapArgument(argument);
-
- if (argument is Function)
- throw new Exception("Cannot serialize Function argument ${argument}.");
-
- // TODO(sashab): Try and detect whether the argument is already serialized.
- return argument;
-}
-
-/// Description of a declarative rule for handling events.
-class Rule extends ChromeObject {
- /*
- * Public (Dart) constructor
- */
- Rule({String id, List conditions, List actions, int priority}) {
- this.id = id;
- this.conditions = conditions;
- this.actions = actions;
- this.priority = priority;
- }
-
- /*
- * Private (JS) constructor
- */
- Rule._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- String get id => JS('String', '#.id', this._jsObject);
-
- void set id(String id) {
- JS('void', '#.id = #', this._jsObject, id);
- }
-
- // TODO(sashab): Wrap these generic Lists somehow.
- List get conditions => JS('List', '#.conditions', this._jsObject);
-
- void set conditions(List conditions) {
- JS('void', '#.conditions = #', this._jsObject, convertArgument(conditions));
- }
-
- // TODO(sashab): Wrap these generic Lists somehow.
- List get actions => JS('List', '#.actions', this._jsObject);
-
- void set actions(List actions) {
- JS('void', '#.actions = #', this._jsObject, convertArgument(actions));
- }
-
- int get priority => JS('int', '#.priority', this._jsObject);
-
- void set priority(int priority) {
- JS('void', '#.priority = #', this._jsObject, priority);
- }
-}
-
-/**
- * The Event class.
- *
- * Chrome Event classes extend this interface.
- *
- * e.g.
- *
- * // chrome.app.runtime.onLaunched
- * class Event_ChromeAppRuntimeOnLaunched extends Event {
- * // constructor, passing the arity of the callback
- * Event_ChromeAppRuntimeOnLaunched(jsObject) :
- * super._(jsObject, 1);
- *
- * // methods, strengthening the Function parameter specificity
- * void addListener(void callback(LaunchData launchData))
- * => super.addListener(callback);
- * void removeListener(void callback(LaunchData launchData))
- * => super.removeListener(callback);
- * bool hasListener(void callback(LaunchData launchData))
- * => super.hasListener(callback);
- * }
- *
- */
-class Event {
- /*
- * JS Object Representation
- */
- final Object _jsObject;
-
- /*
- * Number of arguments the callback takes.
- */
- final int _callbackArity;
-
- /*
- * Private constructor
- */
- Event._(this._jsObject, this._callbackArity);
-
- /*
- * Methods
- */
-
- /// Registers an event listener <em>callback</em> to an event.
- void addListener(covariant Function callback) => JS(
- 'void',
- '#.addListener(#)',
- this._jsObject,
- convertDartClosureToJS(callback, this._callbackArity));
-
- /// Deregisters an event listener <em>callback</em> from an event.
- void removeListener(covariant Function callback) => JS(
- 'void',
- '#.removeListener(#)',
- this._jsObject,
- convertDartClosureToJS(callback, this._callbackArity));
-
- /// Returns True if <em>callback</em> is registered to the event.
- bool hasListener(covariant Function callback) => JS(
- 'bool',
- '#.hasListener(#)',
- this._jsObject,
- convertDartClosureToJS(callback, this._callbackArity));
-
- /// Returns true if any event listeners are registered to the event.
- bool hasListeners() => JS('bool', '#.hasListeners()', this._jsObject);
-
- /// Registers rules to handle events.
- ///
- /// [eventName] is the name of the event this function affects and [rules] are
- /// the rules to be registered. These do not replace previously registered
- /// rules. [callback] is called with registered rules.
- ///
- void addRules(String eventName, List<Rule> rules,
- [void callback(List<Rule> rules)]) {
- // proxy the callback
- void __proxy_callback(List rules) {
- if (callback != null) {
- List<Rule> __proxy_rules = new List<Rule>();
-
- for (Object o in rules) __proxy_rules.add(new Rule._proxy(o));
-
- callback(__proxy_rules);
- }
- }
-
- JS(
- 'void',
- '#.addRules(#, #, #)',
- this._jsObject,
- convertArgument(eventName),
- convertArgument(rules),
- convertDartClosureToJS(__proxy_callback, 1));
- }
-
- /// Returns currently registered rules.
- ///
- /// [eventName] is the name of the event this function affects and, if an array
- /// is passed as [ruleIdentifiers], only rules with identifiers contained in
- /// this array are returned. [callback] is called with registered rules.
- ///
- void getRules(String eventName,
- [List<String> ruleIdentifiers, void callback(List<Rule> rules)]) {
- // proxy the callback
- void __proxy_callback(List rules) {
- if (callback != null) {
- List<Rule> __proxy_rules = new List<Rule>();
-
- for (Object o in rules) __proxy_rules.add(new Rule._proxy(o));
-
- callback(__proxy_rules);
- }
- }
-
- JS(
- 'void',
- '#.getRules(#, #, #)',
- this._jsObject,
- convertArgument(eventName),
- convertArgument(ruleIdentifiers),
- convertDartClosureToJS(__proxy_callback, 1));
- }
-
- /// Unregisters currently registered rules.
- ///
- /// [eventName] is the name of the event this function affects and, if an array
- /// is passed as [ruleIdentifiers], only rules with identifiers contained in
- /// this array are unregistered. [callback] is called when the rules are
- /// unregistered.
- ///
- void removeRules(String eventName,
- [List<String> ruleIdentifiers, void callback()]) =>
- JS(
- 'void',
- '#.removeRules(#, #, #)',
- this._jsObject,
- convertArgument(eventName),
- convertArgument(ruleIdentifiers),
- convertDartClosureToJS(callback, 0));
-}
-
-// Copyright (c) 2012, 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.
-
-// chrome.app
-class API_ChromeApp {
- /*
- * JS Variable
- */
- final Object _jsObject;
-
- /*
- * Members
- */
- API_app_window window;
- API_app_runtime runtime;
-
- /*
- * Constructor
- */
- API_ChromeApp(this._jsObject) {
- var window_object = JS('', '#.window', this._jsObject);
- if (window_object == null)
- throw new UnsupportedError('Not supported by current browser.');
- window = new API_app_window(window_object);
-
- var runtime_object = JS('', '#.runtime', this._jsObject);
- if (runtime_object == null)
- throw new UnsupportedError('Not supported by current browser.');
- runtime = new API_app_runtime(runtime_object);
- }
-}
-
-// chrome
-class API_Chrome {
- /*
- * JS Variable
- */
- Object _jsObject;
-
- /*
- * Members
- */
- API_ChromeApp app;
- API_file_system fileSystem;
-
- /*
- * Constructor
- */
- API_Chrome() {
- this._jsObject = JS("Object", "chrome");
- if (this._jsObject == null)
- throw new UnsupportedError('Not supported by current browser.');
-
- var app_object = JS('', '#.app', this._jsObject);
- if (app_object == null)
- throw new UnsupportedError('Not supported by current browser.');
- app = new API_ChromeApp(app_object);
-
- var file_system_object = JS('', '#.fileSystem', this._jsObject);
- if (file_system_object == null)
- throw new UnsupportedError('Not supported by current browser.');
- fileSystem = new API_file_system(file_system_object);
- }
-}
-
-// The final chrome objects
-final API_Chrome chrome = new API_Chrome();
-// Copyright (c) 2013, 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.
-
-// Generated from namespace: app.window
-
-/**
- * Types
- */
-
-class AppWindowBounds extends ChromeObject {
- /*
- * Public constructor
- */
- AppWindowBounds({int left, int top, int width, int height}) {
- if (left != null) this.left = left;
- if (top != null) this.top = top;
- if (width != null) this.width = width;
- if (height != null) this.height = height;
- }
-
- /*
- * Private constructor
- */
- AppWindowBounds._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- int get left => JS('int', '#.left', this._jsObject);
-
- void set left(int left) {
- JS('void', '#.left = #', this._jsObject, left);
- }
-
- int get top => JS('int', '#.top', this._jsObject);
-
- void set top(int top) {
- JS('void', '#.top = #', this._jsObject, top);
- }
-
- int get width => JS('int', '#.width', this._jsObject);
-
- void set width(int width) {
- JS('void', '#.width = #', this._jsObject, width);
- }
-
- int get height => JS('int', '#.height', this._jsObject);
-
- void set height(int height) {
- JS('void', '#.height = #', this._jsObject, height);
- }
-}
-
-class AppWindowCreateWindowOptions extends ChromeObject {
- /*
- * Public constructor
- */
- AppWindowCreateWindowOptions(
- {String id,
- int defaultWidth,
- int defaultHeight,
- int defaultLeft,
- int defaultTop,
- int width,
- int height,
- int left,
- int top,
- int minWidth,
- int minHeight,
- int maxWidth,
- int maxHeight,
- String type,
- String frame,
- AppWindowBounds bounds,
- bool transparentBackground,
- String state,
- bool hidden,
- bool resizable,
- bool singleton}) {
- if (id != null) this.id = id;
- if (defaultWidth != null) this.defaultWidth = defaultWidth;
- if (defaultHeight != null) this.defaultHeight = defaultHeight;
- if (defaultLeft != null) this.defaultLeft = defaultLeft;
- if (defaultTop != null) this.defaultTop = defaultTop;
- if (width != null) this.width = width;
- if (height != null) this.height = height;
- if (left != null) this.left = left;
- if (top != null) this.top = top;
- if (minWidth != null) this.minWidth = minWidth;
- if (minHeight != null) this.minHeight = minHeight;
- if (maxWidth != null) this.maxWidth = maxWidth;
- if (maxHeight != null) this.maxHeight = maxHeight;
- if (type != null) this.type = type;
- if (frame != null) this.frame = frame;
- if (bounds != null) this.bounds = bounds;
- if (transparentBackground != null)
- this.transparentBackground = transparentBackground;
- if (state != null) this.state = state;
- if (hidden != null) this.hidden = hidden;
- if (resizable != null) this.resizable = resizable;
- if (singleton != null) this.singleton = singleton;
- }
-
- /*
- * Private constructor
- */
- AppWindowCreateWindowOptions._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// Id to identify the window. This will be used to remember the size and
- /// position of the window and restore that geometry when a window with the
- /// same id is later opened.
- String get id => JS('String', '#.id', this._jsObject);
-
- void set id(String id) {
- JS('void', '#.id = #', this._jsObject, id);
- }
-
- /// Default width of the window. (Deprecated; regular bounds act like this
- /// now.)
- int get defaultWidth => JS('int', '#.defaultWidth', this._jsObject);
-
- void set defaultWidth(int defaultWidth) {
- JS('void', '#.defaultWidth = #', this._jsObject, defaultWidth);
- }
-
- /// Default height of the window. (Deprecated; regular bounds act like this
- /// now.)
- int get defaultHeight => JS('int', '#.defaultHeight', this._jsObject);
-
- void set defaultHeight(int defaultHeight) {
- JS('void', '#.defaultHeight = #', this._jsObject, defaultHeight);
- }
-
- /// Default X coordinate of the window. (Deprecated; regular bounds act like
- /// this now.)
- int get defaultLeft => JS('int', '#.defaultLeft', this._jsObject);
-
- void set defaultLeft(int defaultLeft) {
- JS('void', '#.defaultLeft = #', this._jsObject, defaultLeft);
- }
-
- /// Default Y coordinate of the window. (Deprecated; regular bounds act like
- /// this now.)
- int get defaultTop => JS('int', '#.defaultTop', this._jsObject);
-
- void set defaultTop(int defaultTop) {
- JS('void', '#.defaultTop = #', this._jsObject, defaultTop);
- }
-
- /// Width of the window. (Deprecated; use 'bounds'.)
- int get width => JS('int', '#.width', this._jsObject);
-
- void set width(int width) {
- JS('void', '#.width = #', this._jsObject, width);
- }
-
- /// Height of the window. (Deprecated; use 'bounds'.)
- int get height => JS('int', '#.height', this._jsObject);
-
- void set height(int height) {
- JS('void', '#.height = #', this._jsObject, height);
- }
-
- /// X coordinate of the window. (Deprecated; use 'bounds'.)
- int get left => JS('int', '#.left', this._jsObject);
-
- void set left(int left) {
- JS('void', '#.left = #', this._jsObject, left);
- }
-
- /// Y coordinate of the window. (Deprecated; use 'bounds'.)
- int get top => JS('int', '#.top', this._jsObject);
-
- void set top(int top) {
- JS('void', '#.top = #', this._jsObject, top);
- }
-
- /// Minimum width for the lifetime of the window.
- int get minWidth => JS('int', '#.minWidth', this._jsObject);
-
- void set minWidth(int minWidth) {
- JS('void', '#.minWidth = #', this._jsObject, minWidth);
- }
-
- /// Minimum height for the lifetime of the window.
- int get minHeight => JS('int', '#.minHeight', this._jsObject);
-
- void set minHeight(int minHeight) {
- JS('void', '#.minHeight = #', this._jsObject, minHeight);
- }
-
- /// Maximum width for the lifetime of the window.
- int get maxWidth => JS('int', '#.maxWidth', this._jsObject);
-
- void set maxWidth(int maxWidth) {
- JS('void', '#.maxWidth = #', this._jsObject, maxWidth);
- }
-
- /// Maximum height for the lifetime of the window.
- int get maxHeight => JS('int', '#.maxHeight', this._jsObject);
-
- void set maxHeight(int maxHeight) {
- JS('void', '#.maxHeight = #', this._jsObject, maxHeight);
- }
-
- /// Type of window to create.
- String get type => JS('String', '#.type', this._jsObject);
-
- void set type(String type) {
- JS('void', '#.type = #', this._jsObject, type);
- }
-
- /// Frame type: 'none' or 'chrome' (defaults to 'chrome').
- String get frame => JS('String', '#.frame', this._jsObject);
-
- void set frame(String frame) {
- JS('void', '#.frame = #', this._jsObject, frame);
- }
-
- /// Size and position of the content in the window (excluding the titlebar). If
- /// an id is also specified and a window with a matching id has been shown
- /// before, the remembered bounds of the window will be used instead.
- AppWindowBounds get bounds =>
- new AppWindowBounds._proxy(JS('', '#.bounds', this._jsObject));
-
- void set bounds(AppWindowBounds bounds) {
- JS('void', '#.bounds = #', this._jsObject, convertArgument(bounds));
- }
-
- /// Enable window background transparency. Only supported in ash. Requires
- /// experimental API permission.
- bool get transparentBackground =>
- JS('bool', '#.transparentBackground', this._jsObject);
-
- void set transparentBackground(bool transparentBackground) {
- JS('void', '#.transparentBackground = #', this._jsObject,
- transparentBackground);
- }
-
- /// The initial state of the window, allowing it to be created already
- /// fullscreen, maximized, or minimized. Defaults to 'normal'.
- String get state => JS('String', '#.state', this._jsObject);
-
- void set state(String state) {
- JS('void', '#.state = #', this._jsObject, state);
- }
-
- /// If true, the window will be created in a hidden state. Call show() on the
- /// window to show it once it has been created. Defaults to false.
- bool get hidden => JS('bool', '#.hidden', this._jsObject);
-
- void set hidden(bool hidden) {
- JS('void', '#.hidden = #', this._jsObject, hidden);
- }
-
- /// If true, the window will be resizable by the user. Defaults to true.
- bool get resizable => JS('bool', '#.resizable', this._jsObject);
-
- void set resizable(bool resizable) {
- JS('void', '#.resizable = #', this._jsObject, resizable);
- }
-
- /// By default if you specify an id for the window, the window will only be
- /// created if another window with the same id doesn't already exist. If a
- /// window with the same id already exists that window is activated instead. If
- /// you do want to create multiple windows with the same id, you can set this
- /// property to false.
- bool get singleton => JS('bool', '#.singleton', this._jsObject);
-
- void set singleton(bool singleton) {
- JS('void', '#.singleton = #', this._jsObject, singleton);
- }
-}
-
-class AppWindowAppWindow extends ChromeObject {
- /*
- * Private constructor
- */
- AppWindowAppWindow._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// The JavaScript 'window' object for the created child.
- // Copyright (c) 2013, 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.
-
- // TODO(sashab, sra): Detect whether this is the current window, or an
- // external one, and return an appropriately-typed object
- WindowBase get contentWindow =>
- JS("Window", "#.contentWindow", this._jsObject);
-
- /*
- * Methods
- */
- /// Focus the window.
- void focus() => JS('void', '#.focus()', this._jsObject);
-
- /// Fullscreens the window.
- void fullscreen() => JS('void', '#.fullscreen()', this._jsObject);
-
- /// Is the window fullscreen?
- bool isFullscreen() => JS('bool', '#.isFullscreen()', this._jsObject);
-
- /// Minimize the window.
- void minimize() => JS('void', '#.minimize()', this._jsObject);
-
- /// Is the window minimized?
- bool isMinimized() => JS('bool', '#.isMinimized()', this._jsObject);
-
- /// Maximize the window.
- void maximize() => JS('void', '#.maximize()', this._jsObject);
-
- /// Is the window maximized?
- bool isMaximized() => JS('bool', '#.isMaximized()', this._jsObject);
-
- /// Restore the window, exiting a maximized, minimized, or fullscreen state.
- void restore() => JS('void', '#.restore()', this._jsObject);
-
- /// Move the window to the position (|left|, |top|).
- void moveTo(int left, int top) =>
- JS('void', '#.moveTo(#, #)', this._jsObject, left, top);
-
- /// Resize the window to |width|x|height| pixels in size.
- void resizeTo(int width, int height) =>
- JS('void', '#.resizeTo(#, #)', this._jsObject, width, height);
-
- /// Draw attention to the window.
- void drawAttention() => JS('void', '#.drawAttention()', this._jsObject);
-
- /// Clear attention to the window.
- void clearAttention() => JS('void', '#.clearAttention()', this._jsObject);
-
- /// Close the window.
- void close() => JS('void', '#.close()', this._jsObject);
-
- /// Show the window. Does nothing if the window is already visible.
- void show() => JS('void', '#.show()', this._jsObject);
-
- /// Hide the window. Does nothing if the window is already hidden.
- void hide() => JS('void', '#.hide()', this._jsObject);
-
- /// Get the window's bounds as a $ref:Bounds object.
- // Copyright (c) 2013, 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.
-
- // TODO(sashab, kalman): Fix IDL parser to read function return values
- // correctly. Currently, it just reads void for all functions.
- AppWindowBounds getBounds() =>
- new AppWindowBounds._proxy(JS('void', '#.getBounds()', this._jsObject));
-
- /// Set the window's bounds.
- void setBounds(AppWindowBounds bounds) =>
- JS('void', '#.setBounds(#)', this._jsObject, convertArgument(bounds));
-
- /// Set the app icon for the window (experimental). Currently this is only
- /// being implemented on Ash. TODO(stevenjb): Investigate implementing this on
- /// Windows and OSX.
- void setIcon(String icon_url) =>
- JS('void', '#.setIcon(#)', this._jsObject, icon_url);
-}
-
-/**
- * Events
- */
-
-/// Fired when the window is resized.
-class Event_app_window_onBoundsChanged extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_window_onBoundsChanged(jsObject) : super._(jsObject, 0);
-}
-
-/// Fired when the window is closed.
-class Event_app_window_onClosed extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_window_onClosed(jsObject) : super._(jsObject, 0);
-}
-
-/// Fired when the window is fullscreened.
-class Event_app_window_onFullscreened extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_window_onFullscreened(jsObject) : super._(jsObject, 0);
-}
-
-/// Fired when the window is maximized.
-class Event_app_window_onMaximized extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_window_onMaximized(jsObject) : super._(jsObject, 0);
-}
-
-/// Fired when the window is minimized.
-class Event_app_window_onMinimized extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_window_onMinimized(jsObject) : super._(jsObject, 0);
-}
-
-/// Fired when the window is restored from being minimized or maximized.
-class Event_app_window_onRestored extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_window_onRestored(jsObject) : super._(jsObject, 0);
-}
-
-/**
- * Functions
- */
-
-class API_app_window {
- /*
- * API connection
- */
- Object _jsObject;
-
- /*
- * Events
- */
- Event_app_window_onBoundsChanged onBoundsChanged;
- Event_app_window_onClosed onClosed;
- Event_app_window_onFullscreened onFullscreened;
- Event_app_window_onMaximized onMaximized;
- Event_app_window_onMinimized onMinimized;
- Event_app_window_onRestored onRestored;
-
- /*
- * Functions
- */
- /// The size and position of a window can be specified in a number of different
- /// ways. The most simple option is not specifying anything at all, in which
- /// case a default size and platform dependent position will be used.<br/><br/>
- /// Another option is to use the bounds property, which will put the window at
- /// the specified coordinates with the specified size. If the window has a
- /// frame, it's total size will be the size given plus the size of the frame;
- /// that is, the size in bounds is the content size, not the window
- /// size.<br/><br/> To automatically remember the positions of windows you can
- /// give them ids. If a window has an id, This id is used to remember the size
- /// and position of the window whenever it is moved or resized. This size and
- /// position is then used instead of the specified bounds on subsequent opening
- /// of a window with the same id. If you need to open a window with an id at a
- /// location other than the remembered default, you can create it hidden, move
- /// it to the desired location, then show it.
- // Copyright (c) 2013, 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.
-
- // TODO(sashab): This override is no longer needed once prefixes are removed.
- void create(String url,
- [AppWindowCreateWindowOptions options,
- void callback(AppWindowAppWindow created_window)]) {
- void __proxy_callback(created_window) {
- if (callback != null)
- callback(new AppWindowAppWindow._proxy(created_window));
- }
-
- JS('void', '#.create(#, #, #)', this._jsObject, url,
- convertArgument(options), convertDartClosureToJS(__proxy_callback, 1));
- }
-
- /// Returns an $ref:AppWindow object for the current script context (ie
- /// JavaScript 'window' object). This can also be called on a handle to a
- /// script context for another page, for example:
- /// otherWindow.chrome.app.window.current().
- // Copyright (c) 2013, 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.
-
- // TODO(sashab, kalman): Fix IDL parser to read function return values
- // correctly. Currently, it just reads void for all functions.
- AppWindowAppWindow current() =>
- new AppWindowAppWindow._proxy(JS('void', '#.current()', this._jsObject));
-
- void initializeAppWindow(Object state) => JS('void',
- '#.initializeAppWindow(#)', this._jsObject, convertArgument(state));
-
- API_app_window(this._jsObject) {
- onBoundsChanged = new Event_app_window_onBoundsChanged(
- JS('', '#.onBoundsChanged', this._jsObject));
- onClosed =
- new Event_app_window_onClosed(JS('', '#.onClosed', this._jsObject));
- onFullscreened = new Event_app_window_onFullscreened(
- JS('', '#.onFullscreened', this._jsObject));
- onMaximized = new Event_app_window_onMaximized(
- JS('', '#.onMaximized', this._jsObject));
- onMinimized = new Event_app_window_onMinimized(
- JS('', '#.onMinimized', this._jsObject));
- onRestored =
- new Event_app_window_onRestored(JS('', '#.onRestored', this._jsObject));
- }
-}
-// Copyright (c) 2013, 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.
-
-// Generated from namespace: app.runtime
-
-/**
- * Types
- */
-
-class AppRuntimeLaunchItem extends ChromeObject {
- /*
- * Public constructor
- */
- AppRuntimeLaunchItem({FileEntry entry, String type}) {
- if (entry != null) this.entry = entry;
- if (type != null) this.type = type;
- }
-
- /*
- * Private constructor
- */
- AppRuntimeLaunchItem._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// FileEntry for the file.
- FileEntry get entry => JS('FileEntry', '#.entry', this._jsObject);
-
- void set entry(FileEntry entry) {
- JS('void', '#.entry = #', this._jsObject, convertArgument(entry));
- }
-
- /// The MIME type of the file.
- String get type => JS('String', '#.type', this._jsObject);
-
- void set type(String type) {
- JS('void', '#.type = #', this._jsObject, type);
- }
-}
-
-class AppRuntimeLaunchData extends ChromeObject {
- /*
- * Public constructor
- */
- AppRuntimeLaunchData({String id, List<AppRuntimeLaunchItem> items}) {
- if (id != null) this.id = id;
- if (items != null) this.items = items;
- }
-
- /*
- * Private constructor
- */
- AppRuntimeLaunchData._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// The id of the file handler that the app is being invoked with.
- String get id => JS('String', '#.id', this._jsObject);
-
- void set id(String id) {
- JS('void', '#.id = #', this._jsObject, id);
- }
-
- List<AppRuntimeLaunchItem> get items {
- List<AppRuntimeLaunchItem> __proxy_items = new List<AppRuntimeLaunchItem>();
- int count = JS('int', '#.items.length', this._jsObject);
- for (int i = 0; i < count; i++) {
- var item = JS('', '#.items[#]', this._jsObject, i);
- __proxy_items.add(new AppRuntimeLaunchItem._proxy(item));
- }
- return __proxy_items;
- }
-
- void set items(List<AppRuntimeLaunchItem> items) {
- JS('void', '#.items = #', this._jsObject, convertArgument(items));
- }
-}
-
-/**
- * Events
- */
-
-/// Fired when an app is launched from the launcher.
-class Event_app_runtime_onLaunched extends Event {
- void addListener(void callback(AppRuntimeLaunchData launchData)) {
- void __proxy_callback(launchData) {
- if (callback != null) {
- callback(new AppRuntimeLaunchData._proxy(launchData));
- }
- }
-
- super.addListener(__proxy_callback);
- }
-
- void removeListener(void callback(AppRuntimeLaunchData launchData)) {
- void __proxy_callback(launchData) {
- if (callback != null) {
- callback(new AppRuntimeLaunchData._proxy(launchData));
- }
- }
-
- super.removeListener(__proxy_callback);
- }
-
- bool hasListener(void callback(AppRuntimeLaunchData launchData)) {
- void __proxy_callback(launchData) {
- if (callback != null) {
- callback(new AppRuntimeLaunchData._proxy(launchData));
- }
- }
-
- super.hasListener(__proxy_callback);
- }
-
- Event_app_runtime_onLaunched(jsObject) : super._(jsObject, 1);
-}
-
-/// Fired at Chrome startup to apps that were running when Chrome last shut
-/// down.
-class Event_app_runtime_onRestarted extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_runtime_onRestarted(jsObject) : super._(jsObject, 0);
-}
-
-/**
- * Functions
- */
-
-class API_app_runtime {
- /*
- * API connection
- */
- Object _jsObject;
-
- /*
- * Events
- */
- Event_app_runtime_onLaunched onLaunched;
- Event_app_runtime_onRestarted onRestarted;
- API_app_runtime(this._jsObject) {
- onLaunched = new Event_app_runtime_onLaunched(
- JS('', '#.onLaunched', this._jsObject));
- onRestarted = new Event_app_runtime_onRestarted(
- JS('', '#.onRestarted', this._jsObject));
- }
-}
-// Copyright (c) 2013, 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.
-
-// Generated from namespace: fileSystem
-
-/**
- * Types
- */
-
-class FilesystemAcceptOption extends ChromeObject {
- /*
- * Public constructor
- */
- FilesystemAcceptOption(
- {String description, List<String> mimeTypes, List<String> extensions}) {
- if (description != null) this.description = description;
- if (mimeTypes != null) this.mimeTypes = mimeTypes;
- if (extensions != null) this.extensions = extensions;
- }
-
- /*
- * Private constructor
- */
- FilesystemAcceptOption._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// This is the optional text description for this option. If not present, a
- /// description will be automatically generated; typically containing an
- /// expanded list of valid extensions (e.g. "text/html" may expand to "*.html,
- /// *.htm").
- String get description => JS('String', '#.description', this._jsObject);
-
- void set description(String description) {
- JS('void', '#.description = #', this._jsObject, description);
- }
-
- /// Mime-types to accept, e.g. "image/jpeg" or "audio/*". One of mimeTypes or
- /// extensions must contain at least one valid element.
- List<String> get mimeTypes =>
- JS('List<String>', '#.mimeTypes', this._jsObject);
-
- void set mimeTypes(List<String> mimeTypes) {
- JS('void', '#.mimeTypes = #', this._jsObject, mimeTypes);
- }
-
- /// Extensions to accept, e.g. "jpg", "gif", "crx".
- List<String> get extensions =>
- JS('List<String>', '#.extensions', this._jsObject);
-
- void set extensions(List<String> extensions) {
- JS('void', '#.extensions = #', this._jsObject, extensions);
- }
-}
-
-class FilesystemChooseEntryOptions extends ChromeObject {
- /*
- * Public constructor
- */
- FilesystemChooseEntryOptions(
- {String type,
- String suggestedName,
- List<FilesystemAcceptOption> accepts,
- bool acceptsAllTypes}) {
- if (type != null) this.type = type;
- if (suggestedName != null) this.suggestedName = suggestedName;
- if (accepts != null) this.accepts = accepts;
- if (acceptsAllTypes != null) this.acceptsAllTypes = acceptsAllTypes;
- }
-
- /*
- * Private constructor
- */
- FilesystemChooseEntryOptions._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// Type of the prompt to show. The default is 'openFile'.
- String get type => JS('String', '#.type', this._jsObject);
-
- void set type(String type) {
- JS('void', '#.type = #', this._jsObject, type);
- }
-
- /// The suggested file name that will be presented to the user as the default
- /// name to read or write. This is optional.
- String get suggestedName => JS('String', '#.suggestedName', this._jsObject);
-
- void set suggestedName(String suggestedName) {
- JS('void', '#.suggestedName = #', this._jsObject, suggestedName);
- }
-
- /// The optional list of accept options for this file opener. Each option will
- /// be presented as a unique group to the end-user.
- List<FilesystemAcceptOption> get accepts {
- List<FilesystemAcceptOption> __proxy_accepts =
- new List<FilesystemAcceptOption>();
- int count = JS('int', '#.accepts.length', this._jsObject);
- for (int i = 0; i < count; i++) {
- var item = JS('', '#.accepts[#]', this._jsObject, i);
- __proxy_accepts.add(new FilesystemAcceptOption._proxy(item));
- }
- return __proxy_accepts;
- }
-
- void set accepts(List<FilesystemAcceptOption> accepts) {
- JS('void', '#.accepts = #', this._jsObject, convertArgument(accepts));
- }
-
- /// Whether to accept all file types, in addition to the options specified in
- /// the accepts argument. The default is true. If the accepts field is unset or
- /// contains no valid entries, this will always be reset to true.
- bool get acceptsAllTypes => JS('bool', '#.acceptsAllTypes', this._jsObject);
-
- void set acceptsAllTypes(bool acceptsAllTypes) {
- JS('void', '#.acceptsAllTypes = #', this._jsObject, acceptsAllTypes);
- }
-}
-
-/**
- * Functions
- */
-
-class API_file_system {
- /*
- * API connection
- */
- Object _jsObject;
-
- /*
- * Functions
- */
- /// Get the display path of a FileEntry object. The display path is based on
- /// the full path of the file on the local file system, but may be made more
- /// readable for display purposes.
- void getDisplayPath(FileEntry fileEntry, void callback(String displayPath)) =>
- JS('void', '#.getDisplayPath(#, #)', this._jsObject,
- convertArgument(fileEntry), convertDartClosureToJS(callback, 1));
-
- /// Get a writable FileEntry from another FileEntry. This call will fail if the
- /// application does not have the 'write' permission under 'fileSystem'.
- void getWritableEntry(
- FileEntry fileEntry, void callback(FileEntry fileEntry)) {
- void __proxy_callback(fileEntry) {
- if (callback != null) {
- callback(fileEntry);
- }
- }
-
- JS(
- 'void',
- '#.getWritableEntry(#, #)',
- this._jsObject,
- convertArgument(fileEntry),
- convertDartClosureToJS(__proxy_callback, 1));
- }
-
- /// Gets whether this FileEntry is writable or not.
- void isWritableEntry(FileEntry fileEntry, void callback(bool isWritable)) =>
- JS('void', '#.isWritableEntry(#, #)', this._jsObject,
- convertArgument(fileEntry), convertDartClosureToJS(callback, 1));
-
- /// Ask the user to choose a file.
- void chooseEntry(void callback(FileEntry fileEntry),
- [FilesystemChooseEntryOptions options]) {
- void __proxy_callback(fileEntry) {
- if (callback != null) {
- callback(fileEntry);
- }
- }
-
- JS('void', '#.chooseEntry(#, #)', this._jsObject, convertArgument(options),
- convertDartClosureToJS(__proxy_callback, 1));
- }
-
- /// Returns the file entry with the given id if it can be restored. This call
- /// will fail otherwise.
- void restoreEntry(String id, void callback(FileEntry fileEntry)) {
- void __proxy_callback(fileEntry) {
- if (callback != null) {
- callback(fileEntry);
- }
- }
-
- JS('void', '#.restoreEntry(#, #)', this._jsObject, id,
- convertDartClosureToJS(__proxy_callback, 1));
- }
-
- /// Returns whether a file entry for the given id can be restored, i.e. whether
- /// restoreEntry would succeed with this id now.
- void isRestorable(String id, void callback(bool isRestorable)) => JS(
- 'void',
- '#.isRestorable(#, #)',
- this._jsObject,
- id,
- convertDartClosureToJS(callback, 1));
-
- /// Returns an id that can be passed to restoreEntry to regain access to a
- /// given file entry. Only the 500 most recently used entries are retained,
- /// where calls to retainEntry and restoreEntry count as use. If the app has
- /// the 'retainEntries' permission under 'fileSystem', entries are retained
- /// indefinitely. Otherwise, entries are retained only while the app is running
- /// and across restarts.
- String retainEntry(FileEntry fileEntry) => JS(
- 'String', '#.retainEntry(#)', this._jsObject, convertArgument(fileEntry));
-
- API_file_system(this._jsObject) {}
-}
diff --git a/sdk/lib/_internal/js_runtime/lib/rti.dart b/sdk/lib/_internal/js_runtime/lib/rti.dart
index da9f7cf..6c6729a 100644
--- a/sdk/lib/_internal/js_runtime/lib/rti.dart
+++ b/sdk/lib/_internal/js_runtime/lib/rti.dart
@@ -93,12 +93,12 @@
// Precomputed derived types. These fields are used to hold derived types that
// are computed eagerly.
// TODO(sra): Implement precomputed type optimizations.
+ @pragma('dart2js:noElision')
dynamic _precomputed1;
dynamic _precomputed2;
dynamic _precomputed3;
dynamic _precomputed4;
- static Rti _getPrecomputed1(Rti rti) => _castToRti(rti._precomputed1);
static void _setPrecomputed1(Rti rti, Rti precomputed) {
rti._precomputed1 = precomputed;
}
@@ -2086,7 +2086,6 @@
if (kind != Rti.kindInterface) {
throw AssertionError('Indexed base must be an interface type');
}
- if (index == 1) return Rti._getPrecomputed1(environment);
var typeArguments = Rti._getInterfaceTypeArguments(environment);
int len = _Utils.arrayLength(typeArguments);
if (index <= len) {
diff --git a/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart b/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart
index ba141fa..ffb8ed3 100644
--- a/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart
+++ b/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart
@@ -45,8 +45,6 @@
categories: "Client,Server",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart"),
- "_chrome": const LibraryInfo("_chrome/dart2js/chrome_dart2js.dart",
- categories: "Client", documented: false),
"collection": const LibraryInfo("collection/collection.dart",
categories: "Client,Server,Embedded",
maturity: Maturity.STABLE,
diff --git a/sdk/lib/libraries.json b/sdk/lib/libraries.json
index 5d1e2a5..4335766 100644
--- a/sdk/lib/libraries.json
+++ b/sdk/lib/libraries.json
@@ -199,9 +199,6 @@
"_js_helper": {
"uri": "_internal/js_runtime/lib/js_helper.dart"
},
- "_chrome": {
- "uri": "_chrome/dart2js/chrome_dart2js.dart"
- },
"js": {
"uri": "js/dart2js/js_dart2js.dart"
},
diff --git a/sdk/lib/libraries.yaml b/sdk/lib/libraries.yaml
index bffd897..78fa02d 100644
--- a/sdk/lib/libraries.yaml
+++ b/sdk/lib/libraries.yaml
@@ -2,7 +2,7 @@
# 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.
-# Note: if you edit this file, you must also edit libraries.json in this
+# Note: if you edit this file, you must also generate libraries.json in this
# directory:
#
# python ./tools/yaml2json.py sdk/lib/libraries.yaml sdk/lib/libraries.json
@@ -161,9 +161,6 @@
uri: "async/async.dart"
patches: "_internal/js_runtime/lib/async_patch.dart"
- _chrome:
- uri: "_chrome/dart2js/chrome_dart2js.dart"
-
collection:
uri: "collection/collection.dart"
patches: "_internal/js_runtime/lib/collection_patch.dart"
diff --git a/sdk_nnbd/BUILD.gn b/sdk_nnbd/BUILD.gn
index 22d6e0a..3a2e18e 100644
--- a/sdk_nnbd/BUILD.gn
+++ b/sdk_nnbd/BUILD.gn
@@ -195,7 +195,6 @@
# Libraries that go under lib/
_full_sdk_libraries = [
- "_chrome",
"_internal",
"async",
"cli",
diff --git a/sdk_nnbd/lib/_chrome/dart2js/chrome_dart2js.dart b/sdk_nnbd/lib/_chrome/dart2js/chrome_dart2js.dart
deleted file mode 100644
index c9a9735..0000000
--- a/sdk_nnbd/lib/_chrome/dart2js/chrome_dart2js.dart
+++ /dev/null
@@ -1,1260 +0,0 @@
-/// Native wrappers for the Chrome packaged app APIs.
-///
-/// These functions allow direct access to the chrome.* APIs, allowing
-/// Chrome packaged apps to be written using Dart.
-///
-/// For more information on these APIs, see the
-/// [chrome.* API documentation](http://developer.chrome.com/apps/api_index.html).
-// @dart = 2.5
-
-library _chrome;
-
-import 'dart:_foreign_helper' show JS;
-import 'dart:_js_helper';
-import 'dart:html_common';
-import 'dart:html';
-
-// Copyright (c) 2013, 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.
-
-// DO NOT EDIT
-// Auto-generated dart:_chrome library.
-
-/* TODO(sashab): Add "show convertDartClosureToJS" once 'show' works. */
-
-// Generated files below this line.
-// Copyright (c) 2013, 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.
-
-/**
- * A set of utilities for use with the Chrome Extension APIs.
- *
- * Allows for easy access to required JS objects.
- */
-
-/**
- * A dart object, that is convertible to JS. Used for creating objects in dart,
- * then passing them to JS.
- *
- * Objects that are passable to JS need to implement this interface.
- */
-abstract class ChromeObject {
- /*
- * Default Constructor
- *
- * Called by child objects during their regular construction.
- */
- ChromeObject() : _jsObject = JS('var', '{}');
-
- /*
- * Internal proxy constructor
- *
- * Creates a new Dart object using this existing proxy.
- */
- ChromeObject._proxy(this._jsObject);
-
- /*
- * JS Object Representation
- */
- final Object _jsObject;
-}
-
-/**
- * Useful functions for converting arguments.
- */
-
-/**
- * Converts the given map-type argument to js-friendly format, recursively.
- * Returns the new Map object.
- */
-Object _convertMapArgument(Map argument) {
- Map m = new Map();
- for (Object key in argument.keys) m[key] = convertArgument(argument[key]);
- return convertDartToNative_Dictionary(m);
-}
-
-/**
- * Converts the given list-type argument to js-friendly format, recursively.
- * Returns the new List object.
- */
-List _convertListArgument(List argument) {
- List l = new List();
- for (var i = 0; i < argument.length; i++) l.add(convertArgument(argument[i]));
- return l;
-}
-
-/**
- * Converts the given argument Object to js-friendly format, recursively.
- *
- * Flattens out all Chrome objects into their corresponding ._toMap()
- * definitions, then converts them to JS objects.
- *
- * Returns the new argument.
- *
- * Cannot be used for functions.
- */
-Object convertArgument(var argument) {
- if (argument == null) return argument;
-
- if (argument is num || argument is String || argument is bool)
- return argument;
-
- if (argument is ChromeObject) return argument._jsObject;
-
- if (argument is List) return _convertListArgument(argument);
-
- if (argument is Map) return _convertMapArgument(argument);
-
- if (argument is Function)
- throw new Exception("Cannot serialize Function argument ${argument}.");
-
- // TODO(sashab): Try and detect whether the argument is already serialized.
- return argument;
-}
-
-/// Description of a declarative rule for handling events.
-class Rule extends ChromeObject {
- /*
- * Public (Dart) constructor
- */
- Rule({String id, List conditions, List actions, int priority}) {
- this.id = id;
- this.conditions = conditions;
- this.actions = actions;
- this.priority = priority;
- }
-
- /*
- * Private (JS) constructor
- */
- Rule._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- String get id => JS('String', '#.id', this._jsObject);
-
- void set id(String id) {
- JS('void', '#.id = #', this._jsObject, id);
- }
-
- // TODO(sashab): Wrap these generic Lists somehow.
- List get conditions => JS('List', '#.conditions', this._jsObject);
-
- void set conditions(List conditions) {
- JS('void', '#.conditions = #', this._jsObject, convertArgument(conditions));
- }
-
- // TODO(sashab): Wrap these generic Lists somehow.
- List get actions => JS('List', '#.actions', this._jsObject);
-
- void set actions(List actions) {
- JS('void', '#.actions = #', this._jsObject, convertArgument(actions));
- }
-
- int get priority => JS('int', '#.priority', this._jsObject);
-
- void set priority(int priority) {
- JS('void', '#.priority = #', this._jsObject, priority);
- }
-}
-
-/**
- * The Event class.
- *
- * Chrome Event classes extend this interface.
- *
- * e.g.
- *
- * // chrome.app.runtime.onLaunched
- * class Event_ChromeAppRuntimeOnLaunched extends Event {
- * // constructor, passing the arity of the callback
- * Event_ChromeAppRuntimeOnLaunched(jsObject) :
- * super._(jsObject, 1);
- *
- * // methods, strengthening the Function parameter specificity
- * void addListener(void callback(LaunchData launchData))
- * => super.addListener(callback);
- * void removeListener(void callback(LaunchData launchData))
- * => super.removeListener(callback);
- * bool hasListener(void callback(LaunchData launchData))
- * => super.hasListener(callback);
- * }
- *
- */
-class Event {
- /*
- * JS Object Representation
- */
- final Object _jsObject;
-
- /*
- * Number of arguments the callback takes.
- */
- final int _callbackArity;
-
- /*
- * Private constructor
- */
- Event._(this._jsObject, this._callbackArity);
-
- /*
- * Methods
- */
-
- /// Registers an event listener <em>callback</em> to an event.
- void addListener(covariant Function callback) => JS(
- 'void',
- '#.addListener(#)',
- this._jsObject,
- convertDartClosureToJS(callback, this._callbackArity));
-
- /// Deregisters an event listener <em>callback</em> from an event.
- void removeListener(covariant Function callback) => JS(
- 'void',
- '#.removeListener(#)',
- this._jsObject,
- convertDartClosureToJS(callback, this._callbackArity));
-
- /// Returns True if <em>callback</em> is registered to the event.
- bool hasListener(covariant Function callback) => JS(
- 'bool',
- '#.hasListener(#)',
- this._jsObject,
- convertDartClosureToJS(callback, this._callbackArity));
-
- /// Returns true if any event listeners are registered to the event.
- bool hasListeners() => JS('bool', '#.hasListeners()', this._jsObject);
-
- /// Registers rules to handle events.
- ///
- /// [eventName] is the name of the event this function affects and [rules] are
- /// the rules to be registered. These do not replace previously registered
- /// rules. [callback] is called with registered rules.
- ///
- void addRules(String eventName, List<Rule> rules,
- [void callback(List<Rule> rules)]) {
- // proxy the callback
- void __proxy_callback(List rules) {
- if (callback != null) {
- List<Rule> __proxy_rules = new List<Rule>();
-
- for (Object o in rules) __proxy_rules.add(new Rule._proxy(o));
-
- callback(__proxy_rules);
- }
- }
-
- JS(
- 'void',
- '#.addRules(#, #, #)',
- this._jsObject,
- convertArgument(eventName),
- convertArgument(rules),
- convertDartClosureToJS(__proxy_callback, 1));
- }
-
- /// Returns currently registered rules.
- ///
- /// [eventName] is the name of the event this function affects and, if an array
- /// is passed as [ruleIdentifiers], only rules with identifiers contained in
- /// this array are returned. [callback] is called with registered rules.
- ///
- void getRules(String eventName,
- [List<String> ruleIdentifiers, void callback(List<Rule> rules)]) {
- // proxy the callback
- void __proxy_callback(List rules) {
- if (callback != null) {
- List<Rule> __proxy_rules = new List<Rule>();
-
- for (Object o in rules) __proxy_rules.add(new Rule._proxy(o));
-
- callback(__proxy_rules);
- }
- }
-
- JS(
- 'void',
- '#.getRules(#, #, #)',
- this._jsObject,
- convertArgument(eventName),
- convertArgument(ruleIdentifiers),
- convertDartClosureToJS(__proxy_callback, 1));
- }
-
- /// Unregisters currently registered rules.
- ///
- /// [eventName] is the name of the event this function affects and, if an array
- /// is passed as [ruleIdentifiers], only rules with identifiers contained in
- /// this array are unregistered. [callback] is called when the rules are
- /// unregistered.
- ///
- void removeRules(String eventName,
- [List<String> ruleIdentifiers, void callback()]) =>
- JS(
- 'void',
- '#.removeRules(#, #, #)',
- this._jsObject,
- convertArgument(eventName),
- convertArgument(ruleIdentifiers),
- convertDartClosureToJS(callback, 0));
-}
-
-// Copyright (c) 2012, 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.
-
-// chrome.app
-class API_ChromeApp {
- /*
- * JS Variable
- */
- final Object _jsObject;
-
- /*
- * Members
- */
- API_app_window window;
- API_app_runtime runtime;
-
- /*
- * Constructor
- */
- API_ChromeApp(this._jsObject) {
- var window_object = JS('', '#.window', this._jsObject);
- if (window_object == null)
- throw new UnsupportedError('Not supported by current browser.');
- window = new API_app_window(window_object);
-
- var runtime_object = JS('', '#.runtime', this._jsObject);
- if (runtime_object == null)
- throw new UnsupportedError('Not supported by current browser.');
- runtime = new API_app_runtime(runtime_object);
- }
-}
-
-// chrome
-class API_Chrome {
- /*
- * JS Variable
- */
- Object _jsObject;
-
- /*
- * Members
- */
- API_ChromeApp app;
- API_file_system fileSystem;
-
- /*
- * Constructor
- */
- API_Chrome() {
- this._jsObject = JS("Object", "chrome");
- if (this._jsObject == null)
- throw new UnsupportedError('Not supported by current browser.');
-
- var app_object = JS('', '#.app', this._jsObject);
- if (app_object == null)
- throw new UnsupportedError('Not supported by current browser.');
- app = new API_ChromeApp(app_object);
-
- var file_system_object = JS('', '#.fileSystem', this._jsObject);
- if (file_system_object == null)
- throw new UnsupportedError('Not supported by current browser.');
- fileSystem = new API_file_system(file_system_object);
- }
-}
-
-// The final chrome objects
-final API_Chrome chrome = new API_Chrome();
-// Copyright (c) 2013, 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.
-
-// Generated from namespace: app.window
-
-/**
- * Types
- */
-
-class AppWindowBounds extends ChromeObject {
- /*
- * Public constructor
- */
- AppWindowBounds({int left, int top, int width, int height}) {
- if (left != null) this.left = left;
- if (top != null) this.top = top;
- if (width != null) this.width = width;
- if (height != null) this.height = height;
- }
-
- /*
- * Private constructor
- */
- AppWindowBounds._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- int get left => JS('int', '#.left', this._jsObject);
-
- void set left(int left) {
- JS('void', '#.left = #', this._jsObject, left);
- }
-
- int get top => JS('int', '#.top', this._jsObject);
-
- void set top(int top) {
- JS('void', '#.top = #', this._jsObject, top);
- }
-
- int get width => JS('int', '#.width', this._jsObject);
-
- void set width(int width) {
- JS('void', '#.width = #', this._jsObject, width);
- }
-
- int get height => JS('int', '#.height', this._jsObject);
-
- void set height(int height) {
- JS('void', '#.height = #', this._jsObject, height);
- }
-}
-
-class AppWindowCreateWindowOptions extends ChromeObject {
- /*
- * Public constructor
- */
- AppWindowCreateWindowOptions(
- {String id,
- int defaultWidth,
- int defaultHeight,
- int defaultLeft,
- int defaultTop,
- int width,
- int height,
- int left,
- int top,
- int minWidth,
- int minHeight,
- int maxWidth,
- int maxHeight,
- String type,
- String frame,
- AppWindowBounds bounds,
- bool transparentBackground,
- String state,
- bool hidden,
- bool resizable,
- bool singleton}) {
- if (id != null) this.id = id;
- if (defaultWidth != null) this.defaultWidth = defaultWidth;
- if (defaultHeight != null) this.defaultHeight = defaultHeight;
- if (defaultLeft != null) this.defaultLeft = defaultLeft;
- if (defaultTop != null) this.defaultTop = defaultTop;
- if (width != null) this.width = width;
- if (height != null) this.height = height;
- if (left != null) this.left = left;
- if (top != null) this.top = top;
- if (minWidth != null) this.minWidth = minWidth;
- if (minHeight != null) this.minHeight = minHeight;
- if (maxWidth != null) this.maxWidth = maxWidth;
- if (maxHeight != null) this.maxHeight = maxHeight;
- if (type != null) this.type = type;
- if (frame != null) this.frame = frame;
- if (bounds != null) this.bounds = bounds;
- if (transparentBackground != null)
- this.transparentBackground = transparentBackground;
- if (state != null) this.state = state;
- if (hidden != null) this.hidden = hidden;
- if (resizable != null) this.resizable = resizable;
- if (singleton != null) this.singleton = singleton;
- }
-
- /*
- * Private constructor
- */
- AppWindowCreateWindowOptions._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// Id to identify the window. This will be used to remember the size and
- /// position of the window and restore that geometry when a window with the
- /// same id is later opened.
- String get id => JS('String', '#.id', this._jsObject);
-
- void set id(String id) {
- JS('void', '#.id = #', this._jsObject, id);
- }
-
- /// Default width of the window. (Deprecated; regular bounds act like this
- /// now.)
- int get defaultWidth => JS('int', '#.defaultWidth', this._jsObject);
-
- void set defaultWidth(int defaultWidth) {
- JS('void', '#.defaultWidth = #', this._jsObject, defaultWidth);
- }
-
- /// Default height of the window. (Deprecated; regular bounds act like this
- /// now.)
- int get defaultHeight => JS('int', '#.defaultHeight', this._jsObject);
-
- void set defaultHeight(int defaultHeight) {
- JS('void', '#.defaultHeight = #', this._jsObject, defaultHeight);
- }
-
- /// Default X coordinate of the window. (Deprecated; regular bounds act like
- /// this now.)
- int get defaultLeft => JS('int', '#.defaultLeft', this._jsObject);
-
- void set defaultLeft(int defaultLeft) {
- JS('void', '#.defaultLeft = #', this._jsObject, defaultLeft);
- }
-
- /// Default Y coordinate of the window. (Deprecated; regular bounds act like
- /// this now.)
- int get defaultTop => JS('int', '#.defaultTop', this._jsObject);
-
- void set defaultTop(int defaultTop) {
- JS('void', '#.defaultTop = #', this._jsObject, defaultTop);
- }
-
- /// Width of the window. (Deprecated; use 'bounds'.)
- int get width => JS('int', '#.width', this._jsObject);
-
- void set width(int width) {
- JS('void', '#.width = #', this._jsObject, width);
- }
-
- /// Height of the window. (Deprecated; use 'bounds'.)
- int get height => JS('int', '#.height', this._jsObject);
-
- void set height(int height) {
- JS('void', '#.height = #', this._jsObject, height);
- }
-
- /// X coordinate of the window. (Deprecated; use 'bounds'.)
- int get left => JS('int', '#.left', this._jsObject);
-
- void set left(int left) {
- JS('void', '#.left = #', this._jsObject, left);
- }
-
- /// Y coordinate of the window. (Deprecated; use 'bounds'.)
- int get top => JS('int', '#.top', this._jsObject);
-
- void set top(int top) {
- JS('void', '#.top = #', this._jsObject, top);
- }
-
- /// Minimum width for the lifetime of the window.
- int get minWidth => JS('int', '#.minWidth', this._jsObject);
-
- void set minWidth(int minWidth) {
- JS('void', '#.minWidth = #', this._jsObject, minWidth);
- }
-
- /// Minimum height for the lifetime of the window.
- int get minHeight => JS('int', '#.minHeight', this._jsObject);
-
- void set minHeight(int minHeight) {
- JS('void', '#.minHeight = #', this._jsObject, minHeight);
- }
-
- /// Maximum width for the lifetime of the window.
- int get maxWidth => JS('int', '#.maxWidth', this._jsObject);
-
- void set maxWidth(int maxWidth) {
- JS('void', '#.maxWidth = #', this._jsObject, maxWidth);
- }
-
- /// Maximum height for the lifetime of the window.
- int get maxHeight => JS('int', '#.maxHeight', this._jsObject);
-
- void set maxHeight(int maxHeight) {
- JS('void', '#.maxHeight = #', this._jsObject, maxHeight);
- }
-
- /// Type of window to create.
- String get type => JS('String', '#.type', this._jsObject);
-
- void set type(String type) {
- JS('void', '#.type = #', this._jsObject, type);
- }
-
- /// Frame type: 'none' or 'chrome' (defaults to 'chrome').
- String get frame => JS('String', '#.frame', this._jsObject);
-
- void set frame(String frame) {
- JS('void', '#.frame = #', this._jsObject, frame);
- }
-
- /// Size and position of the content in the window (excluding the titlebar). If
- /// an id is also specified and a window with a matching id has been shown
- /// before, the remembered bounds of the window will be used instead.
- AppWindowBounds get bounds =>
- new AppWindowBounds._proxy(JS('', '#.bounds', this._jsObject));
-
- void set bounds(AppWindowBounds bounds) {
- JS('void', '#.bounds = #', this._jsObject, convertArgument(bounds));
- }
-
- /// Enable window background transparency. Only supported in ash. Requires
- /// experimental API permission.
- bool get transparentBackground =>
- JS('bool', '#.transparentBackground', this._jsObject);
-
- void set transparentBackground(bool transparentBackground) {
- JS('void', '#.transparentBackground = #', this._jsObject,
- transparentBackground);
- }
-
- /// The initial state of the window, allowing it to be created already
- /// fullscreen, maximized, or minimized. Defaults to 'normal'.
- String get state => JS('String', '#.state', this._jsObject);
-
- void set state(String state) {
- JS('void', '#.state = #', this._jsObject, state);
- }
-
- /// If true, the window will be created in a hidden state. Call show() on the
- /// window to show it once it has been created. Defaults to false.
- bool get hidden => JS('bool', '#.hidden', this._jsObject);
-
- void set hidden(bool hidden) {
- JS('void', '#.hidden = #', this._jsObject, hidden);
- }
-
- /// If true, the window will be resizable by the user. Defaults to true.
- bool get resizable => JS('bool', '#.resizable', this._jsObject);
-
- void set resizable(bool resizable) {
- JS('void', '#.resizable = #', this._jsObject, resizable);
- }
-
- /// By default if you specify an id for the window, the window will only be
- /// created if another window with the same id doesn't already exist. If a
- /// window with the same id already exists that window is activated instead. If
- /// you do want to create multiple windows with the same id, you can set this
- /// property to false.
- bool get singleton => JS('bool', '#.singleton', this._jsObject);
-
- void set singleton(bool singleton) {
- JS('void', '#.singleton = #', this._jsObject, singleton);
- }
-}
-
-class AppWindowAppWindow extends ChromeObject {
- /*
- * Private constructor
- */
- AppWindowAppWindow._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// The JavaScript 'window' object for the created child.
- // Copyright (c) 2013, 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.
-
- // TODO(sashab, sra): Detect whether this is the current window, or an
- // external one, and return an appropriately-typed object
- WindowBase get contentWindow =>
- JS("Window", "#.contentWindow", this._jsObject);
-
- /*
- * Methods
- */
- /// Focus the window.
- void focus() => JS('void', '#.focus()', this._jsObject);
-
- /// Fullscreens the window.
- void fullscreen() => JS('void', '#.fullscreen()', this._jsObject);
-
- /// Is the window fullscreen?
- bool isFullscreen() => JS('bool', '#.isFullscreen()', this._jsObject);
-
- /// Minimize the window.
- void minimize() => JS('void', '#.minimize()', this._jsObject);
-
- /// Is the window minimized?
- bool isMinimized() => JS('bool', '#.isMinimized()', this._jsObject);
-
- /// Maximize the window.
- void maximize() => JS('void', '#.maximize()', this._jsObject);
-
- /// Is the window maximized?
- bool isMaximized() => JS('bool', '#.isMaximized()', this._jsObject);
-
- /// Restore the window, exiting a maximized, minimized, or fullscreen state.
- void restore() => JS('void', '#.restore()', this._jsObject);
-
- /// Move the window to the position (|left|, |top|).
- void moveTo(int left, int top) =>
- JS('void', '#.moveTo(#, #)', this._jsObject, left, top);
-
- /// Resize the window to |width|x|height| pixels in size.
- void resizeTo(int width, int height) =>
- JS('void', '#.resizeTo(#, #)', this._jsObject, width, height);
-
- /// Draw attention to the window.
- void drawAttention() => JS('void', '#.drawAttention()', this._jsObject);
-
- /// Clear attention to the window.
- void clearAttention() => JS('void', '#.clearAttention()', this._jsObject);
-
- /// Close the window.
- void close() => JS('void', '#.close()', this._jsObject);
-
- /// Show the window. Does nothing if the window is already visible.
- void show() => JS('void', '#.show()', this._jsObject);
-
- /// Hide the window. Does nothing if the window is already hidden.
- void hide() => JS('void', '#.hide()', this._jsObject);
-
- /// Get the window's bounds as a $ref:Bounds object.
- // Copyright (c) 2013, 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.
-
- // TODO(sashab, kalman): Fix IDL parser to read function return values
- // correctly. Currently, it just reads void for all functions.
- AppWindowBounds getBounds() =>
- new AppWindowBounds._proxy(JS('void', '#.getBounds()', this._jsObject));
-
- /// Set the window's bounds.
- void setBounds(AppWindowBounds bounds) =>
- JS('void', '#.setBounds(#)', this._jsObject, convertArgument(bounds));
-
- /// Set the app icon for the window (experimental). Currently this is only
- /// being implemented on Ash. TODO(stevenjb): Investigate implementing this on
- /// Windows and OSX.
- void setIcon(String icon_url) =>
- JS('void', '#.setIcon(#)', this._jsObject, icon_url);
-}
-
-/**
- * Events
- */
-
-/// Fired when the window is resized.
-class Event_app_window_onBoundsChanged extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_window_onBoundsChanged(jsObject) : super._(jsObject, 0);
-}
-
-/// Fired when the window is closed.
-class Event_app_window_onClosed extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_window_onClosed(jsObject) : super._(jsObject, 0);
-}
-
-/// Fired when the window is fullscreened.
-class Event_app_window_onFullscreened extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_window_onFullscreened(jsObject) : super._(jsObject, 0);
-}
-
-/// Fired when the window is maximized.
-class Event_app_window_onMaximized extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_window_onMaximized(jsObject) : super._(jsObject, 0);
-}
-
-/// Fired when the window is minimized.
-class Event_app_window_onMinimized extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_window_onMinimized(jsObject) : super._(jsObject, 0);
-}
-
-/// Fired when the window is restored from being minimized or maximized.
-class Event_app_window_onRestored extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_window_onRestored(jsObject) : super._(jsObject, 0);
-}
-
-/**
- * Functions
- */
-
-class API_app_window {
- /*
- * API connection
- */
- Object _jsObject;
-
- /*
- * Events
- */
- Event_app_window_onBoundsChanged onBoundsChanged;
- Event_app_window_onClosed onClosed;
- Event_app_window_onFullscreened onFullscreened;
- Event_app_window_onMaximized onMaximized;
- Event_app_window_onMinimized onMinimized;
- Event_app_window_onRestored onRestored;
-
- /*
- * Functions
- */
- /// The size and position of a window can be specified in a number of different
- /// ways. The most simple option is not specifying anything at all, in which
- /// case a default size and platform dependent position will be used.<br/><br/>
- /// Another option is to use the bounds property, which will put the window at
- /// the specified coordinates with the specified size. If the window has a
- /// frame, it's total size will be the size given plus the size of the frame;
- /// that is, the size in bounds is the content size, not the window
- /// size.<br/><br/> To automatically remember the positions of windows you can
- /// give them ids. If a window has an id, This id is used to remember the size
- /// and position of the window whenever it is moved or resized. This size and
- /// position is then used instead of the specified bounds on subsequent opening
- /// of a window with the same id. If you need to open a window with an id at a
- /// location other than the remembered default, you can create it hidden, move
- /// it to the desired location, then show it.
- // Copyright (c) 2013, 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.
-
- // TODO(sashab): This override is no longer needed once prefixes are removed.
- void create(String url,
- [AppWindowCreateWindowOptions options,
- void callback(AppWindowAppWindow created_window)]) {
- void __proxy_callback(created_window) {
- if (callback != null)
- callback(new AppWindowAppWindow._proxy(created_window));
- }
-
- JS('void', '#.create(#, #, #)', this._jsObject, url,
- convertArgument(options), convertDartClosureToJS(__proxy_callback, 1));
- }
-
- /// Returns an $ref:AppWindow object for the current script context (ie
- /// JavaScript 'window' object). This can also be called on a handle to a
- /// script context for another page, for example:
- /// otherWindow.chrome.app.window.current().
- // Copyright (c) 2013, 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.
-
- // TODO(sashab, kalman): Fix IDL parser to read function return values
- // correctly. Currently, it just reads void for all functions.
- AppWindowAppWindow current() =>
- new AppWindowAppWindow._proxy(JS('void', '#.current()', this._jsObject));
-
- void initializeAppWindow(Object state) => JS('void',
- '#.initializeAppWindow(#)', this._jsObject, convertArgument(state));
-
- API_app_window(this._jsObject) {
- onBoundsChanged = new Event_app_window_onBoundsChanged(
- JS('', '#.onBoundsChanged', this._jsObject));
- onClosed =
- new Event_app_window_onClosed(JS('', '#.onClosed', this._jsObject));
- onFullscreened = new Event_app_window_onFullscreened(
- JS('', '#.onFullscreened', this._jsObject));
- onMaximized = new Event_app_window_onMaximized(
- JS('', '#.onMaximized', this._jsObject));
- onMinimized = new Event_app_window_onMinimized(
- JS('', '#.onMinimized', this._jsObject));
- onRestored =
- new Event_app_window_onRestored(JS('', '#.onRestored', this._jsObject));
- }
-}
-// Copyright (c) 2013, 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.
-
-// Generated from namespace: app.runtime
-
-/**
- * Types
- */
-
-class AppRuntimeLaunchItem extends ChromeObject {
- /*
- * Public constructor
- */
- AppRuntimeLaunchItem({FileEntry entry, String type}) {
- if (entry != null) this.entry = entry;
- if (type != null) this.type = type;
- }
-
- /*
- * Private constructor
- */
- AppRuntimeLaunchItem._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// FileEntry for the file.
- FileEntry get entry => JS('FileEntry', '#.entry', this._jsObject);
-
- void set entry(FileEntry entry) {
- JS('void', '#.entry = #', this._jsObject, convertArgument(entry));
- }
-
- /// The MIME type of the file.
- String get type => JS('String', '#.type', this._jsObject);
-
- void set type(String type) {
- JS('void', '#.type = #', this._jsObject, type);
- }
-}
-
-class AppRuntimeLaunchData extends ChromeObject {
- /*
- * Public constructor
- */
- AppRuntimeLaunchData({String id, List<AppRuntimeLaunchItem> items}) {
- if (id != null) this.id = id;
- if (items != null) this.items = items;
- }
-
- /*
- * Private constructor
- */
- AppRuntimeLaunchData._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// The id of the file handler that the app is being invoked with.
- String get id => JS('String', '#.id', this._jsObject);
-
- void set id(String id) {
- JS('void', '#.id = #', this._jsObject, id);
- }
-
- List<AppRuntimeLaunchItem> get items {
- List<AppRuntimeLaunchItem> __proxy_items = new List<AppRuntimeLaunchItem>();
- int count = JS('int', '#.items.length', this._jsObject);
- for (int i = 0; i < count; i++) {
- var item = JS('', '#.items[#]', this._jsObject, i);
- __proxy_items.add(new AppRuntimeLaunchItem._proxy(item));
- }
- return __proxy_items;
- }
-
- void set items(List<AppRuntimeLaunchItem> items) {
- JS('void', '#.items = #', this._jsObject, convertArgument(items));
- }
-}
-
-/**
- * Events
- */
-
-/// Fired when an app is launched from the launcher.
-class Event_app_runtime_onLaunched extends Event {
- void addListener(void callback(AppRuntimeLaunchData launchData)) {
- void __proxy_callback(launchData) {
- if (callback != null) {
- callback(new AppRuntimeLaunchData._proxy(launchData));
- }
- }
-
- super.addListener(__proxy_callback);
- }
-
- void removeListener(void callback(AppRuntimeLaunchData launchData)) {
- void __proxy_callback(launchData) {
- if (callback != null) {
- callback(new AppRuntimeLaunchData._proxy(launchData));
- }
- }
-
- super.removeListener(__proxy_callback);
- }
-
- bool hasListener(void callback(AppRuntimeLaunchData launchData)) {
- void __proxy_callback(launchData) {
- if (callback != null) {
- callback(new AppRuntimeLaunchData._proxy(launchData));
- }
- }
-
- super.hasListener(__proxy_callback);
- }
-
- Event_app_runtime_onLaunched(jsObject) : super._(jsObject, 1);
-}
-
-/// Fired at Chrome startup to apps that were running when Chrome last shut
-/// down.
-class Event_app_runtime_onRestarted extends Event {
- void addListener(void callback()) => super.addListener(callback);
-
- void removeListener(void callback()) => super.removeListener(callback);
-
- bool hasListener(void callback()) => super.hasListener(callback);
-
- Event_app_runtime_onRestarted(jsObject) : super._(jsObject, 0);
-}
-
-/**
- * Functions
- */
-
-class API_app_runtime {
- /*
- * API connection
- */
- Object _jsObject;
-
- /*
- * Events
- */
- Event_app_runtime_onLaunched onLaunched;
- Event_app_runtime_onRestarted onRestarted;
- API_app_runtime(this._jsObject) {
- onLaunched = new Event_app_runtime_onLaunched(
- JS('', '#.onLaunched', this._jsObject));
- onRestarted = new Event_app_runtime_onRestarted(
- JS('', '#.onRestarted', this._jsObject));
- }
-}
-// Copyright (c) 2013, 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.
-
-// Generated from namespace: fileSystem
-
-/**
- * Types
- */
-
-class FilesystemAcceptOption extends ChromeObject {
- /*
- * Public constructor
- */
- FilesystemAcceptOption(
- {String description, List<String> mimeTypes, List<String> extensions}) {
- if (description != null) this.description = description;
- if (mimeTypes != null) this.mimeTypes = mimeTypes;
- if (extensions != null) this.extensions = extensions;
- }
-
- /*
- * Private constructor
- */
- FilesystemAcceptOption._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// This is the optional text description for this option. If not present, a
- /// description will be automatically generated; typically containing an
- /// expanded list of valid extensions (e.g. "text/html" may expand to "*.html,
- /// *.htm").
- String get description => JS('String', '#.description', this._jsObject);
-
- void set description(String description) {
- JS('void', '#.description = #', this._jsObject, description);
- }
-
- /// Mime-types to accept, e.g. "image/jpeg" or "audio/*". One of mimeTypes or
- /// extensions must contain at least one valid element.
- List<String> get mimeTypes =>
- JS('List<String>', '#.mimeTypes', this._jsObject);
-
- void set mimeTypes(List<String> mimeTypes) {
- JS('void', '#.mimeTypes = #', this._jsObject, mimeTypes);
- }
-
- /// Extensions to accept, e.g. "jpg", "gif", "crx".
- List<String> get extensions =>
- JS('List<String>', '#.extensions', this._jsObject);
-
- void set extensions(List<String> extensions) {
- JS('void', '#.extensions = #', this._jsObject, extensions);
- }
-}
-
-class FilesystemChooseEntryOptions extends ChromeObject {
- /*
- * Public constructor
- */
- FilesystemChooseEntryOptions(
- {String type,
- String suggestedName,
- List<FilesystemAcceptOption> accepts,
- bool acceptsAllTypes}) {
- if (type != null) this.type = type;
- if (suggestedName != null) this.suggestedName = suggestedName;
- if (accepts != null) this.accepts = accepts;
- if (acceptsAllTypes != null) this.acceptsAllTypes = acceptsAllTypes;
- }
-
- /*
- * Private constructor
- */
- FilesystemChooseEntryOptions._proxy(_jsObject) : super._proxy(_jsObject);
-
- /*
- * Public accessors
- */
- /// Type of the prompt to show. The default is 'openFile'.
- String get type => JS('String', '#.type', this._jsObject);
-
- void set type(String type) {
- JS('void', '#.type = #', this._jsObject, type);
- }
-
- /// The suggested file name that will be presented to the user as the default
- /// name to read or write. This is optional.
- String get suggestedName => JS('String', '#.suggestedName', this._jsObject);
-
- void set suggestedName(String suggestedName) {
- JS('void', '#.suggestedName = #', this._jsObject, suggestedName);
- }
-
- /// The optional list of accept options for this file opener. Each option will
- /// be presented as a unique group to the end-user.
- List<FilesystemAcceptOption> get accepts {
- List<FilesystemAcceptOption> __proxy_accepts =
- new List<FilesystemAcceptOption>();
- int count = JS('int', '#.accepts.length', this._jsObject);
- for (int i = 0; i < count; i++) {
- var item = JS('', '#.accepts[#]', this._jsObject, i);
- __proxy_accepts.add(new FilesystemAcceptOption._proxy(item));
- }
- return __proxy_accepts;
- }
-
- void set accepts(List<FilesystemAcceptOption> accepts) {
- JS('void', '#.accepts = #', this._jsObject, convertArgument(accepts));
- }
-
- /// Whether to accept all file types, in addition to the options specified in
- /// the accepts argument. The default is true. If the accepts field is unset or
- /// contains no valid entries, this will always be reset to true.
- bool get acceptsAllTypes => JS('bool', '#.acceptsAllTypes', this._jsObject);
-
- void set acceptsAllTypes(bool acceptsAllTypes) {
- JS('void', '#.acceptsAllTypes = #', this._jsObject, acceptsAllTypes);
- }
-}
-
-/**
- * Functions
- */
-
-class API_file_system {
- /*
- * API connection
- */
- Object _jsObject;
-
- /*
- * Functions
- */
- /// Get the display path of a FileEntry object. The display path is based on
- /// the full path of the file on the local file system, but may be made more
- /// readable for display purposes.
- void getDisplayPath(FileEntry fileEntry, void callback(String displayPath)) =>
- JS('void', '#.getDisplayPath(#, #)', this._jsObject,
- convertArgument(fileEntry), convertDartClosureToJS(callback, 1));
-
- /// Get a writable FileEntry from another FileEntry. This call will fail if the
- /// application does not have the 'write' permission under 'fileSystem'.
- void getWritableEntry(
- FileEntry fileEntry, void callback(FileEntry fileEntry)) {
- void __proxy_callback(fileEntry) {
- if (callback != null) {
- callback(fileEntry);
- }
- }
-
- JS(
- 'void',
- '#.getWritableEntry(#, #)',
- this._jsObject,
- convertArgument(fileEntry),
- convertDartClosureToJS(__proxy_callback, 1));
- }
-
- /// Gets whether this FileEntry is writable or not.
- void isWritableEntry(FileEntry fileEntry, void callback(bool isWritable)) =>
- JS('void', '#.isWritableEntry(#, #)', this._jsObject,
- convertArgument(fileEntry), convertDartClosureToJS(callback, 1));
-
- /// Ask the user to choose a file.
- void chooseEntry(void callback(FileEntry fileEntry),
- [FilesystemChooseEntryOptions options]) {
- void __proxy_callback(fileEntry) {
- if (callback != null) {
- callback(fileEntry);
- }
- }
-
- JS('void', '#.chooseEntry(#, #)', this._jsObject, convertArgument(options),
- convertDartClosureToJS(__proxy_callback, 1));
- }
-
- /// Returns the file entry with the given id if it can be restored. This call
- /// will fail otherwise.
- void restoreEntry(String id, void callback(FileEntry fileEntry)) {
- void __proxy_callback(fileEntry) {
- if (callback != null) {
- callback(fileEntry);
- }
- }
-
- JS('void', '#.restoreEntry(#, #)', this._jsObject, id,
- convertDartClosureToJS(__proxy_callback, 1));
- }
-
- /// Returns whether a file entry for the given id can be restored, i.e. whether
- /// restoreEntry would succeed with this id now.
- void isRestorable(String id, void callback(bool isRestorable)) => JS(
- 'void',
- '#.isRestorable(#, #)',
- this._jsObject,
- id,
- convertDartClosureToJS(callback, 1));
-
- /// Returns an id that can be passed to restoreEntry to regain access to a
- /// given file entry. Only the 500 most recently used entries are retained,
- /// where calls to retainEntry and restoreEntry count as use. If the app has
- /// the 'retainEntries' permission under 'fileSystem', entries are retained
- /// indefinitely. Otherwise, entries are retained only while the app is running
- /// and across restarts.
- String retainEntry(FileEntry fileEntry) => JS(
- 'String', '#.retainEntry(#)', this._jsObject, convertArgument(fileEntry));
-
- API_file_system(this._jsObject) {}
-}
diff --git a/sdk_nnbd/lib/_internal/js_runtime/lib/rti.dart b/sdk_nnbd/lib/_internal/js_runtime/lib/rti.dart
index f1f8d00..bba55ef 100644
--- a/sdk_nnbd/lib/_internal/js_runtime/lib/rti.dart
+++ b/sdk_nnbd/lib/_internal/js_runtime/lib/rti.dart
@@ -95,12 +95,12 @@
// Precomputed derived types. These fields are used to hold derived types that
// are computed eagerly.
// TODO(sra): Implement precomputed type optimizations.
+ @pragma('dart2js:noElision')
dynamic _precomputed1;
dynamic _precomputed2;
dynamic _precomputed3;
dynamic _precomputed4;
- static Rti _getPrecomputed1(Rti rti) => _castToRti(rti._precomputed1);
static void _setPrecomputed1(Rti rti, Rti precomputed) {
rti._precomputed1 = precomputed;
}
@@ -2088,7 +2088,6 @@
if (kind != Rti.kindInterface) {
throw AssertionError('Indexed base must be an interface type');
}
- if (index == 1) return Rti._getPrecomputed1(environment);
var typeArguments = Rti._getInterfaceTypeArguments(environment);
int len = _Utils.arrayLength(typeArguments);
if (index <= len) {
diff --git a/sdk_nnbd/lib/_internal/sdk_library_metadata/lib/libraries.dart b/sdk_nnbd/lib/_internal/sdk_library_metadata/lib/libraries.dart
index 9d41ab3..523a0c1 100644
--- a/sdk_nnbd/lib/_internal/sdk_library_metadata/lib/libraries.dart
+++ b/sdk_nnbd/lib/_internal/sdk_library_metadata/lib/libraries.dart
@@ -47,8 +47,6 @@
categories: "Client,Server",
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart"),
- "_chrome": const LibraryInfo("_chrome/dart2js/chrome_dart2js.dart",
- categories: "Client", documented: false),
"collection": const LibraryInfo("collection/collection.dart",
categories: "Client,Server,Embedded",
maturity: Maturity.STABLE,
diff --git a/sdk_nnbd/lib/libraries.json b/sdk_nnbd/lib/libraries.json
index fc19bb1..95aa4205 100644
--- a/sdk_nnbd/lib/libraries.json
+++ b/sdk_nnbd/lib/libraries.json
@@ -199,9 +199,6 @@
"_js_helper": {
"uri": "_internal/js_runtime/lib/js_helper.dart"
},
- "_chrome": {
- "uri": "_chrome/dart2js/chrome_dart2js.dart"
- },
"js": {
"uri": "js/dart2js/js_dart2js.dart"
},
diff --git a/sdk_nnbd/lib/libraries.yaml b/sdk_nnbd/lib/libraries.yaml
index 7e78ad6..31a800e 100644
--- a/sdk_nnbd/lib/libraries.yaml
+++ b/sdk_nnbd/lib/libraries.yaml
@@ -2,7 +2,7 @@
# 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.
-# Note: if you edit this file, you must also edit libraries.json in this
+# Note: if you edit this file, you must also generate libraries.json in this
# directory:
#
# python ./tools/yaml2json.py sdk_nnbd/lib/libraries.yaml sdk_nnbd/lib/libraries.json
@@ -161,9 +161,6 @@
uri: "async/async.dart"
patches: "_internal/js_runtime/lib/async_patch.dart"
- _chrome:
- uri: "_chrome/dart2js/chrome_dart2js.dart"
-
collection:
uri: "collection/collection.dart"
patches: "_internal/js_runtime/lib/collection_patch.dart"
diff --git a/tests/standalone_2/io/file_error2_test.dart b/tests/standalone_2/io/file_error2_test.dart
index c282d038..6e21417 100644
--- a/tests/standalone_2/io/file_error2_test.dart
+++ b/tests/standalone_2/io/file_error2_test.dart
@@ -7,6 +7,7 @@
// Customize ASAN options for this test with 'allocator_may_return_null=1' as
// it tries to allocate a large memory buffer.
// Environment=ASAN_OPTIONS=handle_segv=0:detect_stack_use_after_return=1:allocator_may_return_null=1
+// Environment=MSAN_OPTIONS=handle_segv=0:detect_stack_use_after_return=1:allocator_may_return_null=1
import "dart:io";
diff --git a/tools/VERSION b/tools/VERSION
index 47453cd..915faac 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -33,7 +33,7 @@
MAJOR 2
MINOR 6
PATCH 0
-PRERELEASE 6
+PRERELEASE 7
PRERELEASE_PATCH 0
ABI_VERSION 17
OLDEST_SUPPORTED_ABI_VERSION 16
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 1cc16e0..0cc4ec9 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -167,6 +167,7 @@
"out/DebugSIMARM_X64/",
"out/DebugSIMDBC64/",
"out/DebugAndroidARM/",
+ "out/DebugAndroidARM_X64/",
"out/DebugAndroidARM64/",
"out/ReleaseIA32/",
"out/ReleaseX64/",
@@ -175,6 +176,7 @@
"out/ReleaseSIMARM_X64/",
"out/ReleaseSIMDBC64/",
"out/ReleaseAndroidARM/",
+ "out/ReleaseAndroidARM_X64/",
"out/ReleaseAndroidARM64/",
"out/ReleaseXARM64/",
"out/ProductIA32/",
@@ -283,6 +285,21 @@
"builder-tag": "asan",
"timeout": 240
}},
+ "dartk-lsan-(linux|mac|win)-(debug|product|release)-(ia32|x64)": {
+ "options": {
+ "builder-tag": "lsan",
+ "timeout": 240
+ }},
+ "dartk-msan-(linux|mac|win)-(debug|product|release)-(ia32|x64)": {
+ "options": {
+ "builder-tag": "msan",
+ "timeout": 240
+ }},
+ "dartk-tsan-(linux|mac|win)-(debug|product|release)-x64": {
+ "options": {
+ "builder-tag": "tsan",
+ "timeout": 240
+ }},
"dart2js-(linux|mac|win)-chrome": {
"options": {
"use-sdk": true
@@ -339,7 +356,7 @@
"minified": true,
"use-sdk": true
}},
- "dartkp-android-(debug|product|release)-(arm|arm64)": {
+ "dartkp-android-(debug|product|release)-(arm|arm64|arm_x64)": {
"options": {
"use-elf": true
}},
@@ -600,6 +617,7 @@
{
"builders": [
"vm-kernel-precomp-android-release-arm",
+ "vm-kernel-precomp-android-release-arm_x64",
"vm-kernel-precomp-android-release-arm64"
],
"meta": {
@@ -785,7 +803,7 @@
"arguments": ["runtime"],
"environment": {
"DART_USE_ASAN": 1,
- "ASAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0",
+ "ASAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
"ASAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
}
},
@@ -794,7 +812,7 @@
"arguments": [
"-ndartk-asan-linux-release-${arch}"],
"environment": {
- "ASAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0",
+ "ASAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
"ASAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
}
}
@@ -802,6 +820,95 @@
},
{
"builders": [
+ "vm-kernel-lsan-linux-release-ia32",
+ "vm-kernel-lsan-linux-release-x64"
+ ],
+ "meta": {
+ "description": "This configuration is used by the vm builders with leak sanitizing (lsan). We have to run gn.py with the DART_USE_LSAN options, which we do by running generate_buildfiles."
+ },
+ "steps": [
+ {
+ "name": "build dart",
+ "script": "tools/build.py",
+ "arguments": ["runtime"],
+ "environment": {
+ "DART_USE_LSAN": 1,
+ "ASAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
+ "ASAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
+ }
+ },
+ {
+ "name": "vm tests",
+ "arguments": [
+ "-ndartk-lsan-linux-release-${arch}"],
+ "environment": {
+ "ASAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
+ "ASAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
+ }
+ }
+ ]
+ },
+ {
+ "builders": [
+ "vm-kernel-msan-linux-release-ia32",
+ "vm-kernel-msan-linux-release-x64"
+ ],
+ "meta": {
+ "description": "This configuration is used by the vm builders with memory sanitizing (msan). We have to run gn.py with the DART_USE_MSAN options, which we do by running generate_buildfiles."
+ },
+ "steps": [
+ {
+ "name": "build dart",
+ "script": "tools/build.py",
+ "arguments": ["runtime"],
+ "environment": {
+ "DART_USE_MSAN": 1,
+ "MSAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
+ "MSAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
+ }
+ },
+ {
+ "name": "vm tests",
+ "arguments": [
+ "-ndartk-msan-linux-release-${arch}"],
+ "environment": {
+ "MSAN_OPTIONS": "handle_segv=0:detect_leaks=1:detect_stack_use_after_return=0:disable_coredump=0:abort_on_error=1",
+ "MSAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
+ }
+ }
+ ]
+ },
+ {
+ "builders": [
+ "vm-kernel-tsan-linux-release-x64"
+ ],
+ "meta": {
+ "description": "This configuration is used by the vm builders with thread sanitizing (tsan). We have to run gn.py with the DART_USE_TSAN options, which we do by running generate_buildfiles."
+ },
+ "steps": [
+ {
+ "name": "build dart",
+ "script": "tools/build.py",
+ "arguments": ["runtime"],
+ "environment": {
+ "DART_USE_TSAN": 1,
+ "TSAN_OPTIONS": "handle_segv=0:disable_coredump=0:abort_on_error=1",
+ "TSAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
+ }
+ },
+ {
+ "name": "vm tests",
+ "arguments": [
+ "-ndartk-tsan-linux-release-${arch}"],
+ "environment": {
+ "TSAN_OPTIONS": "handle_segv=0:disable_coredump=0:abort_on_error=1",
+ "TSAN_SYMBOLIZER_PATH": "buildtools/linux-x64/clang/bin/llvm-symbolizer"
+ }
+ }
+ ]
+ },
+ {
+ "builders": [
"vm-kernel-linux-release-simarm",
"vm-kernel-linux-release-simarm64",
"vm-kernel-linux-release-ia32",
diff --git a/tools/build.py b/tools/build.py
index 6eef99c..4ff1a18 100755
--- a/tools/build.py
+++ b/tools/build.py
@@ -17,7 +17,7 @@
SCRIPT_DIR = os.path.dirname(sys.argv[0])
DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
AVAILABLE_ARCHS = [
- 'ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6', 'simarmv5te',
+ 'ia32', 'x64', 'simarm', 'arm', 'arm_x64', 'simarmv6', 'armv6', 'simarmv5te',
'armv5te', 'simarm64', 'arm64', 'simdbc', 'simdbc64', 'armsimdbc',
'armsimdbc64', 'simarm_x64'
]
@@ -117,7 +117,7 @@
% (os_name, HOST_OS))
return False
if not arch in [
- 'ia32', 'x64', 'arm', 'armv6', 'armv5te', 'arm64', 'simdbc',
+ 'ia32', 'x64', 'arm', 'arm_x64', 'armv6', 'armv5te', 'arm64', 'simdbc',
'simdbc64'
]:
print(
diff --git a/tools/gn.py b/tools/gn.py
index 2b023a3..14f5a4b 100755
--- a/tools/gn.py
+++ b/tools/gn.py
@@ -20,6 +20,7 @@
# Environment variables for default settings.
DART_USE_ASAN = "DART_USE_ASAN" # Use instead of --asan
+DART_USE_LSAN = "DART_USE_LSAN" # Use instead of --lsan
DART_USE_MSAN = "DART_USE_MSAN" # Use instead of --msan
DART_USE_TSAN = "DART_USE_TSAN" # Use instead of --tsan
DART_USE_TOOLCHAIN = "DART_USE_TOOLCHAIN" # Use instread of --toolchain-prefix
@@ -35,6 +36,10 @@
return DART_USE_ASAN in os.environ
+def UseLSAN():
+ return DART_USE_LSAN in os.environ
+
+
def UseMSAN():
return DART_USE_MSAN in os.environ
@@ -89,7 +94,9 @@
'simarmv5te', 'simdbc', 'armsimdbc', 'simarm_x64'
]:
return 'x86'
- if arch in ['x64', 'arm64', 'simarm64', 'simdbc64', 'armsimdbc64']:
+ if arch in [
+ 'x64', 'arm64', 'simarm64', 'simdbc64', 'armsimdbc64', 'arm_x64'
+ ]:
return 'x64'
@@ -103,6 +110,8 @@
return 'arm' if target_os == 'android' else 'x86'
if arch in ['simdbc64']:
return 'arm64' if target_os == 'android' else 'x64'
+ if arch == 'arm_x64':
+ return 'arm'
if arch == 'armsimdbc':
return 'arm'
if arch == 'armsimdbc64':
@@ -116,7 +125,7 @@
return 'ia32'
if arch in ['x64']:
return 'x64'
- if arch in ['arm', 'simarm', 'simarm_x64']:
+ if arch in ['arm', 'simarm', 'simarm_x64', 'arm_x64']:
return 'arm'
if arch in ['armv6', 'simarmv6']:
return 'armv6'
@@ -148,7 +157,7 @@
def UseSanitizer(args):
- return args.asan or args.msan or args.tsan
+ return args.asan or args.lsan or args.msan or args.tsan
def DontUseClang(args, target_os, host_cpu, target_cpu):
@@ -245,6 +254,7 @@
gn_args['dart_vm_code_coverage'] = enable_code_coverage
gn_args['is_asan'] = args.asan and gn_args['is_clang']
+ gn_args['is_lsan'] = args.lsan and gn_args['is_clang']
gn_args['is_msan'] = args.msan and gn_args['is_clang']
gn_args['is_tsan'] = args.tsan and gn_args['is_clang']
@@ -313,7 +323,7 @@
return False
for arch in args.arch:
archs = [
- 'ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6', 'simarmv5te',
+ 'ia32', 'x64', 'simarm', 'arm', 'arm_x64', 'simarmv6', 'armv6', 'simarmv5te',
'armv5te', 'simarm64', 'arm64', 'simdbc', 'simdbc64', 'armsimdbc',
'armsimdbc64', 'simarm_x64'
]
@@ -334,7 +344,7 @@
% (os_name, HOST_OS))
return False
if not arch in [
- 'ia32', 'x64', 'arm', 'armv6', 'armv5te', 'arm64', 'simdbc',
+ 'ia32', 'x64', 'arm', 'arm_x64', 'armv6', 'armv5te', 'arm64', 'simdbc',
'simdbc64'
]:
print(
@@ -373,7 +383,7 @@
'-a',
type=str,
help='Target architectures (comma-separated).',
- metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,'
+ metavar='[all,ia32,x64,simarm,arm,arm_x64,simarmv6,armv6,simarmv5te,armv5te,'
'simarm64,arm64,simdbc,armsimdbc,simarm_x64]',
default='x64')
common_group.add_argument(
@@ -457,6 +467,13 @@
dest='exclude_kernel_service',
action='store_true')
other_group.add_argument(
+ '--lsan',
+ help='Build with LSAN',
+ default=UseLSAN(),
+ action='store_true')
+ other_group.add_argument(
+ '--no-lsan', help='Disable LSAN', dest='lsan', action='store_false')
+ other_group.add_argument(
'--msan',
help='Build with MSAN',
default=UseMSAN(),
diff --git a/tools/patches/flutter-engine/8ba6f7e2eb8ac44b6de3e87a3062d1c8e34b6cc1.patch b/tools/patches/flutter-engine/8ba6f7e2eb8ac44b6de3e87a3062d1c8e34b6cc1.patch
new file mode 100644
index 0000000..408eb4f
--- /dev/null
+++ b/tools/patches/flutter-engine/8ba6f7e2eb8ac44b6de3e87a3062d1c8e34b6cc1.patch
@@ -0,0 +1,282 @@
+diff --git a/BUILD.gn b/BUILD.gn
+index b894fe26f..e4ce1dea1 100644
+--- a/BUILD.gn
++++ b/BUILD.gn
+@@ -42,7 +42,7 @@ group("flutter") {
+ if (!is_fuchsia && !is_fuchsia_host) {
+ if (current_toolchain == host_toolchain) {
+ public_deps += [
+- "$flutter_root/frontend_server",
++ "$flutter_root/flutter_frontend_server:frontend_server",
+ "//third_party/dart:create_sdk",
+ ]
+
+diff --git a/frontend_server/.gitignore b/flutter_frontend_server/.gitignore
+similarity index 100%
+rename from frontend_server/.gitignore
+rename to flutter_frontend_server/.gitignore
+diff --git a/flutter_frontend_server/BUILD.gn b/flutter_frontend_server/BUILD.gn
+new file mode 100644
+index 000000000..37740acaa
+--- /dev/null
++++ b/flutter_frontend_server/BUILD.gn
+@@ -0,0 +1,63 @@
++# Copyright 2013 The Flutter Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++if (!is_fuchsia_host && !is_fuchsia) {
++ import("//third_party/dart/utils/application_snapshot.gni")
++
++ frontend_server_files =
++ exec_script("//third_party/dart/tools/list_dart_files.py",
++ [
++ "absolute",
++ rebase_path("."),
++ ],
++ "list lines")
++
++ frontend_server_files +=
++ exec_script("//third_party/dart/tools/list_dart_files.py",
++ [
++ "absolute",
++ rebase_path("../../third_party/dart/pkg"),
++ ],
++ "list lines")
++
++ application_snapshot("frontend_server") {
++ main_dart = "bin/starter.dart"
++ deps = [
++ ":package_incremental_compiler",
++ "$flutter_root/lib/snapshot:kernel_platform_files",
++ ]
++ dot_packages = rebase_path(".packages")
++ flutter_patched_sdk = rebase_path("$root_out_dir/flutter_patched_sdk")
++ training_args = [
++ "--train",
++ "--sdk-root=$flutter_patched_sdk",
++ rebase_path(main_dart),
++ ]
++
++ inputs = frontend_server_files
++ }
++
++ # For flutter/flutter#36738 we make the source files available so that
++ # we can generate a local frontend_server snapshot in the tools cache.
++ action("package_incremental_compiler") {
++ script = "$flutter_root/flutter_frontend_server/package_incremental.py"
++
++ inputs = frontend_server_files
++
++ outputs = [
++ "$root_gen_dir/dart-pkg/frontend_server/pubspec.yaml",
++ "$root_gen_dir/dart-pkg/vm/pubspec.yaml",
++ "$root_gen_dir/dart-pkg/build_integration/pubspec.yaml",
++ "$root_gen_dir/dart-pkg/front_end/pubspec.yaml",
++ "$root_gen_dir/dart-pkg/kernel/pubspec.yaml",
++ "$root_gen_dir/dart-pkg/dev_compiler/pubspec.yaml",
++ ]
++
++ args = [
++ "--input-root=" + rebase_path("//third_party/dart/pkg"),
++ "--output-root=" + rebase_path("$root_gen_dir/dart-pkg"),
++ "--frontend-server=" + rebase_path("$flutter_root"),
++ ]
++ }
++}
+diff --git a/frontend_server/README.md b/flutter_frontend_server/README.md
+similarity index 100%
+rename from frontend_server/README.md
+rename to flutter_frontend_server/README.md
+diff --git a/frontend_server/bin/starter.dart b/flutter_frontend_server/bin/starter.dart
+similarity index 76%
+rename from frontend_server/bin/starter.dart
+rename to flutter_frontend_server/bin/starter.dart
+index da85e5575..862a8a7ea 100644
+--- a/frontend_server/bin/starter.dart
++++ b/flutter_frontend_server/bin/starter.dart
+@@ -2,7 +2,7 @@ library frontend_server;
+
+ import 'dart:io';
+
+-import 'package:frontend_server/server.dart';
++import 'package:flutter_frontend_server/server.dart';
+
+ void main(List<String> args) async {
+ final int exitCode = await starter(args);
+diff --git a/frontend_server/lib/server.dart b/flutter_frontend_server/lib/server.dart
+similarity index 98%
+rename from frontend_server/lib/server.dart
+rename to flutter_frontend_server/lib/server.dart
+index 8e34efa93..24894c878 100644
+--- a/frontend_server/lib/server.dart
++++ b/flutter_frontend_server/lib/server.dart
+@@ -11,7 +11,7 @@ import 'package:args/args.dart';
+ import 'package:path/path.dart' as path;
+
+ import 'package:vm/incremental_compiler.dart';
+-import 'package:vm/frontend_server.dart' as frontend
++import 'package:frontend_server/frontend_server.dart' as frontend
+ show
+ FrontendCompiler,
+ CompilerInterface,
+diff --git a/frontend_server/package_incremental.py b/flutter_frontend_server/package_incremental.py
+similarity index 94%
+rename from frontend_server/package_incremental.py
+rename to flutter_frontend_server/package_incremental.py
+index 63b019a33..a8b424260 100755
+--- a/frontend_server/package_incremental.py
++++ b/flutter_frontend_server/package_incremental.py
+@@ -15,7 +15,7 @@ PACKAGES = [
+ "kernel",
+ "front_end",
+ "dev_compiler",
+- "frontend_server",
++ "flutter_frontend_server",
+ ]
+
+ VM_PUBSPEC = r'''name: vm
+@@ -41,7 +41,7 @@ dependencies:
+ meta: any
+ '''
+
+-FRONTEND_SERVER_PUBSPEC = r'''name: frontend_server
++FLUTTER_FRONTEND_SERVER_PUBSPEC = r'''name: flutter_frontend_server
+ version: 0.0.1
+ environment:
+ sdk: ">=2.2.2 <3.0.0"
+@@ -87,7 +87,7 @@ dependencies:
+ PUBSPECS = {
+ 'vm': VM_PUBSPEC,
+ 'build_integration': BUILD_INTEGRATION_PUBSPEC,
+- 'frontend_server': FRONTEND_SERVER_PUBSPEC,
++ 'flutter_frontend_server': FLUTTER_FRONTEND_SERVER_PUBSPEC,
+ 'kernel': KERNEL_PUBSPEC,
+ 'front_end': FRONT_END_PUBSPEC,
+ 'dev_compiler': DEV_COMPILER_PUBSPEC,
+@@ -103,7 +103,7 @@ def main():
+ for package in PACKAGES:
+ base = args.input
+ # Handle different path for frontend_server
+- if package == 'frontend_server':
++ if package == 'flutter_frontend_server':
+ base = args.frontend
+ package_root = os.path.join(base, package)
+ for root, directories, files in os.walk(package_root):
+diff --git a/frontend_server/pubspec.yaml b/flutter_frontend_server/pubspec.yaml
+similarity index 100%
+rename from frontend_server/pubspec.yaml
+rename to flutter_frontend_server/pubspec.yaml
+diff --git a/frontend_server/BUILD.gn b/frontend_server/BUILD.gn
+index 330f1e394..6cb8ce88f 100644
+--- a/frontend_server/BUILD.gn
++++ b/frontend_server/BUILD.gn
+@@ -6,9 +6,9 @@ if (is_fuchsia_host || is_fuchsia) {
+ import("//build/dart/dart_library.gni")
+ import("//build/dart/dart_tool.gni")
+
+- dart_library("frontend_server") {
++ dart_library("flutter_frontend_server") {
+ disable_analysis = true
+- package_name = "frontend_server"
++ package_name = "flutter_frontend_server"
+
+ sources = [
+ "server.dart",
+@@ -19,6 +19,7 @@ if (is_fuchsia_host || is_fuchsia) {
+ "//third_party/dart-pkg/pub/path",
+ "//third_party/dart-pkg/pub/usage",
+ "//third_party/dart/pkg/build_integration",
++ "//third_party/dart/pkg/frontend_server",
+ "//third_party/dart/pkg/front_end",
+ "//third_party/dart/pkg/kernel",
+ "//third_party/dart/pkg/vm",
+@@ -27,72 +28,15 @@ if (is_fuchsia_host || is_fuchsia) {
+
+ dart_tool("frontend_server_tool") {
+ main_dart = "bin/starter.dart"
+- source_dir = "."
++ source_dir = "../flutter_frontend_server"
+ disable_analysis = true
+ output_name = "frontend_server"
+
+ sources = []
+
+ deps = [
+- ":frontend_server",
+- ]
+- }
+-} else {
+- import("//third_party/dart/utils/application_snapshot.gni")
+-
+- frontend_server_files =
+- exec_script("//third_party/dart/tools/list_dart_files.py",
+- [
+- "absolute",
+- rebase_path("."),
+- ],
+- "list lines")
+-
+- frontend_server_files +=
+- exec_script("//third_party/dart/tools/list_dart_files.py",
+- [
+- "absolute",
+- rebase_path("../../third_party/dart/pkg"),
+- ],
+- "list lines")
+-
+- application_snapshot("frontend_server") {
+- main_dart = "bin/starter.dart"
+- deps = [
+- ":package_incremental_compiler",
+- "$flutter_root/lib/snapshot:kernel_platform_files",
+- ]
+- dot_packages = rebase_path(".packages")
+- flutter_patched_sdk = rebase_path("$root_out_dir/flutter_patched_sdk")
+- training_args = [
+- "--train",
+- "--sdk-root=$flutter_patched_sdk",
+- rebase_path(main_dart),
+- ]
+-
+- inputs = frontend_server_files
+- }
+-
+- # For flutter/flutter#36738 we make the source files available so that
+- # we can generate a local frontend_server snapshot in the tools cache.
+- action("package_incremental_compiler") {
+- script = "$flutter_root/frontend_server/package_incremental.py"
+-
+- inputs = frontend_server_files
+-
+- outputs = [
+- "$root_gen_dir/dart-pkg/frontend_server/pubspec.yaml",
+- "$root_gen_dir/dart-pkg/vm/pubspec.yaml",
+- "$root_gen_dir/dart-pkg/build_integration/pubspec.yaml",
+- "$root_gen_dir/dart-pkg/front_end/pubspec.yaml",
+- "$root_gen_dir/dart-pkg/kernel/pubspec.yaml",
+- "$root_gen_dir/dart-pkg/dev_compiler/pubspec.yaml",
+- ]
+-
+- args = [
+- "--input-root=" + rebase_path("//third_party/dart/pkg"),
+- "--output-root=" + rebase_path("$root_gen_dir/dart-pkg"),
+- "--frontend-server=" + rebase_path("$flutter_root"),
++ ":flutter_frontend_server",
+ ]
+ }
+ }
++
+diff --git a/tools/generate_package_files.py b/tools/generate_package_files.py
+index 13399b126..1eb1e6f6c 100644
+--- a/tools/generate_package_files.py
++++ b/tools/generate_package_files.py
+@@ -10,7 +10,7 @@ import os
+ import shutil
+
+ ALL_PACKAGES = {
+- 'frontend_server': [],
++ 'flutter_frontend_server': [],
+ }
+
+ SRC_DIR = os.getcwd()
diff --git a/utils/dartdevc/BUILD.gn b/utils/dartdevc/BUILD.gn
index ef1bc76..0621dd1 100644
--- a/utils/dartdevc/BUILD.gn
+++ b/utils/dartdevc/BUILD.gn
@@ -207,13 +207,8 @@
":dartdevc_kernel_sdk",
":dartdevc_sdk",
":dartdevc_test_pkg",
+ "../..:create_sdk",
]
-
- if (use_nnbd) {
- deps += [ "../../sdk_nnbd:create_sdk" ]
- } else {
- deps += [ "../../sdk:create_sdk" ]
- }
}
# Builds everything needed to run dartdevc tests locally using test.dart without
diff --git a/utils/kernel-service/BUILD.gn b/utils/kernel-service/BUILD.gn
index c65d570..9519ba8 100644
--- a/utils/kernel-service/BUILD.gn
+++ b/utils/kernel-service/BUILD.gn
@@ -47,7 +47,7 @@
}
application_snapshot("frontend_server") {
- main_dart = "../../pkg/vm/bin/frontend_server_starter.dart"
+ main_dart = "../../pkg/frontend_server/bin/frontend_server_starter.dart"
deps = [
"../../runtime/vm:kernel_platform_files($host_toolchain)",
]