Beispiel #1
0
        private MemberVisibility GetVisibility(MemberNode node, TypeSymbol typeSymbol) {
            if (typeSymbol.Type == SymbolType.Interface) {
                return MemberVisibility.Public;
            }

            MemberVisibility visibility = MemberVisibility.PrivateInstance;

            if (((node.Modifiers & Modifiers.Static) != 0) ||
                (node.NodeType == ParseNodeType.ConstFieldDeclaration)) {
                visibility |= MemberVisibility.Static;
            }

            if ((node.Modifiers & Modifiers.Public) != 0) {
                visibility |= MemberVisibility.Public;
            }
            else {
                if ((node.Modifiers & Modifiers.Protected) != 0) {
                    visibility |= MemberVisibility.Protected;
                }
                if ((node.Modifiers & Modifiers.Internal) != 0) {
                    visibility |= MemberVisibility.Internal;
                }
            }

            return visibility;
        }
Beispiel #2
0
        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();
            }
        }