コード例 #1
0
        internal TypeDefinitionSyntax(FileScope pScope,
                                      TypeSyntax pType,
                                      TypeSyntax pImplements,
                                      DefinitionTypes pDefinitionType,
                                      List <TypedIdentifierSyntax> pFields,
                                      List <MethodSyntax> pMethods)
        {
            System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(pType.Value), "Define name cannot be empty");
            System.Diagnostics.Debug.Assert(pDefinitionType != DefinitionTypes.Unknown);

            Scope          = pScope;
            DeclaredType   = pType;
            DefinitionType = pDefinitionType;
            AppliesTo      = pImplements;
            Fields         = pFields;
            Methods        = pMethods;

            var tp = new List <string>();

            foreach (var pa in DeclaredType.GenericArguments)
            {
                tp.Add(pa.Value);
            }
            TypeParameters = tp;
            _typeMappings  = new List <Dictionary <string, SmallType> >();
        }
コード例 #2
0
ファイル: SyntaxFactory.cs プロジェクト: btbaggin/SmallerLang
 public static TypeDefinitionSyntax TypeDefinition(FileScope pScope, TypeSyntax pType, TypeSyntax pImplements, DefinitionTypes pDefinitionType, List <MethodSyntax> pMethods, List <TypedIdentifierSyntax> pFields)
 {
     return(new TypeDefinitionSyntax(pScope, pType, pImplements, pDefinitionType, pFields, pMethods));
 }
コード例 #3
0
 /// <summary>
 /// Defines a length in a UIContainer
 /// </summary>
 /// <param name="definitionType">
 /// Fixed: A length you can specify here as an integer.
 /// Auto: Takes up only the space of its largest item.
 /// Fill: Takes up all remaining space in the container, divided evenly between the other Fill definitions of this dimension.</param>
 public Definition(DefinitionTypes definitionType)
 {
     this.DefinitionType = definitionType;
 }
コード例 #4
0
        public void CreateDefinitionCoverageReport()
        {
            var result = new StringBuilder();


            foreach (var definitionType in DefinitionTypes.OrderBy(d => d.Name))
            {
                var allProps       = definitionType.GetProperties().OrderBy(p => p.Name);
                var validatedProps = allProps.Where(p => p.GetCustomAttributes(typeof(ExpectValidationAttribute)).Any());
                var updatableProps = allProps.Where(p => p.GetCustomAttributes(true).Any(a => (a as ExpectUpdate) != null));

                Trace.WriteLine(definitionType.Name);

                result.Append("<table class='table table-bordered table-striped'>");

                result.Append("<thead>");
                result.Append("<tr>");
                result.AppendFormat("<th style='width: 150px;'>{0}</th>", definitionType.Name);
                result.Append("<th>Property</th>");
                result.Append("<th>Validated</th>");
                result.Append("<th>Updated</th>");
                result.Append("</tr>");
                result.Append("</thead>");

                result.Append("<tr>");

                bool isFirst = true;

                foreach (var prop in allProps)
                {
                    if (!isFirst)
                    {
                        result.Append("<tr>");
                    }

                    var isValidated = validatedProps.Any(p => p.Name == prop.Name);
                    var isUpdated   = updatableProps.Any(p => p.Name == prop.Name);

                    result.AppendFormat("<td></td>");
                    result.AppendFormat("<td>{0}</td>", prop.Name);
                    result.AppendFormat("<td>{0}</td>", isValidated);
                    result.AppendFormat("<td>{0}</td>", isUpdated);

                    Trace.WriteLine(string.Format("{0}{1} - validated:{2} updated:{3}", '\t', prop.Name, isValidated, isUpdated));

                    isFirst = false;

                    if (!isFirst)
                    {
                        result.Append("</tr>");
                    }
                }

                result.Append("</table>");
                result.Append("<br/>");
                result.Append("<br/>");
            }

            var reportHtml = result.ToString();

            Trace.WriteLine(reportHtml);
        }
コード例 #5
0
 protected Definition(DefinitionTypes definitionType)
 {
     DefinitionType = definitionType;
     Properties     = new Dictionary <string, string>();
 }
コード例 #6
0
ファイル: EnsuringApi.cs プロジェクト: Evobolics/EvoAssembly
        /// <summary>
        /// Ensures the execution type system has a type entry for the specified type reference, type, or structural input type node.
        /// </summary>
        /// <param name="context"></param>
        public ExecutionTypeNode_I Ensure(ExecutionEnsureContext context)
        {
            //if (inputType.InputStructuralNode.CecilTypeReference.Name != "<Module>")
            //{
            //	Execution.Types.Ensuring.Ensure(conversion.RuntimicSystem, inputType);
            //}

            if (context?.TypeReference?.FullName ==
                "<PrivateImplementationDetails>"
                )
            {
            }

            // Step 1 - Get Strcutral input type node
            if (context.StructuralInputTypeNode == null)
            {
                if (context.TypeReference != null)
                {
                    context.StructuralInputTypeNode = Infrastructure.Structural.Types.Ensure(context.RuntimicSystem, context.TypeReference, null, context.MethodReference);
                }
                else if (context.UnderlyingType != null)
                {
                    context.StructuralInputTypeNode = Infrastructure.Structural.Types.Ensure(context.RuntimicSystem, context.UnderlyingType);
                }
                else
                {
                    throw new Exception("A bound or converted type entry cannot be ensured without either a 'metadata type definition/reference' " +
                                        "or a 'runtime type' (System.Type).");
                }
            }

            if (context.TypeReference == null)
            {
                context.TypeReference = context.StructuralInputTypeNode.CecilTypeReference;
            }

            var metadataToken = context.StructuralInputTypeNode.MetadataToken;

            context.RowId = metadataToken & 0x00FFFFFF;


            // Step 3 - Build out the execution node
            if (context.StructuralInputTypeNode.IsByReferenceType)
            {
                return(ByReferences.Ensure(context));
            }

            // Depends upon the underlying unified entry
            if (context.StructuralInputTypeNode.IsPointerType)
            {
                return(Pointers.Ensure(context));
            }

            // Depends upon the underlying unified entry
            if (context.StructuralInputTypeNode.IsArrayType)
            {
                return(Arrays.Ensure(context));
            }


            // Depends upon the underlying unified entry
            if (context.StructuralInputTypeNode.IsGenericParameter)
            {
                // You cannot create a generic parameter directly.  It is created when its parent type creates it.
                return(GenericParameters.Ensure(context));
            }



            context.IsConverted = IsConverted(context);

            if (context.StructuralInputTypeNode.IsGenericInstance)
            {
                // You cannot create a generic parameter directly.  It is created when its parent type creates it.
                return(GenericInstanceTypes.Ensure(context));
            }

            return(DefinitionTypes.Ensure(context));
        }