Closed natebosch closed 5 years ago
cc @scheglov
It looks like the (deprecated) element
getter on ClassDeclaration
is now returning null when using the task model analyzer version 0.33.3
. Is this a known regression?
NoSuchMethodError: The getter 'supertype' was called on null.
Receiver: null
Tried calling: supertype
#0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
#1 poExtendsAnotherPo (package:pageloader/src/generators/pageobject_generator.dart:264:34)
#2 PageObjectGenerator._generateClass (package:pageloader/src/generators/pageobject_generator.dart:81:9)
#3 PageObjectGenerator.generateForAnnotatedElement (package:pageloader/src/generators/pageobject_generator.dart:53:16)
I'll try working around it by passing both the Element
and Declaration
view of the class...
@natebosch You used ParsedLibraryResultImpl
, which does not set resolution for ASTs. To get resolution, you need to use a much more expensive ResolvedLibraryResultImpl
. If you can get away with passing in element
and unresolved ClassDeclaration
it is better.
Last time I tried to convert PageLoader to use the element tree without fully-resolved AST, I was blocked by prefixes in import statements. I don't know if this is fixed yet.
For now, let's use ResolvedLibraryResultImpl
to not break it. I can merge this into internal once this PR is submitted.
Should we close this? #165
Switch to use a temporary
ParsedLibraryResult
API until the final API is worked out inpackage:build
. The current approach of usingcomputeNode()
will break in the next breaking release ofbuild
when it flips to usingAnalysisDriver
isntead ofAnalysisContext
to back theResolver
. This temporary API will allow backwards compatibility until the migration is complete.