/// <summary> /// Initializes a new instance of the <see cref="CSharpAttachmentInstruction"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="parentFeature">The parent feature.</param> /// <param name="source">The Easly instruction from which the C# instruction is created.</param> protected CSharpAttachmentInstruction(ICSharpContext context, ICSharpFeature parentFeature, IAttachmentInstruction source) : base(context, parentFeature, source) { SourceExpression = CSharpExpression.Create(context, (IExpression)source.Source); IResultType ResolvedResult = SourceExpression.Source.ResolvedResult.Item; for (int i = 0; i < source.EntityNameList.Count; i++) { IName EntityName = source.EntityNameList[i]; string ValidName = EntityName.ValidText.Item; EntityNameList.Add(new CSharpVariableContext(ValidName)); } foreach (IAttachment Attachment in source.AttachmentList) { ICSharpAttachment NewAttachment = CSharpAttachment.Create(context, this, Attachment); AttachmentList.Add(NewAttachment); } if (source.ElseInstructions.IsAssigned) { ElseInstructions = CSharpScope.Create(context, parentFeature, (IScope)source.ElseInstructions.Item); } }
/// <summary> /// Creates an attribute specification. /// </summary> /// <param name="attribute">the attribute</param> /// <param name="entities">the list of entity names</param> /// <param name="entityClass">the class of the entities</param> /// <param name="value">the value</param> public AttributeSpecification(Attribute attribute, EntityNameList entities, EntityClass entityClass, Expression @value) { this.attribute = attribute; this.entities = entities; this.entityClass = entityClass; this.value = @value; }