method createPropertyAccessors


void createPropertyAccessors()

Source

void createPropertyAccessors() {
  // Dart note: since we don't have a prototype in Dart, most of the work of
  // createPolymerAccessors is done lazily on the first access of properties.
  // Here we just extract the information from annotations and store it as
  // properties on the declaration.

  // Dart Note: The js side makes computed properties read only, and does
  // special logic right here for them. For us they are automatically read
  // only unless you define a setter for them, so we left that out.
  var options = const smoke.QueryOptions(
      includeInherited: true,
      includeUpTo: HtmlElement,
      withAnnotations: const [ComputedProperty]);
  var existing = {};
  for (var decl in smoke.query(type, options)) {
    var name = decl.name;
    if (_checkPropertyBlacklist(name)) continue;
    var meta = decl.annotations.firstWhere((e) => e is ComputedProperty);
    var prev = existing[name];
    // The definition of a child class takes priority.
    if (prev == null || smoke.isSubclassOf(decl.type, prev.type)) {
      _computed[name] = meta.expression;
      existing[name] = decl;
    }
  }
}