private IEnumerable <IPyStatement> ConvertRequestedToCode() { var result = new List <IPyStatement>(); foreach (var item in RequiredFiles.Distinct()) { var req = new PyImportStatement(item.RelativeModulePath, item.Alias); result.Add(req); } return(result.ToArray()); }
private IEnumerable <IPhpStatement> ConvertRequestedToCode() { var result = new List <IPhpStatement>(); var alreadyDefined = new List <string>(); var style = new PhpEmitStyle(); foreach (var item in RequiredFiles.Distinct()) { var code = item.GetPhpCode(style); //rozróżniam je po wygenerowanym kodzie if (alreadyDefined.Contains(code)) { continue; } alreadyDefined.Add(code); var req = new PhpMethodCallExpression("require_once", item); result.Add(new PhpExpressionStatement(req)); } return(result.ToArray()); }