You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The html library implementation needs a way to indicate that a DOM class has a field with a Dart name that maps to a JavaScript property with a different name.
@JS_NAME('nextSibling') // JavaScript name
final _NodeImpl nextNode; // Dart name
This is better than the currently available 'inline assembly' version:
_NodeImpl get nextNode() => JS('_NodeImpl', '#.nextSibling', this);
The declarative metadata form is better because JS() is opaque, so dart2js can't tell that inlining the JS() body is possible on a nullable receiver. Inlining on nullable receivers opens up many more inlining possiblities but is only possible if the inlined code preserves the NullPointerException behaviour.
In addition mapping nextNode to nextSibling, the declarative form tells the compiler that nextSibling exists on native classes so should not be used as the JavaScript member name of any Dart members.
The text was updated successfully, but these errors were encountered:
The html library implementation needs a way to indicate that a DOM class has a field with a Dart name that maps to a JavaScript property with a different name.
@JS_NAME('nextSibling') // JavaScript name
final _NodeImpl nextNode; // Dart name
This is better than the currently available 'inline assembly' version:
_NodeImpl get nextNode() => JS('_NodeImpl', '#.nextSibling', this);
The declarative metadata form is better because JS() is opaque, so dart2js can't tell that inlining the JS() body is possible on a nullable receiver. Inlining on nullable receivers opens up many more inlining possiblities but is only possible if the inlined code preserves the NullPointerException behaviour.
In addition mapping nextNode to nextSibling, the declarative form tells the compiler that nextSibling exists on native classes so should not be used as the JavaScript member name of any Dart members.
The text was updated successfully, but these errors were encountered: