public MetadataImporter(IErrorReporter errorReporter, ICompilation compilation, IAttributeStore attributeStore, CompilerOptions options) { _errorReporter = errorReporter; _compilation = compilation; _attributeStore = attributeStore; _minimizeNames = options.MinimizeScript; _systemObject = compilation.MainAssembly.Compilation.FindType(KnownTypeCode.Object); _typeSemantics = new Dictionary<ITypeDefinition, TypeSemantics>(); _delegateSemantics = new Dictionary<ITypeDefinition, DelegateScriptSemantics>(); _instanceMemberNamesByType = new Dictionary<ITypeDefinition, HashSet<string>>(); _staticMemberNamesByType = new Dictionary<ITypeDefinition, HashSet<string>>(); _methodSemantics = new Dictionary<IMethod, MethodScriptSemantics>(); _propertySemantics = new Dictionary<IProperty, PropertyScriptSemantics>(); _fieldSemantics = new Dictionary<IField, FieldScriptSemantics>(); _eventSemantics = new Dictionary<IEvent, EventScriptSemantics>(); _constructorSemantics = new Dictionary<IMethod, ConstructorScriptSemantics>(); _propertyBackingFieldNames = new Dictionary<IProperty, Tuple<string, bool>>(); _eventBackingFieldNames = new Dictionary<IEvent, Tuple<string, bool>>(); _backingFieldCountPerType = new Dictionary<ITypeDefinition, int>(); _internalTypeCountPerAssemblyAndNamespace = new Dictionary<Tuple<IAssembly, string>, int>(); _ignoredMembers = new HashSet<IMember>(); var sna = _attributeStore.AttributesFor(compilation.MainAssembly).GetAttribute<ScriptNamespaceAttribute>(); if (sna != null) { if (sna.Name == null || (sna.Name != "" && !sna.Name.IsValidNestedJavaScriptIdentifier())) { Message(Messages._7002, default(DomRegion), "assembly"); } } }
public static bool?ShouldGenericArgumentsBeIncluded(IMethod method, IAttributeStore attributeStore) { var iga = attributeStore.AttributesFor(method).GetAttribute <IncludeGenericArgumentsAttribute>(); if (iga != null) { return(iga.Include); } var imp = attributeStore.AttributesFor(method.DeclaringTypeDefinition).GetAttribute <ImportedAttribute>(); if (imp != null) { return(false); } var def = attributeStore.AttributesFor(method.ParentAssembly).GetAttribute <IncludeGenericArgumentsDefaultAttribute>(); switch (def != null ? def.MethodDefault : GenericArgumentsDefault.IncludeExceptImported) { case GenericArgumentsDefault.IncludeExceptImported: return(true); case GenericArgumentsDefault.Ignore: return(false); case GenericArgumentsDefault.RequireExplicitSpecification: return(null); default: throw new ArgumentException("Invalid generic arguments default " + def.TypeDefault); } }
public override void ApplyTo(IAssembly assembly, IAttributeStore attributeStore, IErrorReporter errorReporter) { foreach (var t in assembly.GetAllTypeDefinitions()) { if (!attributeStore.AttributesFor(t).HasAttribute<DefaultMemberReflectabilityAttribute>()) { ApplyTo(t, attributeStore, errorReporter); } } }
void FillStoreDefault(IAttributeStore <string> store) { foreach (var line in attributes) { store.PlaceAndGetLinks(line); } }
public Linker(IMetadataImporter metadataImporter, INamer namer, IAttributeStore attributeStore, ICompilation compilation) { _metadataImporter = metadataImporter; _namer = namer; _attributeStore = attributeStore; _compilation = compilation; }
private IntroducedNamesGatherer(IMetadataImporter metadataImporter, IAssembly mainAssembly, IAttributeStore attributeStore) { _metadataImporter = metadataImporter; _mainAssembly = mainAssembly; _attributeStore = attributeStore; _mainModuleName = MetadataUtils.GetModuleName(_mainAssembly, attributeStore); }
/// <summary> /// Sets multiple attributes on this object. /// </summary> /// <param name="values">Attribute store.</param> public virtual void SetAttributes(IAttributeStore values) { foreach (string name in values.GetAttributeNames()) { object value = values.GetAttribute(name); SetAttribute(name, value); } }
public RuntimeLibrary(IMetadataImporter metadataImporter, IErrorReporter errorReporter, ICompilation compilation, INamer namer, IAttributeStore attributeStore) { _metadataImporter = metadataImporter; _errorReporter = errorReporter; _compilation = compilation; _namer = namer; _attributeStore = attributeStore; _omitDowncasts = MetadataUtils.OmitDowncasts(compilation, _attributeStore); _omitNullableChecks = MetadataUtils.OmitNullableChecks(compilation, _attributeStore); }
private void RunAutomaticMetadataAttributeAppliers(IAttributeStore store, ICompilation compilation) { var processors = new IAutomaticMetadataAttributeApplier[] { new MakeMembersWithScriptableAttributesReflectable(store) }; foreach (var p in processors) { foreach (var asm in compilation.Assemblies) p.Process(asm); foreach (var t in compilation.GetAllTypeDefinitions()) p.Process(t); } }
public override void ApplyTo(IAssembly assembly, IAttributeStore attributeStore, IErrorReporter errorReporter) { foreach (var t in assembly.GetAllTypeDefinitions()) { if (!attributeStore.AttributesFor(t).HasAttribute <DefaultMemberReflectabilityAttribute>()) { ApplyTo(t, attributeStore, errorReporter); } } }
private static string GetTypeModuleName(ITypeDefinition type, IAttributeStore attributeStore) { string result; if (!_typeModuleNames.TryGetValue(type, out result)) { _typeModuleNames[type] = result = MetadataUtils.GetModuleName(type, attributeStore); } return(result); }
public static void MakeKnockoutProperty(IProperty property, IAttributeStore attributeStore) { var getter = attributeStore.AttributesFor(property.Getter); getter.ReplaceAttribute(new ScriptNameAttribute("{owner}")); getter.ReplaceAttribute(new DontGenerateAttribute()); var setter = attributeStore.AttributesFor(property.Setter); setter.ReplaceAttribute(new ScriptNameAttribute("{owner}")); setter.ReplaceAttribute(new DontGenerateAttribute()); var prop = attributeStore.AttributesFor(property); prop.ReplaceAttribute(new CustomInitializationAttribute("{$KnockoutApi.Knockout}.observable({value})")); prop.ReplaceAttribute(new BackingFieldNameAttribute("{owner}")); }
// init public Previewer(IEnumerable <ITransaction> transactions, IEnumerable <ICluster> clusters, IAttributeStore <T> store) { this.transactions = transactions; this.clusters = clusters; this.store = store; resultForClusters = new List <int[]>(); attributes = new T[0]; links = new int[0]; }
private ImportVisitor(IMetadataImporter metadataImporter, INamer namer, IAttributeStore attributeStore, IAssembly mainAssembly, HashSet <string> usedSymbols, JsExpression currentAssembly) { _metadataImporter = metadataImporter; _namer = namer; _attributeStore = attributeStore; _mainModuleName = MetadataUtils.GetModuleName(mainAssembly, attributeStore); _mainAssembly = mainAssembly; _usedSymbols = usedSymbols; _currentAssembly = currentAssembly; _moduleAliases = new Dictionary <string, string>(); }
/// <summary> /// Sets multiple attributes on this object. /// </summary> /// <param name="values">Attribute store.</param> public virtual void SetAttributes(IAttributeStore values) { lock (((ICollection)_attributes).SyncRoot) { foreach (string name in values.GetAttributeNames()) { object value = values.GetAttribute(name); SetAttribute(name, value); } } }
public virtual void SetAttributes(IAttributeStore values) { lock (((ICollection)this._attributes).SyncRoot) { foreach (string str in values.GetAttributeNames()) { object attribute = values.GetAttribute(str); this.SetAttribute(str, attribute); } } }
public static string GetModuleName(ITypeDefinition type, IAttributeStore attributeStore) { for (var current = type; current != null; current = current.DeclaringTypeDefinition) { var mna = attributeStore.AttributesFor(type).GetAttribute <ModuleNameAttribute>(); if (mna != null) { return(!String.IsNullOrEmpty(mna.ModuleName) ? mna.ModuleName : null); } } return(GetModuleName(type.ParentAssembly, attributeStore)); }
public override void SetAttributes(IAttributeStore values) { BeginUpdate(); try { _so.SetAttributes(values); } finally { EndUpdate(); } foreach (ISharedObjectListener listener in _serverListeners) { listener.OnSharedObjectUpdate(this, values); } }
public override void ApplyTo(IEntity entity, IAttributeStore attributeStore, IErrorReporter errorReporter) { var type = entity as ITypeDefinition; if (type == null) return; foreach (var m in type.Members) { var attributes = attributeStore.AttributesFor(m); if (!attributes.HasAttribute<ReflectableAttribute>()) { if (IsMemberReflectable(m)) { attributes.Add(new ReflectableAttribute(true)); } } } }
// logic void PrepareTest() { attributeStore = _GetAttributeStore(); logger.Write($"Prepare test>"); logger.Write($"> file > {vars.Filename}"); logger.Write($"> repulsion > {vars.Repulsion}"); logger.Write($"> delimeter > {vars.Separator}"); logger.Write($"> line to skip > {vars.FirstLinesToSkip}"); logger.Write($"> column to view > {vars.ColumnToView}"); clope.Repulsion = vars.Repulsion; clope.StepDone += (step, changes) => StepInfo(step, changes); logger.Write("------"); }
public override void ApplyTo(IEntity entity, IAttributeStore attributeStore, IErrorReporter errorReporter) { if (IsKnockoutProperty) { var p = (IProperty)entity; if (p.IsStatic) { errorReporter.Message(MessageSeverity.Error, 8000, "The property {0} cannot have a [KnockoutPropertyAttribute] because it is static", p.FullName); } else if (MetadataUtils.IsAutoProperty(p) == false) { errorReporter.Message(MessageSeverity.Error, 8001, "The property {0} cannot be a knockout property because it is not an auto-property", p.FullName); } else { MakeKnockoutProperty((IProperty)entity, attributeStore); } } }
public override void ApplyTo(IEntity entity, IAttributeStore attributeStore, IErrorReporter errorReporter) { foreach (var p in ((ITypeDefinition)entity).GetProperties(options: GetMemberOptions.IgnoreInheritedMembers)) { if (attributeStore.AttributesFor(p).HasAttribute<KnockoutPropertyAttribute>()) continue; if (p.IsStatic) continue; if (MetadataUtils.IsAutoProperty(p) == false) { errorReporter.Message(MessageSeverity.Error, 8001, "The property {0} is not an auto-property so because its containing type has a [KnockoutModelAttribute], the property must be decorated with [KnockoutPropertyAttribute(false)]", p.FullName); continue; } KnockoutPropertyAttribute.MakeKnockoutProperty(p, attributeStore); } }
public OOPEmulator(ICompilation compilation, IMetadataImporter metadataImporter, IRuntimeLibrary runtimeLibrary, INamer namer, ILinker linker, IAttributeStore attributeStore, IErrorReporter errorReporter) { _compilation = compilation; _systemScript = new JsTypeReferenceExpression(compilation.FindType(new FullTypeName("System.Script")).GetDefinition()); _systemObject = new JsTypeReferenceExpression(compilation.FindType(KnownTypeCode.Object).GetDefinition()); _metadataImporter = metadataImporter; _runtimeLibrary = runtimeLibrary; _namer = namer; _linker = linker; _attributeStore = attributeStore; _errorReporter = errorReporter; _defaultReflectionRuntimeContext = new ReflectionRuntimeContext(false, _systemObject, _namer); _genericSpecializationReflectionRuntimeContext = new ReflectionRuntimeContext(true, _systemObject, _namer); }
private void RunAutomaticMetadataAttributeAppliers(IAttributeStore store, ICompilation compilation) { var processors = new IAutomaticMetadataAttributeApplier[] { new MakeMembersWithScriptableAttributesReflectable(store) }; foreach (var p in processors) { foreach (var asm in compilation.Assemblies) { p.Process(asm); } foreach (var t in compilation.GetAllTypeDefinitions()) { p.Process(t); } } }
public override void SetAttributes(IAttributeStore values) { if (values == null) { return; } BeginUpdate(); try { foreach (string name in values.GetAttributeNames()) { SetAttribute(name, values.GetAttribute(name)); } } finally { EndUpdate(); } }
public override void SetAttributes(IAttributeStore values) { if (values != null) { this.BeginUpdate(); try { foreach (string str in values.GetAttributeNames()) { this.SetAttribute(str, values.GetAttribute(str)); } } finally { this.EndUpdate(); } } }
public override void ApplyTo(IEntity entity, IAttributeStore attributeStore, IErrorReporter errorReporter) { var type = entity as ITypeDefinition; if (type == null) { return; } foreach (var m in type.Members) { var attributes = attributeStore.AttributesFor(m); if (!attributes.HasAttribute <ReflectableAttribute>()) { if (IsMemberReflectable(m)) { attributes.Add(new ReflectableAttribute(true)); } } } }
public override void ApplyTo(IEntity entity, IAttributeStore attributeStore, IErrorReporter errorReporter) { foreach (var p in ((ITypeDefinition)entity).GetProperties(options: GetMemberOptions.IgnoreInheritedMembers)) { if (attributeStore.AttributesFor(p).HasAttribute <KnockoutPropertyAttribute>()) { continue; } if (p.IsStatic) { continue; } if (MetadataUtils.IsAutoProperty(p) == false) { errorReporter.Message(MessageSeverity.Error, 8001, "The property {0} is not an auto-property so because its containing type has a [KnockoutModelAttribute], the property must be decorated with [KnockoutPropertyAttribute(false)]", p.FullName); continue; } KnockoutPropertyAttribute.MakeKnockoutProperty(p, attributeStore); } }
/// <summary> /// Determines the preferred name for a member. The first item is the name, the second item is true if the name was explicitly specified. /// </summary> public static Tuple<string, bool> DeterminePreferredMemberName(IMember member, bool minimizeNames, IAttributeStore attributeStore) { member = UnwrapValueTypeConstructor(member); bool isConstructor = member is IMethod && ((IMethod)member).IsConstructor; bool isAccessor = member is IMethod && ((IMethod)member).IsAccessor; bool isPreserveMemberCase = IsPreserveMemberCase(member.DeclaringTypeDefinition, attributeStore); string defaultName; if (isConstructor) { defaultName = "$ctor"; } else if (!CanBeMinimized(member, attributeStore)) { defaultName = isPreserveMemberCase ? member.Name : MakeCamelCase(member.Name); } else { if (minimizeNames && member.DeclaringType.Kind != TypeKind.Interface) defaultName = null; else defaultName = "$" + (isPreserveMemberCase ? member.Name : MakeCamelCase(member.Name)); } var attributes = attributeStore.AttributesFor(member); var asa = attributes.GetAttribute<AlternateSignatureAttribute>(); if (asa != null) { var otherMembers = member.DeclaringTypeDefinition.Methods.Where(m => m.Name == member.Name && !attributeStore.AttributesFor(m).HasAttribute<AlternateSignatureAttribute>() && !attributeStore.AttributesFor(m).HasAttribute<NonScriptableAttribute>() && !attributeStore.AttributesFor(m).HasAttribute<InlineCodeAttribute>()).ToList(); if (otherMembers.Count == 1) { return DeterminePreferredMemberName(otherMembers[0], minimizeNames, attributeStore); } else { return Tuple.Create(member.Name, false); // Error } } var sna = attributes.GetAttribute<ScriptNameAttribute>(); if (sna != null) { string name = sna.Name; if (IsNamedValues(member.DeclaringTypeDefinition, attributeStore) && (name == "" || !name.IsValidJavaScriptIdentifier())) { return Tuple.Create(defaultName, false); // For named values enum, allow the use to specify an empty or invalid value, which will only be used as the literal value for the field, not for the name. } if (name == "" && isConstructor) name = "$ctor"; return Tuple.Create(name, true); } if (isConstructor && IsImported(member.DeclaringTypeDefinition, attributeStore)) { return Tuple.Create("$ctor", true); } var ica = attributes.GetAttribute<InlineCodeAttribute>(); if (ica != null) { if (ica.GeneratedMethodName != null) return Tuple.Create(ica.GeneratedMethodName, true); } if (attributes.HasAttribute<PreserveCaseAttribute>()) return Tuple.Create(member.Name, true); bool preserveName = (!isConstructor && !isAccessor && ( attributes.HasAttribute<PreserveNameAttribute>() || attributes.HasAttribute<InstanceMethodOnFirstArgumentAttribute>() || IsPreserveMemberNames(member.DeclaringTypeDefinition, attributeStore) && member.ImplementedInterfaceMembers.Count == 0 && !member.IsOverride) || (IsSerializable(member.DeclaringTypeDefinition, attributeStore) && !member.IsStatic && (member is IProperty || member is IField))) || (IsNamedValues(member.DeclaringTypeDefinition, attributeStore) && member is IField); if (preserveName) return Tuple.Create(isPreserveMemberCase ? member.Name : MakeCamelCase(member.Name), true); return Tuple.Create(defaultName, false); }
public static bool CanBeMinimized(IMember member, IAttributeStore attributeStore) { return !member.IsExternallyVisible() || attributeStore.AttributesFor(member.ParentAssembly).HasAttribute<MinimizePublicNamesAttribute>(); }
public static bool DoesTypeObeyTypeSystem(ITypeDefinition type, IAttributeStore attributeStore) { var ia = attributeStore.AttributesFor(type).GetAttribute <ImportedAttribute>(); return(ia == null || ia.ObeysTypeSystem); }
/// <summary> /// Sets multiple attributes on this object. /// </summary> /// <param name="values">Attribute store.</param> public override void SetAttributes(IAttributeStore values) { base.SetAttributes(values); OnModified(); }
public static string GetModuleName(IAssembly assembly, IAttributeStore attributeStore) { var mna = attributeStore.AttributesFor(assembly).GetAttribute<ModuleNameAttribute>(); return (mna != null && !String.IsNullOrEmpty(mna.ModuleName) ? mna.ModuleName : null); }
public MakeMembersWithScriptableAttributesReflectable(IAttributeStore attributeStore) { _attributeStore = attributeStore; }
public static string GetSerializableTypeCheckCode(ITypeDefinition type, IAttributeStore attributeStore) { var attr = attributeStore.AttributesFor(type).GetAttribute<ScriptSerializableAttribute>(); return attr != null ? attr.TypeCheckCode : null; }
public static string GetModuleName(IAssembly assembly, IAttributeStore attributeStore) { var mna = attributeStore.AttributesFor(assembly).GetAttribute <ModuleNameAttribute>(); return(mna != null && !String.IsNullOrEmpty(mna.ModuleName) ? mna.ModuleName : null); }
public static IEnumerable<KeyValuePair<string,string>> GetAdditionalDependencies(IAssembly assembly, IAttributeStore attributeStore) { return attributeStore.AttributesFor(assembly).GetAttributes<AdditionalDependencyAttribute>() .Select(a => new KeyValuePair<string,string>(a.ModuleName, a.InstanceName)); }
public static bool DoesTypeObeyTypeSystem(ITypeDefinition type, IAttributeStore attributeStore) { var ia = attributeStore.AttributesFor(type).GetAttribute<ImportedAttribute>(); return ia == null || ia.ObeysTypeSystem; }
public static bool IsMixin(ITypeDefinition type, IAttributeStore attributeStore) { return attributeStore.AttributesFor(type).HasAttribute<MixinAttribute>(); }
public static bool IsImported(ITypeDefinition type, IAttributeStore attributeStore) { return attributeStore.AttributesFor(type).HasAttribute<ImportedAttribute>(); }
public TestRewriter(IErrorReporter errorReporter, IRuntimeLibrary runtimeLibrary, IAttributeStore attributeStore) { _errorReporter = errorReporter; _runtimeLibrary = runtimeLibrary; _attributeStore = attributeStore; }
public override void SetAttributes(IAttributeStore values) { if (values == null) return; BeginUpdate(); try { foreach (string name in values.GetAttributeNames()) { SetAttribute(name, values.GetAttribute(name)); } } finally { EndUpdate(); } }
public static bool IsSerializable(ITypeDefinition type, IAttributeStore attributeStore) { return attributeStore.AttributesFor(type).HasAttribute<ScriptSerializableAttribute>() || (type.GetAllBaseTypeDefinitions().Any(td => td.FullName == "System.Record") && type.FullName != "System.Record"); }
public static bool? ShouldGenericArgumentsBeIncluded(IMethod method, IAttributeStore attributeStore) { var iga = attributeStore.AttributesFor(method).GetAttribute<IncludeGenericArgumentsAttribute>(); if (iga != null) return iga.Include; var imp = attributeStore.AttributesFor(method.DeclaringTypeDefinition).GetAttribute<ImportedAttribute>(); if (imp != null) return false; var def = attributeStore.AttributesFor(method.ParentAssembly).GetAttribute<IncludeGenericArgumentsDefaultAttribute>(); switch (def != null ? def.MethodDefault : GenericArgumentsDefault.IncludeExceptImported) { case GenericArgumentsDefault.IncludeExceptImported: return true; case GenericArgumentsDefault.Ignore: return false; case GenericArgumentsDefault.RequireExplicitSpecification: return null; default: throw new ArgumentException("Invalid generic arguments default " + def.TypeDefault); } }
/// <summary> /// Determines the preferred name for a member. The first item is the name, the second item is true if the name was explicitly specified. /// </summary> public static Tuple <string, bool> DeterminePreferredMemberName(IMember member, bool minimizeNames, IAttributeStore attributeStore) { member = UnwrapValueTypeConstructor(member); bool isConstructor = member is IMethod && ((IMethod)member).IsConstructor; bool isAccessor = member is IMethod && ((IMethod)member).IsAccessor; bool isPreserveMemberCase = IsPreserveMemberCase(member.DeclaringTypeDefinition, attributeStore); string defaultName; if (isConstructor) { defaultName = "$ctor"; } else if (!CanBeMinimized(member, attributeStore)) { defaultName = isPreserveMemberCase ? member.Name : MakeCamelCase(member.Name); } else { if (minimizeNames && member.DeclaringType.Kind != TypeKind.Interface) { defaultName = null; } else { defaultName = "$" + (isPreserveMemberCase ? member.Name : MakeCamelCase(member.Name)); } } var attributes = attributeStore.AttributesFor(member); var asa = attributes.GetAttribute <AlternateSignatureAttribute>(); if (asa != null) { var otherMembers = member.DeclaringTypeDefinition.Methods.Where(m => m.Name == member.Name && !attributeStore.AttributesFor(m).HasAttribute <AlternateSignatureAttribute>() && !attributeStore.AttributesFor(m).HasAttribute <NonScriptableAttribute>() && !attributeStore.AttributesFor(m).HasAttribute <InlineCodeAttribute>()).ToList(); if (otherMembers.Count == 1) { return(DeterminePreferredMemberName(otherMembers[0], minimizeNames, attributeStore)); } else { return(Tuple.Create(member.Name, false)); // Error } } var sna = attributes.GetAttribute <ScriptNameAttribute>(); if (sna != null) { string name = sna.Name; if (IsNamedValues(member.DeclaringTypeDefinition, attributeStore) && (name == "" || !name.IsValidJavaScriptIdentifier())) { return(Tuple.Create(defaultName, false)); // For named values enum, allow the use to specify an empty or invalid value, which will only be used as the literal value for the field, not for the name. } if (name == "" && isConstructor) { name = "$ctor"; } return(Tuple.Create(name, true)); } if (isConstructor && IsImported(member.DeclaringTypeDefinition, attributeStore)) { return(Tuple.Create("$ctor", true)); } var ica = attributes.GetAttribute <InlineCodeAttribute>(); if (ica != null) { if (ica.GeneratedMethodName != null) { return(Tuple.Create(ica.GeneratedMethodName, true)); } } if (attributes.HasAttribute <PreserveCaseAttribute>()) { return(Tuple.Create(member.Name, true)); } bool preserveName = (!isConstructor && !isAccessor && (attributes.HasAttribute <PreserveNameAttribute>() || attributes.HasAttribute <InstanceMethodOnFirstArgumentAttribute>() || IsPreserveMemberNames(member.DeclaringTypeDefinition, attributeStore) && member.ImplementedInterfaceMembers.Count == 0 && !member.IsOverride) || (IsSerializable(member.DeclaringTypeDefinition, attributeStore) && !member.IsStatic && (member is IProperty || member is IField))) || (IsNamedValues(member.DeclaringTypeDefinition, attributeStore) && member is IField); if (preserveName) { return(Tuple.Create(isPreserveMemberCase ? member.Name : MakeCamelCase(member.Name), true)); } return(Tuple.Create(defaultName, false)); }
public static string GetModuleName(ITypeDefinition type, IAttributeStore attributeStore) { for (var current = type; current != null; current = current.DeclaringTypeDefinition) { var mna = attributeStore.AttributesFor(type).GetAttribute<ModuleNameAttribute>(); if (mna != null) return !String.IsNullOrEmpty(mna.ModuleName) ? mna.ModuleName : null; } return GetModuleName(type.ParentAssembly, attributeStore); }
public static bool IsSerializable(ITypeDefinition type, IAttributeStore attributeStore) { return(attributeStore.AttributesFor(type).HasAttribute <ScriptSerializableAttribute>() || (type.GetAllBaseTypeDefinitions().Any(td => td.FullName == "System.Record") && type.FullName != "System.Record")); }
public static bool CanBeMinimized(IMember member, IAttributeStore attributeStore) { return(!member.IsExternallyVisible() || attributeStore.AttributesFor(member.ParentAssembly).HasAttribute <MinimizePublicNamesAttribute>()); }
public static bool IsPreserveMemberCase(ITypeDefinition type, IAttributeStore attributeStore) { var pmca = attributeStore.AttributesFor(type).GetAttribute<PreserveMemberCaseAttribute>() ?? attributeStore.AttributesFor(type.ParentAssembly).GetAttribute<PreserveMemberCaseAttribute>(); return pmca != null && pmca.Preserve; }
public static bool IsReflectable(IMember member, IAttributeStore attributeStore) { var ra = attributeStore.AttributesFor(member).GetAttribute <ReflectableAttribute>(); return(ra != null && ra.Reflectable); }
/// <summary> /// Sets multiple attributes on this object. /// </summary> /// <param name="values">Attribute store.</param> public void SetAttributes(IAttributeStore values) { _scope.SetAttributes(values); }
public static string GetSerializableTypeCheckCode(ITypeDefinition type, IAttributeStore attributeStore) { var attr = attributeStore.AttributesFor(type).GetAttribute <ScriptSerializableAttribute>(); return(attr != null ? attr.TypeCheckCode : null); }
public static bool IsReflectable(IMember member, IAttributeStore attributeStore) { var ra = attributeStore.AttributesFor(member).GetAttribute<ReflectableAttribute>(); return ra != null && ra.Reflectable; }
public static bool IsNamedValues(ITypeDefinition type, IAttributeStore attributeStore) { return attributeStore.AttributesFor(type).HasAttribute<NamedValuesAttribute>(); }
public static bool IsResources(ITypeDefinition type, IAttributeStore attributeStore) { return attributeStore.AttributesFor(type).HasAttribute<ResourcesAttribute>(); }
public static bool IsGlobalMethods(ITypeDefinition type, IAttributeStore attributeStore) { return attributeStore.AttributesFor(type).HasAttribute<GlobalMethodsAttribute>(); }