本文整理汇总了C#中System.Linq.Expressions.LabelTarget类的典型用法代码示例。如果您正苦于以下问题:C# LabelTarget类的具体用法?C# LabelTarget怎么用?C# LabelTarget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LabelTarget类属于System.Linq.Expressions命名空间,在下文中一共展示了LabelTarget类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ForCSharpStatement
internal ForCSharpStatement(ReadOnlyCollection<ParameterExpression> variables, ReadOnlyCollection<Expression> initializers, Expression test, ReadOnlyCollection<Expression> iterators, Expression body, LabelTarget breakLabel, LabelTarget continueLabel)
: base(test, body, breakLabel, continueLabel)
{
Variables = variables;
Initializers = initializers;
Iterators = iterators;
}
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:7,代码来源:ForCSharpStatement.cs
示例2: Update
public Expression Update(LabelTarget labelTarget, Type type) {
if (LabelTarget.Equals(labelTarget) && Type.Equals(type)) {
return this;
}
return AstExpression.Label(_labelStatement, ParentScope, Visitor);
}
开发者ID:sagifogel,项目名称:NJection.LambdaConverter,代码行数:7,代码来源:Label.cs
示例3: Update
public Expression Update(LabelTarget labelTarget, Type type) {
if (LabelTarget.Equals(labelTarget) && Type.Equals(type)) {
return this;
}
return AstExpression.Goto(_gotoStatement, this as IScope, Visitor);
}
开发者ID:sagifogel,项目名称:NJection.LambdaConverter,代码行数:7,代码来源:Goto.cs
示例4: BeforeVisit
public override void BeforeVisit(Function node)
{
base.BeforeVisit(node);
//_currentOutputExp = Expression.Parameter(typeof (TextWriter), CurrentOutputIdentifier);
//Create return target
_returnLabelTarget = Expression.Label(typeof(object), "lambdaReturn");
}
开发者ID:dlurton,项目名称:Happy,代码行数:7,代码来源:AstAnalyzer.Function.cs
示例5: Compile
public override Expression Compile(ParameterExpression stateParameterExpression, LabelTarget returnTarget, LogicExpression valueExpression)
{
var value = this.Target.Compile(stateParameterExpression, returnTarget);
var convertedValue = Expression.Convert(value, typeof(LogicStructureInstance));
var valueVariable = Expression.Variable(typeof(LogicStructureInstance), "value");
var field = Expression.Variable(typeof(LogicField), "field");
Expression<Func<LogicStructureInstance, string, LogicField>> lookupField =
(x, z) => x.Fields.Keys.First(y => y.Name == z);
var assignValue = Expression.Assign(valueVariable, convertedValue);
var assignFieldName = Expression.Assign(
field,
Expression.Invoke(lookupField, valueVariable, Expression.Constant(this.Field)));
var assignField =
Expression.Assign(
Expression.Property(Expression.Property(valueVariable, "Fields"), "Item", field),
Expression.Convert(valueExpression.Compile(stateParameterExpression, returnTarget), typeof(object)));
var assignFieldSet =
Expression.Assign(
Expression.Property(Expression.Property(valueVariable, "FieldsSet"), "Item", field),
Expression.Constant(true));
return Expression.Block(
new[] { valueVariable, field },
assignValue,
assignFieldName,
assignField,
assignFieldSet);
}
开发者ID:johnsonc,项目名称:Protogame,代码行数:31,代码来源:FieldLogicAssignmentTarget.cs
示例6: GotoExpression
internal GotoExpression(GotoExpressionKind kind, LabelTarget target, Expression value, Type type)
{
_kind = kind;
_value = value;
_target = target;
_type = type;
}
开发者ID:er0dr1guez,项目名称:corefx,代码行数:7,代码来源:GotoExpression.cs
示例7: Bind
public sealed override Expression Bind(object[] args, ReadOnlyCollection<ParameterExpression> parameters, LabelTarget returnLabel) {
if (args.Length == 0) {
throw new InvalidOperationException();
}
MetaObject[] mos;
if (args.Length != 1) {
mos = new MetaObject[args.Length - 1];
for (int i = 1; i < args.Length; i++) {
mos[i - 1] = MetaObject.ObjectToMetaObject(args[i], parameters[i]);
}
} else {
mos = MetaObject.EmptyMetaObjects;
}
MetaObject binding = Bind(
MetaObject.ObjectToMetaObject(args[0], parameters[0]),
mos
);
if (binding == null) {
throw Error.BindingCannotBeNull();
}
return GetMetaObjectRule(binding, returnLabel);
}
开发者ID:mscottford,项目名称:ironruby,代码行数:26,代码来源:MetaObjectBinder.cs
示例8: Loop
public static LoopExpression Loop(Expression body, LabelTarget @break, LabelTarget @continue) {
RequiresCanRead(body, "body");
// TODO: lift the restriction on break, and allow loops to have non-void type
ContractUtils.Requires(@break == null || @break.Type == typeof(void), "break", Strings.LabelTypeMustBeVoid);
ContractUtils.Requires(@continue == null || @continue.Type == typeof(void), "continue", Strings.LabelTypeMustBeVoid);
return new LoopExpression(body, @break, @continue);
}
开发者ID:mscottford,项目名称:ironruby,代码行数:7,代码来源:LoopExpression.cs
示例9: Update
public ForEachExpression Update(ParameterExpression variable, Expression enumerable, Expression body, LabelTarget breakTarget, LabelTarget continueTarget)
{
if (this.variable == variable && this.enumerable == enumerable && this.body == body && break_target == breakTarget && continue_target == continueTarget)
return this;
return CustomExpression.ForEach(variable, enumerable, body, continueTarget, breakTarget);
}
开发者ID:netcasewqs,项目名称:nlite,代码行数:7,代码来源:ForEachExpression.cs
示例10: Update
public Expression Update(LabelTarget target, Type type, Expression value) {
if (Target.Equals(target) && Type.Equals(type) && Value.Equals(value)) {
return this;
}
return AstExpression.Break(_breakStatement, ParentScope, Visitor);
}
开发者ID:sagifogel,项目名称:NJection.LambdaConverter,代码行数:7,代码来源:Break.cs
示例11: AplusScope
public AplusScope(AplusScope parent,
string name,
Aplus runtime = null,
DLR.ParameterExpression runtimeParam = null,
DLR.ParameterExpression moduleParam = null,
DLR.LabelTarget returnTarget = null,
bool isEval = false,
bool isMethod = false,
bool isAssignment = false)
{
this.parent = parent;
this.name = name;
this.runtime = runtime;
this.runtimeParam = runtimeParam;
this.moduleParam = moduleParam;
this.returnTarget = returnTarget;
this.variables = new Dictionary<string, DLR.ParameterExpression>();
this.callbackInfo = new CallbackInfoStorage();
this.iseval = isEval;
this.ismethod = isMethod;
this.isAssignment = isAssignment;
InheritProperties(parent);
}
开发者ID:sammoorhouse,项目名称:aplusdotnet,代码行数:29,代码来源:AplusScope.cs
示例12: Update
public Expression Update(LabelTarget label, Type type) {
if (LabelTarget.Equals(label) && Type.Equals(type)) {
return this;
}
return AstExpression.Continue(_continueStatement, this as IScope, Visitor);
}
开发者ID:sagifogel,项目名称:NJection.LambdaConverter,代码行数:7,代码来源:Continue.cs
示例13: Update
public Expression Update(GotoExpressionKind kind, LabelTarget target, Expression value) {
if (Target.Equals(target) && ReferenceEquals(Value, value) && Kind == kind) {
return this;
}
return AstExpression.Return(_returnStatement, ParentScope, Visitor);
}
开发者ID:sagifogel,项目名称:NJection.LambdaConverter,代码行数:7,代码来源:Return.cs
示例14: Update
public Expression Update(LabelTarget target, Expression defaultValue) {
if (Target.Equals(target) && DefaultValue == defaultValue) {
return this;
}
return AstExpression.Label(_caseLabel, ParentScope, Visitor);
}
开发者ID:sagifogel,项目名称:NJection.LambdaConverter,代码行数:7,代码来源:CaseLabel.cs
示例15: Switch
public static SwitchExpression Switch(Expression value, LabelTarget label, IEnumerable<SwitchCase> cases) {
RequiresCanRead(value, "value");
ContractUtils.Requires(value.Type == typeof(int), "value", Strings.ValueMustBeInt);
ContractUtils.RequiresNotNull(cases, "cases");
var caseList = cases.ToReadOnly();
ContractUtils.RequiresNotEmpty(caseList, "cases");
ContractUtils.RequiresNotNullItems(caseList, "cases");
// TODO: does it make sense for switch to have non-void type?
ContractUtils.Requires(label == null || label.Type == typeof(void), "label", Strings.LabelTypeMustBeVoid);
bool @default = false;
int max = Int32.MinValue;
int min = Int32.MaxValue;
foreach (SwitchCase sc in caseList) {
if (sc.IsDefault) {
ContractUtils.Requires(@default == false, "cases", Strings.OnlyDefaultIsAllowed);
@default = true;
} else {
int val = sc.Value;
if (val > max) max = val;
if (val < min) min = val;
}
}
ContractUtils.Requires(UniqueCaseValues(caseList, min, max), "cases", Strings.CaseValuesMustBeUnique);
return new SwitchExpression(value, label, caseList);
}
开发者ID:mscottford,项目名称:ironruby,代码行数:28,代码来源:SwitchExpression.cs
示例16: Compile
public override Expression Compile(ParameterExpression stateParameterExpression, LabelTarget returnTarget)
{
return Expression.Property(
Expression.Property(stateParameterExpression, "Variables"),
"Item",
Expression.Constant(this.Identifier));
}
开发者ID:johnsonc,项目名称:Protogame,代码行数:7,代码来源:IdentifierLogicExpression.cs
示例17: Update
public Expression Update(LabelTarget target, Type type, Expression value) {
if (Target.Equals(target) && Type.Equals(type) && Value.Equals(value)) {
return this;
}
return AstExpression.Init(_variableInitializer, ParentScope, Visitor);
}
开发者ID:sagifogel,项目名称:NJection.LambdaConverter,代码行数:7,代码来源:Init.cs
示例18: Update
public LoopExpression Update (LabelTarget breakLabel, LabelTarget continueLabel, Expression body)
{
Contract.Requires(body != null);
Contract.Requires(continueLabel == null || continueLabel.Type == typeof(void), "Continue label type must be void");
Contract.Ensures(Contract.Result<LoopExpression>() != null);
return default(LoopExpression);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:7,代码来源:System.Linq.Expressions.LoopExpression.cs
示例19: Update
public GotoExpression Update (LabelTarget target, Expression value)
{
Contract.Requires(target != null);
Contract.Requires(value != null || target.Type == typeof(void), "Label type must be void when no value is provided");
Contract.Ensures(Contract.Result<GotoExpression>() != null);
return default(GotoExpression);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:7,代码来源:System.Linq.Expressions.GotoExpression.cs
示例20: Bind
// Just splat the args and dispatch through a nested site
public override Expression Bind(object[] args, ReadOnlyCollection<ParameterExpression> parameters, LabelTarget returnLabel) {
Debug.Assert(args.Length == 2);
int count = ((object[])args[1]).Length;
ParameterExpression array = parameters[1];
var nestedArgs = new ReadOnlyCollectionBuilder<Expression>(count + 1);
var delegateArgs = new Type[count + 3]; // args + target + returnType + CallSite
nestedArgs.Add(parameters[0]);
delegateArgs[0] = typeof(CallSite);
delegateArgs[1] = typeof(object);
for (int i = 0; i < count; i++) {
nestedArgs.Add(Expression.ArrayAccess(array, Expression.Constant(i)));
delegateArgs[i + 2] = typeof(object).MakeByRefType();
}
delegateArgs[delegateArgs.Length - 1] = typeof(object);
return Expression.IfThen(
Expression.Equal(Expression.ArrayLength(array), Expression.Constant(count)),
Expression.Return(
returnLabel,
Expression.MakeDynamic(
Expression.GetDelegateType(delegateArgs),
new ComInvokeAction(new CallInfo(count)),
nestedArgs
)
)
);
}
开发者ID:jschementi,项目名称:iron,代码行数:30,代码来源:ComInvokeAction.cs
注:本文中的System.Linq.Expressions.LabelTarget类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论