google / pageloader

A framework for creating page objects for in-browser or WebDriver tests.
https://pub.dartlang.org/packages/pageloader
Apache License 2.0
40 stars 46 forks source link

Upgrade to analyzer 0.33.3 #164

Closed natebosch closed 5 years ago

natebosch commented 5 years ago

Switch to use a temporary ParsedLibraryResult API until the final API is worked out in package:build. The current approach of using computeNode() will break in the next breaking release of build when it flips to using AnalysisDriver isntead of AnalysisContext to back the Resolver. This temporary API will allow backwards compatibility until the migration is complete.

natebosch commented 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...

scheglov commented 5 years ago

@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.

mk13 commented 5 years ago

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.

mk13 commented 5 years ago

Should we close this? #165