当前位置: 首页>>代码示例>>C#>>正文


C# InternalLocal类代码示例

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


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


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