コード例 #1
0
 public LazilyBuiltDictionaryLayoutNode(TypeSystemEntity owningMethodOrType)
     : base(owningMethodOrType)
 {
 }
コード例 #2
0
        static void ParseTypeSymbol(string id, ref int index, TypeSystemEntity typeParameterContext, List <string> results)
        {
            // Note: Roslyn has a special case that deviates from the language spec, which
            // allows context expressions embedded in a type reference => <context-definition>:<type-parameter>
            // We do not support this special format.

            Debug.Assert(results.Count == 0);

            if (PeekNextChar(id, index) == '`')
            {
                ParseTypeParameterSymbol(id, ref index, typeParameterContext, results);
            }
            else
            {
                ParseNamedTypeSymbol(id, ref index, typeParameterContext, results);
            }

            // apply any array or pointer constructions to results
            var startIndex = index;
            var endIndex   = index;

            for (int i = 0; i < results.Count; i++)
            {
                index = startIndex;
                var typeReference = results[i];

                while (true)
                {
                    if (PeekNextChar(id, index) == '[')
                    {
                        var boundsStartIndex = index;
                        var bounds           = ParseArrayBounds(id, ref index);
                        var boundsEndIndex   = index;
                        Debug.Assert(bounds > 0);
                        // Instead of constructing a representation of the array bounds, we
                        // use the original input to represent the bounds, and later match it
                        // against the generated strings for types in signatures.
                        // This ensures that we will only resolve members with supported array bounds.
                        typeReference += id.Substring(boundsStartIndex, boundsEndIndex - boundsStartIndex);
                        continue;
                    }

                    if (PeekNextChar(id, index) == '*')
                    {
                        index++;
                        typeReference += '*';
                        continue;
                    }

                    break;
                }

                if (PeekNextChar(id, index) == '@')
                {
                    index++;
                    typeReference += '@';
                }

                results[i] = typeReference;
                endIndex   = index;
            }

            index = endIndex;
        }
コード例 #3
0
        public ReadyToRunGenericHelperNode(NodeFactory factory, ReadyToRunHelperId helperId, object target, TypeSystemEntity dictionaryOwner)
        {
            _id = helperId;
            _dictionaryOwner = dictionaryOwner;
            _target          = target;

            _lookupSignature = GetLookupSignature(factory, helperId, target);
        }
コード例 #4
0
 public static void EmitLdToken(this InstructionEncoder code, TypeSystemEntity typeSystemEntity, ManagedBinaryEmitter emitter)
 {
     code.OpCode(ILOpCode.Ldtoken);
     code.Token(emitter.EmitMetadataHandleForTypeSystemEntity(typeSystemEntity));
 }
コード例 #5
0
 internal DictionaryLayoutNode GenericDictionaryLayout(TypeSystemEntity methodOrType)
 {
     return(_genericDictionaryLayouts.GetOrAdd(methodOrType));
 }
コード例 #6
0
 public void LogWarning(string text, int code, TypeSystemEntity origin, string subcategory = MessageSubCategory.None) =>
 LogWarning(text, code, new MessageOrigin(origin), subcategory);
コード例 #7
0
ファイル: UtcNodeFactory.cs プロジェクト: tedd/corert
 public override DictionaryLayoutNode GetLayout(TypeSystemEntity methodOrType)
 {
     return(new UtcDictionaryLayoutNode(methodOrType));
 }
コード例 #8
0
 internal abstract DictionaryLayoutNode GetLayout(TypeSystemEntity methodOrType);
コード例 #9
0
 internal override DictionaryLayoutNode GetLayout(TypeSystemEntity methodOrType)
 {
     return(new LazilyBuiltDictionaryLayoutNode(methodOrType));
 }
コード例 #10
0
 public GenericContext(TypeSystemEntity context)
 {
     Context = context;
 }
コード例 #11
0
 public void DetectGenericCycles(TypeSystemEntity owner, TypeSystemEntity referent)
 {
     _genericCycleDetector.DetectCycle(owner, referent);
 }
コード例 #12
0
 public ISymbolNode ReadyToRunHelperFromTypeLookup(ReadyToRunHelperId id, Object target, TypeSystemEntity dictionaryOwner)
 {
     throw new NotImplementedException();
 }
コード例 #13
0
 void CheckAndReportRequires(TypeSystemEntity calledMember, in MessageOrigin origin, string requiresAttributeName)
コード例 #14
0
 public EntityPair(TypeSystemEntity owner, TypeSystemEntity referent)
 => (Owner, Referent) = (owner, referent);
コード例 #15
0
 public UtcDictionaryLayoutNode(TypeSystemEntity owningMethodOrType) : base(owningMethodOrType)
 {
 }
コード例 #16
0
 public NativeLayoutSignatureNode(NativeLayoutSavedVertexNode nativeSignature, TypeSystemEntity identity, Utf8String identityPrefix)
 {
     _nativeSignature = nativeSignature;
     _identity        = identity;
     _identityPrefix  = identityPrefix;
 }
コード例 #17
0
 public void LogError(string text, int code, TypeSystemEntity origin, string subcategory = MessageSubCategory.None) =>
 LogError(text, code, subcategory, new MessageOrigin(origin));
コード例 #18
0
 public override DictionaryLayoutNode GenericDictionaryLayout(TypeSystemEntity methodOrType)
 {
     return(_hostedGenericDictionaryLayouts.GetOrAdd(methodOrType));
 }
コード例 #19
0
 public void LogWarning(TypeSystemEntity origin, DiagnosticId id, params string[] args) =>
 LogWarning(new MessageOrigin(origin), id, args);
コード例 #20
0
 public DictionaryLayoutNode(TypeSystemEntity owningMethodOrType)
 {
     _owningMethodOrType = owningMethodOrType;
     Validate();
 }
コード例 #21
0
 private MetadataType InitializeArrayOfTType(TypeSystemEntity contextEntity)
 {
     _arrayOfTType = contextEntity.Context.SystemModule.GetType("System", "Array`1");
     return(_arrayOfTType);
 }
コード例 #22
0
 public NativeLayoutSignatureKey(NativeLayoutSavedVertexNode signatureVertex, Utf8String identityPrefix, TypeSystemEntity identity)
 {
     SignatureVertex = signatureVertex;
     IdentityPrefix  = identityPrefix;
     Identity        = identity;
 }
コード例 #23
0
 public ReadyToRunGenericHelperKey(ReadyToRunHelperId helperId, object target, TypeSystemEntity dictionaryOwner)
 {
     HelperId        = helperId;
     Target          = target;
     DictionaryOwner = dictionaryOwner;
 }
コード例 #24
0
 public NativeLayoutSignatureNode NativeLayoutSignature(NativeLayoutSavedVertexNode signature, Utf8String identityPrefix, TypeSystemEntity identity)
 {
     return(_nativeLayoutSignatureNodes.GetOrAdd(new NativeLayoutSignatureKey(signature, identityPrefix, identity)));
 }
コード例 #25
0
 public ISymbolNode ReadyToRunHelperFromDictionaryLookup(ReadyToRunHelperId id, Object target, TypeSystemEntity dictionaryOwner)
 {
     return(_genericReadyToRunHelpersFromDict.GetOrAdd(new Tuple <ReadyToRunHelperId, object, TypeSystemEntity>(id, target, dictionaryOwner)));
 }
コード例 #26
0
 public NativeLayoutDictionarySignatureNode DictionarySignature(TypeSystemEntity owningMethodOrType)
 {
     return(_dictionarySignatures.GetOrAdd(owningMethodOrType));
 }
コード例 #27
0
 public ReadyToRunGenericLookupFromTypeNode(NodeFactory factory, ReadyToRunHelperId helperId, object target, TypeSystemEntity dictionaryOwner)
     : base(factory, helperId, target, dictionaryOwner)
 {
 }
コード例 #28
0
 public bool ShouldWarnWhenAccessedForReflection(TypeSystemEntity entity) =>
     entity switch
     {
コード例 #29
0
 public ISymbolNode ReadyToRunHelperFromTypeLookup(ReadyToRunHelperId id, Object target, TypeSystemEntity dictionaryOwner)
 {
     return(_genericReadyToRunHelpersFromType.GetOrAdd(new ReadyToRunGenericHelperKey(id, target, dictionaryOwner)));
 }
コード例 #30
0
 private void GetFlowDependenciesForInstantiation(ref DependencyList dependencies, NodeFactory factory, Instantiation instantiation, Instantiation typicalInstantiation, TypeSystemEntity source)
 {
     for (int i = 0; i < instantiation.Length; i++)
     {
         var genericParameter = (GenericParameterDesc)typicalInstantiation[i];
         if (FlowAnnotations.GetGenericParameterAnnotation(genericParameter) != default)
         {
             var deps = ILCompiler.Dataflow.ReflectionMethodBodyScanner.ProcessGenericArgumentDataFlow(factory, FlowAnnotations, Logger, genericParameter, instantiation[i], source);
             if (deps.Count > 0)
             {
                 if (dependencies == null)
                 {
                     dependencies = deps;
                 }
                 else
                 {
                     dependencies.AddRange(deps);
                 }
             }
         }
     }
 }