public string CreateNamedValue(EnumerationFieldSymbol field) {
            Debug.Assert(_namedValues);
            Debug.Assert(field.Parent == this);

            if (field.IsTransformed) {
                return field.GeneratedName;
            }

            string name = field.Name;
            if (field.IsCasePreserved == false) {
                name = Utility.CreateCamelCaseName(name);
            }
            return name;
        }
        private EnumerationFieldSymbol BuildEnumField(EnumerationFieldNode fieldNode, TypeSymbol typeSymbol) {
            Debug.Assert(typeSymbol is EnumerationSymbol);
            EnumerationSymbol enumSymbol = (EnumerationSymbol)typeSymbol;

            TypeSymbol fieldTypeSymbol;
            if (enumSymbol.UseNamedValues) {
                fieldTypeSymbol = _symbols.ResolveIntrinsicType(IntrinsicType.String);
            }
            else {
                fieldTypeSymbol = _symbols.ResolveIntrinsicType(IntrinsicType.Integer);
            }

            EnumerationFieldSymbol fieldSymbol = new EnumerationFieldSymbol(fieldNode.Name, typeSymbol, fieldNode.Value, fieldTypeSymbol);
            BuildMemberDetails(fieldSymbol, typeSymbol, fieldNode, fieldNode.Attributes);

            return fieldSymbol;
        }
Exemple #3
0
        public string CreateNamedValue(EnumerationFieldSymbol field)
        {
            Debug.Assert(_namedValues);
            Debug.Assert(field.Parent == this);

            if (field.IsTransformed)
            {
                return(field.GeneratedName);
            }

            string name = field.Name;

            if (field.IsCasePreserved == false)
            {
                name = Utility.CreateCamelCaseName(name);
            }
            return(name);
        }
 public EnumerationFieldExpression(Expression objectReference, EnumerationFieldSymbol field)
     : base(ExpressionType.EnumerationField, objectReference, field) {
 }
        private void ImportEnumFields(TypeSymbol enumTypeSymbol)
        {
            TypeDefinition type = (TypeDefinition)enumTypeSymbol.MetadataReference;

            foreach (FieldDefinition field in type.Fields) {
                if (field.IsSpecialName) {
                    continue;
                }

                Debug.Assert(enumTypeSymbol is EnumerationSymbol);
                EnumerationSymbol enumSymbol = (EnumerationSymbol)enumTypeSymbol;

                TypeSymbol fieldType;
                if (enumSymbol.UseNamedValues) {
                    fieldType = _symbols.ResolveIntrinsicType(IntrinsicType.String);
                }
                else {
                    fieldType = _symbols.ResolveIntrinsicType(IntrinsicType.Integer);
                }

                string fieldName = field.Name;
                int fieldValue = (int)field.Constant;

                EnumerationFieldSymbol fieldSymbol =
                    new EnumerationFieldSymbol(fieldName, enumTypeSymbol, fieldValue, fieldType);
                ImportMemberDetails(fieldSymbol, null, field);

                enumTypeSymbol.AddMember(fieldSymbol);
            }
        }
Exemple #6
0
 public EnumerationFieldExpression(Expression objectReference, EnumerationFieldSymbol field)
     : base(ExpressionType.EnumerationField, objectReference, field)
 {
 }
Exemple #7
0
 private void DumpEnumerationField(EnumerationFieldSymbol enumFieldSymbol)
 {
 }
 private void DumpEnumerationField(EnumerationFieldSymbol enumFieldSymbol)
 {
 }