Version 2.19.0-17.0.dev
Merge commit '21d0028643aed72bfde19cb8bfa700d61247376b' into 'dev'
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 32a7b10..b933373 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -565,11 +565,23 @@
// rest of this method, we will need to start again.
var needsBuild = true;
final temporaryWatcherSubscriptions = temporaryWatchers
- .map((watcher) => watcher.changes.listen((event) {
- if (shouldRestartBuild(event.path)) {
+ .map((watcher) => watcher.changes.listen(
+ (event) {
+ if (shouldRestartBuild(event.path)) {
+ needsBuild = true;
+ }
+ },
+ onError: (error, stackTrace) {
+ // Errors in the watcher such as "Directory watcher closed
+ // unexpectedly" on Windows when the buffer overflows also
+ // require that we restarted to be consistent.
needsBuild = true;
- }
- }))
+ _instrumentationService.logError(
+ 'Temporary watcher error; restarting context build.\n'
+ '$error\n$stackTrace',
+ );
+ },
+ ))
.toList();
try {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/ignore_diagnostic.dart b/pkg/analysis_server/lib/src/services/correction/dart/ignore_diagnostic.dart
index 6e5d8ee..ffaa862 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/ignore_diagnostic.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/ignore_diagnostic.dart
@@ -6,6 +6,9 @@
import 'package:analysis_server/src/services/correction/fix.dart';
import 'package:analysis_server/src/services/correction/util.dart';
import 'package:analyzer/error/error.dart';
+import 'package:analyzer/src/dart/analysis/session.dart'
+ show AnalysisSessionImpl;
+import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
import 'package:analyzer/src/ignore_comments/ignore_info.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
@@ -59,6 +62,13 @@
lineOffset, '$prefix$indent$comment$eol$suffix');
});
}
+
+ bool _isCodeUnignorable() {
+ var session = sessionHelper.session as AnalysisSessionImpl;
+ var analysisOptions =
+ session.analysisContext.analysisOptions as AnalysisOptionsImpl;
+ return analysisOptions.unignorableNames.contains(error.errorCode.name);
+ }
}
class IgnoreDiagnosticInFile extends AbstractIgnoreDiagnostic {
@@ -67,6 +77,8 @@
@override
Future<void> compute(ChangeBuilder builder) async {
+ if (_isCodeUnignorable()) return;
+
final insertDesc = utils.getInsertDescIgnoreForFile();
await _computeEdit(
builder,
@@ -83,6 +95,8 @@
@override
Future<void> compute(ChangeBuilder builder) async {
+ if (_isCodeUnignorable()) return;
+
final insertDesc = CorrectionUtils_InsertDesc();
insertDesc.offset = node.offset;
await _computeEdit(
diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
index 00846be..103aa35 100644
--- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
+++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
@@ -351,6 +351,8 @@
CompileTimeErrorCode.DISALLOWED_TYPE_INSTANTIATION_EXPRESSION:
status: needsFix
since: 2.15
+CompileTimeErrorCode.DUPLICATE_AUGMENTATION_IMPORT:
+ status: needsEvaluation
CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT:
status: needsEvaluation
CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME:
@@ -537,6 +539,8 @@
status: needsEvaluation
CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY:
status: needsEvaluation
+CompileTimeErrorCode.IMPORT_OF_NOT_AUGMENTATION:
+ status: needsEvaluation
CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES:
status: needsEvaluation
CompileTimeErrorCode.INCONSISTENT_INHERITANCE:
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index 92e318a..4c55722 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -105,12 +105,13 @@
/// Create an analysis options file based on the given arguments.
void createAnalysisOptionsFile({
List<String>? experiments,
+ List<String>? cannotIgnore,
bool? implicitCasts,
List<String>? lints,
}) {
var buffer = StringBuffer();
- if (experiments != null || implicitCasts != null) {
+ if (experiments != null || implicitCasts != null || cannotIgnore != null) {
buffer.writeln('analyzer:');
}
@@ -126,6 +127,13 @@
buffer.writeln(' implicit-casts: $implicitCasts');
}
+ if (cannotIgnore != null) {
+ buffer.writeln(' cannot-ignore:');
+ for (var unignorable in cannotIgnore) {
+ buffer.writeln(' - $unignorable');
+ }
+ }
+
if (lints != null) {
buffer.writeln('linter:');
buffer.writeln(' rules:');
diff --git a/pkg/analysis_server/test/src/services/correction/fix/ignore_diagnostic_test.dart b/pkg/analysis_server/test/src/services/correction/fix/ignore_diagnostic_test.dart
index f29c3df..91829da 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/ignore_diagnostic_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/ignore_diagnostic_test.dart
@@ -20,6 +20,26 @@
@override
FixKind get kind => DartFixKind.IGNORE_ERROR_FILE;
+ Future<void> test_cannotIgnore_other() async {
+ createAnalysisOptionsFile(
+ experiments: experiments,
+ cannotIgnore: ['unused_label'],
+ );
+
+ await resolveTestCode('''
+void f() {
+ var a = 1;
+}
+''');
+ await assertHasFix('''
+// ignore_for_file: unused_local_variable
+
+void f() {
+ var a = 1;
+}
+''');
+ }
+
Future<void> test_existingIgnores() async {
await resolveTestCode('''
// Copyright header.
@@ -28,8 +48,8 @@
// Some other header.
-/// main dartcode
-void main(List<String> args) {
+/// some comment
+void f() {
var a = 1;
}
''');
@@ -40,8 +60,8 @@
// Some other header.
-/// main dartcode
-void main(List<String> args) {
+/// some comment
+void f() {
var a = 1;
}
''');
@@ -53,8 +73,8 @@
// Some other header.
-/// main dartcode
-void main(List<String> args) {
+/// some comment
+void f() {
var a = 1;
}
''');
@@ -65,8 +85,8 @@
// ignore_for_file: unused_local_variable
-/// main dartcode
-void main(List<String> args) {
+/// some comment
+void f() {
var a = 1;
}
''');
@@ -74,18 +94,32 @@
Future<void> test_noHeader() async {
await resolveTestCode('''
-void main(List<String> args) {
+void f() {
var a = 1;
}
''');
await assertHasFix('''
// ignore_for_file: unused_local_variable
-void main(List<String> args) {
+void f() {
var a = 1;
}
''');
}
+
+ Future<void> test_unignorable() async {
+ createAnalysisOptionsFile(
+ experiments: experiments,
+ cannotIgnore: ['unused_local_variable'],
+ );
+
+ await resolveTestCode('''
+void f() {
+ var a = 1;
+}
+''');
+ await assertNoFix();
+ }
}
@reflectiveTest
@@ -93,29 +127,62 @@
@override
FixKind get kind => DartFixKind.IGNORE_ERROR_LINE;
+ Future<void> test_cannotIgnore_other() async {
+ createAnalysisOptionsFile(
+ experiments: experiments,
+ cannotIgnore: ['unused_label'],
+ );
+
+ await resolveTestCode('''
+void f() {
+ var a = 1;
+}
+''');
+ await assertHasFix('''
+void f() {
+ // ignore: unused_local_variable
+ var a = 1;
+}
+''');
+ }
+
Future<void> test_existingIgnore() async {
await resolveTestCode('''
-void main(List<String> args) {
+void f() {
// ignore: foo
var a = 1;
}
''');
await assertHasFix('''
-void main(List<String> args) {
+void f() {
// ignore: foo, unused_local_variable
var a = 1;
}
''');
}
+ Future<void> test_unignorable() async {
+ createAnalysisOptionsFile(
+ experiments: experiments,
+ cannotIgnore: ['unused_local_variable'],
+ );
+
+ await resolveTestCode('''
+void f() {
+ var a = 1;
+}
+''');
+ await assertNoFix();
+ }
+
Future<void> test_unusedCode() async {
await resolveTestCode('''
-void main(List<String> args) {
+void f() {
var a = 1;
}
''');
await assertHasFix('''
-void main(List<String> args) {
+void f() {
// ignore: unused_local_variable
var a = 1;
}
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index 4eb024d..2dec46a 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -1454,7 +1454,8 @@
///
/// Clients may not extend, implement or mix-in this class.
@experimental
-abstract class LibraryAugmentationElement extends LibraryOrAugmentationElement {
+abstract class LibraryAugmentationElement
+ implements LibraryOrAugmentationElement, _ExistingElement {
/// Returns the library that is augmented by this augmentation.
LibraryOrAugmentationElement get augmented;
}
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 445e43b..0ec336d 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -155,6 +155,7 @@
CompileTimeErrorCode.DEFERRED_IMPORT_OF_EXTENSION,
CompileTimeErrorCode.DEFINITELY_UNASSIGNED_LATE_LOCAL_VARIABLE,
CompileTimeErrorCode.DISALLOWED_TYPE_INSTANTIATION_EXPRESSION,
+ CompileTimeErrorCode.DUPLICATE_AUGMENTATION_IMPORT,
CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT,
CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME,
CompileTimeErrorCode.DUPLICATE_DEFINITION,
@@ -232,6 +233,7 @@
CompileTimeErrorCode.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS,
CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY,
CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY,
+ CompileTimeErrorCode.IMPORT_OF_NOT_AUGMENTATION,
CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES,
CompileTimeErrorCode.INCONSISTENT_INHERITANCE,
CompileTimeErrorCode.INCONSISTENT_INHERITANCE_GETTER_AND_METHOD,
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index a7c42ff..b2e4b1f 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -557,6 +557,66 @@
return units;
}
+ void _resolveAugmentationImportDirective({
+ required AugmentationImportDirectiveImpl directive,
+ required AugmentationImportElement element,
+ required AugmentationImportState state,
+ // TODO(scheglov) wrong value, wrong name
+ required ErrorReporter libraryErrorReporter,
+ required Set<AugmentationFileKind> seenAugmentations,
+ }) {
+ directive.element = element;
+
+ final primaryUriState = state.uri;
+ if (primaryUriState is DirectiveUriWithString) {
+ directive.uriContent = primaryUriState.relativeUriStr;
+ directive.uriSource = primaryUriState.source;
+ }
+
+ if (state is AugmentationImportWithUri) {
+ if (state.importedSource == null) {
+ // TODO(scheglov) When do we have a valid URI here and in imports?
+ final errorCode = state.uri.isValid
+ ? CompileTimeErrorCode.URI_DOES_NOT_EXIST
+ : CompileTimeErrorCode.INVALID_URI;
+ libraryErrorReporter.reportErrorForNode(
+ errorCode,
+ directive.uri,
+ [state.uri.relativeUriStr],
+ );
+ } else if (state is AugmentationImportWithFile) {
+ final importedAugmentation = state.importedAugmentation;
+ if (!state.importedFile.exists) {
+ final errorCode = isGeneratedSource(state.importedSource)
+ ? CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED
+ : CompileTimeErrorCode.URI_DOES_NOT_EXIST;
+ libraryErrorReporter.reportErrorForNode(
+ errorCode,
+ directive.uri,
+ [state.importedFile.uriStr],
+ );
+ } else if (importedAugmentation == null) {
+ libraryErrorReporter.reportErrorForNode(
+ CompileTimeErrorCode.IMPORT_OF_NOT_AUGMENTATION,
+ directive.uri,
+ [state.importedFile.uriStr],
+ );
+ } else if (!seenAugmentations.add(importedAugmentation)) {
+ libraryErrorReporter.reportErrorForNode(
+ CompileTimeErrorCode.DUPLICATE_AUGMENTATION_IMPORT,
+ directive.uri,
+ [state.importedFile.uriStr],
+ );
+ }
+ }
+ } else {
+ libraryErrorReporter.reportErrorForNode(
+ CompileTimeErrorCode.URI_WITH_INTERPOLATION,
+ directive.uri,
+ );
+ }
+ }
+
void _resolveDirectives(
Map<FileState, CompilationUnitImpl> units,
CompilationUnitImpl libraryUnit,
@@ -565,10 +625,12 @@
ErrorReporter libraryErrorReporter = _getErrorReporter(_library.file);
- var importIndex = 0;
- var exportIndex = 0;
+ var augmentationImportIndex = 0;
+ var libraryImportIndex = 0;
+ var libraryExportIndex = 0;
LibraryIdentifier? libraryNameNode;
+ final seenAugmentations = <AugmentationFileKind>{};
var seenPartSources = <Source>{};
var directivesToResolve = <DirectiveImpl>[];
final partIndexes = _PartDirectiveIndexes();
@@ -576,25 +638,34 @@
if (directive is LibraryDirectiveImpl) {
libraryNameNode = directive.name;
directivesToResolve.add(directive);
- } else if (directive is AugmentationImportDirective) {
- // TODO(scheglov) implement
- throw UnimplementedError();
+ } else if (directive is AugmentationImportDirectiveImpl) {
+ final index = augmentationImportIndex++;
+ _resolveAugmentationImportDirective(
+ directive: directive,
+ // TODO(scheglov) Not only in the library.
+ element: _libraryElement.augmentationImports[index],
+ // TODO(scheglov) Not only in the library.
+ state: _library.augmentationImports[index],
+ // TODO(scheglov) Not only in the library.
+ libraryErrorReporter: libraryErrorReporter,
+ seenAugmentations: seenAugmentations,
+ );
} else if (directive is ImportDirectiveImpl) {
- _resolveImportDirective(
+ _resolveLibraryImportDirective(
directive: directive,
- importElement: _libraryElement.libraryImports[importIndex],
- importState: _library.libraryImports[importIndex],
+ importElement: _libraryElement.libraryImports[libraryImportIndex],
+ importState: _library.libraryImports[libraryImportIndex],
libraryErrorReporter: libraryErrorReporter,
);
- importIndex++;
+ libraryImportIndex++;
} else if (directive is ExportDirectiveImpl) {
- _resolveExportDirective(
+ _resolveLibraryExportDirective(
directive: directive,
- exportElement: _libraryElement.libraryExports[exportIndex],
- exportState: _library.libraryExports[exportIndex],
+ exportElement: _libraryElement.libraryExports[libraryExportIndex],
+ exportState: _library.libraryExports[libraryExportIndex],
libraryErrorReporter: libraryErrorReporter,
);
- exportIndex++;
+ libraryExportIndex++;
} else if (directive is PartDirectiveImpl) {
_resolvePartDirective(
directive: directive,
@@ -619,7 +690,45 @@
}
}
- void _resolveExportDirective({
+ void _resolveFile(FileState file, CompilationUnit unit) {
+ var source = file.source;
+ RecordingErrorListener errorListener = _getErrorListener(file);
+
+ var unitElement = unit.declaredElement as CompilationUnitElementImpl;
+
+ unit.accept(
+ ResolutionVisitor(
+ unitElement: unitElement,
+ errorListener: errorListener,
+ featureSet: unit.featureSet,
+ nameScope: _libraryElement.scope,
+ elementWalker: ElementWalker.forCompilationUnit(
+ unitElement,
+ libraryFilePath: _library.file.path,
+ unitFilePath: file.path,
+ ),
+ ),
+ );
+
+ unit.accept(ScopeResolverVisitor(
+ _libraryElement, source, _typeProvider, errorListener,
+ nameScope: _libraryElement.scope));
+
+ // Nothing for RESOLVED_UNIT8?
+ // Nothing for RESOLVED_UNIT9?
+ // Nothing for RESOLVED_UNIT10?
+
+ FlowAnalysisHelper flowAnalysisHelper =
+ FlowAnalysisHelper(_typeSystem, _testingData != null, unit.featureSet);
+ _testingData?.recordFlowAnalysisDataForTesting(
+ file.uri, flowAnalysisHelper.dataForTesting!);
+
+ unit.accept(ResolverVisitor(
+ _inheritance, _libraryElement, source, _typeProvider, errorListener,
+ featureSet: unit.featureSet, flowAnalysisHelper: flowAnalysisHelper));
+ }
+
+ void _resolveLibraryExportDirective({
required ExportDirectiveImpl directive,
required LibraryExportElement exportElement,
required LibraryExportState exportState,
@@ -675,45 +784,7 @@
}
}
- void _resolveFile(FileState file, CompilationUnit unit) {
- var source = file.source;
- RecordingErrorListener errorListener = _getErrorListener(file);
-
- var unitElement = unit.declaredElement as CompilationUnitElementImpl;
-
- unit.accept(
- ResolutionVisitor(
- unitElement: unitElement,
- errorListener: errorListener,
- featureSet: unit.featureSet,
- nameScope: _libraryElement.scope,
- elementWalker: ElementWalker.forCompilationUnit(
- unitElement,
- libraryFilePath: _library.file.path,
- unitFilePath: file.path,
- ),
- ),
- );
-
- unit.accept(ScopeResolverVisitor(
- _libraryElement, source, _typeProvider, errorListener,
- nameScope: _libraryElement.scope));
-
- // Nothing for RESOLVED_UNIT8?
- // Nothing for RESOLVED_UNIT9?
- // Nothing for RESOLVED_UNIT10?
-
- FlowAnalysisHelper flowAnalysisHelper =
- FlowAnalysisHelper(_typeSystem, _testingData != null, unit.featureSet);
- _testingData?.recordFlowAnalysisDataForTesting(
- file.uri, flowAnalysisHelper.dataForTesting!);
-
- unit.accept(ResolverVisitor(
- _inheritance, _libraryElement, source, _typeProvider, errorListener,
- featureSet: unit.featureSet, flowAnalysisHelper: flowAnalysisHelper));
- }
-
- void _resolveImportDirective({
+ void _resolveLibraryImportDirective({
required ImportDirectiveImpl directive,
required LibraryImportElement importElement,
required LibraryImportState importState,
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 1d27313..4a90b77 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -3884,6 +3884,9 @@
}
@override
+ Source get librarySource => library.source;
+
+ @override
AnalysisSessionImpl get session => augmented.session;
@override
@@ -4279,6 +4282,14 @@
}
if (prefix == null && name.startsWith(r'_$')) {
+ for (final augmentation in augmentationImports) {
+ final uri = augmentation.uri;
+ if (uri is DirectiveUriWithSource &&
+ uri is! DirectiveUriWithAugmentation &&
+ file_paths.isGenerated(uri.relativeUriString)) {
+ return true;
+ }
+ }
for (var partElement in parts2) {
final uri = partElement.uri;
if (uri is DirectiveUriWithSource &&
diff --git a/pkg/analyzer/lib/src/error/codes.g.dart b/pkg/analyzer/lib/src/error/codes.g.dart
index b725ca4..18b51e9 100644
--- a/pkg/analyzer/lib/src/error/codes.g.dart
+++ b/pkg/analyzer/lib/src/error/codes.g.dart
@@ -1073,6 +1073,17 @@
hasPublishedDocs: true,
);
+ /// Parameters:
+ /// 0: the URI of the duplicate augmentation
+ static const CompileTimeErrorCode DUPLICATE_AUGMENTATION_IMPORT =
+ CompileTimeErrorCode(
+ 'DUPLICATE_AUGMENTATION_IMPORT',
+ "The library already contains an augmentation with the URI '{0}'.",
+ correctionMessage:
+ "Try removing all except one of the duplicated augmentation "
+ "directives.",
+ );
+
/// No parameters.
static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT =
CompileTimeErrorCode(
@@ -1890,6 +1901,17 @@
hasPublishedDocs: true,
);
+ /// Parameters:
+ /// 0: the URI of the imported file
+ static const CompileTimeErrorCode IMPORT_OF_NOT_AUGMENTATION =
+ CompileTimeErrorCode(
+ 'IMPORT_OF_NOT_AUGMENTATION',
+ "The imported file '{0}' isn't an augmentation of this library.",
+ correctionMessage:
+ "Try adding a 'library augment' directive referencing this library to "
+ "the imported file.",
+ );
+
/// 13.9 Switch: It is a compile-time error if values of the expressions
/// <i>e<sub>k</sub></i> are not instances of the same class <i>C</i>, for all
/// <i>1 <= k <= n</i>.
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
index 8cb650a..bc8a8d3 100644
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
@@ -111,6 +111,10 @@
TypeProviderImpl get _typeProvider => _resolver.typeProvider;
+ void visitAugmentationImportDirective(AugmentationImportDirectiveImpl node) {
+ _resolveAnnotations(node.metadata);
+ }
+
void visitClassDeclaration(ClassDeclaration node) {
_resolveAnnotations(node.metadata);
}
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index f4793da..d7408ef 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -1030,6 +1030,14 @@
}
@override
+ void visitAugmentationImportDirective(
+ covariant AugmentationImportDirectiveImpl node,
+ ) {
+ node.visitChildren(this);
+ elementResolver.visitAugmentationImportDirective(node);
+ }
+
+ @override
void visitAwaitExpression(AwaitExpression node, {DartType? contextType}) {
DartType? futureUnion;
if (contextType != null) {
diff --git a/pkg/analyzer/lib/src/summary2/bundle_reader.dart b/pkg/analyzer/lib/src/summary2/bundle_reader.dart
index 429b980..27c7070 100644
--- a/pkg/analyzer/lib/src/summary2/bundle_reader.dart
+++ b/pkg/analyzer/lib/src/summary2/bundle_reader.dart
@@ -992,7 +992,7 @@
container: container,
),
);
- ImportElementFlags.read(_reader, element);
+ LibraryImportElementFlags.read(_reader, element);
return element;
}
diff --git a/pkg/analyzer/lib/src/summary2/bundle_writer.dart b/pkg/analyzer/lib/src/summary2/bundle_writer.dart
index 81ed6aa..d3d4cc2 100644
--- a/pkg/analyzer/lib/src/summary2/bundle_writer.dart
+++ b/pkg/analyzer/lib/src/summary2/bundle_writer.dart
@@ -345,7 +345,7 @@
_sink.writeList(element.combinators, _writeNamespaceCombinator);
_writeImportElementPrefix(element.prefix);
_writeDirectiveUri(element.uri);
- ImportElementFlags.write(_sink, element);
+ LibraryImportElementFlags.write(_sink, element);
}
void _writeImportElementPrefix(ImportElementPrefix? prefix) {
diff --git a/pkg/analyzer/lib/src/summary2/element_flags.dart b/pkg/analyzer/lib/src/summary2/element_flags.dart
index b6cbdce..5b04107 100644
--- a/pkg/analyzer/lib/src/summary2/element_flags.dart
+++ b/pkg/analyzer/lib/src/summary2/element_flags.dart
@@ -150,21 +150,6 @@
}
}
-class ImportElementFlags {
- static const int _isSynthetic = 1 << 0;
-
- static void read(SummaryDataReader reader, LibraryImportElementImpl element) {
- var byte = reader.readByte();
- element.isSynthetic = (byte & _isSynthetic) != 0;
- }
-
- static void write(BufferedSink sink, LibraryImportElementImpl element) {
- var result = 0;
- result |= element.isSynthetic ? _isSynthetic : 0;
- sink.writeByte(result);
- }
-}
-
class LibraryElementFlags {
static const int _hasPartOfDirective = 1 << 0;
static const int _isSynthetic = 1 << 1;
@@ -183,6 +168,21 @@
}
}
+class LibraryImportElementFlags {
+ static const int _isSynthetic = 1 << 0;
+
+ static void read(SummaryDataReader reader, LibraryImportElementImpl element) {
+ var byte = reader.readByte();
+ element.isSynthetic = (byte & _isSynthetic) != 0;
+ }
+
+ static void write(BufferedSink sink, LibraryImportElementImpl element) {
+ var result = 0;
+ result |= element.isSynthetic ? _isSynthetic : 0;
+ sink.writeByte(result);
+ }
+}
+
class MethodElementFlags {
static const int _hasImplicitReturnType = 1 << 0;
static const int _invokesSuperSelf = 1 << 1;
diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml
index 6f13f7d..b961513 100644
--- a/pkg/analyzer/messages.yaml
+++ b/pkg/analyzer/messages.yaml
@@ -3238,6 +3238,12 @@
print(i);
}
```
+ DUPLICATE_AUGMENTATION_IMPORT:
+ problemMessage: "The library already contains an augmentation with the URI '{0}'."
+ correctionMessage: Try removing all except one of the duplicated augmentation directives.
+ comment: |-
+ Parameters:
+ 0: the URI of the duplicate augmentation
DUPLICATE_CONSTRUCTOR_NAME:
sharedName: DUPLICATE_CONSTRUCTOR
problemMessage: "The constructor with name '{0}' is already defined."
@@ -5911,6 +5917,12 @@
Import the library that contains the [part file][] rather than the
[part file][] itself.
+ IMPORT_OF_NOT_AUGMENTATION:
+ problemMessage: "The imported file '{0}' isn't an augmentation of this library."
+ correctionMessage: Try adding a 'library augment' directive referencing this library to the imported file.
+ comment: |-
+ Parameters:
+ 0: the URI of the imported file
INCONSISTENT_CASE_EXPRESSION_TYPES:
problemMessage: "Case expressions must have the same types, '{0}' isn't a '{1}'."
comment: |-
diff --git a/pkg/analyzer/test/src/dart/resolution/augmentation_import_test.dart b/pkg/analyzer/test/src/dart/resolution/augmentation_import_test.dart
new file mode 100644
index 0000000..1457bd4
--- /dev/null
+++ b/pkg/analyzer/test/src/dart/resolution/augmentation_import_test.dart
@@ -0,0 +1,119 @@
+// Copyright (c) 2022, 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:test_reflective_loader/test_reflective_loader.dart';
+
+import 'context_collection_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(AugmentationImportDirectiveResolutionTest);
+ });
+}
+
+@reflectiveTest
+class AugmentationImportDirectiveResolutionTest
+ extends PubPackageResolutionTest {
+ test_augmentation() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+library augment 'test.dart';
+''');
+
+ await resolveTestCode(r'''
+import augment 'a.dart';
+''');
+
+ final node = findNode.augmentationImportDirective('a.dart');
+ assertResolvedNodeText(node, r'''
+AugmentationImportDirective
+ importKeyword: import
+ augmentKeyword: augment
+ uri: SimpleStringLiteral
+ literal: 'a.dart'
+ semicolon: ;
+ element: AugmentationImportElement
+ uri: DirectiveUriWithAugmentation
+ uri: package:test/a.dart
+ uriContent: a.dart
+ uriElement: self::@augmentation::package:test/a.dart
+ uriSource: package:test/a.dart
+''');
+ }
+
+ test_library() async {
+ newFile('$testPackageLibPath/a.dart', '');
+
+ await resolveTestCode(r'''
+import augment 'a.dart';
+''');
+
+ final node = findNode.augmentationImportDirective('a.dart');
+ assertResolvedNodeText(node, r'''
+AugmentationImportDirective
+ importKeyword: import
+ augmentKeyword: augment
+ uri: SimpleStringLiteral
+ literal: 'a.dart'
+ semicolon: ;
+ element: AugmentationImportElement
+ uri: DirectiveUriWithSource
+ source: package:test/a.dart
+ uriContent: a.dart
+ uriElement: <null>
+ uriSource: package:test/a.dart
+''');
+ }
+
+ test_partOfName() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+part of my.lib;
+''');
+
+ await resolveTestCode(r'''
+import augment 'a.dart';
+''');
+
+ final node = findNode.augmentationImportDirective('a.dart');
+ assertResolvedNodeText(node, r'''
+AugmentationImportDirective
+ importKeyword: import
+ augmentKeyword: augment
+ uri: SimpleStringLiteral
+ literal: 'a.dart'
+ semicolon: ;
+ element: AugmentationImportElement
+ uri: DirectiveUriWithSource
+ source: package:test/a.dart
+ uriContent: a.dart
+ uriElement: <null>
+ uriSource: package:test/a.dart
+''');
+ }
+
+ test_partOfUri() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+part of 'test.dart';
+''');
+
+ await resolveTestCode(r'''
+import augment 'a.dart';
+''');
+
+ final node = findNode.augmentationImportDirective('a.dart');
+ assertResolvedNodeText(node, r'''
+AugmentationImportDirective
+ importKeyword: import
+ augmentKeyword: augment
+ uri: SimpleStringLiteral
+ literal: 'a.dart'
+ semicolon: ;
+ element: AugmentationImportElement
+ uri: DirectiveUriWithSource
+ source: package:test/a.dart
+ uriContent: a.dart
+ uriElement: <null>
+ uriSource: package:test/a.dart
+''');
+ }
+}
diff --git a/pkg/analyzer/test/src/dart/resolution/import_prefix_test.dart b/pkg/analyzer/test/src/dart/resolution/library_import_prefix_test.dart
similarity index 100%
rename from pkg/analyzer/test/src/dart/resolution/import_prefix_test.dart
rename to pkg/analyzer/test/src/dart/resolution/library_import_prefix_test.dart
diff --git a/pkg/analyzer/test/src/dart/resolution/import_test.dart b/pkg/analyzer/test/src/dart/resolution/library_import_test.dart
similarity index 100%
rename from pkg/analyzer/test/src/dart/resolution/import_test.dart
rename to pkg/analyzer/test/src/dart/resolution/library_import_test.dart
diff --git a/pkg/analyzer/test/src/dart/resolution/test_all.dart b/pkg/analyzer/test/src/dart/resolution/test_all.dart
index 4c46650..6d2bd25 100644
--- a/pkg/analyzer/test/src/dart/resolution/test_all.dart
+++ b/pkg/analyzer/test/src/dart/resolution/test_all.dart
@@ -6,6 +6,7 @@
import 'assignment_test.dart' as assignment;
import 'ast_rewrite_test.dart' as ast_rewrite;
+import 'augmentation_import_test.dart' as augmentation_import;
import 'await_expression_test.dart' as await_expression;
import 'binary_expression_test.dart' as binary_expression;
import 'class_alias_test.dart' as class_alias;
@@ -31,8 +32,6 @@
import 'generic_type_alias_test.dart' as generic_type_alias;
import 'if_element_test.dart' as if_element;
import 'if_statement_test.dart' as if_statement;
-import 'import_prefix_test.dart' as import_prefix;
-import 'import_test.dart' as import_;
import 'index_expression_test.dart' as index_expression;
import 'instance_creation_test.dart' as instance_creation;
import 'instance_member_inference_class_test.dart'
@@ -42,6 +41,8 @@
import 'interpolation_string_test.dart' as interpolation_string;
import 'language_version_test.dart' as language_version;
import 'library_element_test.dart' as library_element;
+import 'library_import_prefix_test.dart' as library_import_prefix;
+import 'library_import_test.dart' as library_import;
import 'local_function_test.dart' as local_function;
import 'local_variable_test.dart' as local_variable;
import 'macro_test.dart' as macro;
@@ -75,6 +76,7 @@
defineReflectiveSuite(() {
assignment.main();
ast_rewrite.main();
+ augmentation_import.main();
await_expression.main();
binary_expression.main();
class_alias.main();
@@ -97,10 +99,8 @@
function_type_alias.main();
generic_function_type.main();
generic_type_alias.main();
- import_.main();
if_element.main();
if_statement.main();
- import_prefix.main();
index_expression.main();
instance_creation.main();
instance_member_inference_class.main();
@@ -108,6 +108,8 @@
interpolation_string.main();
language_version.main();
library_element.main();
+ library_import_prefix.main();
+ library_import.main();
local_function.main();
local_variable.main();
macro.main();
diff --git a/pkg/analyzer/test/src/diagnostics/duplicate_augmentation_import_test.dart b/pkg/analyzer/test/src/diagnostics/duplicate_augmentation_import_test.dart
new file mode 100644
index 0000000..e95a00e
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/duplicate_augmentation_import_test.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2022, 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/context_collection_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(DuplicateAugmentationImportTest);
+ });
+}
+
+@reflectiveTest
+class DuplicateAugmentationImportTest extends PubPackageResolutionTest {
+ test_duplicate() async {
+ newFile('$testPackageLibPath/a.dart', '''
+library augment 'test.dart';
+class A {}
+''');
+
+ newFile('$testPackageLibPath/b.dart', '''
+library augment 'test.dart';
+class B {}
+''');
+
+ await assertErrorsInCode(r'''
+import augment 'a.dart';
+import augment 'b.dart';
+import augment 'a.dart';
+''', [
+ error(CompileTimeErrorCode.DUPLICATE_AUGMENTATION_IMPORT, 65, 8),
+ ]);
+ }
+
+ test_ok() async {
+ newFile('$testPackageLibPath/a.dart', '''
+library augment 'test.dart';
+class A {}
+''');
+
+ newFile('$testPackageLibPath/b.dart', '''
+library augment 'test.dart';
+class B {}
+''');
+
+ await assertNoErrorsInCode(r'''
+import augment 'a.dart';
+import augment 'b.dart';
+''');
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/import_of_not_augmentation_test.dart b/pkg/analyzer/test/src/diagnostics/import_of_not_augmentation_test.dart
new file mode 100644
index 0000000..6e2ef0b
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/import_of_not_augmentation_test.dart
@@ -0,0 +1,73 @@
+// Copyright (c) 2022, 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/context_collection_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(ImportOfNotAugmentationTest);
+ });
+}
+
+@reflectiveTest
+class ImportOfNotAugmentationTest extends PubPackageResolutionTest {
+ test_inLibrary_augmentation() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+library augment 'test.dart';
+''');
+
+ await assertNoErrorsInCode('''
+import augment 'a.dart';
+''');
+ }
+
+ test_inLibrary_library_explicit() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+library my.lib;
+''');
+
+ await assertErrorsInCode('''
+import augment 'a.dart';
+''', [
+ error(CompileTimeErrorCode.IMPORT_OF_NOT_AUGMENTATION, 15, 8),
+ ]);
+ }
+
+ test_inLibrary_library_implicit() async {
+ newFile('$testPackageLibPath/a.dart', '');
+
+ await assertErrorsInCode('''
+import augment 'a.dart';
+''', [
+ error(CompileTimeErrorCode.IMPORT_OF_NOT_AUGMENTATION, 15, 8),
+ ]);
+ }
+
+ test_inLibrary_partOfName() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+part of my.lib;
+''');
+
+ await assertErrorsInCode('''
+import augment 'a.dart';
+''', [
+ error(CompileTimeErrorCode.IMPORT_OF_NOT_AUGMENTATION, 15, 8),
+ ]);
+ }
+
+ test_inLibrary_partOfUri() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+part of 'test.dart';
+''');
+
+ await assertErrorsInCode('''
+import augment 'a.dart';
+''', [
+ error(CompileTimeErrorCode.IMPORT_OF_NOT_AUGMENTATION, 15, 8),
+ ]);
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_uri_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_uri_test.dart
index 75f1f02..89560e1 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_uri_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_uri_test.dart
@@ -15,7 +15,23 @@
@reflectiveTest
class InvalidUriTest extends PubPackageResolutionTest {
- test_emptyUri() async {
+ test_augmentationImport_invalidScheme() async {
+ await assertErrorsInCode('''
+import augment 'ht:';
+''', [
+ error(CompileTimeErrorCode.INVALID_URI, 15, 5),
+ ]);
+ }
+
+ test_libraryExport_invalidScheme() async {
+ await assertErrorsInCode('''
+export 'ht:';
+''', [
+ error(CompileTimeErrorCode.INVALID_URI, 7, 5),
+ ]);
+ }
+
+ test_libraryImport_emptyUri() async {
await assertNoErrorsInCode('''
import '' as top;
int x = 1;
@@ -27,15 +43,7 @@
assertElement(findNode.simple('x; // ref'), findElement.topGet('x'));
}
- test_invalidScheme_export() async {
- await assertErrorsInCode('''
-export 'ht:';
-''', [
- error(CompileTimeErrorCode.INVALID_URI, 7, 5),
- ]);
- }
-
- test_invalidScheme_import() async {
+ test_libraryImport_invalidScheme() async {
await assertErrorsInCode('''
import 'ht:';
''', [
@@ -43,7 +51,7 @@
]);
}
- test_invalidScheme_part() async {
+ test_part_invalidScheme() async {
await assertErrorsInCode(r'''
part 'ht:';
''', [
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
index 6df5d31..f68bbf7 100644
--- a/pkg/analyzer/test/src/diagnostics/test_all.dart
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -144,6 +144,8 @@
import 'deprecated_member_use_test.dart' as deprecated_member_use;
import 'deprecated_mixin_function_test.dart' as deprecated_mixin_function;
import 'division_optimization_test.dart' as division_optimization;
+import 'duplicate_augmentation_import_test.dart'
+ as duplicate_augmentation_import;
import 'duplicate_constructor_default_test.dart'
as duplicate_constructor_default;
import 'duplicate_constructor_name_test.dart' as duplicate_constructor_name;
@@ -292,6 +294,7 @@
import 'import_of_legacy_library_into_null_safe_test.dart'
as import_of_legacy_library_into_null_safe;
import 'import_of_non_library_test.dart' as import_of_non_library;
+import 'import_of_not_augmentation_test.dart' as import_of_not_augmentation;
import 'inconsistent_case_expression_types_test.dart'
as inconsistent_case_expression_types;
import 'inconsistent_inheritance_getter_and_method_test.dart'
@@ -893,6 +896,7 @@
deprecated_member_use.main();
deprecated_mixin_function.main();
division_optimization.main();
+ duplicate_augmentation_import.main();
duplicate_constructor_default.main();
duplicate_constructor_name.main();
duplicate_definition.main();
@@ -990,6 +994,7 @@
import_internal_library.main();
import_of_legacy_library_into_null_safe.main();
import_of_non_library.main();
+ import_of_not_augmentation.main();
inconsistent_case_expression_types.main();
inconsistent_inheritance_getter_and_method.main();
inconsistent_inheritance.main();
diff --git a/pkg/analyzer/test/src/diagnostics/undefined_class_test.dart b/pkg/analyzer/test/src/diagnostics/undefined_class_test.dart
index 1f28005..ce2d86a 100644
--- a/pkg/analyzer/test/src/diagnostics/undefined_class_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/undefined_class_test.dart
@@ -15,6 +15,63 @@
@reflectiveTest
class UndefinedClassTest extends PubPackageResolutionTest {
+ test_augmentation_exists_uriGenerated_nameIgnorable() async {
+ newFile('$testPackageLibPath/a.g.dart', r'''
+library augment 'test.dart';
+''');
+
+ await assertErrorsInCode(r'''
+import augment 'a.g.dart';
+
+_$A a;
+''', [
+ error(CompileTimeErrorCode.UNDEFINED_CLASS, 28, 3),
+ ]);
+ }
+
+ test_augmentation_notExist_uriGenerated_nameIgnorable() async {
+ await assertErrorsInCode(r'''
+import augment 'a.g.dart';
+
+_$A a;
+''', [
+ error(CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED, 15, 10),
+ ]);
+ }
+
+ test_augmentation_notExist_uriGenerated_nameNotIgnorable() async {
+ await assertErrorsInCode(r'''
+import augment 'a.g.dart';
+
+A a;
+''', [
+ error(CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED, 15, 10),
+ error(CompileTimeErrorCode.UNDEFINED_CLASS, 28, 1),
+ ]);
+ }
+
+ test_augmentation_notExist_uriNotGenerated_nameIgnorable() async {
+ await assertErrorsInCode(r'''
+import augment 'a.dart';
+
+_$A a;
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 15, 8),
+ error(CompileTimeErrorCode.UNDEFINED_CLASS, 26, 3),
+ ]);
+ }
+
+ test_augmentation_notExist_uriNotGenerated_nameNotIgnorable() async {
+ await assertErrorsInCode(r'''
+import augment 'a.dart';
+
+A a;
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 15, 8),
+ error(CompileTimeErrorCode.UNDEFINED_CLASS, 26, 1),
+ ]);
+ }
+
test_const() async {
await assertErrorsInCode(r'''
f() {
@@ -35,7 +92,7 @@
]);
}
- test_ignore_import_prefix() async {
+ test_ignore_libraryImport_prefix() async {
await assertErrorsInCode(r'''
import 'a.dart' as p;
@@ -45,7 +102,7 @@
]);
}
- test_ignore_import_show_it() async {
+ test_ignore_libraryImport_show_it() async {
await assertErrorsInCode(r'''
import 'a.dart' show A;
@@ -55,7 +112,7 @@
]);
}
- test_ignore_import_show_other() async {
+ test_ignore_libraryImport_show_other() async {
await assertErrorsInCode(r'''
import 'a.dart' show B;
diff --git a/pkg/analyzer/test/src/diagnostics/uri_does_not_exist_test.dart b/pkg/analyzer/test/src/diagnostics/uri_does_not_exist_test.dart
index 0486dd4..81707fb 100644
--- a/pkg/analyzer/test/src/diagnostics/uri_does_not_exist_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/uri_does_not_exist_test.dart
@@ -15,18 +15,15 @@
@reflectiveTest
class UriDoesNotExistTest extends PubPackageResolutionTest {
- test_deferredImportWithInvalidUri() async {
- await assertErrorsInCode(r'''
-import '[invalid uri]' deferred as p;
-main() {
- p.loadLibrary();
-}
+ test_augmentationImport() async {
+ await assertErrorsInCode('''
+import augment 'unknown.dart';
''', [
- error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 7, 15),
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 15, 14),
]);
}
- test_export() async {
+ test_libraryExport() async {
await assertErrorsInCode('''
export 'unknown.dart';
''', [
@@ -34,7 +31,7 @@
]);
}
- test_export_cannotResolve() async {
+ test_libraryExport_cannotResolve() async {
await assertErrorsInCode(r'''
export 'dart:foo';
''', [
@@ -42,7 +39,7 @@
]);
}
- test_export_dart() async {
+ test_libraryExport_dart() async {
await assertErrorsInCode('''
export 'dart:math/bar.dart';
''', [
@@ -50,7 +47,7 @@
]);
}
- test_import() async {
+ test_libraryImport() async {
await assertErrorsInCode('''
import 'unknown.dart';
''', [
@@ -58,7 +55,7 @@
]);
}
- test_import_appears_after_deleting_target() async {
+ test_libraryImport_appears_after_deleting_target() async {
String filePath = newFile('$testPackageLibPath/target.dart', '').path;
await assertErrorsInCode('''
@@ -80,7 +77,7 @@
]);
}
- test_import_cannotResolve() async {
+ test_libraryImport_cannotResolve() async {
await assertErrorsInCode(r'''
import 'dart:foo';
''', [
@@ -88,7 +85,7 @@
]);
}
- test_import_dart() async {
+ test_libraryImport_dart() async {
await assertErrorsInCode('''
import 'dart:math/bar.dart';
''', [
@@ -96,8 +93,19 @@
]);
}
+ test_libraryImport_deferredWithInvalidUri() async {
+ await assertErrorsInCode(r'''
+import '[invalid uri]' deferred as p;
+main() {
+ p.loadLibrary();
+}
+''', [
+ error(CompileTimeErrorCode.URI_DOES_NOT_EXIST, 7, 15),
+ ]);
+ }
+
@failingTest
- test_import_disappears_when_fixed() async {
+ test_libraryImport_disappears_when_fixed() async {
await assertErrorsInCode('''
import 'target.dart';
''', [
diff --git a/pkg/analyzer/test/src/diagnostics/uri_with_interpolation_test.dart b/pkg/analyzer/test/src/diagnostics/uri_with_interpolation_test.dart
index a011990..7272aac 100644
--- a/pkg/analyzer/test/src/diagnostics/uri_with_interpolation_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/uri_with_interpolation_test.dart
@@ -15,7 +15,15 @@
@reflectiveTest
class UriWithInterpolationTest extends PubPackageResolutionTest {
- test_export() async {
+ test_augmentationImport() async {
+ await assertErrorsInCode(r'''
+import augment '${'foo'}.dart';
+''', [
+ error(CompileTimeErrorCode.URI_WITH_INTERPOLATION, 15, 15),
+ ]);
+ }
+
+ test_libraryExport() async {
await assertErrorsInCode(r'''
export '${'foo'}.dart';
''', [
@@ -23,7 +31,7 @@
]);
}
- test_import() async {
+ test_libraryImport() async {
await assertErrorsInCode(r'''
import '${'foo'}.dart';
''', [
diff --git a/pkg/analyzer/test/src/summary/elements_test.dart b/pkg/analyzer/test/src/summary/elements_test.dart
index 3d18ac2..3dbecde 100644
--- a/pkg/analyzer/test/src/summary/elements_test.dart
+++ b/pkg/analyzer/test/src/summary/elements_test.dart
@@ -245,6 +245,107 @@
''');
}
+ test_augmentation_defaultValue_class_field() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+class A {
+ static const a = 0;
+}
+''');
+
+ newFile('$testPackageLibPath/b.dart', r'''
+library augment 'test.dart';
+import 'a.dart';
+void f({int x = A.a}) {}
+''');
+
+ final library = await buildLibrary(r'''
+import augment 'b.dart';
+''');
+
+ checkElementText(library, r'''
+library
+ augmentationImports
+ package:test/b.dart
+ imports
+ package:test/a.dart
+ definingUnit
+ functions
+ f @51
+ parameters
+ optionalNamed x @58
+ type: int
+ constantInitializer
+ PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: A @62
+ staticElement: package:test/a.dart::@class::A
+ staticType: null
+ period: . @63
+ identifier: SimpleIdentifier
+ token: a @64
+ staticElement: package:test/a.dart::@class::A::@getter::a
+ staticType: int
+ staticElement: package:test/a.dart::@class::A::@getter::a
+ staticType: int
+ returnType: void
+ definingUnit
+''');
+ }
+
+ test_augmentation_defaultValue_prefix_class_field() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+class A {
+ static const a = 0;
+}
+''');
+
+ newFile('$testPackageLibPath/b.dart', r'''
+library augment 'test.dart';
+import 'a.dart' as prefix;
+void f({int x = prefix.A.a}) {}
+''');
+
+ final library = await buildLibrary(r'''
+import augment 'b.dart';
+''');
+
+ checkElementText(library, r'''
+library
+ augmentationImports
+ package:test/b.dart
+ imports
+ package:test/a.dart as prefix @48
+ definingUnit
+ functions
+ f @61
+ parameters
+ optionalNamed x @68
+ type: int
+ constantInitializer
+ PropertyAccess
+ target: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: prefix @72
+ staticElement: self::@augmentation::package:test/b.dart::@prefix::prefix
+ staticType: null
+ period: . @78
+ identifier: SimpleIdentifier
+ token: A @79
+ staticElement: package:test/a.dart::@class::A
+ staticType: null
+ staticElement: package:test/a.dart::@class::A
+ staticType: null
+ operator: . @80
+ propertyName: SimpleIdentifier
+ token: a @81
+ staticElement: package:test/a.dart::@class::A::@getter::a
+ staticType: int
+ staticType: int
+ returnType: void
+ definingUnit
+''');
+ }
+
test_augmentation_documented() async {
newFile('$testPackageLibPath/a.dart', r'''
/// My documentation.
diff --git a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
index 7dae515..0c26b7e 100644
--- a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
+++ b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
@@ -125,6 +125,18 @@
}
@override
+ void visitAugmentationImportDirective(AugmentationImportDirective node) {
+ _writeln('AugmentationImportDirective');
+ _withIndent(() {
+ _writeNamedChildEntities(node);
+ _writeElement('element', node.element);
+ _writeRaw('uriContent', node.uriContent);
+ _writeElement('uriElement', node.uriElement);
+ _writeSource('uriSource', node.uriSource);
+ });
+ }
+
+ @override
void visitAwaitExpression(AwaitExpression node) {
_writeln('AwaitExpression');
_withIndent(() {
@@ -1352,8 +1364,23 @@
_indent = indent;
}
+ void _writeAugmentationImportElement(AugmentationImportElement element) {
+ _writeln('AugmentationImportElement');
+ _withIndent(() {
+ _sink.write(_indent);
+ _sink.write('uri: ');
+ _writeDirectiveUri(element.uri);
+ });
+ }
+
void _writeDirectiveUri(DirectiveUri uri) {
- if (uri is DirectiveUriWithUnit) {
+ if (uri is DirectiveUriWithAugmentation) {
+ _writeln('DirectiveUriWithAugmentation');
+ _withIndent(() {
+ final uriStr = _stringOfSource(uri.augmentation.source);
+ _writelnWithIndent('uri: $uriStr');
+ });
+ } else if (uri is DirectiveUriWithUnit) {
_writeln('DirectiveUriWithUnit');
_withIndent(() {
final uriStr = _stringOfSource(uri.unit.source);
@@ -1409,6 +1436,8 @@
});
} else if (element is MultiplyDefinedElement) {
_sink.writeln('<null>');
+ } else if (element is AugmentationImportElement) {
+ _writeAugmentationImportElement(element);
} else if (element is PartElement) {
_writePartElement(element);
} else {
diff --git a/pkg/analyzer_cli/README.md b/pkg/analyzer_cli/README.md
index 5eea2c3..83cf1ed 100644
--- a/pkg/analyzer_cli/README.md
+++ b/pkg/analyzer_cli/README.md
@@ -1,19 +1,19 @@
-# dartanalyzer
+# SDK development code analysis
_dartanalyzer_ used to be the tool for statically analyzing dart code
-at the command line. However, this tool has been replaced with
+at the command line. However, this tool [has been replaced][] with
`dart analyze` for this purpose in current SDKs and will no longer
be published on pub.
-Do not depend on the command line interface or other semantics in
+**Do not** depend on the command line interface or other semantics in
this directory as it is now an internal tool for SDK development, used
as the `dart2analyzer` "compiler" for `tools/test.py` in the SDK.
It is configured as part of the test runner,
[here](https://github.com/dart-lang/sdk/blob/main/pkg/test_runner/lib/src/compiler_configuration.dart).
-## Basic usage
+## SDK development usage
-Run `dartanalyzer` from the test tool to validate analysis
+For SDK development, run analysis from the test tool to validate analysis
conclusions on language samples in the testing directory.
From the root of the SDK:
@@ -23,5 +23,7 @@
This will build the Dart VM and compile dartanalyzer into a snapshot, then use
that snapshot while analyzing those directories under `testing/`. Without
-`--use-sdk`, test.py will use the source code version of `dartanalyzer`
+`--use-sdk`, test.py will use the source code version of the analyzer
instead of the compiled one, which can be useful for debugging.
+
+[has been replaced]: https://github.com/dart-lang/sdk/issues/48457
\ No newline at end of file
diff --git a/pkg/dart2wasm/lib/code_generator.dart b/pkg/dart2wasm/lib/code_generator.dart
index 0e0f2c1..c24f897 100644
--- a/pkg/dart2wasm/lib/code_generator.dart
+++ b/pkg/dart2wasm/lib/code_generator.dart
@@ -915,7 +915,7 @@
compare = () => call(translator.stringEquals.reference);
} else {
// Object switch
- assert(check<InvalidExpression, InstanceConstant>());
+ assert(check<InvalidExpression, Constant>());
nonNullableType = w.RefType.eq(nullable: false);
nullableType = w.RefType.eq(nullable: true);
compare = () => b.ref_eq();
diff --git a/pkg/dart2wasm/lib/target.dart b/pkg/dart2wasm/lib/target.dart
index 5dce90c..78e4ce4 100644
--- a/pkg/dart2wasm/lib/target.dart
+++ b/pkg/dart2wasm/lib/target.dart
@@ -47,9 +47,11 @@
'dart:async',
'dart:ffi',
'dart:_internal',
+ 'dart:_http',
'dart:_js_helper',
'dart:typed_data',
'dart:nativewrappers',
+ 'dart:io',
'dart:js',
'dart:js_util',
'dart:wasm',
diff --git a/sdk/lib/_internal/wasm/lib/io_patch.dart b/sdk/lib/_internal/wasm/lib/io_patch.dart
new file mode 100644
index 0000000..028ba6b
--- /dev/null
+++ b/sdk/lib/_internal/wasm/lib/io_patch.dart
@@ -0,0 +1,758 @@
+// 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.
+
+import 'dart:_internal' show patch;
+import 'dart:async';
+import 'dart:convert';
+import 'dart:isolate';
+import 'dart:typed_data';
+
+@patch
+class _Directory {
+ @patch
+ static _current(_Namespace namespace) {
+ throw new UnsupportedError("Directory._current");
+ }
+
+ @patch
+ static _setCurrent(_Namespace namespace, Uint8List path) {
+ throw new UnsupportedError("Directory_SetCurrent");
+ }
+
+ @patch
+ static _createTemp(_Namespace namespace, Uint8List path) {
+ throw new UnsupportedError("Directory._createTemp");
+ }
+
+ @patch
+ static String _systemTemp(_Namespace namespace) {
+ throw new UnsupportedError("Directory._systemTemp");
+ }
+
+ @patch
+ static _exists(_Namespace namespace, Uint8List path) {
+ throw new UnsupportedError("Directory._exists");
+ }
+
+ @patch
+ static _create(_Namespace namespace, Uint8List path) {
+ throw new UnsupportedError("Directory._create");
+ }
+
+ @patch
+ static _deleteNative(_Namespace namespace, Uint8List path, bool recursive) {
+ throw new UnsupportedError("Directory._deleteNative");
+ }
+
+ @patch
+ static _rename(_Namespace namespace, Uint8List path, String newPath) {
+ throw new UnsupportedError("Directory._rename");
+ }
+
+ @patch
+ static void _fillWithDirectoryListing(
+ _Namespace namespace,
+ List<FileSystemEntity> list,
+ Uint8List path,
+ bool recursive,
+ bool followLinks) {
+ throw new UnsupportedError("Directory._fillWithDirectoryListing");
+ }
+}
+
+@patch
+class _AsyncDirectoryListerOps {
+ @patch
+ factory _AsyncDirectoryListerOps(int pointer) {
+ throw new UnsupportedError("Directory._list");
+ }
+}
+
+@patch
+class _EventHandler {
+ @patch
+ static void _sendData(Object? sender, SendPort sendPort, int data) {
+ throw new UnsupportedError("EventHandler._sendData");
+ }
+}
+
+@patch
+class FileStat {
+ @patch
+ static _statSync(_Namespace namespace, String path) {
+ throw new UnsupportedError("FileStat.stat");
+ }
+}
+
+@patch
+class FileSystemEntity {
+ @patch
+ static _getTypeNative(
+ _Namespace namespace, Uint8List path, bool followLinks) {
+ throw new UnsupportedError("FileSystemEntity._getType");
+ }
+
+ @patch
+ static _identicalNative(_Namespace namespace, String path1, String path2) {
+ throw new UnsupportedError("FileSystemEntity._identical");
+ }
+
+ @patch
+ static _resolveSymbolicLinks(_Namespace namespace, Uint8List path) {
+ throw new UnsupportedError("FileSystemEntity._resolveSymbolicLinks");
+ }
+}
+
+@patch
+class _File {
+ @patch
+ static _exists(_Namespace namespace, Uint8List path) {
+ throw new UnsupportedError("File._exists");
+ }
+
+ @patch
+ static _create(_Namespace namespace, Uint8List path) {
+ throw new UnsupportedError("File._create");
+ }
+
+ @patch
+ static _createLink(_Namespace namespace, Uint8List path, String target) {
+ throw new UnsupportedError("File._createLink");
+ }
+
+ @patch
+ static _linkTarget(_Namespace namespace, Uint8List path) {
+ throw new UnsupportedError("File._linkTarget");
+ }
+
+ @patch
+ static _deleteNative(_Namespace namespace, Uint8List path) {
+ throw new UnsupportedError("File._deleteNative");
+ }
+
+ @patch
+ static _deleteLinkNative(_Namespace namespace, Uint8List path) {
+ throw new UnsupportedError("File._deleteLinkNative");
+ }
+
+ @patch
+ static _rename(_Namespace namespace, Uint8List oldPath, String newPath) {
+ throw new UnsupportedError("File._rename");
+ }
+
+ @patch
+ static _renameLink(_Namespace namespace, Uint8List oldPath, String newPath) {
+ throw new UnsupportedError("File._renameLink");
+ }
+
+ @patch
+ static _copy(_Namespace namespace, Uint8List oldPath, String newPath) {
+ throw new UnsupportedError("File._copy");
+ }
+
+ @patch
+ static _lengthFromPath(_Namespace namespace, Uint8List path) {
+ throw new UnsupportedError("File._lengthFromPath");
+ }
+
+ @patch
+ static _lastModified(_Namespace namespace, Uint8List path) {
+ throw new UnsupportedError("File._lastModified");
+ }
+
+ @patch
+ static _lastAccessed(_Namespace namespace, Uint8List path) {
+ throw new UnsupportedError("File._lastAccessed");
+ }
+
+ @patch
+ static _setLastModified(_Namespace namespace, Uint8List path, int millis) {
+ throw new UnsupportedError("File._setLastModified");
+ }
+
+ @patch
+ static _setLastAccessed(_Namespace namespace, Uint8List path, int millis) {
+ throw new UnsupportedError("File._setLastAccessed");
+ }
+
+ @patch
+ static _open(_Namespace namespace, Uint8List path, int mode) {
+ throw new UnsupportedError("File._open");
+ }
+
+ @patch
+ static int _openStdio(int fd) {
+ throw new UnsupportedError("File._openStdio");
+ }
+}
+
+@patch
+class _Namespace {
+ @patch
+ static void _setupNamespace(var namespace) {
+ throw new UnsupportedError("_Namespace");
+ }
+
+ @patch
+ static _Namespace get _namespace {
+ throw new UnsupportedError("_Namespace");
+ }
+
+ @patch
+ static int get _namespacePointer {
+ throw new UnsupportedError("_Namespace");
+ }
+}
+
+@patch
+class _RandomAccessFileOps {
+ @patch
+ factory _RandomAccessFileOps(int pointer) {
+ throw new UnsupportedError("RandomAccessFile");
+ }
+}
+
+@patch
+bool _isDirectIOCapableTypedList(List<int> buffer) {
+ throw UnsupportedError("_isDirectIOCapableTypedList");
+}
+
+@patch
+class _IOCrypto {
+ @patch
+ static Uint8List getRandomBytes(int count) {
+ throw new UnsupportedError("_IOCrypto.getRandomBytes");
+ }
+}
+
+@patch
+class _Platform {
+ @patch
+ static int _numberOfProcessors() {
+ throw new UnsupportedError("Platform._numberOfProcessors");
+ }
+
+ @patch
+ static String _pathSeparator() {
+ throw new UnsupportedError("Platform._pathSeparator");
+ }
+
+ @patch
+ static String _operatingSystem() {
+ throw new UnsupportedError("Platform._operatingSystem");
+ }
+
+ @patch
+ static _operatingSystemVersion() {
+ throw new UnsupportedError("Platform._operatingSystemVersion");
+ }
+
+ @patch
+ static _localHostname() {
+ throw new UnsupportedError("Platform._localHostname");
+ }
+
+ @patch
+ static _executable() {
+ throw new UnsupportedError("Platform._executable");
+ }
+
+ @patch
+ static _resolvedExecutable() {
+ throw new UnsupportedError("Platform._resolvedExecutable");
+ }
+
+ @patch
+ static List<String> _executableArguments() {
+ throw new UnsupportedError("Platform._executableArguments");
+ }
+
+ @patch
+ static String _packageRoot() {
+ throw new UnsupportedError("Platform._packageRoot");
+ }
+
+ @patch
+ static String _packageConfig() {
+ throw new UnsupportedError("Platform._packageConfig");
+ }
+
+ @patch
+ static _environment() {
+ throw new UnsupportedError("Platform._environment");
+ }
+
+ @patch
+ static String _version() {
+ throw new UnsupportedError("Platform._version");
+ }
+
+ @patch
+ static String _localeName() {
+ throw new UnsupportedError("Platform._localeName");
+ }
+
+ @patch
+ static Uri _script() {
+ throw new UnsupportedError("Platform._script");
+ }
+}
+
+@patch
+class _ProcessUtils {
+ @patch
+ static Never _exit(int status) {
+ throw new UnsupportedError("ProcessUtils._exit");
+ }
+
+ @patch
+ static void _setExitCode(int status) {
+ throw new UnsupportedError("ProcessUtils._setExitCode");
+ }
+
+ @patch
+ static int _getExitCode() {
+ throw new UnsupportedError("ProcessUtils._getExitCode");
+ }
+
+ @patch
+ static void _sleep(int millis) {
+ throw new UnsupportedError("ProcessUtils._sleep");
+ }
+
+ @patch
+ static int _pid(Process? process) {
+ throw new UnsupportedError("ProcessUtils._pid");
+ }
+
+ @patch
+ static Stream<ProcessSignal> _watchSignal(ProcessSignal signal) {
+ throw new UnsupportedError("ProcessUtils._watchSignal");
+ }
+}
+
+@patch
+class ProcessInfo {
+ @patch
+ static int get currentRss {
+ throw new UnsupportedError("ProcessInfo.currentRss");
+ }
+
+ @patch
+ static int get maxRss {
+ throw new UnsupportedError("ProcessInfo.maxRss");
+ }
+}
+
+@patch
+class Process {
+ @patch
+ static Future<Process> start(String executable, List<String> arguments,
+ {String? workingDirectory,
+ Map<String, String>? environment,
+ bool includeParentEnvironment: true,
+ bool runInShell: false,
+ ProcessStartMode mode: ProcessStartMode.normal}) {
+ throw new UnsupportedError("Process.start");
+ }
+
+ @patch
+ static Future<ProcessResult> run(String executable, List<String> arguments,
+ {String? workingDirectory,
+ Map<String, String>? environment,
+ bool includeParentEnvironment: true,
+ bool runInShell: false,
+ Encoding? stdoutEncoding: systemEncoding,
+ Encoding? stderrEncoding: systemEncoding}) {
+ throw new UnsupportedError("Process.run");
+ }
+
+ @patch
+ static ProcessResult runSync(String executable, List<String> arguments,
+ {String? workingDirectory,
+ Map<String, String>? environment,
+ bool includeParentEnvironment: true,
+ bool runInShell: false,
+ Encoding? stdoutEncoding: systemEncoding,
+ Encoding? stderrEncoding: systemEncoding}) {
+ throw new UnsupportedError("Process.runSync");
+ }
+
+ @patch
+ static bool killPid(int pid, [ProcessSignal signal = ProcessSignal.sigterm]) {
+ throw new UnsupportedError("Process.killPid");
+ }
+}
+
+@patch
+class InternetAddress {
+ @patch
+ static InternetAddress get loopbackIPv4 {
+ throw new UnsupportedError("InternetAddress.loopbackIPv4");
+ }
+
+ @patch
+ static InternetAddress get loopbackIPv6 {
+ throw new UnsupportedError("InternetAddress.loopbackIPv6");
+ }
+
+ @patch
+ static InternetAddress get anyIPv4 {
+ throw new UnsupportedError("InternetAddress.anyIPv4");
+ }
+
+ @patch
+ static InternetAddress get anyIPv6 {
+ throw new UnsupportedError("InternetAddress.anyIPv6");
+ }
+
+ @patch
+ factory InternetAddress(String address, {InternetAddressType? type}) {
+ throw new UnsupportedError("InternetAddress");
+ }
+
+ @patch
+ factory InternetAddress.fromRawAddress(Uint8List rawAddress,
+ {InternetAddressType? type}) {
+ throw new UnsupportedError("InternetAddress.fromRawAddress");
+ }
+
+ @patch
+ static Future<List<InternetAddress>> lookup(String host,
+ {InternetAddressType type: InternetAddressType.any}) {
+ throw new UnsupportedError("InternetAddress.lookup");
+ }
+
+ @patch
+ static InternetAddress _cloneWithNewHost(
+ InternetAddress address, String host) {
+ throw new UnsupportedError("InternetAddress._cloneWithNewHost");
+ }
+
+ @patch
+ static InternetAddress? tryParse(String address) {
+ throw UnsupportedError("InternetAddress.tryParse");
+ }
+}
+
+@patch
+class NetworkInterface {
+ @patch
+ static bool get listSupported {
+ throw new UnsupportedError("NetworkInterface.listSupported");
+ }
+
+ @patch
+ static Future<List<NetworkInterface>> list(
+ {bool includeLoopback: false,
+ bool includeLinkLocal: false,
+ InternetAddressType type: InternetAddressType.any}) {
+ throw new UnsupportedError("NetworkInterface.list");
+ }
+}
+
+@patch
+class RawServerSocket {
+ @patch
+ static Future<RawServerSocket> bind(address, int port,
+ {int backlog: 0, bool v6Only: false, bool shared: false}) {
+ throw new UnsupportedError("RawServerSocket.bind");
+ }
+}
+
+@patch
+class ServerSocket {
+ @patch
+ static Future<ServerSocket> _bind(address, int port,
+ {int backlog: 0, bool v6Only: false, bool shared: false}) {
+ throw new UnsupportedError("ServerSocket.bind");
+ }
+}
+
+@patch
+class RawSocket {
+ @patch
+ static Future<RawSocket> connect(dynamic host, int port,
+ {dynamic sourceAddress, int sourcePort = 0, Duration? timeout}) {
+ throw new UnsupportedError("RawSocket constructor");
+ }
+
+ @patch
+ static Future<ConnectionTask<RawSocket>> startConnect(dynamic host, int port,
+ {dynamic sourceAddress, int sourcePort = 0}) {
+ throw new UnsupportedError("RawSocket constructor");
+ }
+}
+
+@patch
+class Socket {
+ @patch
+ static Future<Socket> _connect(dynamic host, int port,
+ {dynamic sourceAddress, int sourcePort = 0, Duration? timeout}) {
+ throw new UnsupportedError("Socket constructor");
+ }
+
+ @patch
+ static Future<ConnectionTask<Socket>> _startConnect(dynamic host, int port,
+ {dynamic sourceAddress, int sourcePort = 0}) {
+ throw new UnsupportedError("Socket constructor");
+ }
+}
+
+@patch
+class SocketControlMessage {
+ @patch
+ factory SocketControlMessage.fromHandles(List<ResourceHandle> handles) {
+ throw UnsupportedError("SocketControlMessage constructor");
+ }
+}
+
+@patch
+class ResourceHandle {
+ @patch
+ factory ResourceHandle.fromFile(RandomAccessFile file) {
+ throw UnsupportedError("ResourceHandle.fromFile constructor");
+ }
+
+ @patch
+ factory ResourceHandle.fromSocket(Socket socket) {
+ throw UnsupportedError("ResourceHandle.fromSocket constructor");
+ }
+
+ @patch
+ factory ResourceHandle.fromRawSocket(RawSocket rawSocket) {
+ throw UnsupportedError("ResourceHandle.fromRawSocket constructor");
+ }
+
+ @patch
+ factory ResourceHandle.fromRawDatagramSocket(
+ RawDatagramSocket rawDatagramSocket) {
+ throw UnsupportedError("ResourceHandle.fromRawDatagramSocket constructor");
+ }
+
+ @patch
+ factory ResourceHandle.fromStdin(Stdin stdin) {
+ throw UnsupportedError("ResourceHandle.fromStdin constructor");
+ }
+
+ @patch
+ factory ResourceHandle.fromStdout(Stdout stdout) {
+ throw UnsupportedError("ResourceHandle.fromStdout constructor");
+ }
+}
+
+@patch
+class SecureSocket {
+ @patch
+ factory SecureSocket._(RawSecureSocket rawSocket) {
+ throw new UnsupportedError("SecureSocket constructor");
+ }
+}
+
+@patch
+class RawSynchronousSocket {
+ @patch
+ static RawSynchronousSocket connectSync(dynamic host, int port) {
+ throw new UnsupportedError("RawSynchronousSocket.connectSync");
+ }
+}
+
+@patch
+class RawSocketOption {
+ @patch
+ static int _getOptionValue(int key) {
+ throw UnsupportedError("RawSocketOption._getOptionValue");
+ }
+}
+
+@patch
+class SecurityContext {
+ @patch
+ factory SecurityContext({bool withTrustedRoots: false}) {
+ throw new UnsupportedError("SecurityContext constructor");
+ }
+
+ @patch
+ static SecurityContext get defaultContext {
+ throw new UnsupportedError("default SecurityContext getter");
+ }
+
+ @patch
+ static bool get alpnSupported {
+ throw new UnsupportedError("SecurityContext alpnSupported getter");
+ }
+}
+
+@patch
+class X509Certificate {
+ @patch
+ factory X509Certificate._() {
+ throw new UnsupportedError("X509Certificate constructor");
+ }
+}
+
+@patch
+class RawDatagramSocket {
+ @patch
+ static Future<RawDatagramSocket> bind(dynamic host, int port,
+ {bool reuseAddress: true, bool reusePort: false, int ttl: 1}) {
+ throw new UnsupportedError("RawDatagramSocket.bind");
+ }
+}
+
+@patch
+class _SecureFilter {
+ @patch
+ factory _SecureFilter._() {
+ throw new UnsupportedError("_SecureFilter._SecureFilter");
+ }
+}
+
+@patch
+class _StdIOUtils {
+ @patch
+ static Stdin _getStdioInputStream(int fd) {
+ throw new UnsupportedError("StdIOUtils._getStdioInputStream");
+ }
+
+ @patch
+ static _getStdioOutputStream(int fd) {
+ throw new UnsupportedError("StdIOUtils._getStdioOutputStream");
+ }
+
+ @patch
+ static int _socketType(Socket socket) {
+ throw new UnsupportedError("StdIOUtils._socketType");
+ }
+
+ @patch
+ static _getStdioHandleType(int fd) {
+ throw new UnsupportedError("StdIOUtils._getStdioHandleType");
+ }
+}
+
+@patch
+class _WindowsCodePageDecoder {
+ @patch
+ static String _decodeBytes(List<int> bytes) {
+ throw new UnsupportedError("_WindowsCodePageDecoder._decodeBytes");
+ }
+}
+
+@patch
+class _WindowsCodePageEncoder {
+ @patch
+ static List<int> _encodeString(String string) {
+ throw new UnsupportedError("_WindowsCodePageEncoder._encodeString");
+ }
+}
+
+@patch
+class RawZLibFilter {
+ @patch
+ static RawZLibFilter _makeZLibDeflateFilter(
+ bool gzip,
+ int level,
+ int windowBits,
+ int memLevel,
+ int strategy,
+ List<int>? dictionary,
+ bool raw) {
+ throw new UnsupportedError("_newZLibDeflateFilter");
+ }
+
+ @patch
+ static RawZLibFilter _makeZLibInflateFilter(
+ int windowBits, List<int>? dictionary, bool raw) {
+ throw new UnsupportedError("_newZLibInflateFilter");
+ }
+}
+
+@patch
+class Stdin {
+ @patch
+ int readByteSync() {
+ throw new UnsupportedError("Stdin.readByteSync");
+ }
+
+ @patch
+ bool get echoMode {
+ throw new UnsupportedError("Stdin.echoMode");
+ }
+
+ @patch
+ void set echoMode(bool enabled) {
+ throw new UnsupportedError("Stdin.echoMode");
+ }
+
+ @patch
+ bool get echoNewlineMode {
+ throw UnsupportedError("Stdin.echoNewlineMode");
+ }
+
+ @patch
+ void set echoNewlineMode(bool enabled) {
+ throw UnsupportedError("Stdin.echoNewlineMode");
+ }
+
+ @patch
+ bool get lineMode {
+ throw new UnsupportedError("Stdin.lineMode");
+ }
+
+ @patch
+ void set lineMode(bool enabled) {
+ throw new UnsupportedError("Stdin.lineMode");
+ }
+
+ @patch
+ bool get supportsAnsiEscapes {
+ throw new UnsupportedError("Stdin.supportsAnsiEscapes");
+ }
+}
+
+@patch
+class Stdout {
+ @patch
+ bool _hasTerminal(int fd) {
+ throw new UnsupportedError("Stdout.hasTerminal");
+ }
+
+ @patch
+ int _terminalColumns(int fd) {
+ throw new UnsupportedError("Stdout.terminalColumns");
+ }
+
+ @patch
+ int _terminalLines(int fd) {
+ throw new UnsupportedError("Stdout.terminalLines");
+ }
+
+ @patch
+ static bool _supportsAnsiEscapes(int fd) {
+ throw new UnsupportedError("Stdout.supportsAnsiEscapes");
+ }
+}
+
+@patch
+class _FileSystemWatcher {
+ @patch
+ static Stream<FileSystemEvent> _watch(
+ String path, int events, bool recursive) {
+ throw new UnsupportedError("_FileSystemWatcher.watch");
+ }
+
+ @patch
+ static bool get isSupported {
+ throw new UnsupportedError("_FileSystemWatcher.isSupported");
+ }
+}
+
+@patch
+class _IOService {
+ @patch
+ static Future _dispatch(int request, List data) {
+ throw new UnsupportedError("_IOService._dispatch");
+ }
+}
diff --git a/sdk/lib/libraries.json b/sdk/lib/libraries.json
index c47b40d..a398608 100644
--- a/sdk/lib/libraries.json
+++ b/sdk/lib/libraries.json
@@ -158,6 +158,9 @@
},
"wasm": {
"libraries": {
+ "_http": {
+ "uri": "_http/http.dart"
+ },
"_internal": {
"uri": "internal/internal.dart",
"patches": [
@@ -232,6 +235,11 @@
"nativewrappers": {
"uri": "html/dartium/nativewrappers.dart"
},
+ "io": {
+ "uri": "io/io.dart",
+ "patches": "_internal/wasm/lib/io_patch.dart",
+ "supported": false
+ },
"isolate": {
"uri": "isolate/isolate.dart"
},
diff --git a/sdk/lib/libraries.yaml b/sdk/lib/libraries.yaml
index aa8d1c9..ee7ad39 100644
--- a/sdk/lib/libraries.yaml
+++ b/sdk/lib/libraries.yaml
@@ -156,6 +156,8 @@
wasm:
libraries:
+ _http:
+ uri: _http/http.dart
_internal:
uri: internal/internal.dart
patches:
@@ -216,6 +218,10 @@
- "_internal/vm/lib/ffi_struct_patch.dart"
nativewrappers:
uri: "html/dartium/nativewrappers.dart"
+ io:
+ uri: io/io.dart
+ patches: _internal/wasm/lib/io_patch.dart
+ supported: false
isolate:
uri: isolate/isolate.dart
js:
diff --git a/tools/VERSION b/tools/VERSION
index 759e452..02e544a 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 19
PATCH 0
-PRERELEASE 16
+PRERELEASE 17
PRERELEASE_PATCH 0
\ No newline at end of file