Skip to content

Commit

Permalink
[cfe] Add comments to and update BodyBuilderContext
Browse files Browse the repository at this point in the history
Change-Id: Ie7b6e9fb4f15a06ba769528dc29b10d0b670dffb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391604
Reviewed-by: Chloe Stefantsova <[email protected]>
Commit-Queue: Johnni Winther <[email protected]>
  • Loading branch information
johnniwinther authored and Commit Queue committed Oct 24, 2024
1 parent 4d552d1 commit a8bee55
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 35 deletions.
6 changes: 3 additions & 3 deletions pkg/front_end/lib/src/builder/class_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ abstract class ClassBuilderImpl extends DeclarationBuilderImpl

@override
Builder? findStaticBuilder(
String name, int charOffset, Uri fileUri, LibraryBuilder accessingLibrary,
String name, int fileOffset, Uri fileUri, LibraryBuilder accessingLibrary,
{bool isSetter = false}) {
if (accessingLibrary.nameOriginBuilder.origin !=
libraryBuilder.nameOriginBuilder.origin &&
Expand All @@ -201,14 +201,14 @@ abstract class ClassBuilderImpl extends DeclarationBuilderImpl
getable: nameSpace.lookupLocalMember(name, setter: false),
setable: nameSpace.lookupLocalMember(name, setter: true),
name: name,
charOffset: charOffset,
charOffset: fileOffset,
fileUri: fileUri,
classNameOrDebugName: this.name,
isSetter: isSetter,
forStaticAccess: true);
if (declaration == null && isAugmenting) {
return origin.findStaticBuilder(
name, charOffset, fileUri, accessingLibrary,
name, fileOffset, fileUri, accessingLibrary,
isSetter: isSetter);
}
return declaration;
Expand Down
2 changes: 1 addition & 1 deletion pkg/front_end/lib/src/builder/declaration_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class IDeclarationBuilder implements ITypeDeclarationBuilder {

/// Lookup a member accessed statically through this declaration.
Builder? findStaticBuilder(
String name, int charOffset, Uri fileUri, LibraryBuilder accessingLibrary,
String name, int fileOffset, Uri fileUri, LibraryBuilder accessingLibrary,
{bool isSetter = false});

MemberBuilder? findConstructorOrFactory(
Expand Down
22 changes: 11 additions & 11 deletions pkg/front_end/lib/src/kernel/body_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ class BodyBuilder extends StackListenerImpl
if (body != null) {
inferredFunctionBody = typeInferrer.inferFunctionBody(
this,
_context.memberCharOffset,
_context.memberNameOffset,
_context.returnTypeContext,
asyncModifier,
body);
Expand All @@ -1268,7 +1268,7 @@ class BodyBuilder extends StackListenerImpl

if (_context.returnType is! OmittedTypeBuilder) {
checkAsyncReturnType(asyncModifier, function.returnType,
_context.memberCharOffset, _context.memberName.length);
_context.memberNameOffset, _context.memberNameLength);
}

if (_context.isSetter) {
Expand All @@ -1279,7 +1279,7 @@ class BodyBuilder extends StackListenerImpl
// Coverage-ignore(suite): Not run.
body?.fileOffset ??
// Coverage-ignore(suite): Not run.
_context.memberCharOffset;
_context.memberNameOffset;
if (body == null) {
body = new EmptyStatement()..fileOffset = charOffset;
}
Expand Down Expand Up @@ -1844,7 +1844,7 @@ class BodyBuilder extends StackListenerImpl
buildProblem(
fasta.templateIllegalMixinDueToConstructors
.withArguments(_context.className),
_context.memberCharOffset,
_context.memberNameOffset,
noLength);
}
if (initializers.last is SuperInitializer) {
Expand Down Expand Up @@ -1979,7 +1979,7 @@ class BodyBuilder extends StackListenerImpl
explicitSuperInitializer = superInitializer;
}
if (argumentsOffset == -1) {
argumentsOffset = _context.memberCharOffset;
argumentsOffset = _context.memberNameOffset;
}

if (positionalArguments != null || namedArguments != null) {
Expand All @@ -1996,19 +1996,19 @@ class BodyBuilder extends StackListenerImpl

if (superTarget == null) {
String superclass = _context.superClassName;
int length = _context.memberName.length;
int length = _context.memberNameLength;
if (length == 0) {
length = _context.className.length;
}
initializer = buildInvalidInitializer(
buildProblem(
fasta.templateSuperclassHasNoDefaultConstructor
.withArguments(superclass),
_context.memberCharOffset,
_context.memberNameOffset,
length),
_context.memberCharOffset);
_context.memberNameOffset);
} else if (checkArgumentsForFunction(superTarget.function, arguments,
_context.memberCharOffset, const <TypeParameter>[])
_context.memberNameOffset, const <TypeParameter>[])
case LocatedMessage argumentIssue) {
List<int>? positionalSuperParametersIssueOffsets;
if (positionalSuperParametersAsArguments != null) {
Expand Down Expand Up @@ -2081,7 +2081,7 @@ class BodyBuilder extends StackListenerImpl
initializer = errorMessageInitializer;
} else {
initializer = buildSuperInitializer(
true, superTarget, arguments, _context.memberCharOffset);
true, superTarget, arguments, _context.memberNameOffset);
}
if (libraryFeatures.superParameters.isEnabled) {
InitializerInferenceResult inferenceResult =
Expand All @@ -2103,7 +2103,7 @@ class BodyBuilder extends StackListenerImpl
buildProblem(
fasta.templateIllegalMixinDueToConstructors
.withArguments(_context.className),
_context.memberCharOffset,
_context.memberNameOffset,
noLength);
}
}
Expand Down
Loading

0 comments on commit a8bee55

Please sign in to comment.