Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeBuilder.GetProperties with flag doesn't work #429

Open
NN--- opened this issue Nov 1, 2012 · 2 comments
Open

TypeBuilder.GetProperties with flag doesn't work #429

NN--- opened this issue Nov 1, 2012 · 2 comments

Comments

@NN---
Copy link
Member

NN--- commented Nov 1, 2012

namespace MacroLibrary1
{
  [MacroUsage(MacroPhase.WithTypedMembers, MacroTargets.Class)]
  public macro Macro1(tb : TypeBuilder)
  {
    M.Do(tb)
  }

  module M
  {
    public Do(tb : TypeBuilder) : PExpr
    {
      Message.Hint("Properties");
      foreach (v in tb.GetProperties())
        Message.Hint($"$v");

      Message.Hint("Instance properties");
      foreach (v in tb.GetProperties(BindingFlags.Instance))
        Message.Hint($"$v");

      Message.Hint("Static properties");
      foreach (v in tb.GetProperties(BindingFlags.Static))
        Message.Hint($"$v");
      <[ ]>
    }
  }
}
[Macro1]
class Program
{
  P : int { get { 0 } }
  static SP : int { get { 0 } }

  static Main() : void
  { }
}

Output

hint: Properties
hint: property: Program.SP : int { get; }
hint: property: Program.P : int { get; }
hint: Instance properties
hint: Static properties

No instance and static properties !

Workaround: specify "BindingFlags.Public | BindingFlags.NonPublic"

@VladD2
Copy link
Member

VladD2 commented Nov 1, 2012

I think, you should add BindingFlags.Public or/and BindingFlags.NonPublic value.

@NN---
Copy link
Member Author

NN--- commented Nov 1, 2012

Yes this helped.
But I think this should be implicit if you do not specify none of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants