private static IAnalysisSet FsReadDirSync(FunctionValue func, Node node, AnalysisUnit unit, IAnalysisSet @this, IAnalysisSet[] args) { CallNode call = (CallNode)node; if (call.Arguments.Length == 1) { var ee = new ExpressionEvaluator(unit); IAnalysisSet arraySet; ReadDirSyncArrayValue array; if (!unit.GetDeclaringModuleEnvironment().TryGetNodeValue(NodeEnvironmentKind.ArrayValue, call, out arraySet)) { array = new ReadDirSyncArrayValue( unit.ProjectEntry, node ); arraySet = array.SelfSet; unit.GetDeclaringModuleEnvironment().AddNodeValue(NodeEnvironmentKind.ArrayValue, call, arraySet); } else { array = (ReadDirSyncArrayValue)arraySet.First().Value; } foreach (var path in ee.MergeStringLiterals(call.Arguments[0])) { array.AddDirectoryMembers(unit, path); } return(array.SelfSet); } return(AnalysisSet.Empty); }
private static IAnalysisSet FsReadDirSync(FunctionValue func, Node node, AnalysisUnit unit, IAnalysisSet @this, IAnalysisSet[] args) { var call = node as CallNode; if (call != null && call.Arguments.Length == 1) { var ee = new ExpressionEvaluator(unit); IAnalysisSet arraySet; ReadDirSyncArrayValue array; if (!unit.GetDeclaringModuleEnvironment().TryGetNodeValue(NodeEnvironmentKind.ArrayValue, call, out arraySet)) { array = new ReadDirSyncArrayValue( unit.ProjectEntry, node ); arraySet = array.SelfSet; unit.GetDeclaringModuleEnvironment().AddNodeValue(NodeEnvironmentKind.ArrayValue, call, arraySet); } else { array = (ReadDirSyncArrayValue)arraySet.First().Value; } foreach (var path in ee.MergeStringLiterals(call.Arguments[0])) { array.AddDirectoryMembers(unit, path); } return array.SelfSet; } return AnalysisSet.Empty; }