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

Make Microsoft.Cci.RootModuleType methods virtual #40526

Open
jakubmisek opened this issue Dec 20, 2019 · 4 comments
Open

Make Microsoft.Cci.RootModuleType methods virtual #40526

jakubmisek opened this issue Dec 20, 2019 · 4 comments

Comments

@jakubmisek
Copy link

A proposal to make methods on Microsoft.Cci.RootModuleType virtual so it can be overridden. 3rd party compilers would be able to define static module constructors and other methods in there (which is in comply with MSIL specs)

Especially helpful would be to alter the method GetMethods

public IEnumerable<IMethodDefinition> GetMethods(EmitContext context)

to

public virtual IEnumerable<IMethodDefinition> GetMethods(EmitContext context)
@jnm2
Copy link
Contributor

jnm2 commented Dec 21, 2019

I ran into this with #40500.

Would reimplementing the Cci.ITypeDefinition.GetMethods interface method be a good workaround, or are there cases where GetMethods is not called using the interface?

/cc @jcouv

@jakubmisek
Copy link
Author

thank you! An implementation of Cci.ITypeDefinition.GetMethods providing some extension points would be sufficient.

As of now we had to re-implement the class just to make GetMethods to return a symbol for our .cctor

https://github.com/peachpiecompiler/peachpie/blob/a2b9abf1516c206c34cd8095076382bf85688d0a/src/Peachpie.CodeAnalysis/Emitter/Model/PhpRootModuleType.cs#L146

@gafter
Copy link
Member

gafter commented Dec 23, 2019

I understand this feature request is to enhance Roslyn's APIs to support 3rd party compilers. Supporting 3rd party compilers is not a goal of Roslyn, but I'll keep this feature request open.

@jakubmisek
Copy link
Author

That's alright, thank you. It can be workarounded by copy-pasting the RootModuleType source.

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

3 participants