public ArrayValue(TypedDef[] indexTypes, ProjectEntry entry, Node node) : base(entry, entry.Analyzer._arrayPrototype) { _indexTypes = indexTypes; _unionType = new TypedDef(); _node = node; entry.Analyzer.AnalysisValueCreated(GetType()); }
/// <summary> /// Makes this analysis value include all of the source analysis /// values and automatically pick up new values if the source /// changes. /// </summary> /// <param name="source"></param> public void AddLinkedValue(AnalysisUnit unit, ExpandoValue source) { if (_linkedValues == null) { _linkedValues = new TypedDef(); } _linkedValues.AddTypes(unit, source.SelfSet); }
public void AddDirectoryMembers(AnalysisUnit unit, string path) { if (!String.IsNullOrWhiteSpace(path) && path.IndexOfAny(InvalidPathChars) == -1 && _readDirs.Add(path) && Directory.Exists(Path.Combine(Path.GetDirectoryName(unit.ProjectEntry.FilePath), path))) { string trimmed = path.Trim(); if (trimmed != "." && trimmed != "/") { string[] files; try { files = Directory.GetFiles(Path.Combine(Path.GetDirectoryName(unit.ProjectEntry.FilePath), path)); } catch (IOException) { return; } catch (UnauthorizedAccessException) { return; } if (IndexTypes.Length < files.Length) { var types = IndexTypes; Array.Resize(ref types, files.Length); IndexTypes = types; } for (int i = 0; i < files.Length; i++) { if (IndexTypes[i] == null) { IndexTypes[i] = new TypedDef(); } IndexTypes[i].AddTypes( unit, unit.Analyzer.GetConstant(Path.GetFileName(files[i])).SelfSet ); } } } }