C# 클래스 LeMP.StandardMacros

파일 보기 프로젝트 열기: qwertie/ecsharp 1 사용 예제들

공개 메소드들

메소드 설명
IsExpressionContext ( IMacroContext ctx ) : bool
IsExpressionContext ( LNode parent, int index ) : bool
KeyNameComponentOf ( LNode name ) : Symbol

Retrieves the "key" name component for the nameof(...) macro.

The key name component of global::Foo!int.Bar!T(x) (in C# notation global::Foo<int>.Bar<T>(x)) is Bar. This example tree has the structure ((((global::Foo)!int).Bar)!T)(x)).

MaybeRemoveNoOpFromRunSeq ( VList runSeq ) : VList
NextStatementMayBeReachable ( LNode stmt ) : bool

Given a statement, this method attempts to decide if the immediately following statement (if any) is reachable.

The goal of this code is to avoid the dreaded compiler warning "Unreachable code detected". This is just a heuristic since we don't have access to proper reachability analysis. In fact, it's no doubt buggy.

NextTempName ( IMacroContext ctx, LNode value ) : Symbol
NextTempName ( IMacroContext ctx, string prefix = "tmp_" ) : Symbol
Replace ( LNode stmt, LNode>.Pair patterns, int &replacementCount ) : LNode
Replace ( VList stmts, LNode>.Pair patterns, int &replacementCount ) : VList

Searches a list of expressions/statements for one or more patterns, and performs replacements.

LNodeExt.MatchesPattern is used for matching.

ReplaceCaptures ( LNode outputSpec, LNode>.MMap captures ) : LNode

Finds capture variables like $x and replaces them with values from captures (e.g. captures[(Symbol)"x"] for $x)

UseSymbolsCore ( VList symbolAttrs, VList options, VList body, IMacroContext context, bool inType ) : LNode
unroll ( LNode var, VList cases, LNode body, IMessageSink sink ) : LNode

보호된 메소드들

메소드 설명
LooksLikeSimpleValue ( LNode value ) : bool
MaybeAddTempVarDecl ( IMacroContext ctx, LNode value, WList output ) : LNode

비공개 메소드들

메소드 설명
@unless ( LNode node, IMessageSink sink ) : LNode
AddCsLineDirectives ( LNode node, IMacroContext context ) : LNode
AddLineDirectives ( VList nodes, bool stmtContext, int &sourceLine_ ) : VList
AlgebraicDataType ( LNode classDecl, IMacroContext context ) : LNode
AutoStripBraces ( LNode node ) : LNode
BackingField ( LNode prop, IMessageSink sink ) : LNode
ChooseArgName ( Symbol fieldName ) : Symbol
ChooseFieldName ( Symbol propName ) : Symbol
ColonEquals ( LNode node, IMessageSink sink ) : LNode
DSOCM_DistributeAttributes ( VList attrs, LNode &newArg, LNode &propOrFieldDecl ) : void
DetectMissingVoidReturn ( IMacroContext context, LNode lastStmt ) : bool
DetectSetOrCreateMember ( LNode arg, Symbol &relevantAttribute, Symbol &fieldName, Symbol &paramName, LNode &newArg, LNode &propOrFieldDecl ) : bool
DoDeconstruct ( LNode arg, IMacroContext context, bool printErrorOnFailure ) : void
DollarSignIdentity ( LNode node, IMacroContext context ) : LNode
DollarSignVariable ( LNode node, IMacroContext context ) : LNode
GetAssertMethod ( IMacroContext context ) : LNode
GetCases ( VList body, IMessageSink sink ) : VList>>.VList

Given the contents of case statement like `matchCode` or `switch`, this method gets a list of the cases.

GetFnAndClassName ( IMacroContext context, LNode &@class, LNode &fn ) : Symbol
GetFnAndClassNameString ( IMacroContext context ) : string
GetNamespaces ( LNode multiName ) : IEnumerable
In ( LNode node, IMacroContext context ) : LNode
IsCaseLabel ( LNode @case ) : bool
IsDefaultLabel ( LNode stmt ) : bool
IsVar ( LNode arg, LNode &type, Symbol &name, LNode &defaultValue ) : bool
MaybeInitTupleMakers ( object>.IDictionary properties ) : LNode>>.IList
MergeIdentifiers ( LNode left, LNode right ) : LNode
Namespace ( LNode node, IMacroContext context ) : LNode
NullCoalesceSet ( LNode node, IMessageSink sink ) : LNode
QuickBind ( LNode node, IMessageSink sink ) : LNode
RangeExcl ( LNode node, IMacroContext context ) : LNode
RangeIncl ( LNode node, IMacroContext context ) : LNode
ReduceBooleanExpr ( LNode node ) : LNode
Reject ( IMessageSink sink, LNode at, string msg ) : LNode
ReplaceAt ( bool &modified, TokenTree &tokens, int i, Token newToken ) : void
ReplaceInTokenTree ( TokenTree &tokens, InternalList Replacements ) : bool

Replaces Ids with Ids or Literals in token trees.

ScanForVariables ( LNode code ) : LNode>.Dictionary
SetOrCreateMember ( LNode fn, IMessageSink sink ) : LNode
SetSyntaxVariables ( LNode>.IDictionary captures, IMacroContext context ) : void
StaticIf ( LNode @if, IMacroContext context ) : LNode
TempVarDecl ( IMacroContext ctx, LNode value, LNode &tmpVarName ) : LNode
TempVarDecl ( IMacroContext ctx, LNode value, LNode &tmpVarName, string prefix ) : LNode
TransformOnCatch ( LNode node, LNode firstArg, LNode rest, LNode on_handler ) : LNode
TryReplaceHere ( LNode node, LNode pattern, LNode replacement, LNode>.MMap captures, LNode>.Pair allPatterns ) : LNode
TryReplaceHere ( LNode node, LNode>.Pair patterns, LNode>.MMap temp ) : LNode
Tuple ( LNode node, IMacroContext context ) : LNode
TupleType ( LNode node, IMacroContext context ) : LNode
UnpackTuple ( LNode node, IMacroContext context ) : LNode
UsingMulti ( LNode stmt, IMacroContext context ) : LNode
ValidateOnStmt ( LNode node, IMacroContext context, VList &restOfStmts, LNode &firstArg ) : LNode
WarnAboutMissingDollarSigns ( LNode argList, IMacroContext context, LNode pattern, LNode replacement ) : void
_assert ( LNode node, IMacroContext context ) : LNode
concatId ( LNode node, IMessageSink sink ) : LNode
ecs ( LNode node, IMacroContext context ) : LNode
includeFile ( LNode node, IMacroContext context ) : LNode
includeFileBinary ( LNode node, IMacroContext context ) : LNode
includeFileText ( LNode node, IMacroContext context ) : LNode
match ( LNode node, IMacroContext context ) : LNode
matchCode ( LNode node, IMacroContext context ) : LNode
on_finally ( LNode node, IMacroContext context ) : LNode
on_return ( LNode node, IMacroContext context ) : LNode
on_throw ( LNode node, IMacroContext context ) : LNode
on_throw_catch ( LNode node, IMacroContext context ) : LNode
replace ( LNode node, IMacroContext context ) : LNode
replaceFn ( LNode node, IMacroContext context1 ) : LNode
runSequence ( LNode node, IMacroContext context ) : LNode
saveAndRestore ( LNode node, IMacroContext context ) : LNode
scope ( LNode node, IMacroContext context ) : LNode
setTupleType ( LNode node, IMacroContext context ) : LNode
staticMatches ( LNode node, IMacroContext context ) : LNode
static_deconstruct ( LNode node, IMacroContext context ) : LNode
static_if ( LNode @if, IMacroContext context ) : LNode
static_matchCode ( LNode node, IMacroContext context ) : LNode
static_tryDeconstruct ( LNode node, IMacroContext context ) : LNode
stringify ( LNode node, IMacroContext context ) : LNode
treeEquals ( LNode node, IMacroContext context ) : LNode
unroll ( LNode node, IMacroContext context ) : LNode
useDefaultTupleTypes ( LNode node, IMacroContext context ) : LNode
useSequenceExpressions ( LNode node, IMacroContext context ) : LNode
useSymbols ( LNode input, IMacroContext context ) : LNode
with ( LNode fn, IMacroContext context ) : LNode

메소드 상세

IsExpressionContext() 공개 정적인 메소드

public static IsExpressionContext ( IMacroContext ctx ) : bool
ctx IMacroContext
리턴 bool

IsExpressionContext() 공개 정적인 메소드

public static IsExpressionContext ( LNode parent, int index ) : bool
parent LNode
index int
리턴 bool

KeyNameComponentOf() 공개 정적인 메소드

Retrieves the "key" name component for the nameof(...) macro.
The key name component of global::Foo!int.Bar!T(x) (in C# notation global::Foo<int>.Bar<T>(x)) is Bar. This example tree has the structure ((((global::Foo)!int).Bar)!T)(x)).
public static KeyNameComponentOf ( LNode name ) : Symbol
name LNode
리턴 Symbol

LooksLikeSimpleValue() 보호된 정적인 메소드

protected static LooksLikeSimpleValue ( LNode value ) : bool
value LNode
리턴 bool

MaybeAddTempVarDecl() 보호된 정적인 메소드

protected static MaybeAddTempVarDecl ( IMacroContext ctx, LNode value, WList output ) : LNode
ctx IMacroContext
value LNode
output WList
리턴 LNode

MaybeRemoveNoOpFromRunSeq() 공개 정적인 메소드

public static MaybeRemoveNoOpFromRunSeq ( VList runSeq ) : VList
runSeq VList
리턴 VList

NextStatementMayBeReachable() 공개 정적인 메소드

Given a statement, this method attempts to decide if the immediately following statement (if any) is reachable.
The goal of this code is to avoid the dreaded compiler warning "Unreachable code detected". This is just a heuristic since we don't have access to proper reachability analysis. In fact, it's no doubt buggy.
public static NextStatementMayBeReachable ( LNode stmt ) : bool
stmt LNode
리턴 bool

NextTempName() 공개 정적인 메소드

public static NextTempName ( IMacroContext ctx, LNode value ) : Symbol
ctx IMacroContext
value LNode
리턴 Symbol

NextTempName() 공개 정적인 메소드

public static NextTempName ( IMacroContext ctx, string prefix = "tmp_" ) : Symbol
ctx IMacroContext
prefix string
리턴 Symbol

Replace() 공개 정적인 메소드

public static Replace ( LNode stmt, LNode>.Pair patterns, int &replacementCount ) : LNode
stmt LNode
patterns LNode>.Pair
replacementCount int
리턴 LNode

Replace() 공개 정적인 메소드

Searches a list of expressions/statements for one or more patterns, and performs replacements.
LNodeExt.MatchesPattern is used for matching.
public static Replace ( VList stmts, LNode>.Pair patterns, int &replacementCount ) : VList
stmts VList A list of expressions/statements in which to search.
patterns LNode>.Pair Each pair consists of (A) something to search /// for and (B) a replacement expression. Part A can use the substitution /// operator with an identifier inside (e.g. $Foo) to "capture" any /// subexpression, and part B can use the same substitution (e.g. $Foo) /// to insert the captured subexpression(s) into the output.
replacementCount int Number of replacements that occurred.
리턴 VList

ReplaceCaptures() 공개 정적인 메소드

Finds capture variables like $x and replaces them with values from captures (e.g. captures[(Symbol)"x"] for $x)
public static ReplaceCaptures ( LNode outputSpec, LNode>.MMap captures ) : LNode
outputSpec LNode
captures LNode>.MMap
리턴 LNode

UseSymbolsCore() 공개 정적인 메소드

public static UseSymbolsCore ( VList symbolAttrs, VList options, VList body, IMacroContext context, bool inType ) : LNode
symbolAttrs VList
options VList
body VList
context IMacroContext
inType bool
리턴 LNode

unroll() 공개 정적인 메소드

public static unroll ( LNode var, VList cases, LNode body, IMessageSink sink ) : LNode
var LNode
cases VList
body LNode
sink IMessageSink
리턴 LNode