/// <summary> /// Reset some intermediate results. /// </summary> /// <param name="ruleTemplateList">The list of rule templates that would read the properties to reset.</param> public void Reset(IRuleTemplateList ruleTemplateList) { bool IsHandled = false; if (ruleTemplateList == RuleTemplateSet.Identifiers) { IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Types) { LocalScope = new SealableDictionary <string, IScopeAttributeFeature>(); InnerScopes = new List <IScopeHolder>(); FullScope = new SealableDictionary <string, IScopeAttributeFeature>(); IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Contract) { AdditionalScope = new SealableDictionary <string, IScopeAttributeFeature>(); AdditionalScope.Seal(); ResolvedResult = new OnceReference <IResultType>(); IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Body) { ResolvedType = new OnceReference <ICompiledType>(); ResolvedException = new OnceReference <IResultException>(); FeatureCall = new OnceReference <IFeatureCall>(); IsHandled = true; } Debug.Assert(IsHandled); }
/// <summary> /// Reset some intermediate results. /// </summary> /// <param name="ruleTemplateList">The list of rule templates that would read the properties to reset.</param> public void Reset(IRuleTemplateList ruleTemplateList) { bool IsHandled = false; if (ruleTemplateList == RuleTemplateSet.Identifiers || ruleTemplateList == RuleTemplateSet.Body) { IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Types) { LocalScope = new SealableDictionary <string, IScopeAttributeFeature>(); InnerScopes = new List <IScopeHolder>(); FullScope = new SealableDictionary <string, IScopeAttributeFeature>(); ParameterTable = new SealableList <IParameter>(); ResolvedAssociatedType = new OnceReference <ICommandOverloadType>(); IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Contract) { AdditionalScope = new SealableDictionary <string, IScopeAttributeFeature>(); AdditionalScope.Seal(); ResolvedBody = new OnceReference <ICompiledBody>(); IsHandled = true; } Debug.Assert(IsHandled); }
/// <summary> /// Creates a <see cref="ClassType"/>. /// </summary> /// <param name="baseClass">The class used to instanciate this type.</param> /// <param name="typeArgumentTable">Arguments if the class is generic.</param> /// <param name="instancingClassType">The class type if this instance is a derivation (such as renaming).</param> public static IClassType Create(IClass baseClass, ISealableDictionary <string, ICompiledType> typeArgumentTable, ICompiledTypeWithFeature instancingClassType) { ISealableDictionary <ITypeName, ICompiledType> ConformanceTable = new SealableDictionary <ITypeName, ICompiledType>(); if (baseClass.ResolvedClassType.IsAssigned) { IClassType ResolvedClassType = baseClass.ResolvedClassType.Item; if (ResolvedClassType.ConformanceTable.IsSealed) { foreach (IInheritance InheritanceItem in baseClass.InheritanceList) { if (InheritanceItem.Conformance == BaseNode.ConformanceType.Conformant) { ITypeName ParentTypeName = InheritanceItem.ResolvedParentTypeName.Item; ICompiledType ParentType = InheritanceItem.ResolvedParentType.Item; ParentType.InstanciateType(instancingClassType, ref ParentTypeName, ref ParentType); ConformanceTable.Add(ParentTypeName, ParentType); } } ConformanceTable.Seal(); } } IClassType ClassType = new ClassType(baseClass, typeArgumentTable, instancingClassType, ConformanceTable); return(ClassType); }
/// <summary> /// Reset some intermediate results. /// </summary> /// <param name="ruleTemplateList">The list of rule templates that would read the properties to reset.</param> public void Reset(IRuleTemplateList ruleTemplateList) { bool IsHandled = false; if (ruleTemplateList == RuleTemplateSet.Identifiers) { IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Types) { LocalScope = new SealableDictionary <string, IScopeAttributeFeature>(); InnerScopes = new List <IScopeHolder>(); FullScope = new SealableDictionary <string, IScopeAttributeFeature>(); IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Contract) { AdditionalScope = new SealableDictionary <string, IScopeAttributeFeature>(); AdditionalScope.Seal(); ResolvedTagTable = new SealableDictionary <string, IExpression>(); ResolvedResult = new OnceReference <IResultType>(); ResolvedRequireList = new OnceReference <IList <IAssertion> >(); ResolvedEnsureList = new OnceReference <IList <IAssertion> >(); ResolvedExceptionIdentifierList = new OnceReference <IList <IIdentifier> >(); IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Body) { ResolvedInstructionList = new OnceReference <IList <IInstruction> >(); IsHandled = true; } Debug.Assert(IsHandled); }
/// <summary> /// Reset some intermediate results. /// </summary> /// <param name="ruleTemplateList">The list of rule templates that would read the properties to reset.</param> public void Reset(IRuleTemplateList ruleTemplateList) { bool IsHandled = false; if (ruleTemplateList == RuleTemplateSet.Identifiers) { IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Types) { ResolvedAgentTypeName = new OnceReference <ITypeName>(); ResolvedAgentType = new OnceReference <ICompiledType>(); ResolvedEffectiveTypeName = new OnceReference <ITypeName>(); ResolvedEffectiveType = new OnceReference <ICompiledType>(); ValidFeatureName = new OnceReference <IFeatureName>(); ResolvedFeature = new OnceReference <ICompiledFeature>(); ResolvedEntityTypeName = new OnceReference <ITypeName>(); ResolvedEntityType = new OnceReference <ICompiledType>(); ParameterTable = new SealableList <IParameter>(); LocalScope = new SealableDictionary <string, IScopeAttributeFeature>(); LocalGetScope = new SealableDictionary <string, IScopeAttributeFeature>(); LocalSetScope = new SealableDictionary <string, IScopeAttributeFeature>(); InnerScopes = new List <IScopeHolder>(); InnerGetScopes = new List <IScopeHolder>(); InnerSetScopes = new List <IScopeHolder>(); FullScope = new SealableDictionary <string, IScopeAttributeFeature>(); FullGetScope = new SealableDictionary <string, IScopeAttributeFeature>(); FullSetScope = new SealableDictionary <string, IScopeAttributeFeature>(); IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Contract) { AdditionalScope = new SealableDictionary <string, IScopeAttributeFeature>(); AdditionalScope.Seal(); IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Body) { IsCallingPrecursor = false; IsHandled = true; } Debug.Assert(IsHandled); }
/// <summary> /// Reset some intermediate results. /// </summary> /// <param name="ruleTemplateList">The list of rule templates that would read the properties to reset.</param> public void Reset(IRuleTemplateList ruleTemplateList) { bool IsHandled = false; if (ruleTemplateList == RuleTemplateSet.Identifiers) { IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Types) { LocalGenericTable = new SealableDictionary <string, ICompiledType>(); GenericTable = new SealableDictionary <string, ICompiledType>(); LocalDiscreteTable = new SealableDictionary <IFeatureName, IDiscrete>(); DiscreteTable = new SealableDictionary <IFeatureName, IDiscrete>(); DiscreteWithValueTable = new SealableDictionary <IFeatureName, IExpression>(); LocalTypedefTable = new SealableDictionary <IFeatureName, ITypedefType>(); TypedefTable = new SealableDictionary <IFeatureName, ITypedefType>(); LocalFeatureTable = new SealableDictionary <IFeatureName, IFeatureInstance>(); FeatureTable = new SealableDictionary <IFeatureName, IFeatureInstance>(); InheritedClassTypeTable = new SealableDictionary <IClassType, IObjectType>(); LocalNamespaceTable = new SealableDictionary <string, ISealableDictionary>(); LocalExportTable = new SealableDictionary <IFeatureName, ISealableDictionary <string, IClass> >(); ExportTable = new SealableDictionary <IFeatureName, ISealableDictionary <string, IClass> >(); ConversionFromTable = new SealableDictionary <IFeatureName, ICreationFeature>(); ConversionToTable = new SealableDictionary <IFeatureName, IFunctionFeature>(); ResolvedClassTypeName = new OnceReference <ITypeName>(); ResolvedClassType = new OnceReference <IClassType>(); GenericInstanceList = new List <IClassType>(); TypeTable = new SealableDictionary <ITypeName, ICompiledType>(); ClassIndexer = new OptionalReference <IIndexerFeature>(); ClassGroupList = new SealableList <IClass>(); ClassGroup = new OnceReference <SingleClassGroup>(); InheritanceTable = new SealableDictionary <ITypeName, ICompiledType>(); ResolvedImportedClassTable = new SealableDictionary <ITypeName, IClassType>(); ResolvedAsCompiledType = new OnceReference <ICompiledType>(); BodyList = new List <IBody>(); CommandOverloadList = new List <ICommandOverload>(); QueryOverloadList = new List <IQueryOverload>(); NodeWithDefaultList = new List <IExpression>(); NodeWithNumberConstantList = new List <IExpression>(); ImportedLanguageTypeTable = new Dictionary <Guid, Tuple <ITypeName, IClassType> >(); NamespaceTable = new SealableDictionary <string, ISealableDictionary>(); LocalScope = new SealableDictionary <string, IScopeAttributeFeature>(); LocalScope.Seal(); InnerScopes = new List <IScopeHolder>(); FullScope = new SealableDictionary <string, IScopeAttributeFeature>(); IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Contract) { AdditionalScope = new SealableDictionary <string, IScopeAttributeFeature>(); AdditionalScope.Seal(); ResolvedBodyTagList = new OnceReference <IList <IBody> >(); ResolvedNodeWithDefaultList = new OnceReference <IList <IExpression> >(); ResolvedNodeWithNumberConstantList = new OnceReference <IList <IExpression> >(); InheritedBodyTagListTable = new SealableDictionary <IClassType, IList <IBody> >(); InitializedObjectList = new List <IInitializedObjectExpression>(); IsHandled = true; } else if (ruleTemplateList == RuleTemplateSet.Body) { ResolvedBodyList = new OnceReference <IList <IBody> >(); AssignedDiscreteTable = new SealableDictionary <IDiscrete, string>(); IsHandled = true; } Debug.Assert(IsHandled); }