Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Tidied CodeWriter and tweaked API for annotations/methods #1243

Merged
merged 4 commits into from
Jan 16, 2020

Conversation

paulbalaji
Copy link
Contributor

Description

Before:

  • annotation defined within the lambda for methods/types/enums
  • can only populate a method using Action<MethodBlock>

Now:

  • do .Annotate on the parent and then call .Method/.Type/.Enum
    • e.g. ns.Annotate("Serializable").Type("public struct Foobar", t => {});
  • .Method has a separate constructor taking Func<IEnumerable> instead of Action
    • e.g.
     t.Method("public static void Test()", () => new[]
     {
     	"var x = 42;",
     	"var y = 360;",
     	"return x + y;"
     });
     t.Method("public static void Test()", () => someList.some(a => wesome).linq());

Also enforced that you can only define namespace/using directives at the top-level CodeWriter

Tests

  • will use for build system codegen port

Documentation

  • changelog

Primary reviewers

If your change will take a long time to review, you can name at most two primary reviewers who are ultimately responsible for reviewing this request. @ mention them.

@improbable-prow-robot improbable-prow-robot added the jira/no-ticket Indicates a PR has no corresponding JIRA ticket label Jan 16, 2020
@improbable-prow-robot improbable-prow-robot added size/L Denotes a PR that changes 150-299 lines, ignoring generated files. A: tooling Area: Tooling labels Jan 16, 2020
@paulbalaji paulbalaji merged commit 3a839e1 into develop Jan 16, 2020
@paulbalaji paulbalaji deleted the feature/codewriter-tweaks branch January 16, 2020 17:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A: tooling Area: Tooling jira/no-ticket Indicates a PR has no corresponding JIRA ticket size/L Denotes a PR that changes 150-299 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants