/// <summary> /// Gets an enumeration of declarations that should be scoped by the same node that declares it. /// </summary> /// <returns>An enumeration of declarations.</returns> public IEnumerable <Declaration> GetScopedDeclarations() { if (ParameterList != null && ParameterList.IdentifierList != null) { return(ParameterList.IdentifierList.OfType <Identifier>() .Select(identifier => DeclarationFactory.CreateDeclaration(DeclarationType.Parameter, true, identifier))); } return(new Declaration[0]); }
void Initialize() { FInstances = new List <IInternalPluginHost>(); FConflictMgr = new ConflictManager(FInstances.AsReadOnly()); FTypeOverloader = new TypeOverloader(); FTypeOverloads = new Dictionary <Type, Type>(); FStructFactories = new List <IStructFactory>(); FContainerRegs = new List <IContainerRegistry>(); FContainerRegs.Add(new StreamContainerRegistry()); FContainerRegs.Add(new SpreadContainerRegistry()); FContainerRegs.Add(new NullContainerRegistry()); FDeclarationFactory = new DeclarationFactory(); FDeclarationFactory.DeclarationChanged += FDeclarationFactory_DeclarationChanged; ComposeIDeclarationFactory(FDeclarationFactory); RegisterFieldtypeRegistry(new PrimitivesFieldTypeRegistry()); RegisterFieldtypeRegistry(new CSFieldTypeRegistry(FSolution)); var vlReg = new VLFieldTypeRegistry(); AddonFactoriesLoaded += vlReg.VLFactoryLoaded; RegisterFieldtypeRegistry(vlReg); foreach (var a in AppDomain.CurrentDomain.GetAssemblies()) { if (a.FullName.Contains("VVVV.DX11.Core")) { string dx11FactoryPath = Path.Combine(FBasePath, $"core{Path.DirectorySeparatorChar}Struct.DX11Factory.dll"); try { LoadExternalFactories(dx11FactoryPath); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e); } } } RegisterFieldtypeRegistry(new RuntimeFieldTypeRegistry()); RegisterFieldtypeRegistry(new NullFieldTypeRegistry()); FDeclarationFactory.Initialize(); FDescriptiveUpdates = new Dictionary <IStructDeclarer, Action>(); FHDEHost.MainLoop.OnPrepareGraph += MainLoop_OnPrepareGraph; }
/// <summary> /// Gets an enumeration of declarations that should be scoped by the same node that declares it. /// </summary> /// <returns>An enumeration of declarations.</returns> public IEnumerable <Declaration> GetScopedDeclarations() { // Check if we have an identifier in a 'for x = 1,1,10 do <block> end' style for loop if (Identifier != null) { yield return(DeclarationFactory.CreateDeclaration(DeclarationType.Variable, true, Identifier)); } // Check if we have an identifier in a 'for x,y in <expression> do <block> end' style for loop if (IdentifierList != null) { IdentifierList.OfType <Identifier>() .Select(identifier => DeclarationFactory.CreateDeclaration(DeclarationType.Variable, true, identifier)); } }
/// <summary> /// Gets an enumeration of declarations that the node declares. /// </summary> /// <returns>An enumeration of declarations.</returns> public IEnumerable<Declaration> GetDeclarations() { if (Identifier != null) { // Try to deduct the declaration type and the type from the Expression DeclarationType declarationType = DeclarationType.Field; string type = null; if (Expression is Function) declarationType = DeclarationType.Function; if (Expression is TableConstructor) { declarationType = DeclarationType.Table; type = ((TableConstructor)Expression).Name; } yield return DeclarationFactory.CreateDeclaration(declarationType, type, Identifier); } }
/// <summary> /// Gets an enumeration of declarations that the node declares. /// </summary> /// <returns>An enumeration of declarations.</returns> public IEnumerable <Declaration> GetDeclarations() { // Iterate through the identifier list and for each Identifier, return a Variable declaration return(IdentifierList.OfType <Identifier>() .Select(identifier => DeclarationFactory.CreateDeclaration(DeclarationType.Variable, true, identifier))); }