Implement various declarative features.
// Dart note: this merges "buildPrototype" "desugarBeforeChaining" and
// "desugarAfterChaining", because we don't have prototypes.
void desugar() {
// back reference declaration element
_declarations[name] = this;
// transcribe `attributes` declarations onto own prototype's `publish`
publishAttributes(superDeclaration);
publishProperties();
inferObservers();
// desugar compound observer syntax, e.g. @ObserveProperty('a b c')
explodeObservers();
createPropertyAccessors();
// install mdv delegate on template
installBindingDelegate(fetchTemplate());
// install external stylesheets as if they are inline
installSheets();
// adjust any paths in dom from imports
resolveElementPaths(element);
// compile list of attributes to copy to instances
accumulateInstanceAttributes();
// parse on-* delegates declared on `this` element
parseHostEvents();
// install a helper method this.resolvePath to aid in
// setting resource urls. e.g.
// this.$.image.src = this.resolvePath('images/foo.png')
initResolvePath();
// under ShadowDOMPolyfill, transforms to approximate missing CSS features
_shimShadowDomStyling(templateContent, name, extendee);
// TODO(jmesserly): this feels unnatrual in Dart. Since we have convenient
// lazy static initialization, can we get by without it?
if (smoke.hasStaticMethod(type, #registerCallback)) {
smoke.invoke(type, #registerCallback, [this]);
}
}