Giter Site home page Giter Site logo

Comments (3)

tmat avatar tmat commented on July 18, 2024

@333fred FYI

from roslyn.

333fred avatar 333fred commented on July 18, 2024

API Review

  • Could we just not use local functions here to make it easier?
    • Would require more wrapping of C# that we don't want to introduce.
  • Tokens aren't really understood by the compiler, and it seems odd that we'd return them.
  • This seems like it would be a significant chunk of work
  • There are other cases that would need to be considered, such as anonymous function symbols.

Conclusion: Needs work. We'll work offline to determine the future of the proposal.

from roslyn.

tmat avatar tmat commented on July 18, 2024

Tokens aren't really understood by the compiler, and it seems odd that we'd return them.

We do have ISymbol.MetadataToken public API that returns token of a PE symbol, or 0 if the symbol isn't a PE symbol with a token.

The proposed API is essentially similar to the existing API, it would instead work on symbols defined in source. I agree we should not try to implement it for symbols that are emitted as implementation details. A rule of thumb could be to support it for definitions that are named in the code and have tokens (named type, method or local function, field, property, event, parameter, generic parameter symbol).

The Semantic Search scenario that uses local function is just one hosting scenario. In general hosting scenario a host application uses Roslyn compilation to emit assembly, then loads the assembly and then interacts with the loaded entities via Reflection. The mapping between ISymbol and the emitted metadata might get complicated. E.g. when the host needs to distinguish 2 method overloads, or needs to find a symbol whose name is mangled (local function, explicit interface implementation, etc.).

Note also that EmitDifferenceResult, which derives from EmitResult and is used for EnC returns handles (tokens) to the methods and types it emitted.

from roslyn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.