private bool FieldIsNotSource(IFieldDefinition fieldDefinition, IExpression source)
 {
     var bound = source as BoundExpression;
     var field = bound == null? null : bound.Definition as IFieldReference;
     bool ret = bound == null || field == null || field.ResolvedField != fieldDefinition;
     return ret;
 }
        public override void Configure(IFieldDefinition definition)
        {
            base.Configure(definition);
            var tdefinition = definition as ITaxonFieldDefinition;
            var tManager = TaxonomyManager.GetManager();
            var tid = tdefinition.TaxonomyId;
            var taxonomy = tManager.GetTaxonomies<FlatTaxonomy>().Where(t => t.Id == tid).SingleOrDefault();
            if (taxonomy != null)
            {
                var colorsTaxa = taxonomy.Taxa.OrderBy(c => c.Title.ToString());
                this.RenderChoicesAs = Telerik.Sitefinity.Web.UI.Fields.Enums.RenderChoicesAs.DropDown;

                // or you can use Telerik.Sitefinity.Web.UI.Fields.Enums.RenderChoicesAs.CheckBoxes for multiple choice

                this.Choices.Clear();
                foreach (var taxon in colorsTaxa)
                {
                    var choice = new ChoiceItem();
                    choice.Value = taxon.Id.ToString();
                    choice.Text = taxon.Title;
                    choice.Enabled = true;
                    this.Choices.Add(choice);
                }
            }
        }
Exemplo n.º 3
0
        public override void TraverseChildren(IFieldDefinition field)
        {
            if (!MemberHelper.IsVisibleOutsideAssembly(field))
                return;

            _assembly.EnrollApi(field);
        }
Exemplo n.º 4
0
Arquivo: Utils.cs Projeto: xornand/cci
 /// <summary>
 /// Returns the field from the closest base class that is hidden by the given field according to C# rules.
 /// </summary>
 public static IFieldDefinition GetHiddenField(IFieldDefinition derivedClassField) {
   var typeDef = derivedClassField.ContainingTypeDefinition;
   foreach (ITypeReference baseClassReference in typeDef.BaseClasses) {
     IFieldDefinition hiddenField = GetHiddenField(derivedClassField, baseClassReference.ResolvedType);
     if (!(hiddenField is Dummy)) return hiddenField;
   }
   return Dummy.FieldDefinition;
 }
        private void WriteFieldDefinition(IFieldDefinition field)
        {
            if (field.IsSpecialName)
                return;

            // Do we care about volatile?
            WriteAttributes(field.Attributes);
            if (!field.IsStatic && field.ContainingTypeDefinition.Layout == LayoutKind.Explicit)
            {
                WriteFakeAttribute("System.Runtime.InteropServices.FieldOffsetAttribute", field.Offset.ToString());
            }

            if (!field.ContainingTypeDefinition.IsEnum)
            {
                WriteVisibility(field.Visibility);

                if (field.Type.IsUnsafeType())
                    WriteKeyword("unsafe");

                if (field.IsCompileTimeConstant)
                    WriteKeyword("const");
                else
                {
                    if (field.IsStatic)
                        WriteKeyword("static");
                    if (field.IsReadOnly)
                        WriteKeyword("readonly");
                }

                if (!field.IsCompileTimeConstant && field.GetHiddenBaseField(_filter) != Dummy.Field)
                    WriteKeyword("new");

                WriteTypeName(field.Type);
                WriteIdentifier(field.Name);

                if (field.Constant != null && field.IsCompileTimeConstant)
                {
                    WriteSpace();
                    WriteSymbol("=", true);
                    WriteMetadataConstant(field.Constant);
                }

                WriteSymbol(";");
            }
            else
            {
                WriteIdentifier(field.Name);
                if (field.Constant != null && field.Constant.Value != null)
                {
                    WriteSpace();
                    WriteSymbol("=", true);
                    WriteMetadataConstant(field.Constant);
                }
                WriteSymbol(",");
            }
        }
Exemplo n.º 6
0
        public override void Visit(IFieldDefinition fieldDefinition)
        {
            NewLine();
            Indent(2);

            AppendElementType(fieldDefinition);
            base.Visit(fieldDefinition);

            output.Append(fieldDefinition.Name.Value);
            AppendSpace();
        }
            protected IFieldDefinition ResolveFieldReference(IFieldReference reference)
            {
                IFieldDefinition fieldDefinition = reference.ResolvedField;

                if (fieldDefinition != Dummy.Field && fieldDefinition != Dummy.SpecializedFieldDefinition)
                {
                    return(fieldDefinition);
                }
                else
                {
                    summary.UnresolvedReferences.Add(reference);
                    return(null);
                }
            }
        public override void Configure(IFieldDefinition definition)
        {
            base.Configure(definition);

            IImageUrlFieldControlDefinition fieldDefinition = definition as IImageUrlFieldControlDefinition;

            if (fieldDefinition != null)
            {
                if (!string.IsNullOrEmpty(fieldDefinition.SampleText))
                {
                    this.Text = fieldDefinition.SampleText;
                }
            }
        }
Exemplo n.º 9
0
        public override void Configure(IFieldDefinition definition)
        {
            base.Configure(definition);

            IFormSelectorFieldControlDefinition fieldDefinition = definition as IFormSelectorFieldControlDefinition;

            if (fieldDefinition != null)
            {
                if (!string.IsNullOrEmpty(fieldDefinition.ModuleType))
                {
                    this.ModuleType = fieldDefinition.ModuleType;
                }
            }
        }
Exemplo n.º 10
0
 public MockField(
     IFieldDefinition fieldDefinition,
     object value,
     object originalValue            = null,
     ValidationState validationState = ValidationState.Valid,
     bool isChangedByUser            = true)
     : this(fieldDefinition)
 {
     Value           = value;
     OriginalValue   = originalValue;
     ValidationState = validationState;
     IsChangedByUser = isChangedByUser;
     IsEditable      = true;
 }
Exemplo n.º 11
0
        public float GetBoost <T, T2>(IFieldDefinition <T, T2> fieldDefinition)
            where T : IndexDefinition <T2>
            where T2 : SystemEntity
        {
            LuceneFieldBoost luceneFieldBoost =
                (_boosts ?? (_boosts = _session.QueryOver <LuceneFieldBoost>()
                                       .Where(boost => boost.Site.Id == _site.Id)
                                       .Cacheable().List()))
                .SingleOrDefault(boost => boost.Definition == fieldDefinition.TypeName);

            return(luceneFieldBoost == null
                ? 1f
                : luceneFieldBoost.Boost);
        }
        public override void Configure(IFieldDefinition definition)
        {
            base.Configure(definition);

            IRelatedUsersFieldDefinition fieldDefinition = definition as IRelatedUsersFieldDefinition;

            if (fieldDefinition != null)
            {
                if (!string.IsNullOrEmpty(fieldDefinition.UserType))
                {
                    this.UserType = fieldDefinition.UserType;
                }
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Returns the field from the closest base class that is hidden by the given field according to C# rules.
        /// </summary>
        public static IFieldDefinition GetHiddenField(IFieldDefinition derivedClassField)
        {
            var typeDef = derivedClassField.ContainingTypeDefinition;

            foreach (ITypeReference baseClassReference in typeDef.BaseClasses)
            {
                IFieldDefinition hiddenField = GetHiddenField(derivedClassField, baseClassReference.ResolvedType);
                if (!(hiddenField is Dummy))
                {
                    return(hiddenField);
                }
            }
            return(Dummy.FieldDefinition);
        }
        public override void Configure(IFieldDefinition definition)
        {
            base.Configure(definition);

            IProductSelectorDefinition fieldDefinition = definition as IProductSelectorDefinition;

            if (fieldDefinition != null)
            {
                if (!string.IsNullOrEmpty(fieldDefinition.DynamicModuleType))
                {
                    this.DynamicModuleType = fieldDefinition.DynamicModuleType;
                }
            }
        }
Exemplo n.º 15
0
Arquivo: Utils.cs Projeto: xornand/cci
 private static IFieldDefinition GetHiddenField(IFieldDefinition derivedClassField, ITypeDefinition baseClass) {
   foreach (ITypeDefinitionMember baseMember in baseClass.GetMembersNamed(derivedClassField.Name, false)) {
     IFieldDefinition/*?*/ baseField = baseMember as IFieldDefinition;
     if (baseField == null) continue;
     if (baseField.Visibility == TypeMemberVisibility.Private) continue;
     return baseField;
   }
   var bases = baseClass.IsInterface ? baseClass.Interfaces : baseClass.BaseClasses;
   foreach (ITypeReference baseClassReference in bases) {
     IFieldDefinition hiddenField = GetHiddenField(derivedClassField, baseClassReference.ResolvedType);
     if (!(hiddenField is Dummy)) return hiddenField;
   }
   return Dummy.FieldDefinition;
 }
Exemplo n.º 16
0
        /// <summary>
        /// Initialize properties of the field implementing
        /// <see cref="T:Telerik.Sitefinity.Web.UI.Fields.Contracts.IField"/>            with default
        /// values from the configuration definition object.
        /// </summary>
        /// <param name="definition">The definition configuration.</param>
        public override void Configure(IFieldDefinition definition)
        {
            base.Configure(definition);

            ICodeEditorDefinition fieldDefinition = definition as ICodeEditorDefinition;

            if (fieldDefinition != null)
            {
                if (!string.IsNullOrEmpty(fieldDefinition.SampleText))
                {
                    Text = fieldDefinition.SampleText;
                }
            }
        }
Exemplo n.º 17
0
        public static string MemberGroupHeading(ITypeDefinitionMember member)
        {
            if (member == null)
            {
                return(null);
            }

            IMethodDefinition method = member as IMethodDefinition;

            if (method != null)
            {
                if (method.IsConstructor)
                {
                    return("Constructors");
                }

                return("Methods");
            }

            IFieldDefinition field = member as IFieldDefinition;

            if (field != null)
            {
                return("Fields");
            }

            IPropertyDefinition property = member as IPropertyDefinition;

            if (property != null)
            {
                return("Properties");
            }

            IEventDefinition evnt = member as IEventDefinition;

            if (evnt != null)
            {
                return("Events");
            }

            INestedTypeDefinition nType = member as INestedTypeDefinition;

            if (nType != null)
            {
                return("Nested Types");
            }

            return(null);
        }
        public bool TestPhxPointerGlobalField()
        {
            IFieldDefinition    field         = Helper.GetGlobalField(Helper.GetNamespace(this.ModuleReaderTest.PhxArchMsil, this._A0x8179e609), this._InitializedPerProcess_initializer__CurrentDomain__CrtImplementationDetails_____Q2P6MXXZEA);
            StringILDasmPaper   stringPaper   = new StringILDasmPaper(2);
            ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.CppAssembly);

            prettyPrinter.FieldDefinition(field);
            string result =
                @".field assembly static void()?A0x8179e609.?InitializedPerProcess$initializer$@CurrentDomain@<CrtImplementationDetails>@@$$Q2P6MXXZEA at{0x00000058,0x00000004}.data=(78 00 00 06 )                                     // x...
{
}
";

            return(result.Equals(stringPaper.Content));
        }
Exemplo n.º 19
0
        public FieldNodeTag(TUITreeNode treeNode, IFieldDefinition field)
        {
            if (field == null)
            {
                throw new ArgumentNullException("field");
            }

            if (treeNode == null)
            {
                throw new ArgumentNullException("treeNode");
            }

            this.UITreeNode = treeNode;
            this.Field      = field;
        }
Exemplo n.º 20
0
        public virtual void PrintFieldDefinitionFixedBuffer(IFieldDefinition fieldDefinition, ICustomAttribute fixedBufferAttribute)
        {
            PrintKeywordUnsafe();
            PrintKeywordFixed();
            var args = new List <IMetadataExpression>(fixedBufferAttribute.Arguments);

            PrintTypeReference(((IMetadataTypeOf)args[0]).TypeToGet.ResolvedType);
            PrintToken(VBToken.Space);
            PrintFieldDefinitionName(fieldDefinition);
            PrintToken(VBToken.LeftSquareBracket);
            int len = (int)(((IMetadataConstant)args[1]).Value);

            this.sourceEmitterOutput.Write(len.ToString());
            PrintToken(VBToken.RightSquareBracket);
        }
 internal override bool TryGetField(IFieldDefinition def, out uint index)
 {
     TypeFromMetadata type;
     if (this.TryGetTypeDefinition(def.ContainingTypeDefinition, out type))
     {
         FieldHandle handle;
         if (type.TryGetField(def.Name, out handle))
         {
             index = (uint)handle.GetRowNumber();
             return true;
         }
     }
     index = 0;
     return false;
 }
 private void CheckPortableAttributes(IFieldDefinition fd, IPortable portable)
 {
     if (fd.GetFactoryId() != portable.GetFactoryId())
     {
         throw new HazelcastSerializationException(
                   "Wrong Portable type! Generic portable types are not supported! " + " Expected factory-id: " +
                   fd.GetFactoryId() + ", Actual factory-id: " + portable.GetFactoryId());
     }
     if (fd.GetClassId() != portable.GetClassId())
     {
         throw new HazelcastSerializationException(
                   "Wrong Portable type! Generic portable types are not supported! " + "Expected class-id: " +
                   fd.GetClassId() + ", Actual class-id: " + portable.GetClassId());
     }
 }
Exemplo n.º 23
0
 private static void CheckPortableAttributes(IFieldDefinition fd, IPortable portable)
 {
     if (fd.FactoryId != portable.FactoryId)
     {
         throw new SerializationException(
                   "Wrong Portable type! Generic portable types are not supported! " + " Expected factory-id: " +
                   fd.FactoryId + ", Actual factory-id: " + portable.FactoryId);
     }
     if (fd.ClassId != portable.ClassId)
     {
         throw new SerializationException(
                   "Wrong Portable type! Generic portable types are not supported! " + "Expected class-id: " +
                   fd.ClassId + ", Actual class-id: " + portable.ClassId);
     }
 }
Exemplo n.º 24
0
 private static void SetValue(FrameworkElement element, IFieldDefinition definition, string key)
 {
     if (element is ContentControl control)
     {
         control.Content = definition.Metadata.Get(key, default(object));
     }
     else if (element is TextBlock textBlock)
     {
         textBlock.Text = definition.Metadata.Get(key, String.Empty);
     }
     else
     {
         throw Ensure.Exception.InvalidOperation($"Not supported target for metadata key '{key}'. Currently only supported are '{nameof(ContentControl)}' and '{(nameof(textBlock))}'");
     }
 }
        public static MvcHtmlString LinkWithFieldDefinitionFor(this HtmlHelper html, IFieldDefinition fieldDefinition, string linkText, int popupWidth, List <string> cssClasses)
        {
            var fieldDefinitionLinkTag = new TagBuilder("a");

            fieldDefinitionLinkTag.Attributes.Add("href", "javascript:void(0)");
            fieldDefinitionLinkTag.Attributes.Add("class", string.Join(" ", cssClasses));
            var labelText = fieldDefinition.GetFieldDefinitionLabel();

            fieldDefinitionLinkTag.Attributes.Add("title", string.Format("Click to get help on {0}", labelText));
            fieldDefinitionLinkTag.InnerHtml = linkText;
            var urlToContent = fieldDefinition.GetContentUrl();

            AddHelpToolTipPopupToHtmlTag(fieldDefinitionLinkTag, labelText, urlToContent, popupWidth);
            return(new MvcHtmlString(fieldDefinitionLinkTag.ToString(TagRenderMode.Normal)));
        }
Exemplo n.º 26
0
        private void SetFieldValueInternal(IFieldDefinition <TIdentifier> fieldDefinition, object value)
        {
            // get current value
            var currentValue = _fieldData.GetFieldValue(fieldDefinition.Id, -1);

            // Only change when actually different
            if (!object.Equals(currentValue, value))
            {
                if (!fieldDefinition.IsEditable)
                {
                    throw new ValidationException(string.Format("The field '{0}' is readonly.", fieldDefinition.Name));
                }

                _fieldData.SetFieldValue(fieldDefinition.Id, value);
            }
        }
Exemplo n.º 27
0
        public static bool IsEditable([NotNull] this IFieldDefinition definition)
        {
            switch (definition.Id)
            {
            case (int)CoreField.IterationPath:
            case (int)CoreField.AreaPath:
                return(true);

            case (int)CoreField.Id:
            case (int)CoreField.Rev:
            case (int)CoreField.WorkItemType:
                return(false);
            }

            return(!definition.IsComputed());
        }
Exemplo n.º 28
0
        public Field(IRevision <TIdentifier> revision, IFieldDefinition <TIdentifier> fieldDefinition)
        {
            if (fieldDefinition == null)
            {
                throw new ArgumentNullException("fieldDefinition", "No field definition specified.");
            }

            if (revision == null)
            {
                throw new ArgumentNullException("revision", "No revision data specified");
            }

            _revision = revision;

            _fieldDefinition = fieldDefinition;
        }
Exemplo n.º 29
0
        public void Insert_UnitTest()
        {
            Int32            index = default(Int32);
            IFieldDefinition value = default(IFieldDefinition);

            ExecuteMethod(
                () => { return((IDisplayFieldList)GetInstance()); },
                instance =>
            {
                index = default(Int32);     //No Constructor
                value = FieldDefinitionImpl_UnitTests.GetInstance();
                Insert_PreCondition(instance, ref index, ref value);
            },
                instance => { instance.Insert(index, value); },
                instance => { Insert_PostValidate(instance, index, value); });
        }
        public void GetFieldValueExternal_UnitTest()
        {
            IFieldDefinition fd       = default(IFieldDefinition);
            Int32            revision = default(Int32);

            ExecuteMethod(
                () => { return((IWorkItem)GetInstance()); },
                instance =>
            {
                fd       = FieldDefinitionWrapper_UnitTests.GetInstance();
                revision = default(Int32);     //No Constructor
                GetFieldValueExternal_PreCondition(instance, ref fd, ref revision);
            },
                instance => { instance.GetFieldValueExternal(fd, revision); },
                instance => { GetFieldValueExternal_PostValidate(instance, fd, revision); });
        }
Exemplo n.º 31
0
        internal override bool TryGetField(IFieldDefinition def, out uint index)
        {
            TypeFromMetadata type;

            if (this.TryGetTypeDefinition(def.ContainingTypeDefinition, out type))
            {
                FieldHandle handle;
                if (type.TryGetField(def.Name, out handle))
                {
                    index = (uint)handle.GetRowNumber();
                    return(true);
                }
            }
            index = 0;
            return(false);
        }
Exemplo n.º 32
0
                public ImmutableLocationInfo SetField(IFieldDefinition field, Interpretation value, int newVersion)
                {
                    if (field.IsReference())
                    {
                        int id = GetIdFromInterpretation(value);
                        var newReferenceFields = this.ReferenceFields.SetItem(field, id);

                        return(new ImmutableLocationInfo(newVersion, newReferenceFields, this.ValueFields));
                    }
                    else
                    {
                        var newValueFields = this.ValueFields.SetItem(field, value);

                        return(new ImmutableLocationInfo(newVersion, this.ReferenceFields, newValueFields));
                    }
                }
        public bool TestListDefaultCapacityField()
        {
            ITypeDefinition     type          = Helper.GetNamespaceType(Helper.GetNamespace(this.ModuleReaderTest.MscorlibAssembly, this.System, this.Collections, this.Generic), this.List);
            IFieldDefinition    field         = Helper.GetFieldNamed(type, this._defaultCapacity);
            StringILDasmPaper   stringPaper   = new StringILDasmPaper(2);
            ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.MscorlibAssembly);

            prettyPrinter.FieldDefinition(field);
            string result =
                @".field private static literal int32 _defaultCapacity=const(4,int32)
{
}
";

            return(result.Equals(stringPaper.Content));
        }
Exemplo n.º 34
0
        private Nest.QueryContainer addOperation <T>(Nest.QueryContainerDescriptor <T> descriptor,
                                                     IFieldDefinition definition) where T : class
        {
            var operation = Operation.FromValue(definition.Op);

            if (operation == Operation.Equal)
            {
                return(descriptor.Term(term => term.Field(definition.Field).Value(definition.Value).Boost(definition.Boost)));
            }
            if (operation == Operation.Contains)
            {
                return(descriptor.Match(match => match.Field(definition.Field).Query(definition.Value).Boost(definition.Boost)));
            }
            if (operation == Operation.GreaterThan)
            {
                return(descriptor.Range(number => number.Field(definition.Field).GreaterThan(double.Parse(definition.Value)).Boost(definition.Boost)));
            }
            if (operation == Operation.GreaterThanOrEqual)
            {
                return(descriptor.Range(number => number.Field(definition.Field).GreaterThanOrEquals(double.Parse(definition.Value)).Boost(definition.Boost)));
            }
            if (operation == Operation.LessThan)
            {
                return(descriptor.Range(number => number.Field(definition.Field).LessThan(double.Parse(definition.Value)).Boost(definition.Boost)));
            }
            if (operation == Operation.LessThanOrEqual)
            {
                return(descriptor.Range(number => number.Field(definition.Field).LessThanOrEquals(double.Parse(definition.Value)).Boost(definition.Boost)));
            }
            if (operation == Operation.NotEqual)
            {
                return(!descriptor.Term(term => term.Field(definition.Field).Value(definition.Value).Boost(definition.Boost)));
            }
            if (operation == Operation.Autocomplete)
            {
                return(descriptor.MultiMatch(match => match.Fields(f => f
                                                                   .Field($"{definition.Field}.default", 10)
                                                                   .Field($"{definition.Field}.stemmed", 2)
                                                                   .Field($"{definition.Field}.shingles", 2)
                                                                   .Field($"{definition.Field}.ngram"))
                                             .Query(definition.Value)
                                             .Operator(Nest.Operator.And)
                                             ));
            }

            throw new ArgumentException($"operation {definition.Op} is not supported");
        }
Exemplo n.º 35
0
        protected virtual bool SaveFieldDefinition(IFieldDefinition fieldDefinition)
        {
            var FieldDefinitionsBuffer = TelemetryFieldDefinitions.ToList();

            FieldDefinitionsBuffer.Add(fieldDefinition);

            if (!FieldDefinitionsListIsValid(FieldDefinitionsBuffer))
            {
                return(false);
            }

            DeleteFieldDefinition(fieldDefinition);

            TelemetryFieldDefinitions.Add(fieldDefinition);

            return(true);
        }
                public void ReadField(
                    VersionedVariable result,
                    VersionedVariable reference,
                    IFieldDefinition field,
                    ISymbolicHeapContext context)
                {
                    this.cachedState = null;

                    var refState = this.TrySecureNotNull(reference, context);

                    if (this.IsConflicting)
                    {
                        return;
                    }

                    Contract.Assert(refState.IsInput);

                    Expression resultVar;

                    if (result.Variable.IsReference)
                    {
                        // Secure that the result variable is initialized
                        var resultState = this.GetOrCreateVariableState(result, context);
                        Contract.Assert(resultState.IsInput);

                        resultVar = resultState.Representation;

                        // Mark as derived from the input heap
                        this.variableStates[resultState.Id] = resultState.WithIsInputDerived(true);
                    }
                    else
                    {
                        // Don't store scalar values in the state
                        resultVar = context.GetNamedVariable(result);
                    }

                    // Initialize the particular field
                    var fieldVar = this.GetOrAddFieldVariable(field, context);

                    // Propagate the read to the SMT solver
                    var selectAssert = (BoolHandle)ExpressionFactory.Equal(
                        resultVar,
                        fieldVar.Select(refState.Representation));

                    context.AddAssertion(selectAssert);
                }
Exemplo n.º 37
0
    /// <summary>
    /// Given a field definition in the closure class, get its reference as will be used by the methods in the closure class. 
    /// </summary>
    internal IFieldReference GetReferenceOfFieldUsedByPeers(IFieldDefinition fieldDef) {

      IFieldReference fieldReference = null;
      ITypeReference typeReference = this.ClosureDefinitionReference;
      ISpecializedNestedTypeReference nestedTypeRef = typeReference as ISpecializedNestedTypeReference;
      IGenericTypeInstanceReference genericTypeInstanceRef = typeReference as IGenericTypeInstanceReference;
      if (nestedTypeRef != null || genericTypeInstanceRef != null) {
        fieldReference = new SpecializedFieldReference() {
          ContainingType = typeReference,
          InternFactory = this.host.InternFactory,
          Name = fieldDef.Name,
          UnspecializedVersion = fieldDef,
          Type = fieldDef.Type
        };
      } else fieldReference = fieldDef;
      return fieldReference;
    }
Exemplo n.º 38
0
        /// <exception cref="System.IO.IOException"/>
        public virtual IPortable[] ReadPortableArray(string fieldName)
        {
            int currentPos = @in.Position();

            try
            {
                IFieldDefinition fd = cd.GetField(fieldName);
                if (fd == null)
                {
                    throw ThrowUnknownFieldException(fieldName);
                }
                if (fd.GetFieldType() != FieldType.PortableArray)
                {
                    throw new HazelcastSerializationException("Not a Portable array field: " + fieldName);
                }
                int pos = ReadPosition(fd);
                @in.Position(pos);
                int len       = @in.ReadInt();
                int factoryId = @in.ReadInt();
                int classId   = @in.ReadInt();

                if (len == Bits.NullArray)
                {
                    return(null);
                }

                CheckFactoryAndClass(fd, factoryId, classId);
                IPortable[] portables = new IPortable[len];
                if (len > 0)
                {
                    int offset = @in.Position();
                    for (int i = 0; i < len; i++)
                    {
                        int start = @in.ReadInt(offset + i * Bits.IntSizeInBytes);
                        @in.Position(start);
                        portables[i] = serializer.ReadAndInitialize(@in, factoryId, classId);
                    }
                }
                return(portables);
            }
            finally
            {
                @in.Position(currentPos);
            }
        }
        private static void InterpretConstructAttributes(ReachabilitySummary summary, string fieldIdentifier, WholeProgram wholeProgram)
        {
            if (summary != null)
            {
                // For now we assume the argument is a field -- we really should support types and methods too
                IFieldDefinition fieldWithAttributes = LookupFieldWithIdentifier(fieldIdentifier, wholeProgram);


                foreach (ICustomAttribute customAttribute in fieldWithAttributes.Attributes)
                {
                    IMethodDefinition constructorDefinition = GarbageCollectHelper.UnspecializeAndResolveMethodReference(customAttribute.Constructor);

                    ITypeDefinition constructorType = constructorDefinition.ContainingTypeDefinition;

                    // Mark attribute constructor reachable
                    summary.NonvirtuallyCalledMethods.Add(constructorDefinition);


                    // Mark named argument property setters reachable
                    foreach (IMetadataNamedArgument namedArgument in customAttribute.NamedArguments)
                    {
                        IName setterName = wholeProgram.Host().NameTable.GetNameFor("set_" + namedArgument.ArgumentName.Value);

                        IMethodDefinition setterMethod = TypeHelper.GetMethod(constructorType, setterName, namedArgument.ArgumentValue.Type);

                        if (setterMethod != Dummy.Method)
                        {
                            // We treat this as a non-virtual call because we know the exact runtime-type of the attribute
                            summary.NonvirtuallyCalledMethods.Add(setterMethod);
                        }
                        else
                        {
                            // Note this won't find a property defined in a super class of the attribute (unsound).
                            // We'll want to fix this if try to generalize this code to handle arbitrary attributes

                            throw new Exception("Couldn't find setter " + setterName + " for type " + namedArgument.ArgumentValue.Type + " in " + constructorType);
                        }
                    }
                }
            }
            else
            {
                throw new Exception("Cannot construct subtypes outside of a summarized method.");
            }
        }
Exemplo n.º 40
0
    public override void TraverseChildren(IFieldDefinition fieldDefinition) {
      if (fieldDefinition.ContainingType.IsEnum && fieldDefinition.IsRuntimeSpecial && fieldDefinition.IsSpecialName)
        return; // implicit value field of an enum

      if (!this.printCompilerGeneratedMembers &&
        AttributeHelper.Contains(fieldDefinition.Attributes, fieldDefinition.Type.PlatformType.SystemRuntimeCompilerServicesCompilerGeneratedAttribute))
        return; // eg. a cached anonymous delegate - may have invalid symbols

      foreach (var e in fieldDefinition.ContainingTypeDefinition.Events) {
        if (e.Name == fieldDefinition.Name)
          return;   // field is probably the implicit delegate backing the event
      }

      // Figure out if this is a special fixed buffer field
      ICustomAttribute fixedBufferAttr = Utils.FindAttribute(fieldDefinition.Attributes, SpecialAttribute.FixedBuffer);

      if (fixedBufferAttr == null)
        PrintAttributes(fieldDefinition);

      if (fieldDefinition.ContainingTypeDefinition.Layout == LayoutKind.Explicit)
        PrintPseudoCustomAttribute(fieldDefinition, "System.Runtime.InteropServices.FieldOffset", fieldDefinition.Offset.ToString(), true, null);

      PrintToken(CSharpToken.Indent);

      if (fieldDefinition.IsCompileTimeConstant && fieldDefinition.ContainingType.IsEnum) {
        PrintFieldDefinitionEnumValue(fieldDefinition);
      } else {
        PrintFieldDefinitionVisibility(fieldDefinition);
        PrintFieldDefinitionModifiers(fieldDefinition);

        if (fixedBufferAttr == null) {
          PrintFieldDefinitionType(fieldDefinition);
          PrintToken(CSharpToken.Space);
          PrintFieldDefinitionName(fieldDefinition);
          if (fieldDefinition.IsCompileTimeConstant) {
            sourceEmitterOutput.Write(" = ");
            PrintFieldDefinitionValue(fieldDefinition);
          }
        } else {
          PrintFieldDefinitionFixedBuffer(fieldDefinition, fixedBufferAttr);
        }
        PrintToken(CSharpToken.Semicolon);
      }
    }
Exemplo n.º 41
0
    public virtual void PrintFieldDefinitionValue(IFieldDefinition fieldDefinition) {
      Contract.Requires(fieldDefinition != null);

      // We've got context here about the field that can be used to provide a better value.
      // For enums, the IMetadataConstant is just the primitive value
      var fieldType = fieldDefinition.Type.ResolvedType;
      if (fieldType.IsEnum) {
        PrintEnumValue(fieldType, fieldDefinition.CompileTimeValue.Value);
      } else if (TypeHelper.TypesAreEquivalent(fieldDefinition.ContainingTypeDefinition, fieldType.PlatformType.SystemFloat32) && 
                 fieldType.TypeCode == PrimitiveTypeCode.Float32) {
        // Defining System.Single, can't reference the symbolic names, use constant hacks instead
        float val = (float)fieldDefinition.CompileTimeValue.Value;
        if (float.IsNegativeInfinity(val))
          sourceEmitterOutput.Write("-1.0f / 0.0f");
        else if (float.IsPositiveInfinity(val))
          sourceEmitterOutput.Write("1.0f / 0.0f");
        else if (float.IsNaN(val))
          sourceEmitterOutput.Write("0.0f / 0.0f");
        else
          sourceEmitterOutput.Write(val.ToString("R") + "f");
      } else if (TypeHelper.TypesAreEquivalent(fieldDefinition.ContainingTypeDefinition, fieldType.PlatformType.SystemFloat64) &&
                 fieldType.TypeCode == PrimitiveTypeCode.Float64) {
        // Defining System.Double, can't reference the symbolic names, use constant hacks instead
        double val = (double)fieldDefinition.CompileTimeValue.Value;
        if (double.IsNegativeInfinity(val))
          sourceEmitterOutput.Write("-1.0 / 0.0");
        else if (double.IsPositiveInfinity(val))
          sourceEmitterOutput.Write("1.0 / 0.0");
        else if (double.IsNaN(val))
          sourceEmitterOutput.Write("0.0 / 0.0");
        else
          sourceEmitterOutput.Write(val.ToString("R"));
      } else if (TypeHelper.TypesAreEquivalent(fieldDefinition.ContainingTypeDefinition, fieldType) && 
        (fieldType.TypeCode == PrimitiveTypeCode.Int32 || fieldType.TypeCode == PrimitiveTypeCode.UInt32 ||
         fieldType.TypeCode == PrimitiveTypeCode.Int64 || fieldType.TypeCode == PrimitiveTypeCode.UInt64)) {
        // Defining a core integral system type, can't reference the symbolic names, use constants
        sourceEmitterOutput.Write(fieldDefinition.CompileTimeValue.Value.ToString());
      } else {
        this.Traverse(fieldDefinition.CompileTimeValue);
      }
    }
        public override void Configure(IFieldDefinition definition)
        {
            base.Configure(definition);
            var aManager = AgentsManager.GetManager();
            var agents = aManager.GetAgents().OrderBy(a => a.Title).Where(a => a.Status == Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live);
            if (agents != null)
            {
                this.RenderChoicesAs = Telerik.Sitefinity.Web.UI.Fields.Enums.RenderChoicesAs.DropDown; //
                // or you can use Telerik.Sitefinity.Web.UI.Fields.Enums.RenderChoicesAs.CheckBoxes for multiple choice

                this.Choices.Clear();
                foreach (var agent in agents)
                {
                    var choice = new ChoiceItem();
                    choice.Value = agent.Id.ToString();
                    choice.Text = agent.Title;
                    choice.Enabled = true;
                    this.Choices.Add(choice);
                }
            }
        }
Exemplo n.º 43
0
 public override void Visit(IFieldDefinition field)
 {
     if (IsMemberExternallyVisible2(field))
     {
         // Recursion
         Visit(field.Type);
     }
 }
Exemplo n.º 44
0
 /// <summary>
 /// Performs some computation with the given field definition.
 /// </summary>
 public virtual void Visit(IFieldDefinition fieldDefinition)
 {
     this.Visit((ITypeDefinitionMember)fieldDefinition);
 }
Exemplo n.º 45
0
 public void Visit(IFieldDefinition fieldDefinition)
 {
     this.traverser.Traverse(fieldDefinition);
 }
Exemplo n.º 46
0
 /// <summary>
 /// Traverses the children of the field definition.
 /// </summary>
 public virtual void TraverseChildren(IFieldDefinition fieldDefinition)
 {
     Contract.Requires(fieldDefinition != null);
       this.TraverseChildren((ITypeDefinitionMember)fieldDefinition);
       if (this.stopTraversal) return;
       if (fieldDefinition.IsCompileTimeConstant) {
     this.Traverse(fieldDefinition.CompileTimeValue);
     if (this.stopTraversal) return;
       }
       if (fieldDefinition.IsModified) {
     this.Traverse(fieldDefinition.CustomModifiers);
     if (this.stopTraversal) return;
       }
       if (fieldDefinition.IsMarshalledExplicitly) {
     this.Traverse(fieldDefinition.MarshallingInformation);
     if (this.stopTraversal) return;
       }
       this.Traverse(fieldDefinition.Type);
 }
Exemplo n.º 47
0
 //^ ensures this.path.Count == old(this.path.Count);
 /// <summary>
 /// Performs some computation with the given field definition.
 /// </summary>
 /// <param name="fieldDefinition"></param>
 public virtual void Visit(IFieldDefinition fieldDefinition)
 {
     if (this.stopTraversal) return;
       //^ int oldCount = this.path.Count;
       this.path.Push(fieldDefinition);
       if (fieldDefinition.IsCompileTimeConstant)
     this.Visit((IMetadataExpression)fieldDefinition.CompileTimeValue);
       if (fieldDefinition.IsModified)
     this.Visit(fieldDefinition.CustomModifiers);
       if (fieldDefinition.IsMarshalledExplicitly)
     this.Visit(fieldDefinition.MarshallingInformation);
       this.Visit(fieldDefinition.Type);
       //^ assume this.path.Count == oldCount+1; //True because all of the virtual methods of this class promise not decrease this.path.Count.
       this.path.Pop();
 }
Exemplo n.º 48
0
 /// <summary>
 /// Traverses the field definition.
 /// </summary>
 public void Traverse(IFieldDefinition fieldDefinition)
 {
     Contract.Requires(fieldDefinition != null);
       //specialized fields are simply traversed as if they were normal fields
       if (this.preorderVisitor != null) fieldDefinition.Dispatch(this.preorderVisitor);
       if (this.stopTraversal) return;
       this.TraverseChildren(fieldDefinition);
       if (this.stopTraversal) return;
       if (this.postorderVisitor != null) fieldDefinition.Dispatch(this.postorderVisitor);
 }
Exemplo n.º 49
0
    private void EmitGenericTypeObject(uint index, IFieldDefinition field, bool isStatic) {
      Contract.Requires(field != null);

      this.sourceEmitter.EmitString("(uintptr_t)((void**)((");
      if (isStatic) {
        this.EmitTypeReference(this.host.PlatformType.SystemType);
        this.sourceEmitter.EmitString(")(typeObject");
        this.EmitAdjustPointerToHeaderFromData();
        this.sourceEmitter.EmitString(")");
      } else {
        this.EmitTypeReference(this.host.PlatformType.SystemType);
        this.sourceEmitter.EmitString(")(((");
        this.EmitTypeReference(this.host.PlatformType.SystemObject);
        this.sourceEmitter.EmitString(")");
        this.sourceEmitter.EmitString("(");
        this.sourceEmitter.EmitString("_this ");
        this.EmitAdjustPointerToHeaderFromData();
        this.sourceEmitter.EmitString(")");
        this.sourceEmitter.EmitString(")->");
        this.sourceEmitter.EmitString(this.GetMangledFieldName(this.typeField));
        this.EmitAdjustPointerToHeaderFromData();
        this.sourceEmitter.EmitString(")");
      }
      this.sourceEmitter.EmitString(")->");
      this.sourceEmitter.EmitString(this.GetMangledFieldName(field));
      this.sourceEmitter.EmitString(")[" + index + "]");
    }
Exemplo n.º 50
0
    private void EmitFastInstanceCheck(Instruction instruction, INamedTypeDefinition targetType, uint depth, IFieldDefinition baseClassField) {

      Contract.Requires(instruction != null);
      Contract.Requires(targetType != null);
      Contract.Requires(baseClassField != null);

      //Just assign the operand to the result.
      this.EmitInstructionResultName(instruction);
      this.sourceEmitter.EmitString(" = ");
      this.EmitInstructionReference(instruction.Operand1);
      this.sourceEmitter.EmitString(";");
      this.sourceEmitter.EmitNewLine();

      //If the result is not null, we have more work to do.
      this.sourceEmitter.EmitString("if (");
      this.EmitInstructionResultName(instruction);
      this.sourceEmitter.EmitString(" != 0) ");
      this.sourceEmitter.EmitBlockOpeningDelimiter("{");
      this.sourceEmitter.EmitNewLine();

      //Get the type of the object to cast
      this.sourceEmitter.EmitString("uintptr_t objectType = ((");
      this.EmitTypeReference(this.host.PlatformType.SystemObject);
      this.sourceEmitter.EmitString(")");
      this.sourceEmitter.EmitString("(");
      this.EmitInstructionReference(instruction.Operand1);
      this.EmitAdjustPointerToHeaderFromData();
      this.sourceEmitter.EmitString(")");
      this.sourceEmitter.EmitString(")->");
      this.sourceEmitter.EmitString(this.GetMangledFieldName(this.typeField));
      this.sourceEmitter.EmitString(";");
      this.sourceEmitter.EmitNewLine();

      //If the types are not the same, we have more work to do.
      this.sourceEmitter.EmitString("if (objectType != ");
      this.sourceEmitter.EmitString(this.GetMangledTypeName(targetType));
      this.sourceEmitter.EmitString("_typeObject) ");
      this.sourceEmitter.EmitBlockOpeningDelimiter("{");
      this.sourceEmitter.EmitNewLine();

      //Get the appropriate baseClass from the type of the object to cast
      this.sourceEmitter.EmitString("uintptr_t baseClassType = ((");
      this.EmitTypeReference(this.host.PlatformType.SystemType);
      this.sourceEmitter.EmitString(")(objectType");
      this.EmitAdjustPointerToHeaderFromData();
      this.sourceEmitter.EmitString("))->");
      this.sourceEmitter.EmitString(this.GetMangledFieldName(baseClassField));
      if (depth >= 6) this.sourceEmitter.EmitString("["+(depth-6)+"]");
      this.sourceEmitter.EmitString(";");
      this.sourceEmitter.EmitNewLine();

      //And now compare and null out the result if they are not the same.
      this.sourceEmitter.EmitString("if (baseClassType != ");
      this.sourceEmitter.EmitString(this.GetMangledTypeName(targetType));
      this.sourceEmitter.EmitString("_typeObject) ");
      this.sourceEmitter.EmitBlockOpeningDelimiter("{");
      this.sourceEmitter.EmitNewLine();
      this.EmitInstructionResultName(instruction);
      this.sourceEmitter.EmitString(" = 0;");
      this.sourceEmitter.EmitNewLine();
      this.sourceEmitter.EmitBlockClosingDelimiter("}");
      this.sourceEmitter.EmitNewLine();

      //Close the object type check if
      this.sourceEmitter.EmitBlockClosingDelimiter("}");
      this.sourceEmitter.EmitNewLine();

      //Close the null check if
      this.sourceEmitter.EmitBlockClosingDelimiter("}");
    }
Exemplo n.º 51
0
 public void Visit(IFieldDefinition fieldDefinition)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 52
0
    private void EmitFastBaseClassCheck(Instruction instruction, INamedTypeDefinition derivedType, 
      uint depth, IFieldDefinition baseClassField) {
      Contract.Requires(instruction != null);
      Contract.Requires(derivedType != null);
      Contract.Requires(baseClassField != null);

      //Only check cast if operand is not null
      this.sourceEmitter.EmitString("if (");
      this.EmitInstructionReference(instruction.Operand1);
      this.sourceEmitter.EmitString(" != 0) ");
      this.sourceEmitter.EmitBlockOpeningDelimiter("{");
      this.sourceEmitter.EmitNewLine();

      //Get the type of the object to cast
      this.sourceEmitter.EmitString("uintptr_t objectType = ((");
      this.EmitTypeReference(this.host.PlatformType.SystemObject);
      this.sourceEmitter.EmitString(")");
      this.sourceEmitter.EmitString("(");
      this.EmitInstructionReference(instruction.Operand1);
      this.EmitAdjustPointerToHeaderFromData();
      this.sourceEmitter.EmitString(")");
      this.sourceEmitter.EmitString(")->");
      this.sourceEmitter.EmitString(this.GetMangledFieldName(this.typeField));
      this.sourceEmitter.EmitString(";");
      this.sourceEmitter.EmitNewLine();

      //We expect the object type to be the same as the derived type in most cases, so check this using only locals.
      this.sourceEmitter.EmitString("if (objectType != ");
      this.sourceEmitter.EmitString(this.GetMangledTypeName(derivedType));
      this.sourceEmitter.EmitString("_typeObject) ");
      this.sourceEmitter.EmitBlockOpeningDelimiter("{");
      this.sourceEmitter.EmitNewLine();

      //Get the appropriate baseClass from the type of the object to cast
      this.sourceEmitter.EmitString("uintptr_t baseClassType = ((");
      this.EmitTypeReference(this.host.PlatformType.SystemType);
      this.sourceEmitter.EmitString(")( objectType");
      this.EmitAdjustPointerToHeaderFromData();
      this.sourceEmitter.EmitString("))->");
      this.sourceEmitter.EmitString(this.GetMangledFieldName(baseClassField));
      if (depth >= 6) this.sourceEmitter.EmitString("["+(depth-6)+"]");
      this.sourceEmitter.EmitString(";");
      this.sourceEmitter.EmitNewLine();

      //And now compare and throw if not the same.
      this.sourceEmitter.EmitString("if (baseClassType != ");
      this.sourceEmitter.EmitString(this.GetMangledTypeName(derivedType));
      this.sourceEmitter.EmitString("_typeObject) ");
      this.sourceEmitter.EmitBlockOpeningDelimiter("{");
      this.sourceEmitter.EmitNewLine();
      this.sourceEmitter.EmitString("uintptr_t invalidCastException;");
      this.sourceEmitter.EmitNewLine();
      this.sourceEmitter.EmitString("exception = GetInvalidCastException((uintptr_t)&invalidCastException);");
      this.sourceEmitter.EmitNewLine();
      this.EmitThrow(instruction.Operation.Offset, this.invalidCastExceptionType, "invalidCastException");
      this.sourceEmitter.EmitString(";");
      this.sourceEmitter.EmitNewLine();
      this.sourceEmitter.EmitBlockClosingDelimiter("}");
      this.sourceEmitter.EmitNewLine();

      //Close the object type check if
      this.sourceEmitter.EmitBlockClosingDelimiter("}");
      this.sourceEmitter.EmitNewLine();

      //Close the null check if
      this.sourceEmitter.EmitBlockClosingDelimiter("}");
      this.sourceEmitter.EmitNewLine();

      //If execution gets to the point in the emitted code, the cast succeeded and we just need to emit code to assign the operand to the instruction result
      this.EmitInstructionResultName(instruction);
      this.sourceEmitter.EmitString(" = ");
      this.EmitInstructionReference(instruction.Operand1);
    }
Exemplo n.º 53
0
 public override void Visit(IFieldDefinition field) {
   field.ContainingTypeDefinition.Dispatch(this);
   field.Type.Dispatch(this);
   this.Visit(field.Name.Value);
   if (field.IsModified) this.Visit(field.CustomModifiers);
 }
Exemplo n.º 54
0
        public virtual void Visit(IFieldDefinition fieldDefinition)
        {
            var constant = fieldDefinition.GetCompileTimeValue(Context);
            var marshalling = fieldDefinition.MarshallingInformation;

            Debug.Assert((constant != null) == fieldDefinition.IsCompileTimeConstant);
            Debug.Assert((marshalling != null || !fieldDefinition.MarshallingDescriptor.IsDefaultOrEmpty) == fieldDefinition.IsMarshalledExplicitly);

            if (constant != null)
            {
                this.Visit((IMetadataExpression)constant);
            }

            if (marshalling != null)
            {
                // Note, we are not visiting MarshallingDescriptor. It is used only for 
                // NoPia embedded/local types and VB Dev11 simply copies the bits without
                // cracking them.
                this.Visit(marshalling);
            }

            this.Visit(fieldDefinition.GetType(Context));
        }
Exemplo n.º 55
0
 public Field(FieldInfo fieldInfo, IFieldDefinition fieldDefinition)
 {
     this.fieldInfo = fieldInfo;
     this.fieldDefinition = fieldDefinition;
 }
Exemplo n.º 56
0
 /// <summary>
 /// Performs some computation with the given field definition.
 /// </summary>
 public virtual void Visit(IFieldDefinition fieldDefinition)
 {
 }
Exemplo n.º 57
0
            /// <summary>
            /// Performs some computation with the given field definition.
            /// </summary>
            public void Visit(IFieldDefinition fieldDefinition)
            {
                this.Visit((ITypeDefinitionMember)fieldDefinition);
                if (fieldDefinition.InternedKey == 0)
                  this.ReportError(MetadataError.IncompleteNode, fieldDefinition, "InternedKey");
                if (fieldDefinition.Type is Dummy)
                  this.ReportError(MetadataError.IncompleteNode, fieldDefinition, "Type");
                if (fieldDefinition.IsCompileTimeConstant) {
                  if (fieldDefinition.IsReadOnly)
                this.ReportError(MetadataError.FieldMayNotBeConstantAndReadonly, fieldDefinition);
                  if (!fieldDefinition.IsStatic)
                this.ReportError(MetadataError.ConstantFieldMustBeStatic, fieldDefinition);
                  var fieldType = fieldDefinition.Type;
                  if (fieldType.IsEnum && fieldType.ResolvedType != Dummy.Type) fieldType = fieldType.ResolvedType.UnderlyingType;
                  if (!TypeHelper.TypesAreEquivalent(fieldDefinition.CompileTimeValue.Type, fieldType))
                this.ReportError(MetadataError.MetadataConstantTypeMismatch, fieldDefinition.CompileTimeValue, fieldDefinition);
                }
                if (fieldDefinition.IsRuntimeSpecial && !fieldDefinition.IsSpecialName)
                  this.ReportError(MetadataError.RuntimeSpecialMustAlsoBeSpecialName, fieldDefinition);
                if (fieldDefinition.ContainingTypeDefinition.Layout == LayoutKind.Explicit) {
                  if (fieldDefinition.Offset > 0 && fieldDefinition.IsStatic)
                this.ReportError(MetadataError.StaticFieldsMayNotHaveLayout, fieldDefinition);
                  if (fieldDefinition.Type.TypeCode == PrimitiveTypeCode.NotPrimitive && (fieldDefinition.Offset % this.validator.host.PointerSize) != 0)
                this.ReportError(MetadataError.FieldOffsetNotNaturallyAlignedForObjectRef, fieldDefinition);
                }
                if (fieldDefinition.IsMapped) {
                  if (!fieldDefinition.Type.IsValueType) //TODO: also check, recursively, that all fields are public and have types that do not reference heap objects.
                this.ReportError(MetadataError.MappedFieldDoesNotHaveAValidType, fieldDefinition);
                }
                if (fieldDefinition.IsMarshalledExplicitly) {
                  if (fieldDefinition.MarshallingInformation.UnmanagedType == System.Runtime.InteropServices.UnmanagedType.LPArray) {
                if (fieldDefinition.MarshallingInformation.ParamIndex != null)
                  this.ReportError(MetadataError.ArraysMarshalledToFieldsCannotSpecifyElementCountParameter, fieldDefinition.MarshallingInformation, fieldDefinition);
                  }
                  if (fieldDefinition.MarshallingInformation.UnmanagedType == System.Runtime.InteropServices.UnmanagedType.LPArray ||
                fieldDefinition.MarshallingInformation.UnmanagedType == System.Runtime.InteropServices.UnmanagedType.ByValArray ||
                fieldDefinition.MarshallingInformation.UnmanagedType == System.Runtime.InteropServices.UnmanagedType.ByValTStr) {
                if (fieldDefinition.MarshallingInformation.NumberOfElements == 0)
                  this.ReportError(MetadataError.MarshalledArraysMustHaveSizeKnownAtCompileTime, fieldDefinition.MarshallingInformation, fieldDefinition);
                  }

                }
            }
 private void CheckPortableAttributes(IFieldDefinition fd, IPortable portable)
 {
     if (fd.GetFactoryId() != portable.GetFactoryId())
     {
         throw new HazelcastSerializationException(
             "Wrong Portable type! Generic portable types are not supported! " + " Expected factory-id: " +
             fd.GetFactoryId() + ", Actual factory-id: " + portable.GetFactoryId());
     }
     if (fd.GetClassId() != portable.GetClassId())
     {
         throw new HazelcastSerializationException(
             "Wrong Portable type! Generic portable types are not supported! " + "Expected class-id: " +
             fd.GetClassId() + ", Actual class-id: " + portable.GetClassId());
     }
 }
Exemplo n.º 59
0
 public virtual void onMetadataElement(IFieldDefinition fieldDefinition) { }
Exemplo n.º 60
0
        public override void TraverseChildren(IFieldDefinition fieldDefinition)
{ MethodEnter(fieldDefinition);
            base.TraverseChildren(fieldDefinition);
     MethodExit();   }