Skip to content

Commit

Permalink
Version 3.5.0-214.0.dev
Browse files Browse the repository at this point in the history
Merge b56843d into dev
  • Loading branch information
Dart CI committed May 31, 2024
2 parents d40adc9 + b56843d commit 53c4132
Show file tree
Hide file tree
Showing 21 changed files with 89 additions and 75 deletions.
10 changes: 10 additions & 0 deletions pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2742,6 +2742,16 @@ Message _withArgumentsCyclicTypedef(String name) {
);
}

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeDartFfiLibraryInDart2Wasm =
messageDartFfiLibraryInDart2Wasm;

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageDartFfiLibraryInDart2Wasm = const MessageCode(
"DartFfiLibraryInDart2Wasm",
problemMessage: r"""'dart:ffi' can't be imported when compiling to Wasm.""",
);

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name, String string)>
templateDebugTrace =
Expand Down
16 changes: 9 additions & 7 deletions pkg/_js_interop_checks/lib/js_interop_checks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:_fe_analyzer_shared/src/messages/codes.dart'
show
Message,
LocatedMessage,
messageDartFfiLibraryInDart2Wasm,
messageJsInteropDartJsInteropAnnotationForStaticInteropOnly,
messageJsInteropEnclosingClassJSAnnotation,
messageJsInteropEnclosingClassJSAnnotationContext,
Expand Down Expand Up @@ -134,7 +135,8 @@ class JsInteropChecks extends RecursiveVisitor {
'package:js/js.dart',
'package:js/js_util.dart',
'dart:js_util',
'dart:js'
'dart:js',
'dart:ffi',
];

/// Libraries that use `external` to exclude from checks on external.
Expand Down Expand Up @@ -550,12 +552,12 @@ class JsInteropChecks extends RecursiveVisitor {
_allowedUseOfDart2WasmDisallowedInteropLibrariesTestPatterns
.any((pattern) => uri.path.contains(pattern));
if (allowedToImport) return;
_reporter.report(
templateJsInteropDisallowedInteropLibraryInDart2Wasm
.withArguments(dependencyUriString),
dependency.fileOffset,
dependencyUriString.length,
node.fileUri);
final message = dependencyUriString == 'dart:ffi'
? messageDartFfiLibraryInDart2Wasm
: templateJsInteropDisallowedInteropLibraryInDart2Wasm
.withArguments(dependencyUriString);
_reporter.report(message, dependency.fileOffset,
dependencyUriString.length, node.fileUri);
}
}
}
Expand Down
20 changes: 2 additions & 18 deletions pkg/dart2wasm/lib/class_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,6 @@ class ClassInfo {

ClassInfo? _repr;

/// All classes which implement this class. This is used to compute `repr`.
final List<ClassInfo> implementedBy = [];

/// Nullabe Wasm ref type for this class.
final w.RefType nullableType;

Expand All @@ -175,9 +172,7 @@ class ClassInfo {
ClassInfo(this.cls, this.classId, this.depth, this.struct, this.superInfo,
{this.typeParameterMatch = const {}})
: nullableType = w.RefType.def(struct, nullable: true),
nonNullableType = w.RefType.def(struct, nullable: false) {
implementedBy.add(this);
}
nonNullableType = w.RefType.def(struct, nullable: false);

void _addField(w.FieldType fieldType, [int? expectedIndex]) {
assert(expectedIndex == null || expectedIndex == struct.fields.length);
Expand Down Expand Up @@ -294,7 +289,6 @@ class ClassInfoCollector {
info = ClassInfo(cls, classId, superInfo.depth + 1, struct, superInfo);
// Mark Top type as implementing Object to force the representation
// type of Object to be Top.
info.implementedBy.add(topInfo);
} else {
// Recursively initialize all supertypes before initializing this class.
_createStructForClass(classIds, superclass);
Expand Down Expand Up @@ -339,16 +333,6 @@ class ClassInfoCollector {
m.types.defineStruct(cls.name, superType: superInfo.struct);
info = ClassInfo(cls, classId, superInfo.depth + 1, struct, superInfo,
typeParameterMatch: typeParameterMatch);

// Mark all interfaces as being implemented by this class. This is
// needed to calculate representation types.
for (Supertype interface in cls.implementedTypes) {
ClassInfo? interfaceInfo = translator.classInfo[interface.classNode];
while (interfaceInfo != null) {
interfaceInfo.implementedBy.add(info);
interfaceInfo = interfaceInfo.superInfo;
}
}
}
translator.classesSupersFirst.add(info);
translator.classes[classId] = info;
Expand Down Expand Up @@ -498,7 +482,7 @@ class ClassInfoCollector {
}
final classId = classIdNumbering.classIds[cls]!;
final info = translator.classes[classId];
info._repr = representation ?? translator.classes[classId];
info._repr = representation ?? info;
}

// Now that the representation types for all classes have been computed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class ConstructorReferenceBuilder {
Builder? target;

ConstructorReferenceBuilder(this.typeName, this.typeArguments, this.suffix,
Builder parent, this.charOffset)
: fileUri = parent.fileUri!;
this.fileUri, this.charOffset);

String get fullNameForErrors {
return "${typeName.fullName}"
Expand Down
2 changes: 1 addition & 1 deletion pkg/front_end/lib/src/fasta/builder/library_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import 'nullability_builder.dart';
import 'prefix_builder.dart';
import 'type_builder.dart';

abstract class LibraryBuilder implements ModifierBuilder {
abstract class LibraryBuilder implements Builder {
Scope get scope;

Scope get exportScope;
Expand Down
6 changes: 1 addition & 5 deletions pkg/front_end/lib/src/fasta/builder/member_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import 'declaration_builders.dart';
import 'library_builder.dart';
import 'modifier_builder.dart';

abstract class MemberBuilder implements ModifierBuilder {
@override
abstract class MemberBuilder implements Builder {
String get name;

bool get isAssignable;
Expand Down Expand Up @@ -165,9 +164,6 @@ abstract class MemberBuilderImpl extends ModifierBuilderImpl
@override
bool get isTopLevel => !isDeclarationMember;

@override
bool get isNative => false;

@override
bool get isExternal => (modifiers & externalMask) != 0;

Expand Down
14 changes: 3 additions & 11 deletions pkg/front_end/lib/src/fasta/builder/modifier_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ import '../modifier.dart';

import 'builder.dart';

abstract class ModifierBuilder implements Builder {
String? get name;

bool get isNative;
}

abstract class ModifierBuilderImpl extends BuilderImpl
implements ModifierBuilder {
abstract class ModifierBuilderImpl extends BuilderImpl {
int get modifiers;

String? get name;

String get debugName;

@override
Expand All @@ -40,9 +35,6 @@ abstract class ModifierBuilderImpl extends BuilderImpl
@override
bool get isAugment => (modifiers & augmentMask) != 0;

@override
bool get isNative => false;

StringBuffer printOn(StringBuffer buffer) {
return buffer..write(name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

part of 'declaration_builders.dart';

abstract class ITypeDeclarationBuilder implements ModifierBuilder {
@override
abstract class ITypeDeclarationBuilder implements Builder {
String get name;

bool get isNamedMixinApplication;
Expand Down
7 changes: 4 additions & 3 deletions pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import '../builder/declaration_builders.dart';
import '../builder/dynamic_type_declaration_builder.dart';
import '../builder/library_builder.dart';
import '../builder/member_builder.dart';
import '../builder/modifier_builder.dart';
import '../builder/name_iterator.dart';
import '../builder/never_type_declaration_builder.dart';
import '../codes/fasta_codes.dart'
Expand Down Expand Up @@ -340,8 +339,10 @@ class DillLibraryBuilder extends LibraryBuilderImpl {
String name;
if (sourceBuildersMap?.containsKey(reference) == true) {
declaration = sourceBuildersMap![reference]!;
if (declaration is ModifierBuilder) {
name = declaration.name!;
if (declaration is TypeDeclarationBuilder) {
name = declaration.name;
} else if (declaration is MemberBuilder) {
name = declaration.name;
} else {
throw new StateError(
"Unexpected: $declaration (${declaration.runtimeType}");
Expand Down
3 changes: 0 additions & 3 deletions pkg/front_end/lib/src/fasta/scope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -967,9 +967,6 @@ mixin ErroneousMemberBuilderMixin implements SourceMemberBuilder {
@override
Iterable<Member> get exportedMembers => const [];

@override
bool get isNative => false;

@override
bool get isAssignable => false;

Expand Down
23 changes: 9 additions & 14 deletions pkg/front_end/lib/src/fasta/source/diet_listener.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import 'package:kernel/core_types.dart' show CoreTypes;

import '../builder/builder.dart';
import '../builder/declaration_builders.dart';
import '../builder/modifier_builder.dart';
import '../codes/fasta_codes.dart'
show Code, LocatedMessage, Message, messageExpectedBlockToSkip;
import '../constant_context.dart' show ConstantContext;
Expand Down Expand Up @@ -552,8 +551,7 @@ class DietListener extends StackListenerImpl {

LibraryDependency? dependency =
_offsetMap.lookupImport(importKeyword).libraryDependency;
parseMetadata(libraryBuilder.bodyBuilderContext, libraryBuilder, metadata,
dependency);
parseMetadata(libraryBuilder.bodyBuilderContext, metadata, dependency);
}

@override
Expand All @@ -568,8 +566,7 @@ class DietListener extends StackListenerImpl {
Token? metadata = pop() as Token?;
LibraryDependency dependency =
_offsetMap.lookupExport(exportKeyword).libraryDependency;
parseMetadata(libraryBuilder.bodyBuilderContext, libraryBuilder, metadata,
dependency);
parseMetadata(libraryBuilder.bodyBuilderContext, metadata, dependency);
}

@override
Expand All @@ -578,8 +575,7 @@ class DietListener extends StackListenerImpl {

Token? metadata = pop() as Token?;
LibraryPart part = _offsetMap.lookupPart(partKeyword);
parseMetadata(
libraryBuilder.bodyBuilderContext, libraryBuilder, metadata, part);
parseMetadata(libraryBuilder.bodyBuilderContext, metadata, part);
}

@override
Expand Down Expand Up @@ -769,8 +765,8 @@ class DietListener extends StackListenerImpl {
}
}

BodyBuilder createListener(BodyBuilderContext bodyBuilderContext,
ModifierBuilder builder, Scope memberScope,
BodyBuilder createListener(
BodyBuilderContext bodyBuilderContext, Scope memberScope,
{VariableDeclaration? thisVariable,
List<TypeParameter>? thisTypeParameters,
Scope? formalParameterScope,
Expand Down Expand Up @@ -825,8 +821,7 @@ class DietListener extends StackListenerImpl {
builder.computeTypeParameterScope(memberScope);
final Scope formalParameterScope =
builder.computeFormalParameterScope(typeParameterScope);
return createListener(
builder.bodyBuilderContext, builder, typeParameterScope,
return createListener(builder.bodyBuilderContext, typeParameterScope,
thisVariable: builder.thisVariable,
thisTypeParameters: builder.thisTypeParameters,
formalParameterScope: formalParameterScope,
Expand Down Expand Up @@ -876,7 +871,7 @@ class DietListener extends StackListenerImpl {
// TODO(paulberry): don't re-parse the field if we've already parsed it
// for type inference.
_parseFields(
createListener(declaration.bodyBuilderContext, declaration, memberScope,
createListener(declaration.bodyBuilderContext, memberScope,
inferenceDataForTesting: declaration.dataForTesting?.inferenceData),
token,
metadata,
Expand Down Expand Up @@ -1303,10 +1298,10 @@ class DietListener extends StackListenerImpl {
/// If the [metadata] is not `null`, return the parsed metadata [Expression]s.
/// Otherwise, return `null`.
List<Expression>? parseMetadata(BodyBuilderContext bodyBuilderContext,
ModifierBuilder builder, Token? metadata, Annotatable? parent) {
Token? metadata, Annotatable? parent) {
if (metadata != null) {
StackListenerImpl listener =
createListener(bodyBuilderContext, builder, memberScope);
createListener(bodyBuilderContext, memberScope);
Parser parser = new Parser(listener,
useImplicitCreationExpression: useImplicitCreationExpressionInCfe,
allowPatterns: libraryFeatures.patterns.isEnabled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ abstract class SourceFunctionBuilder

void set body(Statement? newBody);

@override
bool get isNative;

/// Returns the [index]th parameter of this function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
ConstructorReferenceBuilder addConstructorReference(TypeName name,
List<TypeBuilder>? typeArguments, String? suffix, int charOffset) {
ConstructorReferenceBuilder ref = new ConstructorReferenceBuilder(
name, typeArguments, suffix, this, charOffset);
name, typeArguments, suffix, fileUri, charOffset);
constructorReferences.add(ref);
return ref;
}
Expand Down
1 change: 0 additions & 1 deletion pkg/front_end/lib/src/fasta/source/source_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,6 @@ severity: $severity
BodyBuilder listener = dietListener.createListener(
new ExpressionCompilerProcedureBodyBuildContext(dietListener, builder,
isDeclarationInstanceMember: isClassInstanceMember),
builder,
dietListener.memberScope,
thisVariable: extensionThis);
builder.procedure.function = parameters..parent = builder.procedure;
Expand Down
4 changes: 3 additions & 1 deletion pkg/front_end/messages.status
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ CyclicRedirectingFactoryConstructors/part_wrapped_script: Fail # Error is report
CyclicRedirectingFactoryConstructors/script: Fail # Error is reported for each factory involved in the cycle.
CyclicRepresentationDependency/analyzerCode: Fail
CyclicTypedef/example: Fail
DartFfiLibraryInDart2Wasm/analyzerCode: Fail
DartFfiLibraryInDart2Wasm/example: Fail
DeferredAfterPrefix/example: Fail
DeferredExtensionImport/analyzerCode: Fail
DeferredExtensionImport/part_wrapped_script: Fail
Expand Down Expand Up @@ -1136,4 +1138,4 @@ YieldNotGenerator/example: Fail
# TODO(johnniwinther): Remove these.
ExternalField/example: Fail
UnexpectedModifierInNonNnbd/example: Fail
SwitchExpressionNotAssignable/example: Fail
SwitchExpressionNotAssignable/example: Fail
5 changes: 4 additions & 1 deletion pkg/front_end/messages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7355,4 +7355,7 @@ ExperimentExpiredEnabled:
problemMessage: "The experiment '#name' has expired and can't be enabled."

ExperimentExpiredDisabled:
problemMessage: "The experiment '#name' has expired and can't be disabled."
problemMessage: "The experiment '#name' has expired and can't be disabled."

DartFfiLibraryInDart2Wasm:
problemMessage: "'dart:ffi' can't be imported when compiling to Wasm."
2 changes: 1 addition & 1 deletion pkg/front_end/test/coverage_suite.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const Map<String, double> _expect = {
95.42483660130719,
"package:front_end/src/fasta/dill/dill_extension_type_member_builder.dart":
83.76623376623377,
"package:front_end/src/fasta/dill/dill_library_builder.dart": 78.134110787172,
"package:front_end/src/fasta/dill/dill_library_builder.dart": 77.0,
"package:front_end/src/fasta/dill/dill_loader.dart": 76.58536585365854,
"package:front_end/src/fasta/dill/dill_member_builder.dart":
86.52173913043478,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@
// ^
// [web] JS interop library 'package:js/js_util.dart' can't be imported when compiling to Wasm.

/**/ import 'dart:ffi';
// ^
// [web] 'dart:ffi' can't be imported when compiling to Wasm.

void main() {}
2 changes: 1 addition & 1 deletion tools/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ CHANNEL dev
MAJOR 3
MINOR 5
PATCH 0
PRERELEASE 213
PRERELEASE 214
PRERELEASE_PATCH 0
Loading

0 comments on commit 53c4132

Please sign in to comment.