SHARE
TWEET

Untitled

a guest Apr 10th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         if (builder.hasSuperClass("haxe.ui.core.Component") == false) {
  2.             return "Must have a superclass of haxe.ui.core.Component";
  3.         }
  4.        
  5.         if (builder.constructor == null) {
  6.             return "A class building component must have a constructor";
  7.         }
  8.  
  9.         ModuleMacros.populateClassMap();
  10.        
  11.         var xml = builder.getClassMetaValue("xml");
  12.         var namedComponents:Map<String, String> = new Map<String, String>();
  13.         var expr = ComponentMacros.buildComponentFromString([], xml, namedComponents);
  14.         var codeBuilder = new CodeBuilder(expr);
  15.         codeBuilder.add(macro
  16.             addComponent(c0)
  17.         );
  18.        
  19.         var createChildrenFn = builder.findFunction("createChildren");
  20.         if (createChildrenFn == null) {
  21.             createChildrenFn = builder.addFunction("createChildren", macro {
  22.                 super.createChildren();
  23.             }, [APrivate, AOverride]);
  24.         }
  25.         createChildrenFn.add(codeBuilder);
  26.        
  27.         for (id in namedComponents.keys()) {
  28.             var safeId:String = StringUtil.capitalizeHyphens(id);
  29.             var cls:String = namedComponents.get(id);
  30.             builder.addVar(safeId, TypeTools.toComplexType(Context.getType(cls)));
  31.             builder.constructor.add(macro
  32.                 $i{safeId} = findComponent($v{id}, $p{cls.split(".")}, true)
  33.             , 1);
  34.         }
  35.        
  36.         return null;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top