Пример #1
0
 public virtual void NewInstance(ConstructorInstance constructor, Script argumentsScript)
 {
     if (mv != null)
     {
         mv.NewInstance(constructor, argumentsScript);
     }
 }
Пример #2
0
        protected void ImplementToString()
        {
            PropertyInstance p_objRefTemplate = GetObjRefTemplatePI(this);

            MethodInstance methodSb;
            {
                methodSb = MethodInstance.FindByTemplate(template_m_toStringSb, true);
                if (methodSb == null || methodSb.Access.HasFlag(MethodAttributes.Abstract))
                {
                    IMethodVisitor mg = VisitMethod(template_m_toStringSb);
                    mg.CallThisGetter(p_objRefTemplate);
                    mg.LoadThis();
                    mg.LoadArgs();
                    mg.InvokeVirtual(m_objRef_toStringSb);
                    mg.ReturnValue();
                    mg.EndMethod();
                    methodSb = mg.Method;
                }
            }
            {
                MethodInstance method = MethodInstance.FindByTemplate(template_m_toString, true);
                if (method == null || NewType.GetType(typeof(Object)).Equals(method.Owner) || methodSb.Access.HasFlag(MethodAttributes.Abstract))
                {
                    IMethodVisitor    mg     = VisitMethod(template_m_toString);
                    LocalVariableInfo loc_sb = mg.NewLocal(typeof(StringBuilder));
                    mg.LoadThis();
                    mg.NewInstance(c_stringBuilder, null);
                    mg.StoreLocal(loc_sb);
                    mg.LoadLocal(loc_sb);
                    mg.InvokeVirtual(methodSb);
                    mg.LoadLocal(loc_sb);
                    mg.InvokeVirtual(new MethodInstance(null, typeof(StringBuilder), typeof(String), "ToString"));
                    mg.ReturnValue();
                    mg.EndMethod();
                }
            }
        }