• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# InternalLocal类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中InternalLocal的典型用法代码示例。如果您正苦于以下问题:C# InternalLocal类的具体用法?C# InternalLocal怎么用?C# InternalLocal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InternalLocal类属于命名空间,在下文中一共展示了InternalLocal类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DeclareLocal

        protected virtual IEntity DeclareLocal(Node sourceNode, string name, IType localType, bool privateScope)
        {
            ClearResolutionCacheFor(name);

            var local = new Local(name, privateScope);
            local.LexicalInfo = sourceNode.LexicalInfo;
            var entity = new InternalLocal(local, localType);
            local.Entity = entity;
            CurrentMethod.Locals.Add(local);
            return entity;
        }
开发者ID:stuman08,项目名称:boo,代码行数:11,代码来源:ProcessMethodBodies.cs


示例2: CloneOrAssignToTemp

 Expression CloneOrAssignToTemp(InternalLocal temp, Expression operand)
 {
     return null == temp
         ? operand.CloneNode()
         : CodeBuilder.CreateAssignment(
             CodeBuilder.CreateReference(temp),
             operand.CloneNode());
 }
开发者ID:stuman08,项目名称:boo,代码行数:8,代码来源:ProcessMethodBodies.cs


示例3: AddInternalFieldFor

		private void AddInternalFieldFor(InternalLocal entity)
		{
			Field field = _enumerator.AddInternalField(UniqueName(entity.Name), entity.Type);
			_mapping[entity] = field.Entity;
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:5,代码来源:GeneratorMethodProcessor.cs


示例4: IsExceptionHandlerVariable

		private bool IsExceptionHandlerVariable(InternalLocal local)
		{
			Declaration originalDeclaration = local.OriginalDeclaration;
			if (originalDeclaration == null) return false;
			return originalDeclaration.ParentNode is ExceptionHandler;
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:6,代码来源:GeneratorMethodProcessor.cs


示例5: CreateReference

 public ReferenceExpression CreateReference(InternalLocal local)
 {
     return CreateLocalReference(local.Name, local);
 }
开发者ID:0xb1dd1e,项目名称:boo,代码行数:4,代码来源:BooCodeBuilder.cs


示例6: ImplementByRefICallableCall

		void ImplementByRefICallableCall(
									Method call,
									InternalCallableType type,
									ClassDefinition node,
									CallableSignature signature,
									int byRefCount)
		{			
			MethodInvocationExpression mie = CreateInvokeInvocation(type);
			IParameter[] parameters = signature.Parameters;			
			ReferenceExpression args = CodeBuilder.CreateReference(call.Parameters[0]);
			InternalLocal[] temporaries = new InternalLocal[byRefCount];
			
			int byRefIndex = 0;
			for (int i=0; i<parameters.Length; ++i)
			{				
				SlicingExpression slice = CodeBuilder.CreateSlicing(args.CloneNode(), i);

				IParameter parameter = parameters[i];				
				if (parameter.IsByRef)
				{
					IType tempType = parameter.Type;
					if (tempType.IsByRef)
					{
						tempType = tempType.ElementType;
					}
					temporaries[byRefIndex] = CodeBuilder.DeclareLocal(call,
								"__temp_" + parameter.Name,
								tempType);
								
					call.Body.Add(
						CodeBuilder.CreateAssignment(
						CodeBuilder.CreateReference(temporaries[byRefIndex]),
							CodeBuilder.CreateCast(
								tempType,
								slice)));
						
					mie.Arguments.Add(
						CodeBuilder.CreateReference(
							temporaries[byRefIndex]));
					
					++byRefIndex;
				}
				else
				{
					mie.Arguments.Add(slice);
				}
			}
			
			if (TypeSystemServices.VoidType == signature.ReturnType)
			{
				call.Body.Add(mie);
				PropagateByRefParameterChanges(call, parameters, temporaries);
			}
			else
			{
				InternalLocal invokeReturnValue = CodeBuilder.DeclareLocal(call,
							"__returnValue", signature.ReturnType);
				call.Body.Add(
					CodeBuilder.CreateAssignment(
						CodeBuilder.CreateReference(invokeReturnValue),
						mie));
				PropagateByRefParameterChanges(call, parameters, temporaries);
				call.Body.Add(
					new ReturnStatement(
						CodeBuilder.CreateReference(invokeReturnValue)));
			}
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:67,代码来源:ImplementICallableOnCallableDefinitions.cs


示例7: LoadIndirectLocal

        void LoadIndirectLocal(InternalLocal local)
        {
            LoadLocal(local);

            IType et = local.Type.ElementType;
            PopType();
            PushType(et);
            OpCode code = GetLoadRefParamCode(et);
            if (code == OpCodes.Ldobj)
                _il.Emit(code, GetSystemType(et));
            else
                _il.Emit(code);
        }
开发者ID:Bombadil77,项目名称:boo,代码行数:13,代码来源:EmitAssembly.cs


示例8: CreateInitValueType

 public Expression CreateInitValueType(LexicalInfo li, InternalLocal local)
 {
     return CreateInitValueType(li, CreateReference(local));
 }
开发者ID:0xb1dd1e,项目名称:boo,代码行数:4,代码来源:BooCodeBuilder.cs


示例9: EmitAssignment

 void EmitAssignment(InternalLocal tag, IType typeOnStack)
 {
     // todo: assignment result must be type on the left in the
     // case of casting
     LocalBuilder local = tag.LocalBuilder;
     EmitCastIfNeeded(tag.Type, typeOnStack);
     _il.Emit(OpCodes.Stloc, local);
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:8,代码来源:EmitAssembly.cs


示例10: EmitIndirectAssignment

        void EmitIndirectAssignment(InternalLocal tag, IType typeOnStack)
        {
            IType et = tag.Type.ElementType;
            EmitCastIfNeeded(et, typeOnStack);

            OpCode code = GetStoreRefParamCode(et);
            if (code == OpCodes.Stobj)
                _il.Emit(code, GetSystemType(et));
            else
                _il.Emit(code);
        }
开发者ID:Bombadil77,项目名称:boo,代码行数:11,代码来源:EmitAssembly.cs


示例11: EmitIndirectAssignment

		void EmitIndirectAssignment(InternalLocal local, IType typeOnStack)
		{
			var elementType = local.Type.ElementType;
			EmitCastIfNeeded(elementType, typeOnStack);

			var code = GetStoreRefParamCode(elementType);
			if (code == OpCodes.Stobj)
				_il.Emit(code, GetSystemType(elementType));
			else
				_il.Emit(code);
		}
开发者ID:hlizard,项目名称:boo,代码行数:11,代码来源:EmitAssembly.cs


示例12: CreateReference

			private ReferenceExpression CreateReference(InternalLocal enteredLoop)
			{
				return CodeBuilder().CreateReference(enteredLoop);
			}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:4,代码来源:NormalizeIterationStatements.cs


示例13: CreateSideEffectAwareSlicingOperation

        private Expression CreateSideEffectAwareSlicingOperation(LexicalInfo lexicalInfo, BinaryOperatorType binaryOperator, SlicingExpression lvalue, Expression rvalue, InternalLocal returnValue)
        {
            MethodInvocationExpression eval = CodeBuilder.CreateEvalInvocation(lexicalInfo);
            if (HasSideEffect(lvalue.Target))
            {
                InternalLocal temp = AddInitializedTempLocal(eval, lvalue.Target);
                lvalue.Target = CodeBuilder.CreateReference(temp);
            }

            foreach (Slice slice in lvalue.Indices)
            {
                Expression index = slice.Begin;
                if (HasSideEffect(index))
                {
                    InternalLocal temp = AddInitializedTempLocal(eval, index);
                    slice.Begin = CodeBuilder.CreateReference(temp);
                }
            }

            BinaryExpression addition = CodeBuilder.CreateBoundBinaryExpression(
                GetExpressionType(lvalue),
                binaryOperator,
                CloneOrAssignToTemp(returnValue, lvalue),
                rvalue);
            Expression expansion = CodeBuilder.CreateAssignment(
                lvalue.CloneNode(),
                addition);
            // Resolve operator overloads if any
            BindArithmeticOperator(addition);
            if (eval.Arguments.Count > 0 || null != returnValue)
            {
                eval.Arguments.Add(expansion);
                if (null != returnValue)
                {
                    eval.Arguments.Add(CodeBuilder.CreateReference(returnValue));
                }
                BindExpressionType(eval, GetExpressionType(lvalue));
                expansion = eval;
            }
            return expansion;
        }
开发者ID:stuman08,项目名称:boo,代码行数:41,代码来源:ProcessMethodBodies.cs


示例14: LoadLocal

 void LoadLocal(InternalLocal local)
 {
     LoadLocal(local, false);
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:4,代码来源:EmitAssembly.cs


示例15: CreateDefaultInitializer

 public Expression CreateDefaultInitializer(LexicalInfo li, InternalLocal local)
 {
     return CreateDefaultInitializer(li, CreateReference(local), local.Type);
 }
开发者ID:0xb1dd1e,项目名称:boo,代码行数:4,代码来源:BooCodeBuilder.cs


示例16: CreateLocalReference

 public ReferenceExpression CreateLocalReference(string name, InternalLocal entity)
 {
     return CreateTypedReference(name, entity);
 }
开发者ID:0xb1dd1e,项目名称:boo,代码行数:4,代码来源:BooCodeBuilder.cs


示例17: SetLocal

        void SetLocal(BinaryExpression node, InternalLocal tag, bool leaveValueOnStack)
        {
            if (AstUtil.IsIndirection(node.Left))
                _il.Emit(OpCodes.Ldloc, tag.LocalBuilder);

            node.Right.Accept(this); // leaves type on stack

            IType typeOnStack = null;

            if (leaveValueOnStack)
            {
                typeOnStack = PeekTypeOnStack();
                _il.Emit(OpCodes.Dup);
            }
            else
            {
                typeOnStack = PopType();
            }

            if (!AstUtil.IsIndirection(node.Left))
                EmitAssignment(tag, typeOnStack);
            else
                EmitIndirectAssignment(tag, typeOnStack);
        }
开发者ID:Bombadil77,项目名称:boo,代码行数:24,代码来源:EmitAssembly.cs


示例18: DeclareLocal

 public InternalLocal DeclareLocal(Method node, string name, IType type)
 {
     Local local = new Local(node.LexicalInfo, name);
     InternalLocal entity = new InternalLocal(local, type);
     local.Entity = entity;
     node.Locals.Add(local);
     return entity;
 }
开发者ID:0xb1dd1e,项目名称:boo,代码行数:8,代码来源:BooCodeBuilder.cs


示例19: PropagateByRefParameterChanges

		void PropagateByRefParameterChanges(Method call, IParameter[] parameters, InternalLocal[] temporaries)
		{
			int byRefIndex = 0;
			for (int i=0; i<parameters.Length; ++i)
			{
				if (!parameters[i].IsByRef) continue;
				
				SlicingExpression slice = CodeBuilder.CreateSlicing(
											CodeBuilder.CreateReference(call.Parameters[0]),
											i);						
				call.Body.Add(
					CodeBuilder.CreateAssignment(
						slice,
						CodeBuilder.CreateReference(temporaries[byRefIndex])));
				++byRefIndex;
			}
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:17,代码来源:ImplementICallableOnCallableDefinitions.cs


示例20: PrepareEvaluationContextInitialization

 public Block PrepareEvaluationContextInitialization(IType evaluationContextType)
 {
     this._evaluationContextLocal = this.get_CodeBuilder().DeclareTempLocal(this.CurrentMethodNode, evaluationContextType);
     Block block = new Block();
     block.Add(this.get_CodeBuilder().CreateAssignment(this.CreateEvaluationContextReference(), this.get_CodeBuilder().CreateConstructorInvocation(UtilitiesModule.ConstructorTakingNArgumentsFor(evaluationContextType, 1), this.EvaluationDomainProviderReference())));
     foreach (ParameterDeclaration declaration in this.CurrentMethodNode.get_Parameters())
     {
         block.Add(this.get_CodeBuilder().CreateAssignment(this.CreateEvaluationContextFieldReference(this.GetEvaluationContextField(declaration)), this.get_CodeBuilder().CreateReference(declaration)));
     }
     return block;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:11,代码来源:ProcessEvalInvocations.cs



注:本文中的InternalLocal类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# InternalModelBuilder类代码示例发布时间:2022-05-24
下一篇:
C# InternalItem类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap