register top-level property

Register register
getter/setter pair

Implementation

Register register = Register(() {
  XmlLayout.register("Function", (node, key) {
    String? type = node.rawAttribute("returnType")?.toLowerCase();
    _ReturnType returnType = _returnTypes[type] ?? _defaultReturnType;

    String? creator = node.rawAttribute("creator");
    dynamic ret;
    if (creator != null) {
      ret = node.status.execute(creator);
    }
    if (ret == true) {
      return returnType.creator(_createNewNode(node, {
        "args": _emptyArgs
      }));
    } else {
      return returnType.function(node);
    }
  });
  XmlLayout.register("Call", (node, key) {
    var call = Call(
      func: node.s<Function>("function"),
      ret: node.s<String>("return"),
      args: node.children<Argument>());
    call.execute(node.status);
    return call;
  });
  XmlLayout.register("Builder", (node, key) {
    var builder = Builder(
      node,
    );
    builder.execute(node.status);
    return builder;
  });
  XmlLayout.register("SetArgument", (node, key) {
    var set = SetArgument(
        ret: node.s<String>("return"),
        argument: node.s("argument")
    );
    set.execute(node.status);
    return set;
  });
  XmlLayout.register("Script", (node, key) {
    var script = Script(node.raw);
    script.execute(node.status);
    return script;
  });
  XmlLayout.register("Argument", (node, key) {
    return Argument(node);
  });

});