Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public static fields | Properties | Public Member Functions | Static Public Member Functions | List of all members
LeMP.MacroInfo Class Reference

Data returned from IMacroContext.AllKnownMacros More...


Source file:
Inheritance diagram for LeMP.MacroInfo:
LeMP.LexicalMacroAttribute

Remarks

Data returned from IMacroContext.AllKnownMacros

Public static fields

static ConcurrentDictionary
< Pair< Type, Symbol?>, List
< MacroInfo > > 
_macroCache = new ConcurrentDictionary<Pair<Type, Symbol?>, List<MacroInfo>>()
 

Properties

Symbol Namespace [get, set]
 
LexicalMacro Macro [get, set]
 
- Properties inherited from LeMP.LexicalMacroAttribute
string Syntax [get, set]
 
string Description [get, set]
 
string[] Names [get, set]
 
MacroMode Mode [get, set]
 
MacroMode Priority [get]
 
string[] DeprecatedNames [get, set]
 A list of names of the macro that have been deprecated. If a name is included in this list, it is not necessary to also include it in the list of Names, but doing so is allowed and won't make a difference. More...
 
string DeprecationMessage [get, set]
 A message to show when the deprecated macro is used. It is not necessary to set this property if the macro was simply renamed, as LeMP can automatically tell the user about the new name if both versions use the same method. More...
 

Public Member Functions

 MacroInfo (Symbol?@namespace, string name, LexicalMacro macro)
 
 MacroInfo (Symbol?@namespace, LexicalMacroAttribute a, LexicalMacro macro, bool deprecateAllNames=false)
 
- Public Member Functions inherited from LeMP.LexicalMacroAttribute
 LexicalMacroAttribute (string syntax, string description, params string[] names)
 LexicalMacroAttribute constuctor. More...
 

Static Public Member Functions

static IEnumerable< MacroInfoGetMacros (Type type, IMessageSink?errorSink=null, Symbol?@namespace=null, object?instance=null, bool permaCache=true)
 Uses reflection to find a list of macros within the specified type by searching for (static) methods that (1) are marked with LexicalMacroAttribute and (2) take no parameters and return a list (IEnumerable) of MacroInfo. Such methods are called to get macros. More...
 

Member Function Documentation

static IEnumerable<MacroInfo> LeMP.MacroInfo.GetMacros ( Type  type,
IMessageSink errorSink = null,
Symbol?@  namespace = null,
object?  instance = null,
bool  permaCache = true 
)
inlinestatic

Uses reflection to find a list of macros within the specified type by searching for (static) methods that (1) are marked with LexicalMacroAttribute and (2) take no parameters and return a list (IEnumerable) of MacroInfo. Such methods are called to get macros.

Parameters
typeThe type to search for macros.
namespaceOptionally overrides the namespace associated with macros marked with LexicalMacroAttribute. Does not affect macros returned in a list of MacroInfo.
errorSinkAn object in which to send error messages (Severity.Warning is used because unavailability of a macro should not appear as an error when compiling something with LeMP.)
instanceAn optional object of the same type as type, which will be used to bind instance methods. If this is null, only static methods are discovered.
permaCacheIf true, the list of macros is saved to avoid doing the reflection operations again if the same type is queried again. This is mainly useful in testing, when LeMP is reinitialized many times. This method is slow because of the reflection methods Delegate.CreateDelegate and especially MethodInfo.GetCustomAttributes. Note: caching is not supported when instance != null.
Returns

References LeMP.LexicalMacro().