/// <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="CSharpIndexAssignmentInstruction"/> 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 CSharpIndexAssignmentInstruction(ICSharpContext context, ICSharpFeature parentFeature, IIndexAssignmentInstruction source) : base(context, parentFeature, source) { Destination = CSharpQualifiedName.Create(context, (IQualifiedName)source.Destination, parentFeature, null, false); FeatureCall = new CSharpFeatureCall(context, source.FeatureCall.Item); SourceExpression = CSharpExpression.Create(context, (IExpression)source.Source); }
/// <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="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 the feature overloads and bodies. /// </summary> /// <param name="context">The initialization context.</param> public override void InitOverloadsAndBodies(ICSharpContext context) { Type = CSharpType.Create(context, Source.ResolvedEffectiveType.Item); if (Source.DefaultValue.IsAssigned) { DefaultValue = CSharpExpression.Create(context, Source.DefaultValue.Item); } }
/// <summary> /// Initializes a new instance of the <see cref="CSharpAssertion"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="source">The Easly node from which the C# node is created.</param> protected CSharpAssertion(ICSharpContext context, IAssertion source) : base(source) { if (source.Tag.IsAssigned) { Tag = ((IName)source.Tag.Item).ValidText.Item; } BooleanExpression = CSharpExpression.Create(context, (IExpression)source.BooleanExpression); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpDiscrete"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="source">The Easly node from which the C# node is created.</param> protected CSharpDiscrete(ICSharpContext context, IDiscrete source) : base(source) { Name = source.ValidDiscreteName.Item.Name; if (source.NumericValue.IsAssigned) { ExplicitValue = CSharpExpression.Create(context, (IExpression)source.NumericValue.Item); } }
/// <summary> /// Initializes a new instance of the <see cref="CSharpAssignmentArgument"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="source">The Easly argument from which the C# argument is created.</param> protected CSharpAssignmentArgument(ICSharpContext context, IAssignmentArgument source) : base(context, source) { IExpression ArgumentSource = (IExpression)source.Source; SourceExpression = CSharpExpression.Create(context, ArgumentSource); foreach (IIdentifier Item in source.ParameterList) { ParameterNameList.Add(Item.ValidText.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="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="CSharpForLoopInstruction"/> 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 CSharpForLoopInstruction(ICSharpContext context, ICSharpFeature parentFeature, IForLoopInstruction source) : base(context, parentFeature, source) { foreach (IEntityDeclaration Declaration in source.EntityDeclarationList) { ICSharpScopeAttributeFeature NewDeclaration = CSharpScopeAttributeFeature.Create(context, parentFeature.Owner, Declaration.ValidEntity.Item); EntityDeclarationList.Add(NewDeclaration); } foreach (IInstruction Instruction in source.InitInstructionList) { ICSharpInstruction NewInstruction = Create(context, parentFeature, Instruction); InitInstructionList.Add(NewInstruction); } WhileCondition = CSharpExpression.Create(context, (IExpression)source.WhileCondition); foreach (IInstruction Instruction in source.LoopInstructionList) { ICSharpInstruction NewInstruction = Create(context, parentFeature, Instruction); LoopInstructionList.Add(NewInstruction); } foreach (IInstruction Instruction in source.IterationInstructionList) { ICSharpInstruction NewInstruction = Create(context, parentFeature, Instruction); IterationInstructionList.Add(NewInstruction); } if (source.Variant.IsAssigned) { VariantExpression = CSharpExpression.Create(context, (IExpression)source.Variant.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="CSharpAssignmentInstruction"/> 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 CSharpAssignmentInstruction(ICSharpContext context, ICSharpFeature parentFeature, IAssignmentInstruction source) : base(context, parentFeature, source) { SourceExpression = CSharpExpression.Create(context, (IExpression)Source.Source); foreach (IQualifiedName Destination in source.DestinationList) { ICompiledFeature SourceFeature = source.FinalFeatureTable[Destination]; ICSharpFeature FinalFeature; if (SourceFeature is IScopeAttributeFeature AsScopeAttributeFeature) { FinalFeature = CSharpScopeAttributeFeature.Create(null, AsScopeAttributeFeature); } else { FinalFeature = context.GetFeature(SourceFeature); } ICSharpQualifiedName NewDestination = CSharpQualifiedName.Create(context, Destination, FinalFeature, null, false); DestinationList.Add(NewDestination); } }
/// <summary> /// Initializes the feature overloads and bodies. /// </summary> /// <param name="context">The initialization context.</param> public override void InitOverloadsAndBodies(ICSharpContext context) { Type = CSharpType.Create(context, Source.ResolvedEntityType.Item); ConstantExpression = CSharpExpression.Create(context, (IExpression)Source.ConstantValue); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpCheckInstruction"/> 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 CSharpCheckInstruction(ICSharpContext context, ICSharpFeature parentFeature, ICheckInstruction source) : base(context, parentFeature, source) { BooleanExpression = CSharpExpression.Create(context, (IExpression)source.BooleanExpression); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpPositionalArgument"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="source">The Easly argument from which the C# argument is created.</param> protected CSharpPositionalArgument(ICSharpContext context, IPositionalArgument source) : base(context, source) { IExpression ArgumentSource = (IExpression)source.Source; SourceExpression = CSharpExpression.Create(context, ArgumentSource); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpKeywordAssignmentInstruction"/> 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 CSharpKeywordAssignmentInstruction(ICSharpContext context, ICSharpFeature parentFeature, IKeywordAssignmentInstruction source) : base(context, parentFeature, source) { SourceExpression = CSharpExpression.Create(context, (IExpression)source.Source); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpPrecursorIndexAssignmentInstruction"/> 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 CSharpPrecursorIndexAssignmentInstruction(ICSharpContext context, ICSharpFeature parentFeature, IPrecursorIndexAssignmentInstruction source) : base(context, parentFeature, source) { FeatureCall = new CSharpFeatureCall(context, source.FeatureCall.Item); SourceExpression = CSharpExpression.Create(context, (IExpression)source.Source); }