//InvocationExpression GetConstructorBaseOrThisInvocation(IMethod ctor) //{ // var ctorNode = (ConstructorDeclaration)ctor.GetDeclaration(); // InvocationExpression node = null; // if (ctorNode != null && ctorNode.Initializer != null && !ctorNode.Initializer.IsNull) // { // var xxx = (CSharpInvocationResolveResult)ctorNode.Initializer.Resolve(); // //throw new NotImplementedException(); // //danel // var baseCtor = xxx.Member; // var id = new IdentifierExpression(baseCtor.Name); // id.SetResolveResult(new MemberResolveResult(null, baseCtor)); // node = new InvocationExpression(id); // node.SetResolveResult(xxx); // //{ entity = ctorNode.invoked_method, Target = ctorNode.invoked_method.Access() }; // //node.SetResolveResult( // // node.Arguments.AddRange(ctorNode.Initializer.Arguments); // } // else // { // var ce = ctor.GetDeclaringTypeDefinition(); // if (Sk.OmitInheritance(ce)) // return null; // var baseType = GetBaseClassIfValid(ce, true); // if (baseType != null) // { // var baseCtor = baseType.GetConstructor(); // if (baseCtor != null) // { // //danel // //throw new NotImplementedException(); // var id = new IdentifierExpression(baseCtor.Name); // id.SetResolveResult(new MemberResolveResult(null, baseCtor)); // node = new InvocationExpression(id);// { entity = baseCtor, expression = baseCtor.Access() }; // node.SetResolveResult(new CSharpInvocationResolveResult(null, baseCtor, null)); // } // } // } // return node; //} InvocationResolveResult GetConstructorBaseOrThisInvocation2(IMethod ctor) { var ctorNode = (ConstructorDeclaration)ctor.GetDeclaration(); InvocationResolveResult node = null; if (ctorNode != null && ctorNode.Initializer != null && !ctorNode.Initializer.IsNull) { var xxx = (CSharpInvocationResolveResult)ctorNode.Initializer.Resolve(); return(xxx); } else { var ce = ctor.GetDeclaringTypeDefinition(); if (JMeta.OmitInheritance(ce)) { return(null); } var baseType = GetBaseClassIfValid(ce, true); if (baseType != null) { var baseCtor = baseType.GetConstructors(t => t.Parameters.Count == 0, GetMemberOptions.IgnoreInheritedMembers).Where(t => !t.IsStatic).FirstOrDefault(); if (baseCtor != null) { return(baseCtor.AccessSelf().Invoke()); } } } return(node); }