/// <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> /// Initializes a new instance of the <see cref="CSharpOverLoopInstruction"/> 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 CSharpOverLoopInstruction(ICSharpContext context, ICSharpFeature parentFeature, IOverLoopInstruction source) : base(context, parentFeature, source) { OverList = CSharpExpression.Create(context, (IExpression)source.OverList); LoopInstructions = CSharpScope.Create(context, parentFeature, (IScope)source.LoopInstructions); foreach (IName Name in source.IndexerList) { string IndexerName = Name.ValidText.Item; IScopeAttributeFeature IndexerFeature = Source.InnerLoopScope[IndexerName]; ICSharpScopeAttributeFeature NewIndexer = CSharpScopeAttributeFeature.Create(context, ParentFeature.Owner, IndexerFeature); IndexerList.Add(NewIndexer); } if (source.ExitEntityName.IsAssigned) { ExitEntityName = ((IIdentifier)source.ExitEntityName.Item).ValidText.Item; } foreach (IAssertion Item in Source.InvariantList) { ICSharpAssertion NewAssertion = CSharpAssertion.Create(context, Item); InvariantList.Add(NewAssertion); } }
/// <summary> /// Initializes a new instance of the <see cref="CSharpConditional"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="parentFeature">The parent feature.</param> /// <param name="source">The Easly node from which the C# node is created.</param> protected CSharpConditional(ICSharpContext context, ICSharpFeature parentFeature, IConditional source) : base(source) { ParentFeature = parentFeature; BooleanExpression = CSharpExpression.Create(context, (IExpression)source.BooleanExpression); Instructions = CSharpScope.Create(context, parentFeature, (IScope)source.Instructions); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpWith"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="parentFeature">The parent feature.</param> /// <param name="source">The Easly node from which the C# node is created.</param> protected CSharpWith(ICSharpContext context, ICSharpFeature parentFeature, IWith source) : base(source) { ParentFeature = parentFeature; foreach (IRange Range in source.RangeList) { AddValueToList(Range.ResolvedRange.Item); } Instructions = CSharpScope.Create(context, parentFeature, (IScope)source.Instructions); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpContinuation"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="parentFeature">The parent feature.</param> /// <param name="source">The Easly node from which the C# node is created.</param> protected CSharpContinuation(ICSharpContext context, ICSharpFeature parentFeature, IContinuation source) : base(source) { ParentFeature = parentFeature; Instructions = CSharpScope.Create(context, parentFeature, (IScope)source.Instructions); foreach (IInstruction Instruction in source.CleanupList) { ICSharpInstruction NewInstruction = CSharpInstruction.Create(context, parentFeature, Instruction); CleanupList.Add(NewInstruction); } }
/// <summary> /// Initializes a new instance of the <see cref="CSharpAttachment"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="parentInstruction">The parent instruction.</param> /// <param name="source">The Easly node from which the C# node is created.</param> protected CSharpAttachment(ICSharpContext context, ICSharpAttachmentInstruction parentInstruction, IAttachment source) : base(source) { ParentInstruction = parentInstruction; foreach (IScopeAttributeFeature Entity in source.ResolvedLocalEntitiesList) { ICSharpType NewType = CSharpType.Create(context, Entity.ResolvedEffectiveType.Item); AttachTypeList.Add(NewType); } Instructions = CSharpScope.Create(context, parentInstruction.ParentFeature, (IScope)source.Instructions); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpIfThenElseInstruction"/> 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 CSharpIfThenElseInstruction(ICSharpContext context, ICSharpFeature parentFeature, IIfThenElseInstruction source) : base(context, parentFeature, source) { foreach (IConditional Conditional in source.ConditionalList) { ICSharpConditional NewConditional = CSharpConditional.Create(context, parentFeature, Conditional); ConditionalList.Add(NewConditional); } if (source.ElseInstructions.IsAssigned) { ElseInstructions = CSharpScope.Create(context, parentFeature, (IScope)source.ElseInstructions.Item); } }
/// <summary> /// Initializes a new instance of the <see cref="CSharpInspectInstruction"/> 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 CSharpInspectInstruction(ICSharpContext context, ICSharpFeature parentFeature, IInspectInstruction source) : base(context, parentFeature, source) { SourceExpression = CSharpExpression.Create(context, (IExpression)source.Source); foreach (IWith With in source.WithList) { ICSharpWith NewWith = CSharpWith.Create(context, parentFeature, With); WithList.Add(NewWith); } if (source.ElseInstructions.IsAssigned) { ElseInstructions = CSharpScope.Create(context, parentFeature, (IScope)source.ElseInstructions.Item); } }
/// <summary> /// Initializes a new instance of the <see cref="CSharpAsLongAsInstruction"/> 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 CSharpAsLongAsInstruction(ICSharpContext context, ICSharpFeature parentFeature, IAsLongAsInstruction source) : base(context, parentFeature, source) { ContinueCondition = CSharpExpression.Create(context, (IExpression)source.ContinueCondition); foreach (IContinuation Continuation in source.ContinuationList) { ICSharpContinuation NewContinuation = CSharpContinuation.Create(context, parentFeature, Continuation); ContinuationList.Add(NewContinuation); } if (source.ElseInstructions.IsAssigned) { ElseInstructions = CSharpScope.Create(context, parentFeature, (IScope)source.ElseInstructions.Item); } }
/// <summary> /// Initializes a new instance of the <see cref="CSharpDebugInstruction"/> 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 CSharpDebugInstruction(ICSharpContext context, ICSharpFeature parentFeature, IDebugInstruction source) : base(context, parentFeature, source) { Instructions = CSharpScope.Create(context, parentFeature, (IScope)source.Instructions); }