/// <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> /// 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 ICSharpCommandInstruction Create(ICSharpContext context, ICSharpFeature parentFeature, ICommandInstruction source) { return(new CSharpCommandInstruction(context, parentFeature, source)); }