internal FieldSymbol GetOrMakeField(ImplicitNamedTypeSymbol previousSubmissionType) { if (_previousSubmissionFieldMap == null) { _previousSubmissionFieldMap = new Dictionary<ImplicitNamedTypeSymbol, FieldSymbol>(); } FieldSymbol previousSubmissionField; if (!_previousSubmissionFieldMap.TryGetValue(previousSubmissionType, out previousSubmissionField)) { // TODO: generate better name? previousSubmissionField = new SynthesizedFieldSymbol( _declaringSubmissionClass, previousSubmissionType, "<" + previousSubmissionType.Name + ">", isReadOnly: true); _previousSubmissionFieldMap.Add(previousSubmissionType, previousSubmissionField); } return previousSubmissionField; }
internal FieldSymbol DefineCallSiteStorageSymbol(NamedTypeSymbol containerDefinition, NamedTypeSymbol delegateTypeOverMethodTypeParameters, TypeMap methodToContainerTypeParametersMap) { var fieldName = GeneratedNames.MakeDynamicCallSiteFieldName(_callSiteIdDispenser++); var delegateTypeOverContainerTypeParameters = methodToContainerTypeParametersMap.SubstituteNamedType(delegateTypeOverMethodTypeParameters); var callSiteType = _factory.Compilation.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_CallSite_T).Construct(new[] { delegateTypeOverContainerTypeParameters }); var field = new SynthesizedFieldSymbol(containerDefinition, callSiteType, fieldName, isPublic: true, isStatic: true); _factory.AddField(containerDefinition, field); return _currentDynamicCallSiteContainer.IsGenericType ? field.AsMember(_currentDynamicCallSiteContainer) : field; }