コード例 #1
0
ファイル: MetadataBuilder.cs プロジェクト: fugaku/scriptsharp
        private void BuildMemberDetails(MemberSymbol memberSymbol, TypeSymbol typeSymbol, MemberNode memberNode, ParseNodeList attributes) {
            if (memberSymbol.Type != SymbolType.EnumerationField) {
                memberSymbol.SetVisibility(GetVisibility(memberNode, typeSymbol));
            }

            bool preserveCase = (AttributeNode.FindAttribute(attributes, "PreserveCase") != null);
            memberSymbol.SetNameCasing(preserveCase);

            string scriptName = GetAttributeValue(attributes, "ScriptName");
            if (scriptName != null) {
                memberSymbol.SetTransformedName(scriptName);
            }
            else if (AttributeNode.FindAttribute(attributes, "PreserveName") != null) {
                memberSymbol.DisableNameTransformation();
            }
        }
コード例 #2
0
        private void ImportMemberDetails(MemberSymbol memberSymbol, MethodDefinition methodDefinition, ICustomAttributeProvider attributeProvider)
        {
            if (methodDefinition != null) {
                MemberVisibility visibility = MemberVisibility.PrivateInstance;
                if (methodDefinition.IsStatic) {
                    visibility |= MemberVisibility.Static;
                }
                if (methodDefinition.IsPublic) {
                    visibility |= MemberVisibility.Public;
                }
                else if (methodDefinition.IsFamily || methodDefinition.IsFamilyOrAssembly) {
                    visibility |= MemberVisibility.Protected;
                }

                memberSymbol.SetVisibility(visibility);
            }

            memberSymbol.SetNameCasing(MetadataHelpers.ShouldPreserveCase(attributeProvider));

            string scriptName = MetadataHelpers.GetScriptName(attributeProvider);
            if (scriptName != null) {
                memberSymbol.SetTransformedName(scriptName);
            }
        }