Get workspace from AnalysisSession in AbstractLinterContextTest.

R=brianwilkerson@google.com, pquitslund@google.com

Change-Id: I46eb8b0cd0193f048e95d921bd555dd22132d271
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199322
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2021-05-11 18:50:15 +00:00 committed by commit-bot@chromium.org
parent da4ff4e9a6
commit ad895e20d2

View file

@ -2,7 +2,6 @@
// 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/src/context/builder.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
import 'package:analyzer/src/dart/element/type_system.dart';
@ -31,13 +30,10 @@ abstract class AbstractLinterContextTest extends PubPackageResolutionTest {
await resolveTestCode(content);
var contextUnit = LinterContextUnit(result.content!, result.unit!);
final libraryPath = result.libraryElement.source.fullName;
// todo (pq): get workspace from analysis context
final workspace = ContextBuilder.createWorkspace(
resourceProvider: resourceProvider,
options: ContextBuilderOptions(),
rootPath: libraryPath,
);
final libraryElement = result.libraryElement;
final analysisContext = libraryElement.session.analysisContext;
final libraryPath = libraryElement.source.fullName;
final workspace = analysisContext.contextRoot.workspace;
final workspacePackage = workspace.findPackageFor(libraryPath);
context = LinterContextImpl(