protected override Func <PropertyInfo, Delegate> Call <TObj, TValue>() { ClassVisitor <DeserializeContext, TValue> elementVisitor = visitorFactory.GetClassVisitor <TValue>(); return(property => { ISetter <TObj, IList <TValue> > setter = Setter.Create <TObj, IList <TValue> >(property); return new ProcessField <DeserializeContext, TObj, IList <TValue> >( (DeserializeContext context, TObj obj, ref IList <TValue> value) => { value = new List <TValue>(); setter.Apply(obj, value); int length = PrimitiveDeserializer.Impl <int> .Instance(context.Stream); for (int i = 0; i < length; i++) { TValue element = new TValue(); if (elementVisitor.Visit(context, element) == VisitStatus.Exit) { return VisitStatus.Exit; } value.Add(element); } return VisitStatus.SkipChildren; }); }); }
private void addNonStaticMethods(CompilerContext context, ClassVisitor cv) { MethodVisitor mv; // public int exec(int returnAddress, int alternativeReturnAddress, bool isJump) throws Exception; mv = cv.visitMethod(Opcodes.ACC_PUBLIC, context.ExecMethodName, context.ExecMethodDesc, null, exceptions); mv.visitCode(); mv.visitMethodInsn(Opcodes.INVOKESTATIC, ClassName, context.StaticExecMethodName, context.StaticExecMethodDesc); mv.visitInsn(Opcodes.IRETURN); mv.visitMaxs(1, 1); mv.visitEnd(); // private static IExecutable e; FieldVisitor fv = cv.visitField(Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC, context.ReplaceFieldName, executableDescriptor, null, null); fv.visitEnd(); // public void setExecutable(IExecutable e); mv = cv.visitMethod(Opcodes.ACC_PUBLIC, context.ReplaceMethodName, context.ReplaceMethodDesc, null, exceptions); mv.visitCode(); mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitFieldInsn(Opcodes.PUTSTATIC, ClassName, context.ReplaceFieldName, executableDescriptor); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(1, 2); mv.visitEnd(); // public IExecutable getExecutable(); mv = cv.visitMethod(Opcodes.ACC_PUBLIC, context.GetMethodName, context.GetMethodDesc, null, exceptions); mv.visitCode(); mv.visitFieldInsn(Opcodes.GETSTATIC, ClassName, context.ReplaceFieldName, executableDescriptor); mv.visitInsn(Opcodes.ARETURN); mv.visitMaxs(1, 1); mv.visitEnd(); }
public SourceCodeMutationResult PerformMutationAnalysisOnSourceCodeProject( EnvDTE.Project sourceCodeProject, List <string> options) { var workspace = _roslynSetupHelper.CreateWorkspace(); var solution = _roslynSetupHelper.GetSolutionToAnalyze( workspace, _currentSolution.FileName); var projectToAnalyze = _roslynSetupHelper.GetProjectToAnalyze(solution, sourceCodeProject.Name); var projectAssembly = _roslynSetupHelper.GetProjectAssembly(projectToAnalyze); var projectSemanticModel = _roslynSetupHelper.GetProjectSemanticModel( _roslynSetupHelper.GetProjectToAnalyze(solution, sourceCodeProject.Name)); //get info about source code project's types var projectClasses = new List <Class>(); foreach (var syntaxTree in projectAssembly.SyntaxTrees) { var classVisitor = new ClassVisitor(); classVisitor.Visit(syntaxTree.GetRoot()); projectClasses.AddRange(classVisitor.ProjectClasses); } var generatedMutants = GenerateMutantsForProject(projectAssembly, projectSemanticModel, options, workspace, projectClasses, solution, projectToAnalyze.OutputFilePath); return(new SourceCodeMutationResult() { GeneratedMutants = generatedMutants, OutputPath = projectToAnalyze.OutputFilePath, Usings = Usings }); }
/// <summary> /// Constructs a new /// <see cref="StaticInitMerger" /> /// . /// </summary> /// <param name="api"> /// the ASM API version implemented by this visitor. Must be one of /// <see cref="Org.Objectweb.Asm.Opcodes.Asm4" /> /// , /// <see cref="Org.Objectweb.Asm.Opcodes.Asm5" /> /// or /// <see cref="Org.Objectweb.Asm.Opcodes.Asm6" /> /// . /// </param> /// <param name="prefix"> /// the prefix to use to rename the existing <clinit> methods. /// </param> /// <param name="classVisitor"> /// the class visitor to which this visitor must delegate method calls. May be /// null. /// </param> protected internal StaticInitMerger(VisitorAsmApiVersion api, string prefix, ClassVisitor classVisitor ) : base(api, classVisitor) { /* latest api = */ renamedClinitMethodPrefix = prefix; }
/// <summary> /// Constructs a new /// <see cref="ClassRemapper" /> /// . /// </summary> /// <param name="api"> /// the ASM API version supported by this remapper. Must be one of /// <see cref="Opcodes.Asm4" /> /// , /// <see cref="Opcodes.Asm5" /> /// , /// <see cref="Opcodes.Asm6" /> /// or /// <see cref="Opcodes.Asm7" /> /// . /// </param> /// <param name="classVisitor">the class visitor this remapper must deleted to.</param> /// <param name="remapper"> /// the remapper to use to remap the types in the visited class. /// </param> protected internal ClassRemapper(VisitorAsmApiVersion api, ClassVisitor classVisitor, Remapper remapper ) : base(api, classVisitor) { /* latest api = */ this.remapper = remapper; }
/// <summary>Makes the given class visitor visit this field.</summary> /// <param name="classVisitor">a class visitor.</param> public virtual void Accept(ClassVisitor classVisitor) { var fieldVisitor = classVisitor.VisitField(access, name, desc, signature , value); if (fieldVisitor == null) { return; } // Visit the annotations. if (visibleAnnotations != null) { for (int i = 0, n = visibleAnnotations.Count; i < n; ++i) { var annotation = visibleAnnotations[i]; annotation.Accept(fieldVisitor.VisitAnnotation(annotation.desc, true)); } } if (invisibleAnnotations != null) { for (int i = 0, n = invisibleAnnotations.Count; i < n; ++i) { var annotation = invisibleAnnotations[i]; annotation.Accept(fieldVisitor.VisitAnnotation(annotation.desc, false)); } } if (visibleTypeAnnotations != null) { for (int i = 0, n = visibleTypeAnnotations.Count; i < n; ++i) { var typeAnnotation = visibleTypeAnnotations[i]; typeAnnotation.Accept(fieldVisitor.VisitTypeAnnotation(typeAnnotation.typeRef, typeAnnotation .typePath, typeAnnotation.desc, true)); } } if (invisibleTypeAnnotations != null) { for (int i = 0, n = invisibleTypeAnnotations.Count; i < n; ++i) { var typeAnnotation = invisibleTypeAnnotations[i]; typeAnnotation.Accept(fieldVisitor.VisitTypeAnnotation(typeAnnotation.typeRef, typeAnnotation .typePath, typeAnnotation.desc, false)); } } // Visit the non standard attributes. if (attrs != null) { for (int i = 0, n = attrs.Count; i < n; ++i) { fieldVisitor.VisitAttribute(attrs[i]); } } fieldVisitor.VisitEnd(); }
/// <summary> /// Constructs a new /// <see cref="TraceClassVisitor" /> /// . /// </summary> /// <param name="classVisitor"> /// the class visitor to which to delegate calls. May be /// <literal>null</literal> /// . /// </param> /// <param name="printer">the printer to convert the visited class into text.</param> /// <param name="printWriter"> /// the print writer to be used to print the class. May be /// <literal>null</literal> /// . /// </param> public TraceClassVisitor(ClassVisitor classVisitor, Printer printer, TextWriter printWriter) : base(VisitorAsmApiVersion.Asm8Experimental, classVisitor) { // DontCheck(MemberName): can't be renamed (for backward binary compatibility). /* latest api = */ this.printWriter = printWriter; p = printer; }
/// <summary> /// Constructs a new /// <see cref="SerialVersionUIDAdder" /> /// . /// <i> /// Subclasses must not use this /// constructor /// </i> /// . Instead, they must use the /// <see cref="SerialVersionUIDAdder(int,ObjectWeb.Asm.ClassVisitor)" /> /// version. /// </summary> /// <param name="classVisitor"> /// a /// <see cref="ClassVisitor" /> /// to which this visitor will delegate calls. /// </param> /// <exception cref="InvalidOperationException"> /// If a subclass calls this constructor. /// </exception> public SerialVersionUIDAdder(ClassVisitor classVisitor) : this(VisitorAsmApiVersion.Asm7, classVisitor) { // DontCheck(AbbreviationAsWordInName): can't be renamed (for backward binary compatibility). /* latest api = */ if (GetType() != typeof(SerialVersionUIDAdder)) { throw new InvalidOperationException(); } }
// Nothing to do. /// <summary>Makes the given class visitor visit this module.</summary> /// <param name="classVisitor">a class visitor.</param> public virtual void Accept(ClassVisitor classVisitor) { var moduleVisitor = classVisitor.VisitModule(name, access, version); if (moduleVisitor == null) { return; } if (mainClass != null) { moduleVisitor.VisitMainClass(mainClass); } if (packages != null) { for (int i = 0, n = packages.Count; i < n; i++) { moduleVisitor.VisitPackage(packages[i]); } } if (requires != null) { for (int i = 0, n = requires.Count; i < n; i++) { requires[i].Accept(moduleVisitor); } } if (exports != null) { for (int i = 0, n = exports.Count; i < n; i++) { exports[i].Accept(moduleVisitor); } } if (opens != null) { for (int i = 0, n = opens.Count; i < n; i++) { opens[i].Accept(moduleVisitor); } } if (uses != null) { for (int i = 0, n = uses.Count; i < n; i++) { moduleVisitor.VisitUse(uses[i]); } } if (provides != null) { for (int i = 0, n = provides.Count; i < n; i++) { provides[i].Accept(moduleVisitor); } } }
private void addConstructor(ClassVisitor cv) { MethodVisitor mv = cv.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null); mv.visitCode(); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, objectInternalName, "<init>", "()V"); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(1, 1); mv.visitEnd(); }
/// <summary>Makes the given class visitor visit this method.</summary> /// <param name="classVisitor">a class visitor.</param> public virtual void Accept(ClassVisitor classVisitor) { var exceptionsArray = exceptions == null ? null : Collections.ToArray (exceptions, new string[0]); var methodVisitor = classVisitor.VisitMethod(access, name, desc, signature , exceptionsArray); if (methodVisitor != null) { Accept(methodVisitor); } }
protected override Delegate Call <TObj>() { ClassVisitor <Stream, TObj> elementVisitor = visitorFactory.GetClassVisitor <TObj>(); return(new ProcessObject <Stream, IList <TObj> >( (Stream stream, IList <TObj> value) => { PrimitiveSerializer.Impl <int> .Instance(stream, value.Count()); foreach (TObj element in value) { elementVisitor.Visit(stream, element); } return VisitStatus.SkipChildren; })); }
internal MethodByteCodeEmitter(ClassVisitor classVisitor, MethodDeclaration declaration, TypeReference ignore) { this._declaration = declaration; foreach (Parameter parameter in declaration.Parameters()) { TypeReference type = parameter.Type(); if (type.InnerClass && !type.Array) { classVisitor.visitInnerClass(byteCodeName(type), outerName(type), type.SimpleName(), type.Modifiers()); } } this._methodVisitor = classVisitor.visitMethod(ACC_PUBLIC, declaration.Name(), desc(declaration), signature(declaration), exceptions(declaration)); this._methodVisitor.visitCode(); this._expressionVisitor = new ByteCodeExpressionVisitor(this._methodVisitor); _stateStack.push(new Method(_methodVisitor, declaration.ReturnType().Void)); }
internal ClassByteCodeWriter(TypeReference type, TypeReference @base, TypeReference[] interfaces) { this._classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES); this._classVisitor = _classWriter; // this separation is useful if we want to add intermediary visitors string[] iNames = new string[interfaces.Length]; for (int i = 0; i < interfaces.Length; i++) { iNames[i] = byteCodeName(interfaces[i]); } _classVisitor.visit(V1_8, ACC_PUBLIC + ACC_SUPER, byteCodeName(type), signature(type), byteCodeName(@base), iNames.Length != 0 ? iNames : null); if (@base.InnerClass) { _classVisitor.visitInnerClass(byteCodeName(@base), outerName(@base), @base.SimpleName(), ACC_PUBLIC + ACC_STATIC); } this._type = type; this.@base = @base; }
/// <summary>Makes the given class visitor visit this record component.</summary> /// <param name="classVisitor">a class visitor.</param> // [Obsolete(@"this API is experimental.")] public virtual void AcceptExperimental(ClassVisitor classVisitor) { var recordComponentVisitor = classVisitor.VisitRecordComponentExperimental (accessExperimental, nameExperimental, descriptorExperimental, signatureExperimental ); if (recordComponentVisitor == null) { return; } // Visit the annotations. if (visibleAnnotationsExperimental != null) { for (int i = 0, n = visibleAnnotationsExperimental.Count; i < n; ++i) { var annotation = visibleAnnotationsExperimental[i]; annotation.Accept(recordComponentVisitor.VisitAnnotationExperimental(annotation.desc , true)); } } if (invisibleAnnotationsExperimental != null) { for (int i = 0, n = invisibleAnnotationsExperimental.Count; i < n; ++i) { var annotation = invisibleAnnotationsExperimental[i]; annotation.Accept(recordComponentVisitor.VisitAnnotationExperimental(annotation.desc , false)); } } if (visibleTypeAnnotationsExperimental != null) { for (int i = 0, n = visibleTypeAnnotationsExperimental.Count; i < n; ++i) { var typeAnnotation = visibleTypeAnnotationsExperimental[i]; typeAnnotation.Accept(recordComponentVisitor.VisitTypeAnnotationExperimental(typeAnnotation .typeRef, typeAnnotation.typePath, typeAnnotation.desc, true)); } } if (invisibleTypeAnnotationsExperimental != null) { for (int i = 0, n = invisibleTypeAnnotationsExperimental.Count; i < n; ++i) { var typeAnnotation = invisibleTypeAnnotationsExperimental[i]; typeAnnotation.Accept(recordComponentVisitor.VisitTypeAnnotationExperimental(typeAnnotation .typeRef, typeAnnotation.typePath, typeAnnotation.desc, false)); } } // Visit the non standard attributes. if (attrsExperimental != null) { for (int i = 0, n = attrsExperimental.Count; i < n; ++i) { recordComponentVisitor.VisitAttributeExperimental(attrsExperimental[i]); } } recordComponentVisitor.VisitEndExperimental(); }
/// <summary> /// Constructs a new /// <see cref="TraceClassVisitor" /> /// . /// </summary> /// <param name="classVisitor"> /// the class visitor to which to delegate calls. May be /// <literal>null</literal> /// . /// </param> /// <param name="printWriter"> /// the print writer to be used to print the class. May be /// <literal>null</literal> /// . /// </param> public TraceClassVisitor(ClassVisitor classVisitor, TextWriter printWriter) : this(classVisitor, new Textifier(), printWriter) { }
public override Accept(ClassVisitor visitor) { visitor.Visit(this); }
public virtual Type specialize(string name, Type c, Dictionary <string, object> variables) { ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); ClassVisitor cv = cw; StringWriter debugOutput = null; if (log.TraceEnabled) { // Dump the class to be specialized (only once) if (!tracedClasses.Contains(c)) { StringWriter classTrace = new StringWriter(); ClassVisitor classTraceCv = new TraceClassVisitor(new PrintWriter(classTrace)); try { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: ClassReader cr = new ClassReader(c.FullName.Replace('.', '/')); cr.accept(classTraceCv, 0); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: log.trace(string.Format("Dump of class to be specialized: {0}", c.FullName)); log.trace(classTrace); } catch (IOException) { // Ignore Exception } tracedClasses.Add(c); } log.trace(string.Format("Specializing class {0}", name)); string[] variableNames = variables.Keys.toArray(new string[variables.Count]); Array.Sort(variableNames); foreach (string variableName in variableNames) { log.trace(string.Format("Variable {0}={1}", variableName, variables[variableName])); } debugOutput = new StringWriter(); PrintWriter debugPrintWriter = new PrintWriter(debugOutput); cv = new TraceClassVisitor(cv, debugPrintWriter); //cv = new TraceClassVisitor(debugPrintWriter); } try { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: ClassReader cr = new ClassReader(c.FullName.Replace('.', '/')); ClassNode cn = new SpecializedClassVisitor(name, variables); cr.accept(cn, 0); cn.accept(cv); } catch (IOException e) { Console.WriteLine("Cannot read class", e); } if (debugOutput != null) { log.trace(debugOutput.ToString()); } Type specializedClass = null; try { specializedClass = classLoader.defineClass(name, cw.toByteArray()); } catch (ClassFormatError e) { Console.WriteLine("Error while defining specialized class", e); } return(specializedClass); }
private Type <IExecutable> interpret(CompilerContext context) { Type <IExecutable> compiledClass = null; context.CodeBlock = this; string className = InternalClassName; if (log.InfoEnabled) { Console.WriteLine("Compiling for Interpreter " + className); } int computeFlag = ClassWriter.COMPUTE_FRAMES; if (context.AutomaticMaxLocals || context.AutomaticMaxStack) { computeFlag |= ClassWriter.COMPUTE_MAXS; } ClassWriter cw = new ClassWriter(computeFlag); ClassVisitor cv = cw; //if (log.DebugEnabled) { cv = new CheckClassAdapter(cv); } StringWriter debugOutput = null; //if (log.DebugEnabled) { debugOutput = new StringWriter(); PrintWriter debugPrintWriter = new PrintWriter(debugOutput); cv = new TraceClassVisitor(cv, debugPrintWriter); } cv.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER, className, null, objectInternalName, interfacesForExecutable); context.startClass(cv); addConstructor(cv); addNonStaticMethods(context, cv); MethodVisitor mv = cv.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, context.StaticExecMethodName, context.StaticExecMethodDesc, null, exceptions); mv.visitCode(); context.MethodVisitor = mv; context.startMethod(); context.compileExecuteInterpreter(StartAddress); mv.visitMaxs(context.MaxStack, context.MaxLocals); mv.visitEnd(); cv.visitEnd(); if (debugOutput != null) { Console.WriteLine(debugOutput.ToString()); } compiledClass = loadExecutable(context, className, cw.toByteArray()); return(compiledClass); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private Class<IExecutable> compile(CompilerContext context) throws ClassFormatError private Type <IExecutable> compile(CompilerContext context) { Type <IExecutable> compiledClass = null; context.CodeBlock = this; string className = InternalClassName; //if (log.DebugEnabled) { string functionName = Utilities.getFunctionNameByAddress(StartAddress); if (!string.ReferenceEquals(functionName, null)) { Console.WriteLine(string.Format("Compiling {0} ({1})", className, functionName)); } else { Console.WriteLine(string.Format("Compiling {0}", className)); } } prepare(context, context.MethodMaxInstructions); currentSequence = null; int computeFlag = ClassWriter.COMPUTE_FRAMES; if (context.AutomaticMaxLocals || context.AutomaticMaxStack) { computeFlag |= ClassWriter.COMPUTE_MAXS; } ClassWriter cw = new ClassWriter(computeFlag); ClassVisitor cv = cw; //if (log.DebugEnabled) { cv = new CheckClassAdapter(cv); } StringWriter debugOutput = null; if (log.TraceEnabled) { debugOutput = new StringWriter(); PrintWriter debugPrintWriter = new PrintWriter(debugOutput); cv = new TraceClassVisitor(cv, debugPrintWriter); } cv.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER, className, null, objectInternalName, interfacesForExecutable); context.startClass(cv); addConstructor(cv); addNonStaticMethods(context, cv); MethodVisitor mv = cv.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, context.StaticExecMethodName, context.StaticExecMethodDesc, null, exceptions); mv.visitCode(); context.MethodVisitor = mv; context.startMethod(); // Jump to the block start if other instructions have been inserted in front if (codeInstructions.Count > 0 && codeInstructions.First.Value.Address != StartAddress) { mv.visitJumpInsn(Opcodes.GOTO, getCodeInstruction(StartAddress).Label); } compile(context, mv, codeInstructions); mv.visitMaxs(context.MaxStack, context.MaxLocals); mv.visitEnd(); foreach (SequenceCodeInstruction sequenceCodeInstruction in sequenceCodeInstructions) { //if (log.DebugEnabled) { Console.WriteLine("Compiling Sequence " + sequenceCodeInstruction.getMethodName(context)); } currentSequence = sequenceCodeInstruction; mv = cv.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, sequenceCodeInstruction.getMethodName(context), "()V", null, exceptions); mv.visitCode(); context.MethodVisitor = mv; context.startSequenceMethod(); compile(context, mv, sequenceCodeInstruction.CodeSequence.Instructions); context.endSequenceMethod(); mv.visitMaxs(context.MaxStack, context.MaxLocals); mv.visitEnd(); } currentSequence = null; cv.visitEnd(); if (debugOutput != null) { log.trace(debugOutput.ToString()); } try { compiledClass = loadExecutable(context, className, cw.toByteArray()); } catch (System.NullReferenceException e) { Console.WriteLine("Error while compiling " + className + ": " + e); } return(compiledClass); }
/// <summary> /// Constructs a new /// <see cref="SerialVersionUIDAdder" /> /// . /// </summary> /// <param name="api"> /// the ASM API version implemented by this visitor. Must be one of /// <see cref="Org.Objectweb.Asm.Opcodes.Asm4" /> /// , /// <see cref="Org.Objectweb.Asm.Opcodes.Asm5" /> /// , /// <see cref="Org.Objectweb.Asm.Opcodes.Asm6" /> /// or /// <see cref="Org.Objectweb.Asm.Opcodes.Asm7" /> /// . /// </param> /// <param name="classVisitor"> /// a /// <see cref="Org.Objectweb.Asm.ClassVisitor" /> /// to which this visitor will delegate calls. /// </param> protected internal SerialVersionUIDAdder(VisitorAsmApiVersion api, ClassVisitor classVisitor) : base(api, classVisitor) { }
public virtual string Accept(ClassVisitor visitor) { return(visitor.Visit(this)); }
/// <summary>Makes the given class visitor visit this inner class.</summary> /// <param name="classVisitor">a class visitor.</param> public virtual void Accept(ClassVisitor classVisitor) { classVisitor.VisitInnerClass(name, outerName, innerName, access); }
/// <summary> /// Constructs a new /// <see cref="ClassRemapper" /> /// . <i>Subclasses must not use this constructor</i>. /// Instead, they must use the /// <see cref="ClassRemapper(int,ObjectWeb.Asm.ClassVisitor,ObjectWeb.Asm.Commons.Remapper)" /> /// version. /// </summary> /// <param name="classVisitor">the class visitor this remapper must deleted to.</param> /// <param name="remapper"> /// the remapper to use to remap the types in the visited class. /// </param> public ClassRemapper(ClassVisitor classVisitor, Remapper remapper) : this(VisitorAsmApiVersion.Asm7, classVisitor, remapper) { }
/// <summary>Makes the given class visitor visit this class.</summary> /// <param name="classVisitor">a class visitor.</param> public virtual void Accept(ClassVisitor classVisitor) { // Visit the header. var interfacesArray = new string[interfaces.Count]; Collections.ToArray(interfaces, interfacesArray); classVisitor.Visit(version, access, name, signature, superName, interfacesArray); // Visit the source. if (sourceFile != null || sourceDebug != null) { classVisitor.VisitSource(sourceFile, sourceDebug); } // Visit the module. if (module != null) { module.Accept(classVisitor); } // Visit the nest host class. if (nestHostClass != null) { classVisitor.VisitNestHost(nestHostClass); } // Visit the outer class. if (outerClass != null) { classVisitor.VisitOuterClass(outerClass, outerMethod, outerMethodDesc); } // Visit the annotations. if (visibleAnnotations != null) { for (int i = 0, n = visibleAnnotations.Count; i < n; ++i) { var annotation = visibleAnnotations[i]; annotation.Accept(classVisitor.VisitAnnotation(annotation.desc, true)); } } if (invisibleAnnotations != null) { for (int i = 0, n = invisibleAnnotations.Count; i < n; ++i) { var annotation = invisibleAnnotations[i]; annotation.Accept(classVisitor.VisitAnnotation(annotation.desc, false)); } } if (visibleTypeAnnotations != null) { for (int i = 0, n = visibleTypeAnnotations.Count; i < n; ++i) { var typeAnnotation = visibleTypeAnnotations[i]; typeAnnotation.Accept(classVisitor.VisitTypeAnnotation(typeAnnotation.typeRef, typeAnnotation .typePath, typeAnnotation.desc, true)); } } if (invisibleTypeAnnotations != null) { for (int i = 0, n = invisibleTypeAnnotations.Count; i < n; ++i) { var typeAnnotation = invisibleTypeAnnotations[i]; typeAnnotation.Accept(classVisitor.VisitTypeAnnotation(typeAnnotation.typeRef, typeAnnotation .typePath, typeAnnotation.desc, false)); } } // Visit the non standard attributes. if (attrs != null) { for (int i = 0, n = attrs.Count; i < n; ++i) { classVisitor.VisitAttribute(attrs[i]); } } // Visit the nest members. if (nestMembers != null) { for (int i = 0, n = nestMembers.Count; i < n; ++i) { classVisitor.VisitNestMember(nestMembers[i]); } } // Visit the permitted subtypes. if (permittedSubtypesExperimental != null) { for (int i = 0, n = permittedSubtypesExperimental.Count; i < n; ++i) { classVisitor.VisitPermittedSubtypeExperimental(permittedSubtypesExperimental[i]); } } // Visit the inner classes. for (int i = 0, n = innerClasses.Count; i < n; ++i) { innerClasses[i].Accept(classVisitor); } // Visit the record components. if (recordComponentsExperimental != null) { for (int i = 0, n = recordComponentsExperimental.Count; i < n; ++i) { recordComponentsExperimental[i].AcceptExperimental(classVisitor); } } // Visit the fields. for (int i = 0, n = fields.Count; i < n; ++i) { fields[i].Accept(classVisitor); } // Visit the methods. for (int i = 0, n = methods.Count; i < n; ++i) { methods[i].Accept(classVisitor); } classVisitor.VisitEnd(); }
public virtual Accept(ClassVisitor visitor) { visitor.Visit(this); }
/// <summary> /// Constructs a new /// <see cref="StaticInitMerger" /> /// . <i>Subclasses must not use this constructor</i>. /// Instead, they must use the /// <see cref="StaticInitMerger(int,string,ObjectWeb.Asm.ClassVisitor)" /> /// version. /// </summary> /// <param name="prefix"> /// the prefix to use to rename the existing <clinit> methods. /// </param> /// <param name="classVisitor"> /// the class visitor to which this visitor must delegate method calls. May be /// null. /// </param> public StaticInitMerger(string prefix, ClassVisitor classVisitor) : this(VisitorAsmApiVersion.Asm7, prefix, classVisitor) { }
public override string Accept(ClassVisitor visitor) { return(visitor.Visit(this)); }