Beispiel #1
0
        public void addExprTemplate(string exprStr, CodeTemplate tmpl)
        {
            var expr = new TypeScriptParser2(exprStr, null).parseExpression();

            if (expr is UnresolvedCallExpression unrCallExpr && unrCallExpr.func is PropertyAccessExpression propAccExpr && propAccExpr.object_ is Identifier ident)
            {
                var callTmpl = new CallTemplate(ident.text, propAccExpr.propertyName, unrCallExpr.args.map(x => (((Identifier)x)).text), tmpl);
                this.addMethod($"{callTmpl.className}.{callTmpl.methodName}@{callTmpl.args.length()}", callTmpl);
            }
Beispiel #2
0
 public void addMethod(string name, CallTemplate callTmpl)
 {
     if (!(this.methods.hasKey(name)))
     {
         this.methods.set(name, new List <CallTemplate>());
     }
     // @php $this->methods[$name][] = $callTmpl;
     this.methods.get(name).push(callTmpl);
 }