Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The transformer makes an attempt to invoke null.parent. #37

Closed
zoechi opened this issue Sep 28, 2015 · 6 comments
Closed

The transformer makes an attempt to invoke null.parent. #37

zoechi opened this issue Sep 28, 2015 · 6 comments
Labels

Comments

@zoechi
Copy link
Contributor

zoechi commented Sep 28, 2015

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

dart: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.

@eernstg
Copy link
Collaborator

eernstg commented Oct 1, 2015

This is a bug in the reflectable transformer, it should of course never make an attempt to call parent on null. There is just one place where it calls parent, 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
Copy link
Collaborator

eernstg commented Oct 1, 2015

Adjusted the title, now that this issue is only about the null.parent bug.

@eernstg eernstg changed the title Transformer should process other entry-points even when it encounters an error in one The transformer makes an attempt to invoke null.parent. Oct 1, 2015
@zoechi
Copy link
Contributor Author

zoechi commented 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_point line for each web_components and reflectable transformer and copied these into the pubspec.yaml file, 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
Copy link
Collaborator

eernstg commented Oct 1, 2015

OK, thanks for the quick reaction!

@zoechi
Copy link
Contributor Author

zoechi commented 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

eernstg added a commit that referenced this issue Oct 1, 2015
Tiny, safe change; will land. TBR.

Fixed issue #37.

Review URL: https://codereview.chromium.org/1378393003 .
@eernstg
Copy link
Collaborator

eernstg commented Oct 1, 2015

OK, thanks!

Apparently, it is possible for an analyzer FieldElement about a field on an instance of a subclass of Element from 'dart:html' to have null as its syntax (node). I've landed a commit (5725ef1) that protects against crashing in such a situation.

@eernstg eernstg closed this as completed Oct 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants