Repository navigation
Description
I got this exception on one of the entry-points
Serving polymer_elements_demo web on http://localhost:45700
Build error:
Transform Reflectable on polymer_elements_demo|ReflectableTransformed threw error: The null object does not have a getter 'parent'.NoSuchMethodError: method not found: 'parent'
Receiver: null
Arguments: []
dart:core-patch/object_patch.dart 42 Object._noSuchMethod
dart:core-patch/object_patch.dart 45 Object.noSuchMethod
package:reflectable/src/transformer_implementation.dart 2326 _extractMetadataCode
package:reflectable/src/transformer_implementation.dart 739 _ReflectorDomain._generateCode.
dart:_internal/iterable.dart 390 MappedIterator.moveNext
dart:core-patch/growable_array.dart 188 List.addAll
package:reflectable/src/transformer_implementation.dart 752 _ReflectorDomain._generateCode
package:reflectable/src/transformer_implementation.dart 50 ReflectionWorld.generateCode.
dart:_internal/iterable.dart 413 MappedListIterable.elementAt
dart:_internal/iterable.dart 148 ListIterable.join
package:reflectable/src/transformer_implementation.dart 2145 _formatAsMap
package:reflectable/src/transformer_implementation.dart 48 ReflectionWorld.generateCode
package:reflectable/src/transformer_implementation.dart 1872 TransformerImplementation._generateNewEntryPoint
package:reflectable/src/transformer_implementation.dart 1996 TransformerImplementation.apply.
dart:async/zone.dart 1165 _RootZone.runUnary
dart:async/future_impl.dart 502 _Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 585 _Future._propagateToListeners
dart:async/future_impl.dart 376 _Future._completeWithValue
dart:async/future_impl.dart 430 _Future._asyncComplete.
dart:async/schedule_microtask.dart 43 _microtaskLoop
dart:async/schedule_microtask.dart 52 _microtaskLoopEntry
dart:isolate-patch/isolate_patch.dart 96 _runPendingImmediateCallback
dart:isolate-patch/isolate_patch.dart 151 _RawReceivePortImpl._handleMessagedart:core Object.noSuchMethod
package:reflectable/src/transformer_implementation.dart 2326 _extractMetadataCode
package:reflectable/src/transformer_implementation.dart 739 _ReflectorDomain._generateCode.
dart:core List.addAll
package:reflectable/src/transformer_implementation.dart 752 _ReflectorDomain._generateCode
package:reflectable/src/transformer_implementation.dart 50 ReflectionWorld.generateCode.
dart:_internal ListIterable.join
package:reflectable/src/transformer_implementation.dart 2145 _formatAsMap
package:reflectable/src/transformer_implementation.dart 48 ReflectionWorld.generateCode
package:reflectable/src/transformer_implementation.dart 1872 TransformerImplementation._generateNewEntryPoint
package:reflectable/src/transformer_implementation.dart 1996 TransformerImplementation.apply.
Build completed with 1 errors.
when loading a Polymer entry page but the error wasn't even related to the page I was loading.
There is also no information about which entry-point caused the exception.
Activity
eernstg commentedon Oct 1, 2015
This is a bug in the reflectable transformer, it should of course never make an attempt to call
parentonnull. There is just one place where it callsparent, and it hasn't been changed since version 0.1.1. It would be very helpful if you could provide source code that causes this failure to occur!The other topic is whether the transformer should continue to transform other entry points when the transformation of any given entry point fails with an transformer detected error in the program under transformation. I separated that out as a new issue #39.
eernstg commentedon Oct 1, 2015
Adjusted the title, now that this issue is only about the
null.parentbug.[-]Transformer should process other entry-points even when it encounters an error in one[/-][+]The transformer makes an attempt to invoke `null.parent`.[/+]zoechi commentedon Oct 1, 2015
Sorry, I guess I won't be able to reproduce.
I'm working on porting PolymerElements from Polymer.js to Poylmer.dart
There are quite a few entry points where the boilerplate is generated from a script which crawles GitHub organizations for repositories generates an entry page for each repository and copies some HTML and JS from GitHub into the generated Dart files.
See https://github.com/bwu-dart-contributing/polymer_elements/tree/demo2/demo/web
I also generated an
entry_pointline for eachweb_componentsandreflectabletransformer and copied these into thepubspec.yamlfile, which led to halfway valid generated code for a lot of entry-points.I then fixed one of the entry-points and tried to load it in Dartium which led to "unrelated" errors because the were from entry-points I didn't care about yet. I didn't expect this specific error to be of interest to you.
The generating script changed a lot since then an produces much better code now by default. I didn't check in all the changes in between.
eernstg commentedon Oct 1, 2015
OK, thanks for the quick reaction!
zoechi commentedon Oct 1, 2015
Seems not to difficult to reproduce after all. I just encountered it again.
This is the source https://github.com/bwu-dart-playground/polymer_elements_parent
demosubdirectorypub getdemo/web/iron_validatable_behavior/index.htmlfrom WebStormInserts check for node==null before .parent.parent
eernstg commentedon Oct 1, 2015
OK, thanks!
Apparently, it is possible for an analyzer
FieldElementabout a field on an instance of a subclass ofElementfrom 'dart:html' to havenullas its syntax (node). I've landed a commit (5725ef1) that protects against crashing in such a situation.