Skip to content

Commit

Permalink
[cfe] Remove exports from internal libraries
Browse files Browse the repository at this point in the history
Change-Id: Ief854e97f5cd3c8a04137ec6682f8193946abcac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213770
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
  • Loading branch information
johnniwinther authored and commit-bot@chromium.org committed Sep 20, 2021
1 parent d45095c commit 3fd4283
Show file tree
Hide file tree
Showing 37 changed files with 149 additions and 371 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import '../kernel/class_hierarchy_builder.dart' show ClassMember;
import '../kernel/constructor_tearoff_lowering.dart';
import '../kernel/expression_generator_helper.dart'
show ExpressionGeneratorHelper;
import '../kernel/kernel_builder.dart'
import '../kernel/utils.dart'
show isRedirectingGenerativeConstructorImplementation;
import '../kernel/kernel_helper.dart' show SynthesizedFunctionNode;

Expand Down
2 changes: 1 addition & 1 deletion pkg/front_end/lib/src/fasta/builder/factory_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.

import 'package:kernel/ast.dart';
import 'package:kernel/core_types.dart';
import 'package:kernel/type_algebra.dart';

import '../dill/dill_member_builder.dart';
Expand All @@ -11,7 +12,6 @@ import '../kernel/class_hierarchy_builder.dart';
import '../kernel/constructor_tearoff_lowering.dart';
import '../kernel/forest.dart';
import '../kernel/internal_ast.dart';
import '../kernel/kernel_api.dart';
import '../kernel/kernel_helper.dart';
import '../kernel/redirecting_factory_body.dart'
show getRedirectingFactoryBody, RedirectingFactoryBody;
Expand Down
2 changes: 1 addition & 1 deletion pkg/front_end/lib/src/fasta/builder/field_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import '../fasta_codes.dart' show messageInternalProblemAlreadyInitialized;

import '../kernel/body_builder.dart' show BodyBuilder;
import '../kernel/class_hierarchy_builder.dart';
import '../kernel/kernel_builder.dart' show ImplicitFieldType;
import '../kernel/implicit_field_type.dart';
import '../kernel/kernel_helper.dart';
import '../kernel/late_lowering.dart' as late_lowering;
import '../kernel/member_covariance.dart';
Expand Down
10 changes: 5 additions & 5 deletions pkg/front_end/lib/src/fasta/builder/library_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:_fe_analyzer_shared/src/messages/severity.dart' show Severity;

import 'package:kernel/ast.dart' show Library, Nullability;

import '../combinator.dart' show Combinator;
import '../combinator.dart' show CombinatorBuilder;

import '../problems.dart' show internalProblem, unsupported;

Expand Down Expand Up @@ -76,8 +76,8 @@ abstract class LibraryBuilder implements ModifierBuilder {

Builder? addBuilder(String? name, Builder declaration, int charOffset);

void addExporter(
LibraryBuilder exporter, List<Combinator>? combinators, int charOffset);
void addExporter(LibraryBuilder exporter,
List<CombinatorBuilder>? combinators, int charOffset);

/// Add a problem with a severity determined by the severity of the message.
///
Expand Down Expand Up @@ -242,8 +242,8 @@ abstract class LibraryBuilderImpl extends ModifierBuilderImpl
}

@override
void addExporter(
LibraryBuilder exporter, List<Combinator>? combinators, int charOffset) {
void addExporter(LibraryBuilder exporter,
List<CombinatorBuilder>? combinators, int charOffset) {
exporters.add(new Export(exporter, this, combinators, charOffset));
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/front_end/lib/src/fasta/builder/procedure_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// BSD-style license that can be found in the LICENSE file.

import 'package:kernel/ast.dart';
import 'package:kernel/type_algebra.dart';

import '../kernel/class_hierarchy_builder.dart';
import '../kernel/kernel_api.dart';
import '../kernel/member_covariance.dart';

import '../loader.dart' show Loader;
Expand Down
10 changes: 4 additions & 6 deletions pkg/front_end/lib/src/fasta/combinator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@
// 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.

library fasta.combinator;

class Combinator {
class CombinatorBuilder {
final bool isShow;

final Set<String> names;

Combinator(this.isShow, this.names, int charOffset, Uri fileUri);
CombinatorBuilder(this.isShow, this.names, int charOffset, Uri fileUri);

Combinator.show(Iterable<String> names, int charOffset, Uri fileUri)
CombinatorBuilder.show(Iterable<String> names, int charOffset, Uri fileUri)
: this(true, new Set<String>.from(names), charOffset, fileUri);

Combinator.hide(Iterable<String> names, int charOffset, Uri fileUri)
CombinatorBuilder.hide(Iterable<String> names, int charOffset, Uri fileUri)
: this(false, new Set<String>.from(names), charOffset, fileUri);

bool get isHide => !isShow;
Expand Down
2 changes: 1 addition & 1 deletion pkg/front_end/lib/src/fasta/dill/dill_member_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import '../builder/library_builder.dart';
import '../kernel/class_hierarchy_builder.dart'
show ClassHierarchyBuilder, ClassMember;
import '../kernel/member_covariance.dart';
import '../kernel/kernel_builder.dart'
import '../kernel/utils.dart'
show isRedirectingGenerativeConstructorImplementation;

import '../modifier.dart'
Expand Down
6 changes: 3 additions & 3 deletions pkg/front_end/lib/src/fasta/export.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ library fasta.export;
import 'builder/builder.dart';
import 'builder/library_builder.dart';

import 'combinator.dart' show Combinator;
import 'combinator.dart' show CombinatorBuilder;
import 'fasta_codes.dart';

class Export {
Expand All @@ -17,7 +17,7 @@ class Export {
/// The library being exported.
LibraryBuilder exported;

final List<Combinator>? combinators;
final List<CombinatorBuilder>? combinators;

final int charOffset;

Expand All @@ -27,7 +27,7 @@ class Export {

bool addToExportScope(String name, Builder member) {
if (combinators != null) {
for (Combinator combinator in combinators!) {
for (CombinatorBuilder combinator in combinators!) {
if (combinator.isShow && !combinator.names.contains(name)) return false;
if (combinator.isHide && combinator.names.contains(name)) return false;
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/front_end/lib/src/fasta/import.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import 'builder/builder.dart';
import 'builder/library_builder.dart';
import 'builder/prefix_builder.dart';

import 'kernel/kernel_builder.dart' show toKernelCombinators;
import 'kernel/utils.dart' show toKernelCombinators;

import 'combinator.dart' show Combinator;
import 'combinator.dart' show CombinatorBuilder;

import 'configuration.dart' show Configuration;

Expand All @@ -31,7 +31,7 @@ class Import {

final String? prefix;

final List<Combinator>? combinators;
final List<CombinatorBuilder>? combinators;

final List<Configuration>? configurations;

Expand Down Expand Up @@ -73,7 +73,7 @@ class Import {
}
imported!.exportScope.forEach((String name, Builder member) {
if (combinators != null) {
for (Combinator combinator in combinators!) {
for (CombinatorBuilder combinator in combinators!) {
if (combinator.isShow && !combinator.names.contains(name)) return;
if (combinator.isHide && combinator.names.contains(name)) return;
}
Expand All @@ -94,7 +94,7 @@ PrefixBuilder? createPrefixBuilder(
String? prefix,
SourceLibraryBuilder importer,
LibraryBuilder? imported,
List<Combinator>? combinators,
List<CombinatorBuilder>? combinators,
bool deferred,
int charOffset,
int prefixCharOffset,
Expand Down
16 changes: 8 additions & 8 deletions pkg/front_end/lib/src/fasta/incremental_compiler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ import 'builder/type_declaration_builder.dart' show TypeDeclarationBuilder;

import 'builder_graph.dart' show BuilderGraph;

import 'combinator.dart' show Combinator;
import 'combinator.dart' show CombinatorBuilder;

import 'compiler_context.dart' show CompilerContext;

Expand Down Expand Up @@ -123,7 +123,7 @@ import 'util/textual_outline.dart' show textualOutline;

import 'hybrid_file_system.dart' show HybridFileSystem;

import 'kernel/kernel_builder.dart' show ClassHierarchyBuilder;
import 'kernel/class_hierarchy_builder.dart' show ClassHierarchyBuilder;

import 'kernel/internal_ast.dart' show VariableDeclarationImpl;

Expand Down Expand Up @@ -2007,16 +2007,16 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
in libraryBuilder.library.dependencies) {
if (!dependency.isImport) continue;

List<Combinator>? combinators;
List<CombinatorBuilder>? combinators;

for (kernel.Combinator combinator in dependency.combinators) {
combinators ??= <Combinator>[];
combinators ??= <CombinatorBuilder>[];

combinators.add(combinator.isShow
? new Combinator.show(combinator.names, combinator.fileOffset,
libraryBuilder.fileUri)
: new Combinator.hide(combinator.names, combinator.fileOffset,
libraryBuilder.fileUri));
? new CombinatorBuilder.show(combinator.names,
combinator.fileOffset, libraryBuilder.fileUri)
: new CombinatorBuilder.hide(combinator.names,
combinator.fileOffset, libraryBuilder.fileUri));
}

debugLibrary.addImport(
Expand Down
43 changes: 13 additions & 30 deletions pkg/front_end/lib/src/fasta/kernel/body_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import 'package:_fe_analyzer_shared/src/parser/quote.dart'
unescapeFirstStringPart,
unescapeLastStringPart,
unescapeString;

import 'package:_fe_analyzer_shared/src/parser/stack_listener.dart'
show FixedNullableList, GrowableList, NullValue, ParserRecovery;
import 'package:_fe_analyzer_shared/src/parser/value_kind.dart';

import 'package:_fe_analyzer_shared/src/scanner/scanner.dart' show Token;
Expand All @@ -39,6 +40,12 @@ import 'package:_fe_analyzer_shared/src/scanner/token_impl.dart'
import 'package:_fe_analyzer_shared/src/util/link.dart';

import 'package:kernel/ast.dart';
import 'package:kernel/class_hierarchy.dart';
import 'package:kernel/clone.dart';
import 'package:kernel/core_types.dart';
import 'package:kernel/src/bounds_checks.dart' hide calculateBounds;
import 'package:kernel/transformations/flags.dart';
import 'package:kernel/type_algebra.dart';
import 'package:kernel/type_environment.dart';

import '../builder/builder.dart';
Expand Down Expand Up @@ -101,59 +108,35 @@ import '../problems.dart'
import '../scope.dart';

import '../source/diet_parser.dart';

import '../source/scope_listener.dart'
show
FixedNullableList,
GrowableList,
JumpTargetKind,
NullValue,
ParserRecovery,
ScopeListener;

import '../source/scope_listener.dart' show JumpTargetKind, ScopeListener;
import '../source/source_library_builder.dart' show SourceLibraryBuilder;

import '../source/stack_listener_impl.dart' show offsetForToken;

import '../source/value_kinds.dart';

import '../type_inference/type_inferrer.dart'
show TypeInferrer, InferredFunctionBody;

import '../type_inference/type_schema.dart' show UnknownType;

import '../util/helpers.dart' show DelayedActionPerformer;

import 'collections.dart';

import 'constness.dart' show Constness;

import 'constructor_tearoff_lowering.dart';

import 'expression_generator.dart';

import 'expression_generator_helper.dart';

import 'forest.dart' show Forest;

import 'implicit_type_argument.dart' show ImplicitTypeArgument;

import 'internal_ast.dart';
import 'kernel_variable_builder.dart';
import 'load_library_builder.dart';
import 'redirecting_factory_body.dart'
show
RedirectingFactoryBody,
RedirectionTarget,
getRedirectingFactoryBody,
getRedirectionTarget;

import 'type_algorithms.dart' show calculateBounds;

import 'kernel_api.dart';

import 'kernel_ast_api.dart';

import 'internal_ast.dart';

import 'kernel_builder.dart';
import 'utils.dart';

// TODO(ahe): Remove this and ensure all nodes have a location.
const int noLocation = TreeNode.noOffset;
Expand Down
7 changes: 4 additions & 3 deletions pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:_fe_analyzer_shared/src/parser/parser.dart'
import 'package:_fe_analyzer_shared/src/scanner/token.dart' show Token;

import 'package:kernel/ast.dart';
import 'package:kernel/text/ast_to_text.dart';
import 'package:kernel/type_algebra.dart';

import '../builder/builder.dart';
Expand Down Expand Up @@ -67,11 +68,11 @@ import 'expression_generator_helper.dart';

import 'forest.dart';

import 'kernel_api.dart' show NameSystem, printNodeOn, printQualifiedNameOn;
import 'internal_ast.dart';

import 'kernel_builder.dart' show LoadLibraryBuilder;
import 'load_library_builder.dart';

import 'internal_ast.dart';
import 'utils.dart';

/// A generator represents a subexpression for which we can't yet build an
/// expression because we don't yet know the context in which it's used.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
library fasta.expression_generator_helper;

import 'package:_fe_analyzer_shared/src/scanner/token.dart' show Token;
import 'package:kernel/ast.dart';
import 'package:kernel/type_algebra.dart';
import 'package:kernel/type_environment.dart';

Expand All @@ -24,25 +25,6 @@ import '../type_inference/inference_helper.dart' show InferenceHelper;
import 'constness.dart' show Constness;
import 'forest.dart' show Forest;
import 'internal_ast.dart';
import 'kernel_ast_api.dart'
show
Arguments,
Constructor,
DartType,
Expression,
FunctionNode,
Initializer,
InterfaceType,
Library,
Member,
Name,
Procedure,
StaticGet,
TreeNode,
TypeParameter,
TypeParameterType,
Typedef,
VariableDeclaration;

/// Alias for Expression | Generator
typedef Expression_Generator = dynamic;
Expand Down
Loading

0 comments on commit 3fd4283

Please sign in to comment.