mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +00:00
Remove pkg/front_end's remaining dependencies on pkg/analyzer.
The remaining dependencies were in code that isn't being used anymore, so I just removed the dead code. R=danrubel@google.com, sigmund@google.com Review-Url: https://codereview.chromium.org/2941083002 .
This commit is contained in:
parent
058c29f0a5
commit
da3d611aaf
6 changed files with 3 additions and 529 deletions
|
@ -1,61 +0,0 @@
|
|||
// Copyright (c) 2016, 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.
|
||||
|
||||
/// Defines a front-end API for converting source code to resolved ASTs.
|
||||
///
|
||||
/// Note: this entire library is deprecated. It is provided as a migration path
|
||||
/// until dev_compiler supports Dart Kernel. Once dev_compiler has been
|
||||
/// converted to use Dart Kernel, this functionality will be removed.
|
||||
@deprecated
|
||||
library front_end.resolved_ast_generator;
|
||||
|
||||
import 'dart:async';
|
||||
import 'compiler_options.dart';
|
||||
import 'package:analyzer/dart/ast/ast.dart' show CompilationUnit;
|
||||
import 'package:analyzer/dart/element/element.dart' show LibraryElement;
|
||||
|
||||
/// Processes the build unit whose source files are in [sources].
|
||||
///
|
||||
/// Intended for modular compilation.
|
||||
///
|
||||
/// [sources] should be the complete set of source files for a build unit
|
||||
/// (including both library and part files). All of the library files are
|
||||
/// compiled to resolved ASTs.
|
||||
///
|
||||
/// The compilation process is hermetic, meaning that the only files which will
|
||||
/// be read are those listed in [sources], [CompilerOptions.inputSummaries], and
|
||||
/// [CompilerOptions.sdkSummary]. If a source file attempts to refer to a file
|
||||
/// which is not obtainable from these paths, that will result in an error, even
|
||||
/// if the file exists on the filesystem.
|
||||
///
|
||||
/// Any `part` declarations found in [sources] must refer to part files which
|
||||
/// are also listed in [sources], otherwise an error results. (It is not
|
||||
/// permitted to refer to a part file declared in another build unit).
|
||||
@deprecated
|
||||
Future<ResolvedAsts> resolvedAstsFor(
|
||||
List<Uri> sources, CompilerOptions options) =>
|
||||
throw new UnimplementedError();
|
||||
|
||||
/// Representation of the resolved ASTs of a build unit.
|
||||
///
|
||||
/// Not intended to be implemented or extended by clients.
|
||||
@deprecated
|
||||
abstract class ResolvedAsts {
|
||||
/// The resolved ASTs of the build unit's source libraries.
|
||||
///
|
||||
/// There is one sub-list per source library; each sub-list consists of the
|
||||
/// resolved AST for the library's defining compilation unit, followed by the
|
||||
/// resolved ASTs for any of the library's part files.
|
||||
List<List<CompilationUnit>> get compilationUnits;
|
||||
|
||||
/// Given a [LibraryElement] referred to by [compilationUnits], determine the
|
||||
/// path to the summary that the library originated from. If the
|
||||
/// [LibraryElement] did not originate from a summary (i.e. because it
|
||||
/// originated from one of the source files of *this* build unit), return
|
||||
/// `null`.
|
||||
///
|
||||
/// This can be used by the client to determine which build unit any
|
||||
/// referenced element originated from.
|
||||
String getOriginatingSummary(LibraryElement element);
|
||||
}
|
|
@ -1,201 +0,0 @@
|
|||
import 'package:analyzer/src/summary/idl.dart';
|
||||
import 'package:front_end/src/base/library_info.dart';
|
||||
|
||||
/// Decodes the contents of the SDK's "libraries.dart" file.
|
||||
///
|
||||
/// Caller should pass in the unlinked summary of the libraries.dart file. This
|
||||
/// function will materialize the "libraries" constant based on information in
|
||||
/// the summary.
|
||||
///
|
||||
/// Note that this code is not intended to be fully general; it makes some
|
||||
/// assumptions about the structure of the "libraries.dart" file (such as what
|
||||
/// declarations are expected to be present in it, and the types of those
|
||||
/// declarations).
|
||||
Map<String, LibraryInfo> readLibraries(UnlinkedUnit librariesUnit) {
|
||||
var constContext = new _ConstContext(librariesUnit.references);
|
||||
for (var variable in librariesUnit.variables) {
|
||||
if (!variable.isConst) continue;
|
||||
constContext.topLevelConstants[variable.name] =
|
||||
new _ConstVariable(variable.initializer.bodyExpr, constContext);
|
||||
}
|
||||
for (var cls in librariesUnit.classes) {
|
||||
if (cls.name == 'Maturity') {
|
||||
for (var field in cls.fields) {
|
||||
if (!field.isConst) continue;
|
||||
constContext.maturityConstants[field.name] =
|
||||
new _ConstVariable(field.initializer.bodyExpr, constContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
return constContext.topLevelConstants['libraries'].value;
|
||||
}
|
||||
|
||||
/// Function type used to invoke a constructor based on dynamic information.
|
||||
///
|
||||
/// Caller supplies two callbacks ([positional] and [named]) which can be used
|
||||
/// to query the arguments passed to the constructor. These callbacks will
|
||||
/// return the requested argument if it was provided; otherwise they will return
|
||||
/// the supplied default value.
|
||||
typedef dynamic _Constructor(dynamic positional(int i, [dynamic defaultValue]),
|
||||
dynamic named(String name, [dynamic defaultValue]));
|
||||
|
||||
/// Contextual information used to evaluate constants in the "libraries.dart"
|
||||
/// file.
|
||||
class _ConstContext {
|
||||
/// Top level constants in the "libraries.dart" file.
|
||||
final topLevelConstants = <String, _ConstVariable>{};
|
||||
|
||||
/// Static constants in "libraries.dart"'s "Maturity" class.
|
||||
final maturityConstants = <String, _ConstVariable>{};
|
||||
|
||||
/// References from the unlinked summary of the "libraries.dart" file.
|
||||
final List<UnlinkedReference> references;
|
||||
|
||||
_ConstContext(this.references);
|
||||
}
|
||||
|
||||
/// Information necessary to evaluate a single constant from the
|
||||
/// "libraries.dart" file.
|
||||
class _ConstVariable {
|
||||
/// The constant expression from the unlinked summary.
|
||||
final UnlinkedExpr expr;
|
||||
|
||||
/// Contextual information necessary to evaluate the constant.
|
||||
final _ConstContext context;
|
||||
|
||||
/// The evaluated value, or `null` if it hasn't been evaluated yet.
|
||||
dynamic _value;
|
||||
|
||||
_ConstVariable(this.expr, this.context);
|
||||
|
||||
/// Evaluate the constant (if necessary) and return it.
|
||||
dynamic get value => _value ??= _materialize();
|
||||
|
||||
/// Find the constructor referred to by [entityRef] and return a function
|
||||
/// which may be used to invoke it.
|
||||
_Constructor _findConstructor(EntityRef entityRef) {
|
||||
// This method is not fully general; we only support the constructor
|
||||
// invocations that we expect to find in LibraryInfo.
|
||||
assert(entityRef.implicitFunctionTypeIndices.isEmpty);
|
||||
assert(entityRef.paramReference == 0);
|
||||
assert(entityRef.syntheticParams.isEmpty);
|
||||
assert(entityRef.syntheticReturnType == null);
|
||||
assert(entityRef.typeArguments.isEmpty);
|
||||
var reference = context.references[entityRef.reference];
|
||||
assert(reference.prefixReference == 0);
|
||||
switch (reference.name) {
|
||||
case 'LibraryInfo':
|
||||
return (dynamic positional(int i, [dynamic defaultValue]),
|
||||
dynamic named(String name, [dynamic defaultValue])) =>
|
||||
new LibraryInfo(positional(0),
|
||||
categories: named('categories', ''),
|
||||
dart2jsPath: named('dart2jsPath'),
|
||||
dart2jsPatchPath: named('dart2jsPatchPath'),
|
||||
implementation: named('implementation', false),
|
||||
documented: named('documented', true),
|
||||
maturity: named('maturity', Maturity.UNSPECIFIED),
|
||||
platforms: named('platforms', DART2JS_PLATFORM | VM_PLATFORM));
|
||||
case 'Maturity':
|
||||
return (dynamic positional(int i, [dynamic defaultValue]),
|
||||
dynamic named(String name, [dynamic defaultValue])) =>
|
||||
new Maturity(positional(0), positional(1), positional(2));
|
||||
default:
|
||||
throw new UnimplementedError(
|
||||
'Unexpected constructor reference: ${reference.name}');
|
||||
}
|
||||
}
|
||||
|
||||
/// Compute the value referred to by [entityRef].
|
||||
dynamic _findReference(EntityRef entityRef) {
|
||||
// This method is not fully general; we only support the references that we
|
||||
// expect to find in LibraryInfo.
|
||||
assert(entityRef.implicitFunctionTypeIndices.isEmpty);
|
||||
assert(entityRef.paramReference == 0);
|
||||
assert(entityRef.syntheticParams.isEmpty);
|
||||
assert(entityRef.syntheticReturnType == null);
|
||||
assert(entityRef.typeArguments.isEmpty);
|
||||
var reference = context.references[entityRef.reference];
|
||||
if (reference.prefixReference == 0) {
|
||||
return context.topLevelConstants[reference.name].value;
|
||||
} else {
|
||||
assert(reference.prefixReference != 0);
|
||||
var prefixReference = context.references[reference.prefixReference];
|
||||
assert(prefixReference.name == 'Maturity');
|
||||
assert(prefixReference.prefixReference == 0);
|
||||
return context.maturityConstants[reference.name].value;
|
||||
}
|
||||
}
|
||||
|
||||
/// Compute the value of the constant.
|
||||
dynamic _materialize() {
|
||||
var stack = [];
|
||||
var stringIndex = 0;
|
||||
var intIndex = 0;
|
||||
var referenceIndex = 0;
|
||||
List popItems(int count) {
|
||||
var items = stack.sublist(stack.length - count, stack.length);
|
||||
stack.length -= count;
|
||||
return items;
|
||||
}
|
||||
|
||||
for (var operation in expr.operations) {
|
||||
switch (operation) {
|
||||
case UnlinkedExprOperation.pushString:
|
||||
stack.add(expr.strings[stringIndex++]);
|
||||
break;
|
||||
case UnlinkedExprOperation.invokeConstructor:
|
||||
var namedArgumentList = popItems(expr.ints[intIndex++]);
|
||||
var namedArguments = <String, dynamic>{};
|
||||
for (var namedArgument in namedArgumentList) {
|
||||
namedArguments[expr.strings[stringIndex++]] = namedArgument;
|
||||
}
|
||||
var positionalArguments = popItems(expr.ints[intIndex++]);
|
||||
stack.add(_findConstructor(expr.references[referenceIndex++])(
|
||||
(i, [defaultValue]) => i < positionalArguments.length
|
||||
? positionalArguments[i]
|
||||
: defaultValue,
|
||||
(name, [defaultValue]) => namedArguments.containsKey(name)
|
||||
? namedArguments[name]
|
||||
: defaultValue));
|
||||
break;
|
||||
case UnlinkedExprOperation.makeUntypedMap:
|
||||
var map = {};
|
||||
var numKeyValuePairs = expr.ints[intIndex++];
|
||||
var keyValueList = popItems(numKeyValuePairs * 2);
|
||||
for (var i = 0; i < numKeyValuePairs; i++) {
|
||||
map[keyValueList[2 * i]] = keyValueList[2 * i + 1];
|
||||
}
|
||||
stack.add(map);
|
||||
break;
|
||||
case UnlinkedExprOperation.pushReference:
|
||||
stack.add(_findReference(expr.references[referenceIndex++]));
|
||||
break;
|
||||
case UnlinkedExprOperation.pushInt:
|
||||
stack.add(expr.ints[intIndex++]);
|
||||
break;
|
||||
case UnlinkedExprOperation.pushFalse:
|
||||
stack.add(false);
|
||||
break;
|
||||
case UnlinkedExprOperation.pushTrue:
|
||||
stack.add(true);
|
||||
break;
|
||||
case UnlinkedExprOperation.bitOr:
|
||||
var y = stack.removeLast();
|
||||
var x = stack.removeLast();
|
||||
stack.add(x | y);
|
||||
break;
|
||||
default:
|
||||
throw new UnimplementedError(
|
||||
'Unexpected expression in libraries.dart: $operation');
|
||||
}
|
||||
}
|
||||
assert(stringIndex == expr.strings.length);
|
||||
assert(intIndex == expr.ints.length);
|
||||
assert(referenceIndex == expr.references.length);
|
||||
assert(stack.length == 1);
|
||||
if (stack[0] == null) {
|
||||
throw new StateError('Unexpected null constant in libraries.dart');
|
||||
}
|
||||
return stack[0];
|
||||
}
|
||||
}
|
|
@ -6,7 +6,6 @@ homepage: https://github.com/dart-lang/sdk/tree/master/pkg/front_end
|
|||
environment:
|
||||
sdk: '>=1.12.0 <2.0.0'
|
||||
dependencies:
|
||||
analyzer: ^0.30.0
|
||||
kernel: 0.3.0-alpha.1
|
||||
path: '^1.3.9'
|
||||
source_span: '^1.2.3'
|
||||
|
|
|
@ -1,239 +0,0 @@
|
|||
// Copyright (c) 2016, 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/error/listener.dart';
|
||||
import 'package:analyzer/src/generated/parser.dart';
|
||||
import 'package:analyzer/src/summary/summarize_ast.dart';
|
||||
import 'package:front_end/src/base/library_info.dart';
|
||||
import 'package:front_end/src/libraries_reader.dart';
|
||||
import 'package:front_end/src/scanner/errors.dart';
|
||||
import 'package:front_end/src/scanner/reader.dart';
|
||||
import 'package:front_end/src/scanner/scanner.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
main() {
|
||||
defineReflectiveSuite(() {
|
||||
defineReflectiveTests(LibrariesReaderTest);
|
||||
});
|
||||
}
|
||||
|
||||
/// Generic URI resolver tests which do not depend on the particular path
|
||||
/// context in use.
|
||||
@reflectiveTest
|
||||
class LibrariesReaderTest {
|
||||
test_categoriesClient() {
|
||||
var info =
|
||||
_computeSingleInfo('const LibraryInfo("", categories: "Client")');
|
||||
expect(info.categories, [Category.client]);
|
||||
expect(info.categoriesString, 'Client');
|
||||
}
|
||||
|
||||
test_categoriesDefault() {
|
||||
var info = _computeSingleInfo('const LibraryInfo("")');
|
||||
expect(info.categories, isEmpty);
|
||||
expect(info.categoriesString, '');
|
||||
}
|
||||
|
||||
test_categoriesMultiple() {
|
||||
var info = _computeSingleInfo(
|
||||
'const LibraryInfo("", categories: "Client,Server")');
|
||||
expect(
|
||||
info.categories, unorderedEquals([Category.client, Category.server]));
|
||||
expect(info.categoriesString, 'Client,Server');
|
||||
}
|
||||
|
||||
test_categoriesNone() {
|
||||
var info = _computeSingleInfo('const LibraryInfo("", categories: "")');
|
||||
expect(info.categories, isEmpty);
|
||||
expect(info.categoriesString, '');
|
||||
}
|
||||
|
||||
test_categoriesSingle() {
|
||||
var info =
|
||||
_computeSingleInfo('const LibraryInfo("", categories: "Client")');
|
||||
expect(info.categories, [Category.client]);
|
||||
expect(info.categoriesString, 'Client');
|
||||
}
|
||||
|
||||
test_complex() {
|
||||
var info = _computeSingleInfo(
|
||||
'''
|
||||
const LibraryInfo(
|
||||
"async/async.dart",
|
||||
categories: "Client,Server",
|
||||
maturity: Maturity.STABLE,
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart"))
|
||||
''',
|
||||
additionalDeclarations: '''
|
||||
class Maturity {
|
||||
final int level;
|
||||
final String name;
|
||||
final String description;
|
||||
|
||||
const Maturity(this.level, this.name, this.description);
|
||||
|
||||
static const Maturity STABLE = const Maturity(4, "Stable", "Stable description");
|
||||
}
|
||||
''');
|
||||
expect(info.path, 'async/async.dart');
|
||||
expect(
|
||||
info.categories, unorderedEquals([Category.client, Category.server]));
|
||||
expect(info.maturity.name, 'Stable');
|
||||
expect(info.dart2jsPatchPath, '_internal/js_runtime/lib/async_patch.dart');
|
||||
}
|
||||
|
||||
test_dart2jsPatchPathDefault() {
|
||||
var info = _computeSingleInfo('const LibraryInfo("")');
|
||||
expect(info.dart2jsPatchPath, null);
|
||||
}
|
||||
|
||||
test_dart2jsPatchPathString() {
|
||||
var info = _computeSingleInfo('''
|
||||
const LibraryInfo(
|
||||
"",
|
||||
dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart")
|
||||
''');
|
||||
expect(info.dart2jsPatchPath, '_internal/js_runtime/lib/async_patch.dart');
|
||||
}
|
||||
|
||||
test_dart2jsPathDefault() {
|
||||
var info = _computeSingleInfo('const LibraryInfo("")');
|
||||
expect(info.dart2jsPath, null);
|
||||
}
|
||||
|
||||
test_dart2jsPathString() {
|
||||
var info = _computeSingleInfo(
|
||||
'const LibraryInfo("", dart2jsPath: "html/dart2js/html_dart2js.dart"');
|
||||
expect(info.dart2jsPath, 'html/dart2js/html_dart2js.dart');
|
||||
}
|
||||
|
||||
test_documentedDefault() {
|
||||
var info = _computeSingleInfo('const LibraryInfo("")');
|
||||
expect(info.documented, true);
|
||||
}
|
||||
|
||||
test_documentedFalse() {
|
||||
var info = _computeSingleInfo('const LibraryInfo("", documented: false)');
|
||||
expect(info.documented, false);
|
||||
}
|
||||
|
||||
test_documentedTrue() {
|
||||
var info = _computeSingleInfo('const LibraryInfo("", documented: true)');
|
||||
expect(info.documented, true);
|
||||
}
|
||||
|
||||
test_implementationDefault() {
|
||||
var info = _computeSingleInfo('const LibraryInfo("")');
|
||||
expect(info.implementation, false);
|
||||
}
|
||||
|
||||
test_implementationFalse() {
|
||||
var info =
|
||||
_computeSingleInfo('const LibraryInfo("", implementation: false)');
|
||||
expect(info.implementation, false);
|
||||
}
|
||||
|
||||
test_implementationTrue() {
|
||||
var info =
|
||||
_computeSingleInfo('const LibraryInfo("", implementation: true)');
|
||||
expect(info.implementation, true);
|
||||
}
|
||||
|
||||
test_maturityDefault() {
|
||||
var info = _computeSingleInfo('const LibraryInfo("")');
|
||||
expect(info.maturity, Maturity.UNSPECIFIED);
|
||||
}
|
||||
|
||||
test_maturityStable() {
|
||||
var info =
|
||||
_computeSingleInfo('const LibraryInfo("", maturity: Maturity.FOO)',
|
||||
additionalDeclarations: '''
|
||||
class Maturity {
|
||||
final int level;
|
||||
final String name;
|
||||
final String description;
|
||||
|
||||
const Maturity(this.level, this.name, this.description);
|
||||
|
||||
static const Maturity FOO = const Maturity(10, "Foo", "Foo description");
|
||||
}
|
||||
''');
|
||||
expect(info.maturity.level, 10);
|
||||
expect(info.maturity.name, 'Foo');
|
||||
expect(info.maturity.description, 'Foo description');
|
||||
}
|
||||
|
||||
test_multipleLibraries() {
|
||||
var info = _computeLibraries('''
|
||||
const Map<String, LibraryInfo> libraries = const {
|
||||
"async": const LibraryInfo("async/async.dart"),
|
||||
"core": const LibraryInfo("core/core.dart")
|
||||
}
|
||||
''');
|
||||
expect(info.keys, unorderedEquals(['async', 'core']));
|
||||
expect(info['async'].path, 'async/async.dart');
|
||||
expect(info['core'].path, 'core/core.dart');
|
||||
}
|
||||
|
||||
test_path() {
|
||||
var info = _computeSingleInfo('const LibraryInfo("core/core.dart")');
|
||||
expect(info.path, 'core/core.dart');
|
||||
}
|
||||
|
||||
test_platformsDefault() {
|
||||
var info = _computeSingleInfo('const LibraryInfo("")');
|
||||
expect(info.platforms, DART2JS_PLATFORM | VM_PLATFORM);
|
||||
}
|
||||
|
||||
test_platformsMultiple() {
|
||||
var info = _computeSingleInfo(
|
||||
'const LibraryInfo("", platforms: VM_PLATFORM | DART2JS_PLATFORM)',
|
||||
additionalDeclarations: '''
|
||||
const int DART2JS_PLATFORM = 1;
|
||||
const int VM_PLATFORM = 2;
|
||||
''');
|
||||
expect(info.platforms, 1 | 2);
|
||||
}
|
||||
|
||||
test_platformsSingle() {
|
||||
var info =
|
||||
_computeSingleInfo('const LibraryInfo("", platforms: VM_PLATFORM)',
|
||||
additionalDeclarations: '''
|
||||
const int VM_PLATFORM = 2;
|
||||
''');
|
||||
expect(info.platforms, 2);
|
||||
}
|
||||
|
||||
Map<String, LibraryInfo> _computeLibraries(String text,
|
||||
{String additionalDeclarations: ''}) {
|
||||
var fullText = '$text\n$additionalDeclarations';
|
||||
var scanner = new _Scanner(fullText);
|
||||
var token = scanner.tokenize();
|
||||
var parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER);
|
||||
var compilationUnit = parser.parseCompilationUnit(token);
|
||||
var unlinkedUnit = serializeAstUnlinked(compilationUnit);
|
||||
return readLibraries(unlinkedUnit);
|
||||
}
|
||||
|
||||
LibraryInfo _computeSingleInfo(String text,
|
||||
{String additionalDeclarations: ''}) {
|
||||
var libraries = _computeLibraries(
|
||||
'const Map<String, LibraryInfo> libraries = const { "x": $text };',
|
||||
additionalDeclarations: additionalDeclarations);
|
||||
return libraries['x'];
|
||||
}
|
||||
}
|
||||
|
||||
class _Scanner extends Scanner {
|
||||
_Scanner(String contents) : super.create(new CharSequenceReader(contents)) {
|
||||
preserveComments = false;
|
||||
}
|
||||
|
||||
@override
|
||||
void reportError(
|
||||
ScannerErrorCode errorCode, int offset, List<Object> arguments) {
|
||||
fail('Unexpected error($errorCode, $offset, $arguments)');
|
||||
}
|
||||
}
|
|
@ -7,7 +7,6 @@ import 'package:test_reflective_loader/test_reflective_loader.dart';
|
|||
import 'api_signature_test.dart' as api_signature;
|
||||
import 'file_repository_test.dart' as file_repository;
|
||||
import 'flat_buffers_test.dart' as flat_buffers;
|
||||
import 'libraries_reader_test.dart' as libraries_reader;
|
||||
import 'processed_options_test.dart' as processed_options;
|
||||
import 'uri_resolver_test.dart' as uri_resolver;
|
||||
|
||||
|
@ -17,7 +16,6 @@ main() {
|
|||
api_signature.main();
|
||||
file_repository.main();
|
||||
flat_buffers.main();
|
||||
libraries_reader.main();
|
||||
processed_options.main();
|
||||
uri_resolver.main();
|
||||
}, name: 'incremental');
|
||||
|
|
|
@ -17,10 +17,7 @@ main() async {
|
|||
///
|
||||
/// Note that this script only checks files in pkg/front_end/lib, so this list
|
||||
/// excludes dev dependencies.
|
||||
///
|
||||
/// TODO(paulberry): remove dependencies on analyzer.
|
||||
final allowedPackageDependencies = [
|
||||
'analyzer',
|
||||
'charcode',
|
||||
'convert',
|
||||
'crypto',
|
||||
|
@ -40,9 +37,8 @@ final allowedPackageDependencies = [
|
|||
///
|
||||
/// TODO(paulberry): stuff in lib/src shouldn't depend on lib; lib should just
|
||||
/// re-export stuff in lib/src.
|
||||
/// TODO(paulberry): remove dependencies on analyzer.
|
||||
final subpackageRules = {
|
||||
'lib': new SubpackageRules(mayImportAnalyzer: true, allowedDependencies: [
|
||||
'lib': new SubpackageRules(allowedDependencies: [
|
||||
'lib/src',
|
||||
'lib/src/base',
|
||||
'lib/src/fasta',
|
||||
|
@ -50,7 +46,7 @@ final subpackageRules = {
|
|||
'lib/src/fasta/kernel',
|
||||
'lib/src/incremental'
|
||||
]),
|
||||
'lib/src': new SubpackageRules(mayImportAnalyzer: true, allowedDependencies: [
|
||||
'lib/src': new SubpackageRules(allowedDependencies: [
|
||||
'lib',
|
||||
'lib/src/base',
|
||||
'lib/src/fasta',
|
||||
|
@ -162,9 +158,6 @@ final subpackageRules = {
|
|||
|
||||
/// Rules for what a subpackage may depend directly on.
|
||||
class SubpackageRules {
|
||||
/// Indicates whether the subpackage may directly depend on analyzer.
|
||||
final bool mayImportAnalyzer;
|
||||
|
||||
/// Indicates whether dart files may exist in subdirectories of this
|
||||
/// subpackage.
|
||||
///
|
||||
|
@ -178,16 +171,12 @@ class SubpackageRules {
|
|||
|
||||
var actuallyContainsFiles = false;
|
||||
|
||||
var actuallyImportsAnalyzer = false;
|
||||
|
||||
var actuallyHasSubdirs = false;
|
||||
|
||||
var actualDependencies = new Set<String>();
|
||||
|
||||
SubpackageRules(
|
||||
{this.mayImportAnalyzer: false,
|
||||
this.allowSubdirs: false,
|
||||
this.allowedDependencies: const []});
|
||||
{this.allowSubdirs: false, this.allowedDependencies: const []});
|
||||
}
|
||||
|
||||
class _SubpackageRelationshipsTest {
|
||||
|
@ -228,14 +217,6 @@ class _SubpackageRelationshipsTest {
|
|||
return;
|
||||
}
|
||||
srcSubpackageRules.actuallyContainsFiles = true;
|
||||
if (dst.pathSegments[0] == 'analyzer') {
|
||||
if (srcSubpackageRules.mayImportAnalyzer) {
|
||||
srcSubpackageRules.actuallyImportsAnalyzer = true;
|
||||
} else {
|
||||
problem('$src depends on $dst, but subpackage "$srcSubpackage" may not '
|
||||
'import analyzer');
|
||||
}
|
||||
}
|
||||
var dstSubPackage = subpackageForUri(dst);
|
||||
if (dstSubPackage == null) return;
|
||||
if (dstSubPackage == srcSubpackage) return;
|
||||
|
@ -296,9 +277,6 @@ class _SubpackageRelationshipsTest {
|
|||
if (!rule.actuallyContainsFiles) {
|
||||
problem("$subpackage contains no files");
|
||||
}
|
||||
if (rule.mayImportAnalyzer && !rule.actuallyImportsAnalyzer) {
|
||||
problem("$subpackage is allowed to import analyzer, but doesn't");
|
||||
}
|
||||
if (rule.allowSubdirs && !rule.actuallyHasSubdirs) {
|
||||
problem("$subpackage is allowed to have subdirectories, but doesn't");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue