/// <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 a new C# body. /// </summary> /// <param name="context">The creation context.</param> /// <param name="parentFeature">The parent feature.</param> /// <param name="source">The Easly body from which the C# body is created.</param> public static ICSharpBody Create(ICSharpContext context, ICSharpFeature parentFeature, ICompiledBody source) { ICSharpBody Result = null; switch (source) { case IDeferredBody AsDeferredBody: Result = CSharpDeferredBody.Create(context, parentFeature, AsDeferredBody); break; case IEffectiveBody AsEffectiveBody: Result = CSharpEffectiveBody.Create(context, parentFeature, AsEffectiveBody); break; case IExternBody AsExternBody: Result = CSharpExternBody.Create(context, parentFeature, AsExternBody); break; case IPrecursorBody AsPrecursorBody: Result = CSharpPrecursorBody.Create(context, parentFeature, AsPrecursorBody); break; } Debug.Assert(Result != null); return(Result); }
/// <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="CSharpInstruction"/> 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 CSharpInstruction(ICSharpContext context, ICSharpFeature parentFeature, IInstruction source) { Debug.Assert(source != null); ParentFeature = parentFeature; Source = source; }
/// <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="CSharpQualifiedName"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="source">The Easly node from which the C# node is created.</param> /// <param name="feature">The feature at the end of the path. Can be null.</param> /// <param name="discrete">The discrete at the end of the path. Can be null.</param> /// <param name="inheritBySideAttribute">Inherit the side-by-side attribute.</param> protected CSharpQualifiedName(ICSharpContext context, IQualifiedName source, ICSharpFeature feature, ICSharpDiscrete discrete, bool inheritBySideAttribute) : base(source) { Debug.Assert((feature != null && discrete == null) || (feature == null && discrete != null)); Feature = feature; Discrete = discrete; InheritBySideAttribute = inheritBySideAttribute; IsAttributeWithContract = feature is ICSharpAttributeFeature AsAttributeFeature && AsAttributeFeature.Source.EnsureList.Count > 0; foreach (IExpressionType Item in source.ValidResultTypePath.Item) { ICSharpClass ItemClass; if (Item.ValueType is IClassType AsClassType) { ItemClass = context.GetClass(AsClassType.BaseClass); } else { ItemClass = null; } ClassPath.Add(ItemClass); } }
/// <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="CSharpCreateInstruction"/> 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 CSharpCreateInstruction(ICSharpContext context, ICSharpFeature parentFeature, ICreateInstruction source) : base(context, parentFeature, source) { EntityType = CSharpType.Create(context, source.ResolvedEntityType.Item); CreatedObjectName = ((IIdentifier)source.EntityIdentifier).ValidText.Item; CreationRoutineName = ((IIdentifier)source.CreationRoutineIdentifier).ValidText.Item; FeatureCall = new CSharpFeatureCall(context, source.FeatureCall.Item); }
/// <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="CSharpCommandOverload"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="source">The Easly node from which the C# node is created.</param> /// <param name="parentFeature">The parent feature.</param> /// <param name="owner">The class where the overload is declared.</param> protected CSharpCommandOverload(ICSharpContext context, ICommandOverload source, ICSharpFeature parentFeature, ICSharpClass owner) : base(source) { ParentFeature = parentFeature; foreach (IParameter Parameter in source.ParameterTable) { ICSharpParameter NewParameter = CSharpParameter.Create(context, Parameter, owner); ParameterList.Add(NewParameter); } Body = CSharpBody.Create(context, parentFeature, source.ResolvedBody.Item); }
/// <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="CSharpScope"/> 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 CSharpScope(ICSharpContext context, ICSharpFeature parentFeature, IScope source) : base(source) { ParentFeature = parentFeature; foreach (IEntityDeclaration Declaration in source.EntityDeclarationList) { ICSharpScopeAttributeFeature NewDeclaration = CSharpScopeAttributeFeature.Create(context, parentFeature.Owner, Declaration.ValidEntity.Item); EntityDeclarationList.Add(NewDeclaration); } foreach (IInstruction Instruction in source.InstructionList) { ICSharpInstruction NewInstruction = CSharpInstruction.Create(context, parentFeature, Instruction); InstructionList.Add(NewInstruction); } }
/// <summary> /// Initializes a new instance of the <see cref="CSharpEffectiveBody"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="parentFeature">The parent feature.</param> /// <param name="source">The Easly body from which the C# body is created.</param> protected CSharpEffectiveBody(ICSharpContext context, ICSharpFeature parentFeature, IEffectiveBody source) : base(context, parentFeature, source) { foreach (IInstruction Instruction in source.BodyInstructionList) { ICSharpInstruction NewInstruction = CSharpInstruction.Create(context, parentFeature, Instruction); BodyInstructionList.Add(NewInstruction); } ICSharpClass Owner = parentFeature.Owner; foreach (IEntityDeclaration Item in source.EntityDeclarationList) { ICSharpScopeAttributeFeature NewDeclaration = CSharpScopeAttributeFeature.Create(context, Owner, Item.ValidEntity.Item); EntityDeclarationList.Add(NewDeclaration); } }
/// <summary> /// Initializes a new instance of the <see cref="CSharpBody"/> class. /// </summary> /// <param name="context">The creation context.</param> /// <param name="parentFeature">The parent feature.</param> /// <param name="source">The Easly body from which the C# body is created.</param> protected CSharpBody(ICSharpContext context, ICSharpFeature parentFeature, IBody source) { Debug.Assert(source != null); ParentFeature = parentFeature; Source = source; foreach (IAssertion Assertion in source.RequireList) { ICSharpAssertion NewAssertion = CSharpAssertion.Create(context, Assertion); RequireList.Add(NewAssertion); } foreach (IAssertion Assertion in source.EnsureList) { ICSharpAssertion NewAssertion = CSharpAssertion.Create(context, Assertion); EnsureList.Add(NewAssertion); } }
/// <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="CSharpCommandInstruction"/> 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 CSharpCommandInstruction(ICSharpContext context, ICSharpFeature parentFeature, ICommandInstruction source) : base(context, parentFeature, source) { Command = CSharpQualifiedName.Create(context, (IQualifiedName)source.Command, parentFeature, null, false); FeatureCall = new CSharpFeatureCall(context, source.FeatureCall.Item); ICompiledFeature SourceFeature = source.SelectedFeature.Item; if (SourceFeature is IScopeAttributeFeature AsScopeAttributeFeature) { FinalFeature = CSharpScopeAttributeFeature.Create(null, AsScopeAttributeFeature); } else { FinalFeature = context.GetFeature(SourceFeature); } ICompiledTypeWithFeature ResolvedBaseType = Source.CommandFinalType.Item.ResolvedBaseType.Item; FinalType = CSharpType.Create(context, ResolvedBaseType) as ICSharpTypeWithFeature; Debug.Assert(FinalType != null); IList <ICSharpClassType> ConformingClassTypeList = FinalType.ConformingClassTypeList; bool InheritFromDotNetEvent = false; bool IsNumberType = false; foreach (ICSharpClassType Item in ConformingClassTypeList) { ICSharpClass CallClass = Item.Class; InheritFromDotNetEvent |= CallClass.InheritFromDotNetEvent; IsNumberType = Item.IsNumberType; } SkipLastInPath = InheritFromDotNetEvent; IsCallingNumberFeature = IsNumberType; }
/// <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> /// Translates nodes from the compiler to the target language. /// </summary> public override void Translate() { ErrorList.ClearErrors(); if (!CreateClasses(out IDictionary <IClass, ICSharpClass> ClassTable)) { return; } if (!CreateFeatures(ClassTable, out IDictionary <ICompiledFeature, ICSharpFeature> FeatureTable)) { return; } ICSharpContext Context = new CSharpContext(ClassTable, FeatureTable); foreach (KeyValuePair <IClass, ICSharpClass> ClassEntry in ClassTable) { ICSharpClass Class = ClassEntry.Value; IList <ICSharpFeature> ClassFeatureList = new List <ICSharpFeature>(); IList <ICSharpFeature> InheritedFeatureList = new List <ICSharpFeature>(); foreach (KeyValuePair <ICompiledFeature, ICSharpFeature> FeatureEntry in FeatureTable) { ICSharpFeature Feature = FeatureEntry.Value; IFeatureInstance Instance = Feature.Instance; if (Instance.IsDiscontinued) { continue; } if (FeatureEntry.Value.Owner == Class) { ClassFeatureList.Add(Feature); } else if (!IsDirectOrNotMainParentFeature(Instance, Class)) { InheritedFeatureList.Add(Feature); } } Class.SetFeatureList(Context, ClassFeatureList, InheritedFeatureList); } foreach (KeyValuePair <ICompiledFeature, ICSharpFeature> Entry in FeatureTable) { ICSharpFeature Feature = Entry.Value; Feature.InitOverloadsAndBodies(Context); } foreach (KeyValuePair <ICompiledFeature, ICSharpFeature> Entry in FeatureTable) { ICSharpFeature Feature = Entry.Value; Feature.InitHierarchy(Context); } foreach (KeyValuePair <IClass, ICSharpClass> Entry in ClassTable) { ICSharpClass Class = Entry.Value; CheckSharedName(Class, ClassTable); } foreach (KeyValuePair <IClass, ICSharpClass> Entry in ClassTable) { ICSharpClass Class = Entry.Value; Class.CheckOverrides(); } foreach (KeyValuePair <IClass, ICSharpClass> Entry in ClassTable) { ICSharpClass Class = Entry.Value; Class.CheckOverrides(); } bool Continue; do { Continue = false; foreach (KeyValuePair <IClass, ICSharpClass> Entry in ClassTable) { ICSharpClass Class = Entry.Value; Class.CheckForcedReadWrite(FeatureTable, ref Continue); } }while (Continue); foreach (KeyValuePair <IClass, ICSharpClass> Entry in ClassTable) { ICSharpClass Class = Entry.Value; Class.CheckSideBySideAttributes(); } foreach (KeyValuePair <IClass, ICSharpClass> Entry in ClassTable) { ICSharpClass Class = Entry.Value; Class.CheckInheritSideBySideAttributes(FeatureTable); } foreach (KeyValuePair <IClass, ICSharpClass> Entry in ClassTable) { ICSharpClass Class = Entry.Value; Class.CreateDelegates(); } ICSharpFeature SingledClassFeature = null; if (SingledGuid != Guid.Empty || SingledGuid == Guid.Empty) { foreach (KeyValuePair <IClass, ICSharpClass> Entry in ClassTable) { ICSharpClass Class = Entry.Value; if (Class.Source.ClassGuid == SingledGuid || SingledGuid == Guid.Empty || SingledGuid != Guid.Empty) { foreach (ICSharpFeature Feature in Class.FeatureList) { if (Feature is ICSharpFeatureWithName AsWithName && AsWithName.Name == SingledName) { SingledClassFeature = Feature; break; } } } if (SingledClassFeature != null) { break; } } } if (SingledClassFeature == null) { foreach (KeyValuePair <IClass, ICSharpClass> Entry in ClassTable) { ICSharpClass Class = Entry.Value; Class.SetWriteDown(); foreach (ICSharpFeature Feature in Class.FeatureList) { Feature.SetWriteDown(); } foreach (ICSharpAssertion Invariant in Class.InvariantList) { Invariant.SetWriteDown(); } } } else { SingledClassFeature.SetWriteDown(); } if (!Directory.Exists(OutputRootFolder)) { Directory.CreateDirectory(OutputRootFolder); } foreach (KeyValuePair <IClass, ICSharpClass> Entry in ClassTable) { ICSharpClass Class = Entry.Value; if (!CSharpClass.IsLanguageClass(Class.Source) && !IsClassFromLibrary(Class.Source)) { if (Class.WriteDown) { Class.Write(OutputRootFolder, Namespace, SourceFileName, SingledClassFeature); } } } }
private static bool CreateFeature(ICSharpClass owner, IFeatureInstance instance, out ICSharpFeature result) { result = null; bool IsHandled = false; ICompiledFeature SourceFeature = instance.Feature; switch (SourceFeature) { case IAttributeFeature AsAttributeFeature: result = CSharpAttributeFeature.Create(owner, instance, AsAttributeFeature); IsHandled = true; break; case IConstantFeature AsConstantFeature: result = CSharpConstantFeature.Create(owner, instance, AsConstantFeature); IsHandled = true; break; case ICreationFeature AsCreationFeature: result = CSharpCreationFeature.Create(owner, instance, AsCreationFeature); IsHandled = true; break; case IFunctionFeature AsFunctionFeature: result = CSharpFunctionFeature.Create(owner, instance, AsFunctionFeature); IsHandled = true; break; case IIndexerFeature AsIndexerFeature: result = CSharpIndexerFeature.Create(owner, instance, AsIndexerFeature); IsHandled = true; break; case IProcedureFeature AsProcedureFeature: result = CSharpProcedureFeature.Create(owner, instance, AsProcedureFeature); IsHandled = true; break; case IPropertyFeature AsPropertyFeature: result = CSharpPropertyFeature.Create(owner, instance, AsPropertyFeature); IsHandled = true; break; case IScopeAttributeFeature AsScopeAttributeFeature: result = CSharpScopeAttributeFeature.Create(owner, AsScopeAttributeFeature); IsHandled = true; break; } Debug.Assert(IsHandled); return(result != null); }
/// <summary> /// Initializes a new instance of the <see cref="CSharpThrowInstruction"/> 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 CSharpThrowInstruction(ICSharpContext context, ICSharpFeature parentFeature, IThrowInstruction source) : base(context, parentFeature, source) { ExceptionType = CSharpType.Create(context, source.ResolvedType.Item); FeatureCall = new CSharpFeatureCall(context, source.FeatureCall.Item); }
/// <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> /// Create a new C# overload. /// </summary> /// <param name="context">The creation context.</param> /// <param name="source">The Easly node from which the C# node is created.</param> /// <param name="parentFeature">The parent feature.</param> /// <param name="owner">The class where the overload is declared.</param> public static ICSharpQueryOverload Create(ICSharpContext context, IQueryOverload source, ICSharpFeature parentFeature, ICSharpClass owner) { return(new CSharpQueryOverload(context, source, parentFeature, owner)); }
/// <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> /// Creates a new C# instruction. /// </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> public static ICSharpKeywordAssignmentInstruction Create(ICSharpContext context, ICSharpFeature parentFeature, IKeywordAssignmentInstruction source) { return(new CSharpKeywordAssignmentInstruction(context, parentFeature, source)); }
/// <summary> /// Creates a new C# instruction. /// </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> public static ICSharpInspectInstruction Create(ICSharpContext context, ICSharpFeature parentFeature, IInspectInstruction source) { return(new CSharpInspectInstruction(context, parentFeature, source)); }
/// <summary> /// Creates a new C# body. /// </summary> /// <param name="context">The creation context.</param> /// <param name="parentFeature">The parent feature.</param> /// <param name="source">The Easly body from which the C# body is created.</param> public static ICSharpEffectiveBody Create(ICSharpContext context, ICSharpFeature parentFeature, IEffectiveBody source) { return(new CSharpEffectiveBody(context, parentFeature, source)); }
public CSharpFeatureTreeViewItem(BaseTreeViewItem parent, IAnalysisResultTreeViewBuilder treeViewBuilder, int numberOfItems, ICSharpFeature feature) : base(parent, treeViewBuilder, numberOfItems, feature.FriendlyName) { Feature = feature; }