/// <summary>
 /// Constructor for the <see cref="CsContainer"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="modelType">The type of code model created.</param>
 /// <param name="members">The members assigned to this container.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="attributes">List of the attributes assigned to this model.</param>
 /// <param name="isGeneric">Flag that determines if the container is a generic definition.</param>
 /// <param name="hasStrongTypesInGenerics">Flag that determines if the generics use strong type definitions.</param>
 /// <param name="genericParameters">Generic parameters assigned to the container.</param>
 /// <param name="genericTypes">Target types for the generic parameters assigned to the container.</param>
 /// <param name="sourceFiles">List of the fully qualified paths to the source code files this model is defined in.</param>
 /// <param name="hasDocumentation">Flag that determines if the model has XML documentation assigned to it.</param>
 /// <param name="documentation">The xml documentation assigned to the model.</param>
 /// <param name="lookupPath">The fully qualified model lookup path for this model.</param>
 /// <param name="name">The name of the model.</param>
 /// <param name="ns">The namespace the container belongs to.</param>
 /// <param name="parentPath">The fully qualified lookup path for the parent model to this one.</param>
 /// <param name="containerType">The type of container this model represents.</param>
 /// <param name="security">The security scope assigned to this model.</param>
 /// <param name="inheritedInterfaces">The interfaces that are inherited by this container.</param>
 protected CsContainer(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, CsModelType modelType,
                       IReadOnlyList <CsAttribute> attributes, bool isGeneric, bool hasStrongTypesInGenerics,
                       IReadOnlyList <CsGenericParameter> genericParameters, IReadOnlyList <CsType> genericTypes,
                       IReadOnlyList <string> sourceFiles, bool hasDocumentation, string documentation, string lookupPath,
                       string name, string ns, string parentPath, CsContainerType containerType, CsSecurity security,
                       IReadOnlyList <CsInterface> inheritedInterfaces, IReadOnlyList <CsMember> members,
                       string sourceDocument = null, ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, modelType, sourceDocument, modelStore, modelErrors)
 {
     _attributes = attributes ?? ImmutableList <CsAttribute> .Empty;
     _isGeneric  = isGeneric;
     _hasStrongTypesInGenerics = hasStrongTypesInGenerics;
     _genericParameters        = genericParameters ?? ImmutableList <CsGenericParameter> .Empty;
     _genericTypes             = genericTypes ?? ImmutableList <CsType> .Empty;
     _sourceFiles      = sourceFiles ?? ImmutableList <string> .Empty;
     _hasDocumentation = hasDocumentation;
     _documentation    = documentation;
     _lookupPath       = lookupPath;
     _name             = name;
     _ns                  = ns;
     _parentPath          = parentPath;
     _containerType       = containerType;
     _security            = security;
     _inheritedInterfaces = inheritedInterfaces ?? ImmutableList <CsInterface> .Empty;
     _members             = members ?? ImmutableList <CsMember> .Empty;
 }
Esempio n. 2
0
 /// <summary>
 /// Constructor for the <see cref="CsMethod"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="parameters">The parameters assigned to the method.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="attributes">List of the attributes assigned to this model.</param>
 /// <param name="sourceFiles">List of the fully qualified paths to the source code files this member is defined in.</param>
 /// <param name="hasDocumentation">Flag that determines if the model has XML documentation assigned to it.</param>
 /// <param name="documentation">The xml documentation assigned to the model.</param>
 /// <param name="lookupPath">The fully qualified model lookup path for this model.</param>
 /// <param name="name">The name of the model.</param>
 /// <param name="parentPath">THe fully qualified lookup path for the parent model to this one.</param>
 /// <param name="security">The security scope assigned to this model.</param>
 /// <param name="isGeneric">Flag that determines if the method is a generic definition.</param>
 /// <param name="hasStrongTypesInGenerics">Flag that determines if the generics use strong type definitions.</param>
 /// <param name="genericParameters">Generic parameters assigned to the method.</param>
 /// <param name="genericTypes">Target types for the generic parameters assigned to the method.</param>
 /// <param name="hasParameters">Flag that determines if the method had parameters.</param>
 /// <param name="isAbstract">Flag that determines if the model is abstract.</param>
 /// <param name="isVirtual">Flag that determines if the model is virtual.</param>
 /// <param name="isSealed">Flag that determines if the model is sealed.</param>
 /// <param name="isOverride">Flag that determines if the model is overridden.</param>
 /// <param name="isStatic">Flag that determines if the model is static.</param>
 /// <param name="isVoid">Flag that determines if the return type is void. </param>
 /// <param name="isAsync">Flag that determines if the method has the async keyword assigned.</param>
 /// <param name="isExtension">Flag that determines if the method is an extension method.</param>
 /// <param name="methodType">The type of method that was implemented.</param>
 /// <param name="returnType">The type definition for the return type.</param>
 protected CsMethod(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language,
                    IReadOnlyList <CsAttribute> attributes, IReadOnlyList <string> sourceFiles,
                    bool hasDocumentation, string documentation, string lookupPath, string name, string parentPath,
                    CsSecurity security, bool isGeneric, bool hasStrongTypesInGenerics,
                    IReadOnlyList <CsGenericParameter> genericParameters, IReadOnlyList <CsType> genericTypes,
                    bool hasParameters, bool isAbstract, bool isVirtual, bool isSealed, bool isOverride, bool isStatic,
                    bool isVoid, bool isAsync, bool isExtension, CsMethodType methodType, CsType returnType,
                    IReadOnlyList <CsParameter> parameters, string sourceDocument = null,
                    ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.Method,
            attributes, sourceFiles, hasDocumentation, documentation, lookupPath, name, parentPath,
            security, CsMemberType.Method, sourceDocument, modelStore, modelErrors)
 {
     _isGeneric = isGeneric;
     _hasStrongTypesInGenerics = hasStrongTypesInGenerics;
     _genericParameters        = genericParameters ?? ImmutableList <CsGenericParameter> .Empty;
     _genericTypes             = genericTypes ?? ImmutableList <CsType> .Empty;
     _hasParameters            = hasParameters;
     _isAbstract  = isAbstract;
     _isVirtual   = isVirtual;
     _isSealed    = isSealed;
     _isOverride  = isOverride;
     _isStatic    = isStatic;
     _isVoid      = isVoid;
     _isAsync     = isAsync;
     _isExtension = isExtension;
     _methodType  = methodType;
     _returnType  = returnType;
     _parameters  = parameters ?? ImmutableList <CsParameter> .Empty;
 }
Esempio n. 3
0
 /// <summary>
 /// Constructor for the <see cref="CsDelegate"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="attributes">List of the attributes assigned to this model.</param>
 /// <param name="isGeneric">Flag that determines if the delegate is a generic definition.</param>
 /// <param name="hasStrongTypesInGenerics">Flag that determines if the generics use strong type definitions.</param>
 /// <param name="genericParameters">Generic parameters assigned to the delegate.</param>
 /// <param name="genericTypes">Target types for the generic parameters assigned to the delegate.</param>
 /// <param name="hasDocumentation">Flag that determines if the model has XML documentation assigned to it.</param>
 /// <param name="documentation">The xml documentation assigned to the model.</param>
 /// <param name="lookupPath">The fully qualified model lookup path for this model.</param>
 /// <param name="sourceFiles">List of the fully qualified paths to the source code files this member is defined in.</param>
 /// <param name="name">The name of the model.</param>
 /// <param name="ns">The namespace this delegate is assigned to.</param>
 /// <param name="isVoid">Flag that determines if the return type is void. </param>
 /// <param name="parentPath">THe fully qualified lookup path for the parent model to this one.</param>
 /// <param name="security">The security scope assigned to this model.</param>
 /// <param name="returnType">The type definition for the return type.</param>
 /// <param name="hasParameters">Flag that determines if the delegate had parameters.</param>
 /// <param name="parameters">The parameters assigned to the delegate.</param>
 /// <param name="invokeMethod">The invoke method definition assigned to this delegate.</param>
 /// <param name="beginInvokeMethod">The begin invoke method definition assigned to this delegate.</param>
 /// <param name="endInvokeMethod">The end invoke method definition assigned to this delegate.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 protected CsDelegate(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language,
                      IReadOnlyList <CsAttribute> attributes, bool isGeneric, bool hasStrongTypesInGenerics, IReadOnlyList <CsGenericParameter> genericParameters,
                      IReadOnlyList <CsType> genericTypes, bool hasDocumentation, string documentation, string lookupPath,
                      IReadOnlyList <string> sourceFiles, string name, string ns, bool hasParameters, bool isVoid, string parentPath,
                      CsSecurity security, CsType returnType, IReadOnlyList <CsParameter> parameters, CsMethod invokeMethod,
                      CsMethod beginInvokeMethod, CsMethod endInvokeMethod, string sourceDocument = null, ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.Delegate, sourceDocument, modelStore, modelErrors)
 {
     _attributes = attributes ?? ImmutableList <CsAttribute> .Empty;
     _isGeneric  = isGeneric;
     _hasStrongTypesInGenerics = hasStrongTypesInGenerics;
     _genericParameters        = genericParameters ?? ImmutableList <CsGenericParameter> .Empty;
     _genericTypes             = genericTypes ?? ImmutableList <CsType> .Empty;
     _hasDocumentation         = hasDocumentation;
     _documentation            = documentation;
     _lookupPath        = lookupPath;
     _sourceFiles       = sourceFiles ?? ImmutableList <string> .Empty;
     _name              = name;
     _ns                = ns;
     _hasParameters     = hasParameters;
     _isVoid            = isVoid;
     _parentPath        = parentPath;
     _security          = security;
     _returnType        = returnType;
     _parameters        = parameters ?? ImmutableList <CsParameter> .Empty;
     _invokeMethod      = invokeMethod;
     _beginInvokeMethod = beginInvokeMethod;
     _endInvokeMethod   = endInvokeMethod;
 }
Esempio n. 4
0
 /// <summary>
 /// Constructor for the <see cref="CsType"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="wellKnownType">The well known type from the language if it is well known.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="isGeneric">Flag that determines if the type is generic.</param>
 /// <param name="hasStrongTypesInGenerics">Flag that determines if the generics are strong types or placeholders.</param>
 /// <param name="genericParameters">Generic parameters assigned to the type.</param>
 /// <param name="genericTypes">The type definitions for the generic implementation.</param>
 /// <param name="name">The name of the type.</param>
 /// <param name="ns">The namespace the type belongs to.</param>
 /// <param name="isWellKnownType">Is the type one of the well known types for the language.</param>
 /// <param name="valueTypeDefaultValue">The default value if the type is a value type.</param>
 /// <param name="isValueType">Flag that determines if it is a value type.</param>
 /// <param name="supportsDisposable">Flag that determines if the type implements <see cref="IDisposable"/> interface.</param>
 /// <param name="isInterface">Flag that determines if the type is an interface definition.</param>
 /// <param name="isStructure">Flag that determines if the type is a structure definition.</param>
 /// <param name="isClass">Flag that determines if the type is a class definition.</param>
 /// <param name="isArray">Flag that determines if the type is also an array.</param>
 /// <param name="arrayDimensions">The dimensions assigned to the array.</param>
 /// <param name="isGenericPlaceHolder">Flag that determines if the type is a generic place holder definition.</param>
 /// <param name="isEnum">Flag that determines if the type is an enumeration.</param>
 /// <param name="isDelegate">Flag that determines if the type is a delegate definition.</param>
 /// <param name="isTuple">Flag that determines if the type is a tuple.</param>
 /// <param name="tupleTypes">The type information for each part of the tuple.</param>
 protected CsType(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, bool isGeneric,
                  bool hasStrongTypesInGenerics, IReadOnlyList <CsGenericParameter> genericParameters, IReadOnlyList <CsType> genericTypes,
                  string name, string ns, bool isWellKnownType, string valueTypeDefaultValue, bool isValueType, bool supportsDisposable,
                  bool isInterface, bool isStructure, bool isClass, bool isArray, IReadOnlyList <int> arrayDimensions, bool isGenericPlaceHolder,
                  bool isEnum, bool isDelegate, bool isTuple, IReadOnlyList <CsTupleTypeParameter> tupleTypes, CsKnownLanguageType wellKnownType,
                  string sourceDocument = null, ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.Type, sourceDocument, modelStore, modelErrors)
 {
     _isGeneric = isGeneric;
     _hasStrongTypesInGenerics = hasStrongTypesInGenerics;
     _genericParameters        = genericParameters ?? ImmutableList <CsGenericParameter> .Empty;
     _genericTypes             = genericTypes ?? ImmutableList <CsType> .Empty;
     _name                  = name;
     _ns                    = ns;
     _isWellKnownType       = isWellKnownType;
     _valueTypeDefaultValue = valueTypeDefaultValue;
     _isValueType           = isValueType;
     _supportsDisposable    = supportsDisposable;
     _isInterface           = isInterface;
     _isStructure           = isStructure;
     _isClass               = isClass;
     _isArray               = isArray;
     _arrayDimensions       = arrayDimensions ?? ImmutableList <int> .Empty;
     _isGenericPlaceHolder  = isGenericPlaceHolder;
     _isEnum                = isEnum;
     _isDelegate            = isDelegate;
     _isTuple               = isTuple;
     _tupleTypes            = tupleTypes ?? ImmutableList <CsTupleTypeParameter> .Empty;
     _wellKnownType         = wellKnownType;
 }
Esempio n. 5
0
 /// <summary>
 /// Constructor for the <see cref="CsNamespace"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="parentPath">The fully qualified path for the model that is a parent of this model.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="lookupPath">The fully qualified lookup path for the model to be used in the model store.</param>
 /// <param name="sourceFiles">The source files where the namespace is defined in.</param>
 /// <param name="name">The fully qualified name of the namespace.</param>
 protected CsNamespace(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, string lookupPath,
                       IReadOnlyList <string> sourceFiles, string name, string parentPath, string sourceDocument = null, ModelStore <ICsModel> modelStore = null,
                       IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.Namespace, sourceDocument, modelStore, modelErrors)
 {
     _lookupPath  = lookupPath;
     _sourceFiles = sourceFiles ?? ImmutableList <string> .Empty;
     _name        = name;
     _parentPath  = parentPath;
 }
 /// <summary>
 /// Constructor for the base class <see cref="VsDocument"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model is loaded.</param>
 /// <param name="hasErrors">Flag that determines if errors occured while loading the model.</param>
 /// <param name="modelErrors">The list of errors that occured if any.</param>
 /// <param name="name">The name of the model.</param>
 /// <param name="hasParent">Flag that determines if this model has a parent model.</param>
 /// <param name="hasChildren">Flag that determines if this model has child models.</param>
 /// <param name="path">The fully qualified path to the document.</param>
 /// <param name="documentType">The type of visual studio document.</param>
 /// <param name="isSourceCode">Is a source code file loadable by code factory.</param>
 /// <param name="sourceType">The type of source code found in the document.</param>
 protected VsDocument(bool isLoaded, bool hasErrors, IReadOnlyList <ModelException <VisualStudioModelType> > modelErrors,
                      string name, bool hasParent, bool hasChildren, string path, VsDocumentType documentType, bool isSourceCode,
                      SourceCodeType sourceType) : base(isLoaded, hasErrors, modelErrors, VisualStudioModelType.Document, name)
 {
     _hasParent    = hasParent;
     _hasChildren  = hasChildren;
     _path         = path;
     _documentType = documentType;
     _isSourceCode = isSourceCode;
     _sourceType   = sourceType;
 }
Esempio n. 7
0
 /// <summary>
 /// Constructor for the <see cref="CsModel"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="modelType">The type of code model created.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 protected CsModel(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, CsModelType modelType, string sourceDocument = null, ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
 {
     _isLoaded         = isLoaded;
     _hasErrors        = hasErrors;
     _loadedFromSource = loadedFromSource;
     _language         = language;
     _sourceDocument   = sourceDocument;
     _modelType        = modelType;
     ModelStore        = modelStore;
     LocalModelErrors  = modelErrors ?? ImmutableList <ModelLoadException> .Empty;
 }
 /// <summary>
 /// Constructor for the <see cref="CsAttribute"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="type">The target type of the attribute.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="sourceFiles">The list of source files the attribute is defined in.</param>
 /// <param name="hasParameters">Flag that determines if the attribute has parameters.</param>
 /// <param name="parentPath">The fully qualified lookup path to the parent model for this attribute.</param>
 /// <param name="parameters">The list of parameters assigned to the attribute.</param>
 protected CsAttribute(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language,
                       IReadOnlyList <string> sourceFiles, bool hasParameters, string parentPath, IReadOnlyList <CsAttributeParameter> parameters,
                       CsType type, string sourceDocument = null, ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.Attribute, sourceDocument, modelStore, modelErrors)
 {
     _sourceFiles   = sourceFiles ?? ImmutableList <string> .Empty;
     _hasParameters = hasParameters;
     _parentPath    = parentPath;
     _parameters    = parameters ?? ImmutableList <CsAttributeParameter> .Empty;
     _type          = type;
 }
Esempio n. 9
0
 /// <summary>
 /// Constructor for the <see cref="CsStructure"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="members">The members assigned to this container.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="attributes">List of the attributes assigned to this model.</param>
 /// <param name="isGeneric">Flag that determines if the container is a generic definition.</param>
 /// <param name="hasStrongTypesInGenerics">Flag that determines if the generics use strong type definitions.</param>
 /// <param name="genericParameters">Generic parameters assigned to the container.</param>
 /// <param name="genericTypes">Target types for the generic parameters assigned to the container.</param>
 /// <param name="sourceFiles">List of the fully qualified paths to the source code files this model is defined in.</param>
 /// <param name="hasDocumentation">Flag that determines if the model has XML documentation assigned to it.</param>
 /// <param name="documentation">The xml documentation assigned to the model.</param>
 /// <param name="lookupPath">The fully qualified model lookup path for this model.</param>
 /// <param name="name">The name of the model.</param>
 /// <param name="ns">The namespace the container belongs to.</param>
 /// <param name="parentPath">The fully qualified lookup path for the parent model to this one.</param>
 /// <param name="security">The security scope assigned to this model.</param>
 /// <param name="inheritedInterfaces">The interfaces that are inherited by this container.</param>
 protected CsStructure(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language,
                       IReadOnlyList <CsAttribute> attributes, bool isGeneric, bool hasStrongTypesInGenerics,
                       IReadOnlyList <CsGenericParameter> genericParameters, IReadOnlyList <CsType> genericTypes, IReadOnlyList <string> sourceFiles,
                       bool hasDocumentation, string documentation, string lookupPath, string name, string ns, string parentPath,
                       CsSecurity security, IReadOnlyList <CsInterface> inheritedInterfaces, IReadOnlyList <CsMember> members,
                       string sourceDocument = null, ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.Structure,
            attributes, isGeneric, hasStrongTypesInGenerics, genericParameters, genericTypes, sourceFiles, hasDocumentation,
            documentation, lookupPath, name, ns, parentPath, CsContainerType.Structure, security, inheritedInterfaces, members,
            sourceDocument, modelStore, modelErrors)
 {
     //Intentionally blank
 }
Esempio n. 10
0
 /// <summary>
 /// Constructor for the <see cref="CsField"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="dataType">The type definition for the field.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="attributes">List of the attributes assigned to this model.</param>
 /// <param name="sourceFiles">List of the fully qualified paths to the source code files this member is defined in.</param>
 /// <param name="hasDocumentation">Flag that determines if the model has XML documentation assigned to it.</param>
 /// <param name="documentation">The xml documentation assigned to the model.</param>
 /// <param name="lookupPath">The fully qualified model lookup path for this model.</param>
 /// <param name="name">The name of the model.</param>
 /// <param name="parentPath">THe fully qualified lookup path for the parent model to this one.</param>
 /// <param name="security">The security scope assigned to this model.</param>
 /// <param name="isReadOnly">Flag that determines if the model is read only.</param>
 /// <param name="isStatic">Flag that determines if the model is a static definition.</param>
 /// <param name="isConstant">Flag that determines if the field is a constant definition.</param>
 /// <param name="constantValue">The value assigned to the field if it is a constant definition.</param>
 protected CsField(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language,
                   IReadOnlyList <CsAttribute> attributes, IReadOnlyList <string> sourceFiles, bool hasDocumentation, string documentation,
                   string lookupPath, string name, string parentPath, CsSecurity security, bool isReadOnly,
                   bool isStatic, bool isConstant, string constantValue, CsType dataType, string sourceDocument, ModelStore <ICsModel> modelStore = null,
                   IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.Field, attributes,
            sourceFiles, hasDocumentation, documentation, lookupPath,
            name, parentPath, security, CsMemberType.Field, sourceDocument, modelStore, modelErrors)
 {
     _isReadOnly    = isReadOnly;
     _isStatic      = isStatic;
     _isConstant    = isConstant;
     _constantValue = constantValue;
     _dataType      = dataType;
 }
Esempio n. 11
0
 /// <summary>
 /// Constructor for the <see cref="CsMember"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="memberType">The type of member this model represents.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="modelType">The type of model that represents this member.</param>
 /// <param name="attributes">List of the attributes assigned to this model.</param>
 /// <param name="sourceFiles">List of the fully qualified paths to the source code files this member is defined in.</param>
 /// <param name="hasDocumentation">Flag that determines if the model has XML documentation assigned to it.</param>
 /// <param name="documentation">The xml documentation assigned to the model.</param>
 /// <param name="lookupPath">The fully qualified model lookup path for this model.</param>
 /// <param name="name">The name of the model.</param>
 /// <param name="parentPath">THe fully qualified lookup path for the parent model to this one.</param>
 /// <param name="security">The security scope assigned to this model.</param>
 protected CsMember(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, CsModelType modelType,
                    IReadOnlyList <CsAttribute> attributes, IReadOnlyList <string> sourceFiles, bool hasDocumentation,
                    string documentation, string lookupPath, string name, string parentPath, CsSecurity security,
                    CsMemberType memberType, string sourceDocument = null, ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, modelType, sourceDocument, modelStore, modelErrors)
 {
     _attributes       = attributes ?? ImmutableList <CsAttribute> .Empty;
     _sourceFiles      = sourceFiles ?? ImmutableList <string> .Empty;
     _hasDocumentation = hasDocumentation;
     _documentation    = documentation;
     _lookupPath       = lookupPath;
     _name             = name;
     _parentPath       = parentPath;
     _security         = security;
     _memberType       = memberType;
 }
Esempio n. 12
0
 /// <summary>
 /// Constructor for the <see cref="CsSource"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="namespaces">The namespaces that are defined in this source.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="lookupPath">The fully qualified name of the model to be used with the model store.</param>
 /// <param name="sourceDocument">The fully qualified path to the source document that loaded this model.</param>
 /// <param name="parentPath">The fully qualified path to the parent model of this model.</param>
 /// <param name="namespaceReferences">The namespace reference in the source.</param>
 /// <param name="interfaces">The interfaces that are define in this source.</param>
 /// <param name="classes">The classes that are defined in this source.</param>
 /// <param name="structures">The structures that are defined in this source.</param>
 /// <param name="delegates">The delegates that are defined in this source.</param>
 /// <param name="enums">The enumerations defined in this source.</param>
 protected CsSource(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, string lookupPath,
                    string sourceDocument, string parentPath, IReadOnlyList <CsUsingStatement> namespaceReferences,
                    IReadOnlyList <CsInterface> interfaces, IReadOnlyList <CsClass> classes, IReadOnlyList <CsStructure> structures,
                    IReadOnlyList <CsDelegate> delegates, IReadOnlyList <CsEnum> enums, IReadOnlyList <CsNamespace> namespaces,
                    ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.Source, sourceDocument, modelStore, modelErrors)
 {
     _lookupPath          = lookupPath;
     _parentPath          = parentPath;
     _namespaceReferences = namespaceReferences ?? ImmutableList <CsUsingStatement> .Empty;
     _interfaces          = interfaces ?? ImmutableList <CsInterface> .Empty;
     _classes             = classes ?? ImmutableList <CsClass> .Empty;
     _structures          = structures ?? ImmutableList <CsStructure> .Empty;
     _delegates           = delegates ?? ImmutableList <CsDelegate> .Empty;
     _enums      = enums ?? ImmutableList <CsEnum> .Empty;
     _namespaces = namespaces ?? ImmutableList <CsNamespace> .Empty;
 }
Esempio n. 13
0
 /// <summary>
 /// Constructor for the <see cref="CsEvent"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="eventType">The type definition that supports this event.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="attributes">List of the attributes assigned to this model.</param>
 /// <param name="sourceFiles">List of the fully qualified paths to the source code files this member is defined in.</param>
 /// <param name="hasDocumentation">Flag that determines if the model has XML documentation assigned to it.</param>
 /// <param name="documentation">The xml documentation assigned to the model.</param>
 /// <param name="lookupPath">The fully qualified model lookup path for this model.</param>
 /// <param name="name">The name of the model.</param>
 /// <param name="parentPath">THe fully qualified lookup path for the parent model to this one.</param>
 /// <param name="security">The security scope assigned to this model.</param>
 /// <param name="isAbstract">Flag that determines if the model is abstract.</param>
 /// <param name="isVirtual">Flag that determines if the model is virtual.</param>
 /// <param name="isSealed">Flag that determines if the model is sealed.</param>
 /// <param name="isOverride">Flag that determines if the model is overridden.</param>
 /// <param name="isStatic">Flag that determines if the model is static.</param>
 /// <param name="eventHandlerDelegate">Delegate model for this event.</param>
 /// <param name="raiseMethod">Model for the raise method for this event.</param>
 /// <param name="addMethod">Model for the add method for this event.</param>
 /// <param name="removeMethod">Model for the remove method for this event.</param>
 protected CsEvent(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language,
                   IReadOnlyList <CsAttribute> attributes, IReadOnlyList <string> sourceFiles, bool hasDocumentation, string documentation,
                   string lookupPath, string name, string parentPath, CsSecurity security, bool isAbstract, bool isVirtual, bool isOverride,
                   bool isSealed, bool isStatic, CsDelegate eventHandlerDelegate, CsMethod raiseMethod, CsMethod addMethod, CsMethod removeMethod,
                   CsType eventType, string sourceDocument = null, ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null) : base(isLoaded, hasErrors, loadedFromSource,
                                                                                                                                                                          language, CsModelType.Event, attributes, sourceFiles, hasDocumentation, documentation,
                                                                                                                                                                          lookupPath, name, parentPath, security, CsMemberType.Event, sourceDocument, modelStore, modelErrors)
 {
     _isAbstract           = isAbstract;
     _isVirtual            = isVirtual;
     _isOverride           = isOverride;
     _isSealed             = isSealed;
     _isStatic             = isStatic;
     _eventHandlerDelegate = eventHandlerDelegate;
     _raiseMethod          = raiseMethod;
     _addMethod            = addMethod;
     _removeMethod         = removeMethod;
     _eventType            = eventType;
 }
Esempio n. 14
0
 /// <summary>
 /// Constructor for the <see cref="CsProperty"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="setSecurity">The security access assigned to the setter.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="attributes">List of the attributes assigned to this model.</param>
 /// <param name="sourceFiles">List of the fully qualified paths to the source code files this member is defined in.</param>
 /// <param name="hasDocumentation">Flag that determines if the model has XML documentation assigned to it.</param>
 /// <param name="documentation">The xml documentation assigned to the model.</param>
 /// <param name="lookupPath">The fully qualified model lookup path for this model.</param>
 /// <param name="name">The name of the model.</param>
 /// <param name="parentPath">THe fully qualified lookup path for the parent model to this one.</param>
 /// <param name="security">The security scope assigned to this model.</param>
 /// <param name="hasGet">Flag that determines if the property implements a getter.</param>
 /// <param name="hasSet">Flag that determines if the property implements a setter.</param>
 /// <param name="isAbstract">Flag that determines if the model is abstract.</param>
 /// <param name="isVirtual">Flag that determines if the model is virtual.</param>
 /// <param name="isSealed">Flag that determines if the model is sealed.</param>
 /// <param name="isOverride">Flag that determines if the model is overridden.</param>
 /// <param name="isStatic">Flag that determines if the model is static.</param>
 /// <param name="propertyType">The type the property supports.</param>
 /// <param name="getSecurity">The security access assigned to the getter.</param>
 protected CsProperty(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language,
                      IReadOnlyList <CsAttribute> attributes, IReadOnlyList <string> sourceFiles, bool hasDocumentation, string documentation,
                      string lookupPath, string name, string parentPath, CsSecurity security,
                      bool hasGet, bool hasSet, bool isAbstract, bool isVirtual, bool isSealed, bool isOverride, bool isStatic,
                      CsType propertyType, CsSecurity getSecurity, CsSecurity setSecurity,
                      string sourceDocument = null, ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.Property, attributes, sourceFiles,
            hasDocumentation, documentation, lookupPath, name, parentPath, security, CsMemberType.Property, sourceDocument, modelStore, modelErrors)
 {
     _hasGet       = hasGet;
     _hasSet       = hasSet;
     _isAbstract   = isAbstract;
     _isVirtual    = isVirtual;
     _isSealed     = isSealed;
     _isOverride   = isOverride;
     _isStatic     = isStatic;
     _propertyType = propertyType;
     _getSecurity  = getSecurity;
     _setSecurity  = setSecurity;
 }
Esempio n. 15
0
 /// <summary>
 /// Constructor for the <see cref="CsParameter"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="defaultValue">The default value assigned to this parameter.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="attributes">Attributes assigned to this model.</param>
 /// <param name="lookupPath">The fully qualified path of the model that is stored in the model store.</param>
 /// <param name="name">The name of the parameter.</param>
 /// <param name="isOut">Parameter is assigned the out keyword.</param>
 /// <param name="isRef">Parameter is assigned the ref keyword.</param>
 /// <param name="isParams">Parameter supports a parameter array.</param>
 /// <param name="isOptional">Parameter is optional.</param>
 /// <param name="isGenericParameter">Is a generic parameter.</param>
 /// <param name="hasDefaultValue">Parameter has an assigned default value.</param>
 /// <param name="parentPath">The fully qualified path name for the parent model to this model.</param>
 /// <param name="parameterType">The type that this parameter supports.</param>
 protected CsParameter(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language,
                       IReadOnlyList <CsAttribute> attributes, string lookupPath, string name, bool isOut, bool isRef, bool isParams,
                       bool isOptional, bool isGenericParameter, bool hasDefaultValue, string parentPath, CsType parameterType,
                       CsParameterDefaultValue defaultValue, string sourceDocument = null, ModelStore <ICsModel> modelStore = null,
                       IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.Parameter, sourceDocument, modelStore, modelErrors)
 {
     _attributes         = attributes ?? ImmutableList <CsAttribute> .Empty;
     _lookupPath         = lookupPath;
     _name               = name;
     _isOut              = isOut;
     _isRef              = isRef;
     _isParams           = isParams;
     _isOptional         = isOptional;
     _isGenericParameter = isGenericParameter;
     _hasDefaultValue    = hasDefaultValue;
     _parentPath         = parentPath;
     _parameterType      = parameterType;
     _defaultValue       = defaultValue;
 }
 /// <summary>
 /// Constructor for the <see cref="CsModel"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="hasDefaultName">Does the type parameter use a distinct name.</param>
 /// <param name="name">The distinct name assigned to the type.</param>
 /// <param name="tupleType">The type definition of the tuple type.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 protected CsTupleTypeParameter(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language,
                                bool hasDefaultName, string name, CsType tupleType, string sourceDocument = null, ModelStore <ICsModel> modelStore = null,
                                IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.TupleTypeParameter, sourceDocument, modelStore, modelErrors)
 {
     _hasDefaultName = hasDefaultName;
     _name           = name;
     _tupleType      = tupleType;
 }
        public async Task SaveSourceFiles(IEnumerable <SourceFile> sourceFiles, string specificationId, SourceCodeType sourceCodeType)
        {
            Guard.ArgumentNotNull(sourceFiles, nameof(sourceFiles));
            Guard.IsNullOrWhiteSpace(specificationId, nameof(specificationId));

            string sourceType;

            switch (sourceCodeType)
            {
            case SourceCodeType.Release:
                sourceType = "release";
                break;

            case SourceCodeType.Preview:
                sourceType = "preview";
                break;

            case SourceCodeType.Diagnostics:
                sourceType = "diagnostics";
                break;

            default:
                throw new InvalidOperationException("Unknown SourceCodeType");
            }

            IEnumerable <(string filename, string content)> files = sourceFiles.Select(m => (m.FileName, m.SourceCode));

            byte[] compressedFiles = ZipUtils.ZipFiles(files);

            if (compressedFiles.IsNullOrEmpty())
            {
                _logger.Error($"Failed to compress source files for specification id: '{specificationId}'");
            }
            else
            {
                await _sourceFilesRepositoryPolicy.ExecuteAsync(() => _sourceFilesRepository.SaveSourceFiles(compressedFiles, specificationId, sourceType));
            }
        }
Esempio n. 18
0
        public async Task <IActionResult> GenerateAndSaveSourceProject(string specificationId, SourceCodeType sourceCodeType)
        {
            Guard.IsNullOrWhiteSpace(specificationId, nameof(specificationId));

            BuildProject buildProject = await GetBuildProjectForSpecificationId(specificationId);

            IEnumerable <Models.Calcs.Calculation> calculations = await _calculationsRepository.GetCalculationsBySpecificationId(specificationId);

            CompilerOptions compilerOptions = await _calculationsRepository.GetCompilerOptions(specificationId);

            if (compilerOptions == null)
            {
                throw new InvalidOperationException("Compiler options returned were null");
            }

            if (sourceCodeType == SourceCodeType.Diagnostics)
            {
                compilerOptions.UseDiagnosticsMode = true;
            }

            IEnumerable <SourceFile> sourceFiles = _sourceCodeService.GenerateSourceFiles(buildProject, calculations, compilerOptions);

            await _sourceCodeService.SaveSourceFiles(sourceFiles, specificationId, sourceCodeType);

            return(new NoContentResult());
        }
Esempio n. 19
0
 /// <summary>
 /// Constructor for the <see cref="CsAttributeParameterValue"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="values">The list of values if the parameter has more then one value.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="parameterKind">The kind of attribute parameter.</param>
 /// <param name="value">The value of the attribute parameter.</param>
 /// <param name="enumValue">The value of the enumeration if the parameter is an enumeration.</param>
 /// <param name="typeValue">The type if the parameter is a single value.</param>
 protected CsAttributeParameterValue(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language,
                                     AttributeParameterKind parameterKind, string value, string enumValue, CsType typeValue,
                                     IReadOnlyList <CsAttributeParameterValue> values, string sourceDocument = null, ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.AttributeParameterValue, sourceDocument, modelStore, modelErrors)
 {
     _parameterKind = parameterKind;
     _value         = value;
     _enumValue     = enumValue;
     _typeValue     = typeValue;
     _values        = values ?? ImmutableList <CsAttributeParameterValue> .Empty;
 }
 /// <summary>
 /// Constructor for the <see cref="CsParameterDefaultValue"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="parentPath">The fully qualified path name for the parent model to this model. </param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="lookupPath">The fully qualified path for the model in the model store.</param>
 /// <param name="valueType">The type of default value assigned to the parameter.</param>
 /// <param name="value">The value assigned as the default value.</param>
 protected CsParameterDefaultValue(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, string lookupPath,
                                   ParameterDefaultValueType valueType, string value, string parentPath, string sourceDocument = null, ModelStore <ICsModel> modelStore = null,
                                   IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.ParameterDefaultValue, sourceDocument, modelStore, modelErrors)
 {
     _lookupPath = lookupPath;
     _valueType  = valueType;
     _value      = value;
     _parentPath = parentPath;
 }
Esempio n. 21
0
 /// <summary>
 /// Constructor for the <see cref="CsAttributeParameter"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="value">The value assigned to the parameter.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="hasNamedParameter">Flag that determines if the attribute parameter is a named parameter.</param>
 /// <param name="name">The name of the parameter, should be null if not named.</param>
 protected CsAttributeParameter(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language,
                                bool hasNamedParameter, string name, CsAttributeParameterValue value, string sourceDocument = null, ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.AttributeParameter, sourceDocument, modelStore, modelErrors)
 {
     _hasNamedParameter = hasNamedParameter;
     _name  = name;
     _value = value;
 }
 /// <summary>
 /// Constructor for the <see cref="CsUsingStatement"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="parentPath">Fully qualified lookup path for the parent model to this model.</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 /// <param name="lookupPath">Fully qualified path for the model to be stored in the model store.</param>
 /// <param name="referenceNamespace">The full namespace being referenced.</param>
 /// <param name="hasAlias">Flag that determines if the namespace is referenced by a alias name.</param>
 /// <param name="alias">The alias name for the referenced namespace. this will be null when <see cref="HasAlias"/> is false</param>
 protected CsUsingStatement(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, string lookupPath,
                            string referenceNamespace, bool hasAlias, string alias, string parentPath, string sourceDocument = null,
                            ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.Using, sourceDocument, modelStore, modelErrors)
 {
     _lookupPath         = lookupPath;
     _referenceNamespace = referenceNamespace;
     _hasAlias           = hasAlias;
     _alias      = alias;
     _parentPath = parentPath;
 }
Esempio n. 23
0
 /// <summary>
 /// Constructor for the <see cref="CsGenericParameter"/>
 /// </summary>
 /// <param name="isLoaded">Flag that determines if the model was loaded.</param>
 /// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
 /// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
 /// <param name="language">The target language the model was generated from.</param>
 /// <param name="modelType">The type of code model created.</param>
 /// <param name="hasOutKeyword">Flag that determines if parameter has out keyword assigned.</param>
 /// <param name="hasNewConstraint">Flag that determines if generic parameter supports new keyword.</param>
 /// <param name="hasClassConstraint">flag that determines if the generic parameter has a constraint requirement to classes.</param>
 /// <param name="hasStructConstraint">Flag that determines if the generic parameter has a constraint requirement to structures.</param>
 /// <param name="hasConstraintTypes">Flag that determines if the generic parameter has additional type constraints.</param>
 /// <param name="constrainingTypes">List of of additional constraints the generic parameter supports.</param>
 /// <param name="type">The type definition for the generic type</param>
 /// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
 /// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
 /// <param name="modelErrors">Optional the error that occured while creating the model.</param>
 protected CsGenericParameter(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, CsModelType modelType,
                              bool hasOutKeyword, bool hasNewConstraint, bool hasClassConstraint, bool hasStructConstraint,
                              bool hasConstraintTypes, IReadOnlyList <CsType> constrainingTypes, CsType type, string sourceDocument = null, ModelStore <ICsModel> modelStore = null, IReadOnlyList <ModelLoadException> modelErrors = null)
     : base(isLoaded, hasErrors, loadedFromSource, language, modelType, sourceDocument, modelStore, modelErrors)
 {
     _hasOutKeyword       = hasOutKeyword;
     _hasNewConstraint    = hasNewConstraint;
     _hasClassConstraint  = hasClassConstraint;
     _hasStructConstraint = hasStructConstraint;
     _hasConstraintTypes  = hasConstraintTypes;
     _constrainingTypes   = constrainingTypes ?? ImmutableList <CsType> .Empty;
     _type = type;
 }
Esempio n. 24
0
 /// <summary>
 /// Compile the <paramref name="expression"/> as the given <paramref name="type"/> of code.
 /// </summary>
 /// <param name="expression"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public IPythonByteCode Compile(string expression, SourceCodeType type)
 {
     return(Compile(expression, (SourceCodeKind)type));
 }