public JsNode VisitMemberResolveResult(MemberResolveResult res) { var me = res.Member; JsNode node2; bool enumValuesAsNames; if (me == null) //TODO: dynamics { throw new NotImplementedException(); //var node3 = Js.Member(node.MemberName); //if (node.Target != null) // node3.PreviousMember = VisitExpression(node.Target); //return node3; } else if (Sk.IsEntityFunctionProperty(res.Member, res))//(Entity)node.entity)) { var pe = (IProperty)me; var xxx = new CSharpInvocationResolveResult(res.TargetResult, pe.Getter, null); node2 = Visit(xxx); return(node2); } else if (me.IsEnumMember() && Sk.UseJsonEnums(me, out enumValuesAsNames)) { var me2 = (IField)me; if (enumValuesAsNames) { return(Js.String(SkJs.GetEntityJsName(me2))); } else { return(Js.Value(me2.ConstantValue)); } } //TODO: Support a way to override this (JsField.ConstantInlining=false) else if (res.IsCompileTimeConstant && !me.IsEnumMember()) { return(Js.Value(res.ConstantValue)); } else { var node3 = SkJs.EntityToMember(me); node2 = node3; if (res.TargetResult != null && !me.IsStatic()) { var instanceContext = VisitExpression(res.TargetResult); if (node3.Name.IsNullOrEmpty()) //support Name="" { node2 = instanceContext; } else { node3.PreviousMember = instanceContext; } } } return(node2); }
public JsNode VisitMemberResolveResult(MemberResolveResult res) { var me = res.Member; JsNode node2; bool enumValuesAsNames; if (me == null) //TODO: dynamics { throw new NotImplementedException(); //var node3 = Js.Member(node.MemberName); //if (node.Target != null) // node3.PreviousMember = VisitExpression(node.Target); //return node3; } else if (Sk.IsEntityFunctionProperty(res.Member, res))//(Entity)node.entity)) { var pe = (IProperty)me; var xxx = new CSharpInvocationResolveResult(res.TargetResult, pe.Getter, null); var fn = res.GetFirstNode(); qiucw.InvokeRR2Location.Add(xxx, new qiucw.InvocationLocation { FileName = fn.GetFileName(), Line = fn.StartLocation.Line }); { node2 = Visit(xxx); } qiucw.InvokeRR2Location.Remove(xxx); return(node2); } else if (me.IsEnumMember() && Sk.UseJsonEnums(me, out enumValuesAsNames)) { var me2 = (IField)me; if (enumValuesAsNames) { return(Js.String(SkJs.GetEntityJsName(me2))); } else { return(Js.Value(me2.ConstantValue)); } } //TODO: Support a way to override this (JsField.ConstantInlining=false) else if (res.IsCompileTimeConstant && !me.IsEnumMember()) { var nodes = res.GetNodes(); if (nodes.IsNotNullOrEmpty()) { if (nodes[0] != null) { bool isPrimitiveExpr = nodes[0] is PrimitiveExpression; if (!isPrimitiveExpr) { return(Js.Value(res.ConstantValue, string.Format(" /* {0} */", nodes[0].ToString()))); } } } return(Js.Value(res.ConstantValue)); } else { var node3 = SkJs.EntityToMember(me); qiucw.CheckAddInvocation(res, node3.Name); node2 = node3; if (res.TargetResult != null && !me.IsStatic()) { var instanceContext = VisitExpression(res.TargetResult); if (node3.Name.IsNullOrEmpty()) //support Name="" { node2 = instanceContext; } else { node3.PreviousMember = instanceContext; } } } return(node2); }
bool IsEntityFunctionProperty(IEntity me, ResolveResult scope) { return(Sk.IsEntityFunctionProperty(me, scope)); }