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

C# IFieldReference类代码示例

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

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



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

示例1: Mangle

    internal string Mangle(IFieldReference field) {
      Contract.Requires(field != null);

      field.ResolvedField.Dispatch(this); //compute the hash
      var sb = new StringBuilder();
      sb.Append('_');
      sb.Append((uint)this.hash);
      sb.Append('_');
      this.AppendSanitizedName(sb, field.Name.Value);
      return sb.ToString();
    }
开发者ID:mestriga,项目名称:Microsoft.CciSamples,代码行数:11,代码来源:Mangler.cs


示例2: ReplacementMethodConstructionContext

        public ReplacementMethodConstructionContext(IMetadataHost host, IFieldReference originalField, IMethodDefinition fakeMethod, BlockStatement block, bool isAssignment, ILogger log, IReplaceableReference originalReference)
        {
            this.host = host;
            this.block = block;
            this.originalField = originalField;
            this.isAssignment = isAssignment;
            this.log = log;
            this.originalReference = originalReference;

            fakeMethodParameters = fakeMethod.Parameters;
            returnType = fakeMethod.Type;
        }
开发者ID:jamarchist,项目名称:SharpMock,代码行数:12,代码来源:ReplacementMethodConstructionContext.cs


示例3: Visit

        public override void Visit(IFieldReference fieldReference)
        {
            if (!alreadySeen.Add(fieldReference))
            {
                return;
            }

            IUnitReference definingUnit = MetadataWriter.GetDefiningUnitReference(fieldReference.GetContainingType(Context), Context);
            if (definingUnit != null && ReferenceEquals(definingUnit, this.module))
            {
                return;
            }

            this.Visit((ITypeMemberReference)fieldReference);
            this.Visit(fieldReference.GetType(Context));
            ReserveFieldToken(fieldReference);
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:17,代码来源:ReferenceIndexer.cs


示例4: TryGetFirstFieldReference

        /// <summary>
        /// Tries to get the first field reference in the method body
        /// </summary>
        /// <param name="body"></param>
        /// <param name="field"></param>
        /// <returns></returns>
        public static bool TryGetFirstFieldReference(IMethodBody body, out IFieldReference field)
        {
            Contract.Requires(body != null);
            Contract.Ensures(!Contract.Result<bool>() || Contract.ValueAtReturn(out field) != null);

            foreach (var operation in body.Operations)
            {
                if (operation.OperationCode == OperationCode.Stfld ||
                    operation.OperationCode == OperationCode.Ldfld)
                {
                    field = (IFieldReference)operation.Value;
                    return field != null;
                }
            }

            field = null;
            return false;
        }
开发者ID:mestriga,项目名称:Microsoft.CciSamples,代码行数:24,代码来源:CcsHelper.cs


示例5: TraverseChildren

        public override void TraverseChildren(IFieldReference fieldReference)
        {
            log.WriteTrace("Visiting field: {0}.", fieldReference.Name.Value);

            var replaceableField = fieldReference.AsReplaceable(ReplaceableReferenceTypes.FieldAccessor);

            if (registry.IsRegistered(replaceableField))
            {
                var replacementMethodToCall = registry.GetReplacement(replaceableField);

                var replacementExpression = new MethodCall();
                replacementExpression.Type = replacementMethodToCall.Type;
                replacementExpression.Arguments = new List<IExpression>();
                replacementExpression.MethodToCall = replacementMethodToCall;
                replacementExpression.IsStaticCall = true;

                var expressionStatement = parent as ExpressionStatement;
                if (expressionStatement != null)
                {
                    var assignment = expressionStatement.Expression as Assignment;
                    if (assignment != null)
                    {
                        var source = assignment.Source as BoundExpression;
                        if (source != null)
                        {
                            var assignmentSource = source.Definition as FieldReference;
                            if (assignmentSource != null)
                            {
                                if (fieldReference.ResolvedField.Equals(assignmentSource.ResolvedField))
                                {
                                    assignment.Source = replacementExpression;
                                }
                            }
                        }
                    }
                }

                var returnStatement = parent as ReturnStatement;
                if (returnStatement != null)
                {
                    returnStatement.Expression = replacementExpression;
                }
            }
        }
开发者ID:jamarchist,项目名称:SharpMock,代码行数:44,代码来源:FieldReferenceVisitor.cs


示例6: CreateFieldVariable

    /// <summary>
    /// Creates a fresh BPL variable to represent <paramref name="field"/>, deciding
    /// on its type based on the heap representation.
    /// </summary>
    public override Bpl.Variable CreateFieldVariable(IFieldReference field) {
      Bpl.Variable v;
      string fieldname = MemberHelper.GetMemberSignature(field, NameFormattingOptions.DocumentationId);
      
      fieldname = TranslationHelper.TurnStringIntoValidIdentifier(fieldname);
      Bpl.IToken tok = field.Token();
      Bpl.Type t = this.sink.CciTypeToBoogie(field.Type.ResolvedType);

      if (field.ResolvedField.IsStatic) {
        Bpl.TypedIdent tident = new Bpl.TypedIdent(tok, fieldname, t);
        v = new Bpl.GlobalVariable(tok, tident);
      }
      else {
        Bpl.Type mt = new Bpl.MapType(tok, new List<Bpl.TypeVariable>(), new List<Bpl.Type>(new Bpl.Type[] {this.RefType}), t);
        Bpl.TypedIdent tident = new Bpl.TypedIdent(tok, fieldname, mt);
        v = new Bpl.GlobalVariable(tok, tident);
      }
      return v;
    }
开发者ID:lleraromero,项目名称:bytecodetranslator,代码行数:23,代码来源:Heap.cs


示例7: TraverseChildren

        public override void TraverseChildren(IFieldReference fieldReference)
        {
            log.WriteTrace("Visiting field: {0}.", fieldReference.Name.Value);

            var replaceableField = fieldReference.AsReplaceable(ReplaceableReferenceTypes.FieldAssignment);

            if (registry.IsRegistered(replaceableField))
            {
                var replacementMethodToCall = registry.GetReplacement(replaceableField);

                var replacementExpression = new MethodCall();
                replacementExpression.Type = replacementMethodToCall.Type;
                replacementExpression.Arguments = new List<IExpression>();
                replacementExpression.MethodToCall = replacementMethodToCall;
                replacementExpression.IsStaticCall = true;

                var expressionStatement = parent as ExpressionStatement;
                if (expressionStatement != null)
                {
                    var assignment = expressionStatement.Expression as Assignment;
                    if (assignment != null)
                    {
                        var target = assignment.Target.Definition as FieldReference;
                        if (target != null)
                        {
                            // If the target is what we're visiting ...
                            if (target.ResolvedField.Equals(fieldReference.ResolvedField))
                            {
                                if (!fieldReference.ResolvedField.IsStatic)
                                {
                                    replacementExpression.Arguments.Add(assignment.Target.Instance);
                                }

                                replacementExpression.Arguments.Add(assignment.Source);
                                expressionStatement.Expression = replacementExpression;
                            }
                        }
                    }
                }
            }
        }
开发者ID:jamarchist,项目名称:SharpMock,代码行数:41,代码来源:FieldAssignmentVisitor.cs


示例8: TraverseUnspecialized

 /// <summary>
 /// Traverses the unspecialized field reference.
 /// </summary>
 private void TraverseUnspecialized(IFieldReference fieldReference)
 {
     Contract.Requires(fieldReference != null);
       Contract.Requires(!(fieldReference is ISpecializedFieldReference));
       if (!this.objectsThatHaveAlreadyBeenTraversed.Add(fieldReference)) return;
       if (this.preorderVisitor != null) this.preorderVisitor.Visit(fieldReference);
       if (this.stopTraversal) return;
       this.TraverseChildren(fieldReference);
       if (this.stopTraversal) return;
       if (this.postorderVisitor != null) this.postorderVisitor.Visit(fieldReference);
 }
开发者ID:rasiths,项目名称:visual-profiler,代码行数:14,代码来源:Visitors.cs


示例9: TraverseChildren

 /// <summary>
 /// Traverses the children of the field reference.
 /// </summary>
 public virtual void TraverseChildren(IFieldReference fieldReference)
 {
     Contract.Requires(fieldReference != null);
       //field reference attributes are distinct from field definition attributes. When a definition serves as a reference, the reference is assumed to be unattributed.
       if (!(fieldReference is IFieldDefinition))
     this.Traverse(fieldReference.Attributes);
       this.Traverse(fieldReference.ContainingType);
       if (this.stopTraversal) return;
       if (fieldReference.IsModified) {
     this.Traverse(fieldReference.CustomModifiers);
     if (this.stopTraversal) return;
       }
       this.Traverse(fieldReference.Type);
 }
开发者ID:rasiths,项目名称:visual-profiler,代码行数:17,代码来源:Visitors.cs


示例10: Visit

 //^ ensures this.path.Count == old(this.path.Count);
 /// <summary>
 /// Performs some computation with the given field reference.
 /// </summary>
 /// <param name="fieldReference"></param>
 public virtual void Visit(IFieldReference fieldReference)
 {
     if (this.stopTraversal) return;
       this.Visit((ITypeMemberReference)fieldReference);
       //^ int oldCount = this.path.Count;
       this.path.Push(fieldReference);
       if (fieldReference.IsModified)
     this.Visit(fieldReference.CustomModifiers);
       //^ assume this.path.Count == oldCount+1; //True because all of the virtual methods of this class promise not decrease this.path.Count.
       this.path.Pop();
 }
开发者ID:rasiths,项目名称:visual-profiler,代码行数:16,代码来源:Visitors.cs


示例11: TraverseChildren

        public override void TraverseChildren(IFieldReference fieldReference)
{ MethodEnter(fieldReference);
            base.TraverseChildren(fieldReference);
     MethodExit();   }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:4,代码来源:DebugCodeTraverser.cs


示例12: GetFieldReferenceInternedId

    uint GetFieldReferenceInternedId(IFieldReference fieldReference) {
      Contract.Requires(fieldReference != null);

      uint containingTypeReferenceInternedId = this.GetTypeReferenceInternId(fieldReference.ContainingType);
      uint fieldTypeInternedId;
      if (fieldReference.IsModified)
        fieldTypeInternedId = this.GetModifiedTypeReferenceInternId(fieldReference.Type, fieldReference.CustomModifiers);
      else
        fieldTypeInternedId = this.GetTypeReferenceInternId(fieldReference.Type);
      uint fieldNameId = (uint)fieldReference.Name.UniqueKey;
      var fieldsForType = this.FieldReferenceHashtable.Find(containingTypeReferenceInternedId);
      if (fieldsForType == null) {
        fieldsForType = new DoubleHashtable();
        this.FieldReferenceHashtable.Add(containingTypeReferenceInternedId, fieldsForType);
      }
      uint result = fieldsForType.Find(fieldNameId, fieldTypeInternedId);
      if (result == 0) {
        result = this.CurrentFieldReferenceInternValue++;
        fieldsForType.Add(fieldNameId, fieldTypeInternedId, result);
      }
      return result;
    }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:22,代码来源:Core.cs


示例13: Visit

 /// <summary>
 /// Performs some computation with the given field reference.
 /// </summary>
 public void Visit(IFieldReference fieldReference)
 {
     this.Visit((ITypeMemberReference)fieldReference);
     if (fieldReference.InternedKey == 0)
       this.ReportError(MetadataError.IncompleteNode, fieldReference, "InternedKey");
     if (fieldReference.Type is Dummy)
       this.ReportError(MetadataError.IncompleteNode, fieldReference, "Type");
     var resolvedField = fieldReference.ResolvedField;
     if (!(resolvedField is Dummy) && fieldReference.InternedKey != resolvedField.InternedKey)
       this.ReportError(MetadataError.FieldReferenceResolvesToDifferentField, fieldReference);
 }
开发者ID:rasiths,项目名称:visual-profiler,代码行数:14,代码来源:Validator.cs


示例14: ReserveFieldToken

 protected override void ReserveFieldToken(IFieldReference fieldReference)
 {
     this.metadataWriter.GetFieldToken(fieldReference);
 }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:4,代码来源:ReferenceIndexer.cs


示例15: ReserveFieldToken

 protected override void ReserveFieldToken(IFieldReference fieldReference)
 {
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:3,代码来源:ReferenceIndexer.cs


示例16: GetNameWithDeclaringType

 public static string GetNameWithDeclaringType(IFieldReference value)
 {
     return GetNameWithResolutionScope(value.DeclaringType as ITypeReference) + "." + GetName(value);
 }
开发者ID:lzybkr,项目名称:CppCliReflector,代码行数:4,代码来源:Helper.cs


示例17: ProcessFieldVariable

    private void ProcessFieldVariable(IFieldReference field, IExpression instance, bool buildSelectExpr) {

      //TranslatedExpressions.Push(Bpl.Expr.Ident(this.StmtTraverser.MethodTraverser.ClassTraverser.FindOrCreateFieldVariable(field.ResolvedField))
      TranslatedExpressions.Push( Bpl.Expr.Ident( 
        this.sink.FindOrCreateFieldVariable(field.ResolvedField) ) );

      this.Visit(instance);

      // if the field access is not a targetexpression we build a select expression
      // otherwise the assignment visitor will build a mapassignment later on
      if (buildSelectExpr) {
        List<Bpl.Expr> elist = new List<Bpl.Expr>();

        while (TranslatedExpressions.Count > 0) {
          elist.Add(TranslatedExpressions.Pop());
        }
        TranslatedExpressions.Push(Bpl.Expr.Select(new Bpl.IdentifierExpr(field.Token(), HeapVariable), elist));
      }
    }
开发者ID:hesam,项目名称:SketchSharp,代码行数:19,代码来源:ExpressionTraverser.cs


示例18: Visit

 public void Visit(IFieldReference fieldReference)
 {
     throw new NotImplementedException();
 }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:4,代码来源:Visitors.cs


示例19: GetFieldInternedKey

 public uint GetFieldInternedKey(IFieldReference fieldReference) {
   return 0;
 }
开发者ID:modulexcite,项目名称:Microsoft.Cci.Metadata,代码行数:3,代码来源:DummyObjects.cs


示例20: FieldAccessorReplacementBuilder

 public FieldAccessorReplacementBuilder(IFieldReference field, ReplacementRegistry registry)
 {
     this.field = field;
     this.registry = registry;
 }
开发者ID:jamarchist,项目名称:SharpMock,代码行数:5,代码来源:FieldAccessorReplacementBuilder.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IFieldSymbol类代码示例发布时间:2022-05-24
下一篇:
C# IFieldDefinition类代码示例发布时间: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