Avoid InconsistentAnalysisException in preprocess builder

This commit is contained in:
Simon Binder 2021-01-14 23:23:34 +01:00
parent 43f90b6a43
commit 4575287ba4
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
1 changed files with 1 additions and 4 deletions

View File

@ -102,16 +102,13 @@ class PreprocessBuilder extends Builder {
// we can now resolve the library we just wrote
final createdLibrary = await buildStep.resolver.libraryFor(tempDartAsset);
final resolveResult = await createdLibrary.session
.getResolvedLibraryByElement(createdLibrary);
final serializer = TypeSerializer(buildStep.resolver);
final codeToType = <String, SerializedType>{};
for (var i = 0; i < dartLexemes.length; i++) {
final member =
_findVariableDefinition(_nameForDartExpr(i), createdLibrary);
final node = resolveResult.getElementDeclaration(member).node
final node = await buildStep.resolver.astNodeFor(member, resolve: true)
as VariableDeclaration;
final type = node.initializer.staticType;