Skip to content

Commit 33daa43

Browse files
scheglovCommit Queue
authored andcommitted
CodeGen. Document GenerateNodeProperty.
Change-Id: I4e89beb032451cbd067d4314a030ad664b0d780d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431200 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 77dd4fb commit 33daa43

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

pkg/analyzer/lib/src/dart/ast/ast.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
/// This file is partially generated, using [GenerateNodeImpl].
6+
/// After modifying any these annotations, run
7+
/// 'dart run pkg/analyzer/tool/generators/ast_generator.dart' to update.
8+
library;
9+
510
import 'dart:collection';
611
import 'dart:math' as math;
712

@@ -12112,18 +12117,41 @@ final class FunctionTypedFormalParameterImpl extends NormalFormalParameterImpl
1211212117
}
1211312118

1211412119
class GenerateNodeImpl {
12120+
/// The order is important for [AstNodeImpl._childEntities].
1211512121
final List<GenerateNodeProperty> childEntitiesOrder;
1211612122

1211712123
const GenerateNodeImpl({required this.childEntitiesOrder});
1211812124
}
1211912125

12126+
/// Description for a single property in the node implementation.
12127+
///
12128+
/// Most of these description refer to properties of the public interface,
12129+
/// e.g. `Foo` in `class FooImpl extends BarImpl implements Baz, Foo`.
1212012130
class GenerateNodeProperty {
1212112131
final String name;
12132+
12133+
/// If `true`, then `super.name` should be generated in the constructor,
12134+
/// and no field or getter is generated, unless [superNullAssertOverride].
1212212135
final bool isSuper;
12136+
12137+
/// Normally [Token] properties are final, but sometimes we mutate nodes.
1212312138
final bool isTokenFinal;
12139+
12140+
/// When the property is from the public interface, its field or getter
12141+
/// should have `@override` annotation. But sometimes we want to have
12142+
/// implementation only property, not in the public interface.
1212412143
final bool withOverride;
12144+
12145+
/// To generate overrides like `Token get name => super.name!;`.
12146+
/// Obviously, these are always paired with [isSuper].
1212512147
final bool superNullAssertOverride;
12148+
12149+
/// Sometimes we use [Token.lexicallyFirst], and want to describe which
12150+
/// group of tokens to use.
1212612151
final int? tokenGroupId;
12152+
12153+
/// If the property does not exist in the public interface, we still need
12154+
/// to know its type.
1212712155
final Type? type;
1212812156

1212912157
const GenerateNodeProperty(

0 commit comments

Comments
 (0)