本文整理汇总了C#中Scope.LookupLabel方法的典型用法代码示例。如果您正苦于以下问题:C# Scope.LookupLabel方法的具体用法?C# Scope.LookupLabel怎么用?C# Scope.LookupLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scope
的用法示例。
在下文中一共展示了Scope.LookupLabel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseBreak
private static void ParseBreak(Scope scope, LuaLexer code)
{
FetchToken(LuaToken.KwBreak, code);
// Erzeuge die Expression
scope.AddExpression(Expression.Goto(scope.LookupLabel(null, csBreakLabel)));
// Optionales Semicolon
FetchToken(LuaToken.Semicolon, code, true);
}
示例2: ParseLabel
private static void ParseLabel(Scope scope, LuaLexer code)
{
// ::identifier::
FetchToken(LuaToken.ColonColon, code);
// Erzeuge das Label
scope.AddExpression(Expression.Label(scope.LookupLabel(null, FetchToken(LuaToken.Identifier, code).Value)));
FetchToken(LuaToken.ColonColon, code);
}
示例3: ParseReturn
private static void ParseReturn(Scope scope, LuaLexer code)
{
// eat return
code.Next();
// Build the return expression for all parameters
Expression exprReturnValue;
if (IsExpressionStart(code)) // there is a return value
{
if (scope.ReturnType == typeof(LuaResult))
{
exprReturnValue = GetLuaResultExpression(scope, code.Current, ParseExpressionList(scope, code).ToArray());
}
else if (scope.ReturnType.IsArray)
{
Type typeArray = scope.ReturnType.GetElementType();
exprReturnValue = Expression.NewArrayInit(
typeArray,
from c in ParseExpressionList(scope, code) select ConvertExpression(scope.Runtime, code.Current, c, typeArray));
}
else
{
List<Expression> exprList = new List<Expression>(ParseExpressionList(scope, code));
if (exprList.Count == 1)
exprReturnValue = ConvertExpression(scope.Runtime, code.Current, exprList[0], scope.ReturnType);
else
{
ParameterExpression tmpVar = Expression.Variable(scope.ReturnType);
exprList[0] = Expression.Assign(tmpVar, ConvertExpression(scope.Runtime, code.Current, exprList[0], scope.ReturnType));
exprList.Add(tmpVar);
exprReturnValue = Expression.Block(scope.ReturnType, new ParameterExpression[] { tmpVar }, exprList);
}
}
}
else // use the default-value
{
if (scope.ReturnType == typeof(LuaResult))
exprReturnValue = Expression.Property(null, Lua.ResultEmptyPropertyInfo);
else if (scope.ReturnType.IsArray)
exprReturnValue = Expression.NewArrayInit(scope.ReturnType.GetElementType());
else
exprReturnValue = Expression.Default(scope.ReturnType);
}
if (code.Current.Typ == LuaToken.Semicolon)
code.Next();
scope.AddExpression(Expression.Goto(scope.LookupLabel(scope.ReturnType, csReturnLabel), exprReturnValue));
}
示例4: ParseGoto
private static void ParseGoto(Scope scope, LuaLexer code)
{
// goto Identifier
FetchToken(LuaToken.KwGoto, code);
var t = FetchToken(LuaToken.Identifier, code);
scope.AddExpression(Expression.Goto(scope.LookupLabel(null, t.Value)));
}