コード例 #1
0
        JsCodeExpression ProcessInlineCodeExpression()
        {
            if (MethodAtt != null && MethodAtt.InlineCodeExpression != null)
            {
                var inliner = new JsCodeInliner
                {
                    InlineCodeExpression = MethodAtt.InlineCodeExpression,
                };
                if (JsTarget != null)
                {
                    inliner.ThisCode = JsTarget.ToJs();
                }

                foreach (var arg in GenericArgs)
                {
                    if (arg.TypeParam == null)
                    {
                        continue;
                    }
                    var prm = new CodeInlinerParameter {
                        Name = arg.TypeParam.Name, Code = arg.JsExpression.ToJs()
                    };
                    inliner.Params.Add(prm);
                }

                foreach (var b in PrmBindings)
                {
                    var exp = b.JsCallResult;
                    var prm = new CodeInlinerParameter {
                        Name = b.Binding.Parameter.Name, Code = exp.ToJs()
                    };
                    inliner.Params.Add(prm);
                }
                var inlinedCode = inliner.Process();
                return(Js.CodeExpression(inlinedCode));
            }
            return(null);
        }