Skip to content
  • Alp Mestanogullari's avatar
    compiler: introduce DynFlags plugins · 900cf195
    Alp Mestanogullari authored and Marge Bot's avatar Marge Bot committed
    They have type '[CommandLineOpts] -> Maybe (DynFlags -> IO DynFlags)'.
    All plugins that supply a non-Nothing 'dynflagsPlugin' will see their
    updates applied to the current DynFlags right after the plugins are
    loaded.
    
    One use case for this is to superseede !1580 for registering hooks
    from a plugin. Frontend/parser plugins were considered to achieve this
    but they respectively conflict with how this plugin is going to be used
    and don't allow overriding/modifying the DynFlags, which is how hooks have
    to be registered.
    
    This commit comes with a test, 'test-hook-plugin', that registers a "fake"
    meta hook that replaces TH expressions with the 0 integer literal.
    900cf195