string Render(Method method)
        {
            ClassType classType = new ClassType
                                  (
                fullyQualifiedName: "myClassFqn",
                assembly: "myModule",
                name: "myClass",
                isAbstract: true,
                initializer: new Initializer(),
                methods: new[] { method }
                                  );

            Symbols.MapTypeToPackage("myClassFqn", "myPackage");
            Symbols.MapNamespace("myNamespace", "MyNamespace");
            Symbols.MapTypeName("myClassFqn", "MyClass", JsonModel.Spec.TypeKind.Class);

            ClassMethodGenerator generator = new ClassMethodGenerator(classType, method, Symbols, Namespaces);

            MethodDeclarationSyntax methodSyntax = generator.CreateMethod();

            return(methodSyntax.NormalizeWhitespace(elasticTrivia: true).ToString());
        }
Exemplo n.º 2
0
 internal ClassGenerator(NativeCompiler compiler, ClassBinding binding)
     : base(compiler, binding)
 {
     this.InstanceMethodGenerator = InstanceMethodGenerator.CreateAndPrepareGenerator(this);
     this.ClassMethodGenerator    = ClassMethodGenerator.CreateAndPrepareGenerator(this);
 }