/*
        /// <summary>
        /// Tworzy instancję obiektu
        /// </summary>
        public PhpDefinedConstExpression()
        {
        }

        Przykłady użycia

        implement INotifyPropertyChanged
        implement INotifyPropertyChanged_Passive
        implement ToString ##DefinedConstName## ##ModuleName##
        implement ToString DefinedConstName=##DefinedConstName##, ModuleName=##ModuleName##
        implement equals DefinedConstName, ModuleName
        implement equals *
        implement equals *, ~exclude1, ~exclude2
        */
        #region Constructors
        /// <summary>
        /// Tworzy instancję obiektu
        /// <param name="definedConstName"></param>
        /// <param name="moduleName"></param>
        /// </summary>
        public PhpDefinedConstExpression(string definedConstName, PhpCodeModuleName moduleName)
        {
            if (definedConstName == "PHP_EOL" && moduleName != null)
                throw new Exception("PHP_EOL is built in");
            _definedConstName = definedConstName;
            _moduleName = moduleName;
        }
Beispiel #2
0
 protected virtual T VisitPhpCodeModuleName(PhpCodeModuleName node)
 {
     if (ThrowNotImplementedException)
     {
         throw new NotImplementedException(string.Format("Method {0} is not supported in class {1}", "VisitPhpCodeModuleName", this.GetType().FullName));
     }
     return(default(T));
 }
Beispiel #3
0
        private PhpCodeModule CurrentConfigModule()
        {
            var assemblyTranslationInfo = _info.GetOrMakeTranslationInfo(_info.CurrentAssembly);
            var phpCodeModuleName       = new PhpCodeModuleName(assemblyTranslationInfo.ConfigModuleName, assemblyTranslationInfo);
            var phpModule = GetOrMakeModuleByName(phpCodeModuleName);

            return(phpModule);
        }
Beispiel #4
0
        // Private Methods 

        /// <summary>
        ///     Gets existing or creates code module for given name
        /// </summary>
        /// <param name="requiredModuleName"></param>
        /// <returns></returns>
        private PhpCodeModule GetOrMakeModuleByName(PhpCodeModuleName requiredModuleName)
        {
            var mod = Modules.FirstOrDefault(i => i.Name == requiredModuleName);

            if (mod != null)
            {
                return(mod);
            }
            mod = new PhpCodeModule(requiredModuleName);
            Modules.Add(mod);
            return(mod);
        }
Beispiel #5
0
 /*
  * /// <summary>
  * /// Tworzy instancję obiektu
  * /// </summary>
  * public ModuleCodeRequest()
  * {
  * }
  *
  * Przykłady użycia
  *
  * implement INotifyPropertyChanged
  * implement INotifyPropertyChanged_Passive
  * implement ToString ##ModuleName## ##Why##
  * implement ToString ModuleName=##ModuleName##, Why=##Why##
  * implement equals ModuleName, Why
  * implement equals *
  * implement equals *, ~exclude1, ~exclude2
  */
 #region Constructors
 /// <summary>
 /// Tworzy instancję obiektu
 /// <param name="moduleName"></param>
 /// <param name="why">Why this Module is requested</param>
 /// </summary>
 public ModuleCodeRequest(PhpCodeModuleName moduleName, string why)
 {
     _moduleName = moduleName;
     _why        = why;
 }
Beispiel #6
0
        // Private Methods 

        /*
         *      static IPhpStatement[] MkArray(IPhpStatement x)
         *      {
         *          return new IPhpStatement[] { x };
         *      }
         */

        // Public Methods 


        public void Translate(AssemblySandbox sandbox)
        {
            var classes            = Info.GetClasses();
            var classesToTranslate = Info.ClassTranslations.Values
                                     .Where(u => u.Type.Assembly.FullName == Info.CurrentAssembly.FullName).ToArray();
            //            classesToTranslate = (from i in _info.ClassTranslations.Values
            //                                      where i.Type.Assembly.FullName == _info.CurrentAssembly.FullName
            //                                      select this.ge.ToArray();
            var interfaces = Info.GetInterfaces();

            //     var interfacesToTranslate = info.ClassTranslations.Values.Where(u => u.Type.Assembly == info.CurrentAssembly).ToArray();
            foreach (var classTranslationInfo in classesToTranslate)
            {
                if (classTranslationInfo.Skip)
                {
                    Debug.Write("");
                }
                PhpClassDefinition phpClass;
                var phpModule = GetOrMakeModuleByName(classTranslationInfo.ModuleName);
                // var assemblyTI = _info.GetOrMakeTranslationInfo(_info.CurrentAssembly);

                {
                    PhpQualifiedName phpBaseClassName;
                    {
                        var netBaseType = classTranslationInfo.Type.BaseType;
                        if ((object)netBaseType == null || netBaseType == typeof(object))
                        {
                            phpBaseClassName = PhpQualifiedName.Empty;
                        }
                        else
                        {
                            // _state.Principles.CurrentTyp is null so we will obtain absolute name
                            phpBaseClassName =
                                _state.Principles.GetPhpType(netBaseType, true, null); // absolute name
                            var baseTypeTranslationInfo = _state.Principles.GetOrMakeTranslationInfo(netBaseType);
                            if (baseTypeTranslationInfo.Skip)
                            {
                                phpBaseClassName = PhpQualifiedName.Empty;
                            }
                        }
                    }
                    phpClass = phpModule.FindOrCreateClass(classTranslationInfo.ScriptName, phpBaseClassName);
                }
                _state.Principles.CurrentType     = classTranslationInfo.Type;
                _state.Principles.CurrentAssembly = _state.Principles.CurrentType.Assembly;
                Console.WriteLine(classTranslationInfo.ModuleName);

                IClassMember[] members;

                if (classTranslationInfo.Type.IsInterface)
                {
                    var sources = interfaces.Where(i => i.FullName == classTranslationInfo.Type.FullName).ToArray();
                    members = (from i in sources
                               from j in i.ClassDeclaration.Members
                               select j).ToArray();
                    {
                        var fileNames = classTranslationInfo.Type.GetCustomAttributes <RequireOnceAttribute>()
                                        .Select(i => i.Filename).Distinct().ToArray();
                        if (fileNames.Any())
                        {
                            var b = fileNames.Select(u => new PhpConstValue(u)).ToArray();
                            phpModule.RequiredFiles.AddRange(b);
                        }
                    }
                }
                else
                {
                    var sources = classes.Where(i => i.FullName == classTranslationInfo.Type.FullName).ToArray();
                    members = (from i in sources
                               from j in i.ClassDeclaration.Members
                               select j).ToArray();
                    {
                        var fileNames = classTranslationInfo.Type.GetCustomAttributes <RequireOnceAttribute>()
                                        .Select(i => i.Filename).Distinct().ToArray();
                        if (fileNames.Any())
                        {
                            var b = fileNames.Select(u => new PhpConstValue(u)).ToArray();
                            phpModule.RequiredFiles.AddRange(b);
                        }
                    }
                }

                {
                    var c = members.OfType <ConstructorDeclaration>().ToArray();
                    if (c.Length > 1)
                    {
                        throw new Exception("PHP supports only one constructor per class");
                    }
                    if (c.Any())
                    {
                        TranslateConstructor(phpClass, c.First());
                    }
                }

                {
                    foreach (var methodDeclaration in members.OfType <MethodDeclaration>())
                    {
                        TranslateMethod(phpClass, methodDeclaration);
                    }
                }

                {
                    foreach (var pDeclaration in members.OfType <CsharpPropertyDeclaration>())
                    {
                        TranslateProperty(phpClass, pDeclaration);
                    }
                }

                {
                    foreach (var constDeclaration in members.OfType <FieldDeclaration>())
                    {
                        TranslateField(phpModule, phpClass, constDeclaration);
                    }
                }

                _state.Principles.CurrentType = null;
                {
                    if (classTranslationInfo.IsPage)
                    {
                        {
                            var ati = Info.GetOrMakeTranslationInfo(Info.CurrentAssembly);
                            if (ati.DefaultTimezone.HasValue)
                            {
                                // date_default_timezone_set('America/Los_Angeles');
                                var a  = new PhpValueTranslator(_state);
                                var aa = a.Visit(new ConstValue(ati.DefaultTimezone.Value));
                                var dateDefaultTimezoneSet =
                                    new PhpMethodCallExpression("date_default_timezone_set", aa);
                                phpModule.BottomCode.Statements.Add(new PhpExpressionStatement(dateDefaultTimezoneSet));
                            }
                        }

                        {
                            var mti = MethodTranslationInfo.FromMethodInfo(classTranslationInfo.PageMethod,
                                                                           classTranslationInfo);
                            var callMain = new PhpMethodCallExpression(mti.ScriptName);
                            callMain.SetClassName(
                                classTranslationInfo.ScriptName,
                                mti
                                );
                            phpModule.BottomCode.Statements.Add(new PhpExpressionStatement(callMain));
                        }
                    }
                }

                {
                    var moduleCodeRequests = new List <ModuleCodeRequest>();
                    var codeRequests       = (phpModule as ICodeRelated).GetCodeRequests().ToArray();
                    {
                        var classCodeRequests = (from request in codeRequests.OfType <ClassCodeRequest>()
                                                 where request.ClassName != null
                                                 select request.ClassName.FullName)
                                                .Distinct()
                                                .ToArray();

                        foreach (var req in classCodeRequests)
                        {
                            var m = Info.ClassTranslations.Values.Where(i => i.ScriptName.FullName == req).ToArray();
                            if (m.Length != 1)
                            {
                                throw new NotSupportedException();
                            }
                            var mm = m[0];
                            if (mm.DontIncludeModuleForClassMembers)
                            {
                                continue;
                            }
                            var includeModule = mm.IncludeModule;
                            if (includeModule == null || mm.ModuleName == phpModule.Name)
                            {
                                continue;
                            }
                            var h = new ModuleCodeRequest(includeModule, "class request: " + req);
                            moduleCodeRequests.Add(h);
                        }
                    }
                    {
                        var moduleRequests = (from i in codeRequests.OfType <ModuleCodeRequest>()
                                              where i.ModuleName != null
                                              select i).Union(moduleCodeRequests).ToArray();
                        var moduleNames = (from mReq in moduleRequests
                                           where mReq.ModuleName != phpModule.Name
                                           let mName = mReq.ModuleName
                                                       where mName != null
                                                       select mName
                                           ).Distinct().ToArray();
                        foreach (var i in moduleNames.Where(x => !PhpCodeModuleName.IsFrameworkName(x)))
                        {
                            AppendCodeReq(i, phpModule);
                        }
                    }
                }
            }

            {
                var emptyModules = Modules.Where(a => a.IsEmpty).ToArray();
                foreach (var module in Modules)
                {
                    // if (module.IsEmpty)
                }
            }
        }
Beispiel #7
0
        private void AppendCodeReq(PhpCodeModuleName req, PhpCodeModule current)
        {
            if (req == current.Name)
            {
                return;
            }
            if (req.Name == PhpCodeModuleName.CS2PHP_CONFIG_MODULE_NAME)
            {
                var phpModule = CurrentConfigModule();
                req = phpModule.Name;
            }

            if (req.AssemblyInfo != null && !string.IsNullOrEmpty(req.AssemblyInfo.IncludePathConstOrVarName))
            {
                var isCurrentAssembly = Info.CurrentAssembly == req.AssemblyInfo.Assembly;
                if (!isCurrentAssembly)
                {
                    var tmp = req.AssemblyInfo.IncludePathConstOrVarName;
                    if (tmp.StartsWith("$"))
                    {
                        throw new NotSupportedException();
                    }
                    // leading slash is not necessary -> config is in global namespace
                    // but full name is a key in dictionary
                    var phpModule = CurrentConfigModule();
                    if (phpModule.DefinedConsts.All(i => i.Key != tmp))
                    {
                        KnownConstInfo value;
                        if (Info.KnownConstsValues.TryGetValue(tmp, out value))
                        {
                            if (!value.UseFixedValue)
                            {
                                var expression = PathUtil.MakePathValueRelatedToFile(value, Info);
                                phpModule.DefinedConsts.Add(new KeyValuePair <string, IPhpValue>(tmp, expression));
                            }
                            else
                            {
                                throw new NotImplementedException();
                            }
                        }
                        else
                        {
                            Info.Log(MessageLevels.Error,
                                     string.Format("const {0} defined in {1} has no known value", tmp, phpModule.Name));
                            phpModule.DefinedConsts.Add(
                                new KeyValuePair <string, IPhpValue>(tmp, new PhpConstValue("UNKNOWN")));
                        }
                    }
                }
            }

            var fileNameExpression = req.MakeIncludePath(current.Name);

            if (fileNameExpression == null)
            {
                return;
            }
            if (current.RequiredFiles.Any())
            {
                var s    = new PhpEmitStyle();
                var code = fileNameExpression.GetPhpCode(s);
                var a    = current.RequiredFiles.Select(i => i.GetPhpCode(s)).ToArray();
                if (a.Any(i => i == code))
                {
                    return;
                }
            }

            // if (fileNameExpression1 !=null)
            {
                var fileNameExpressionICodeRelated = fileNameExpression as ICodeRelated;
                // scan nested requests
                var nestedCodeRequests = fileNameExpressionICodeRelated.GetCodeRequests().ToArray();
                if (nestedCodeRequests.Any())
                {
                    var nestedModuleCodeRequests = nestedCodeRequests.OfType <ModuleCodeRequest>();
                    foreach (var nested in nestedModuleCodeRequests)
                    {
                        AppendCodeReq(nested.ModuleName, current);
                    }
                }
            }
            current.RequiredFiles.Add(fileNameExpression);
        }
Beispiel #8
0
        void Update()
        {
            if (_initialized)
            {
                return;
            }
            _initialized = true;


            var ati = _info.GetOrMakeTranslationInfo(_type.Assembly);


            var declaringTypeTranslationInfo = (object)_type.DeclaringType == null
                ? null
                : _info.GetOrMakeTranslationInfo(_type.DeclaringType);
            var ats = _type.GetCustomAttributes(false);

            _ignoreNamespace = ats.OfType <IgnoreNamespaceAttribute>().Any();

            #region ScriptName
            {
                if (_ignoreNamespace)
                {
                    _scriptName = (PhpQualifiedName)PhpQualifiedName.SanitizePhpName(_type.Name); // only short name without namespace
                }
                else if (_type.IsGenericType)
                {
                    _scriptName = (PhpQualifiedName)DotNetNameToPhpName(_type.FullName ?? _type.Name); // beware of generic types
                }
                else
                {
                    _scriptName = (PhpQualifiedName)DotNetNameToPhpName(_type.FullName ?? _type.Name);
                }

                var scriptNameAttribute = ats.OfType <ScriptNameAttribute>().FirstOrDefault();
                if (scriptNameAttribute != null)
                {
                    if (scriptNameAttribute.Name.StartsWith(PhpQualifiedName.TokenNsSeparator.ToString(CultureInfo.InvariantCulture)))
                    {
                        _scriptName = (PhpQualifiedName)scriptNameAttribute.Name;
                    }
                    else if (IgnoreNamespace)
                    {
                        _scriptName = (PhpQualifiedName)(PhpQualifiedName.TokenNsSeparator + scriptNameAttribute.Name);
                    }
                    else
                    {
                        _scriptName =
                            (PhpQualifiedName)
                            (DotNetNameToPhpName(_type.FullName) + PhpQualifiedName.TokenNsSeparator +
                             scriptNameAttribute.Name);
                    }
                }
                if (declaringTypeTranslationInfo != null)
                {
                    _scriptName = (PhpQualifiedName)(declaringTypeTranslationInfo.ScriptName + "__" + _type.Name); // parent clas followed by __ and short name
                }
            }
            #endregion
            #region Module name
            {
                //if (declaringTypeTranslationInfo != null && declaringTypeTranslationInfo.ModuleName != null)
                _moduleName = new PhpCodeModuleName(_type, ati, declaringTypeTranslationInfo);
            }
            #endregion
            #region PageAttribute
            {
                var pageAttribute = ats.OfType <PageAttribute>().FirstOrDefault();
                _isPage     = pageAttribute != null;
                _pageMethod = _isPage ? FindPhpMainMethod(_type) : null;
            }
            #endregion
            #region AsArrayAttribute
            {
                var asArrayAttribute = ats.OfType <AsArrayAttribute>().FirstOrDefault();
                _isArray = asArrayAttribute != null;
            }
            #endregion
            #region SkipAttribute
            {
                var skipAttribute = ats.OfType <SkipAttribute>().FirstOrDefault();
                if (skipAttribute != null)
                {
                    _skip = true;
                }
            }
            #endregion
            #region BuiltInAttribute
            {
                var builtInAttribute = ats.OfType <BuiltInAttribute>().FirstOrDefault();
                if (builtInAttribute != null)
                {
                    _buildIn = true;
                }
            }
            #endregion

            if (_skip && _buildIn)
            {
                throw new Exception("Don't mix SkipAttribute and BuiltInAttribute for type " + _type.ExcName());
            }
            if (_buildIn)
            {
                _skip = true;
            }
            if (_type.IsGenericParameter)
            {
                _skip = true;
            }
            if (_isArray)
            {
                _skip = true;
            }
        }
        /*
        /// <summary>
        /// Tworzy instancję obiektu
        /// </summary>
        public PhpInstanceFieldAccessExpression()
        {
        }

        Przykłady użycia

        implement INotifyPropertyChanged
        implement INotifyPropertyChanged_Passive
        implement ToString ##FieldName## ##TargetObject## ##IncludeModule##
        implement ToString FieldName=##FieldName##, TargetObject=##TargetObject##, IncludeModule=##IncludeModule##
        implement equals FieldName, TargetObject, IncludeModule
        implement equals *
        implement equals *, ~exclude1, ~exclude2
        */
        #region Constructors
        /// <summary>
        /// Tworzy instancję obiektu
        /// <param name="FieldName"></param>
        /// <param name="TargetObject"></param>
        /// <param name="IncludeModule"></param>
        /// </summary>
        public PhpInstanceFieldAccessExpression(string FieldName, IPhpValue TargetObject, PhpCodeModuleName IncludeModule)
        {
            fieldName = FieldName;
            targetObject = TargetObject;
            this.IncludeModule = IncludeModule;
        }
        void Update()
        {
            if (_initialized) return;
            _initialized = true;


            var ati = _info.GetOrMakeTranslationInfo(_type.Assembly);


            var declaringTypeTranslationInfo = (object)_type.DeclaringType == null
                ? null
                : _info.GetOrMakeTranslationInfo(_type.DeclaringType);
            var ats = _type.GetCustomAttributes(false);
            _ignoreNamespace = ats.OfType<IgnoreNamespaceAttribute>().Any();

            #region ScriptName
            {
                if (_ignoreNamespace)
                    _scriptName = (PhpQualifiedName)PhpQualifiedName.SanitizePhpName(_type.Name); // only short name without namespace
                else if (_type.IsGenericType)
                    _scriptName = (PhpQualifiedName)DotNetNameToPhpName(_type.FullName ?? _type.Name); // beware of generic types
                else
                    _scriptName = (PhpQualifiedName)DotNetNameToPhpName(_type.FullName ?? _type.Name);

                var scriptNameAttribute = ats.OfType<ScriptNameAttribute>().FirstOrDefault();
                if (scriptNameAttribute != null)
                {
                    if (scriptNameAttribute.Name.StartsWith(PhpQualifiedName.TokenNsSeparator.ToString(CultureInfo.InvariantCulture)))
                        _scriptName = (PhpQualifiedName)scriptNameAttribute.Name;
                    else if (IgnoreNamespace)
                        _scriptName = (PhpQualifiedName)(PhpQualifiedName.TokenNsSeparator + scriptNameAttribute.Name);
                    else
                        _scriptName =
                            (PhpQualifiedName)
                                (DotNetNameToPhpName(_type.FullName) + PhpQualifiedName.TokenNsSeparator +
                                 scriptNameAttribute.Name);
                }
                if (declaringTypeTranslationInfo != null)
                    _scriptName = (PhpQualifiedName)(declaringTypeTranslationInfo.ScriptName + "__" + _type.Name); // parent clas followed by __ and short name
            }
            #endregion
            #region Module name
            {
                //if (declaringTypeTranslationInfo != null && declaringTypeTranslationInfo.ModuleName != null)
                _moduleName = new PhpCodeModuleName(_type, ati, declaringTypeTranslationInfo);
            }
            #endregion
            #region PageAttribute
            {
                var pageAttribute = ats.OfType<PageAttribute>().FirstOrDefault();
                _isPage = pageAttribute != null;
                _pageMethod = _isPage ? FindPhpMainMethod(_type) : null;
            }
            #endregion
            #region AsArrayAttribute
            {
                var asArrayAttribute = ats.OfType<AsArrayAttribute>().FirstOrDefault();
                _isArray = asArrayAttribute != null;
            }
            #endregion
            #region SkipAttribute
            {
                var skipAttribute = ats.OfType<SkipAttribute>().FirstOrDefault();
                if (skipAttribute != null)
                    _skip = true;
            }
            #endregion
            #region BuiltInAttribute
            {
                var builtInAttribute = ats.OfType<BuiltInAttribute>().FirstOrDefault();
                if (builtInAttribute != null)
                    _buildIn = true;
            }
            #endregion

            if (_skip && _buildIn)
                throw new Exception("Don't mix SkipAttribute and BuiltInAttribute for type " + _type.ExcName());
            if (_buildIn)
                _skip = true;
            if (_type.IsGenericParameter)
                _skip = true;
            if (_isArray)
                _skip = true;
        }
Beispiel #11
0
 public static bool IsEmpty(this PhpCodeModuleName phpCodeModuleName)
 {
     return(phpCodeModuleName == null || phpCodeModuleName.IsEmpty);
 }
Beispiel #12
0
        // Private Methods 

        /// <summary>
        /// Gets existing or creates code module for given name
        /// </summary>
        /// <param name="requiredModuleName"></param>
        /// <returns></returns>
        PhpCodeModule GetOrMakeModuleByName(PhpCodeModuleName requiredModuleName)
        {
            var mod = _modules.FirstOrDefault(i => i.Name == requiredModuleName);
            if (mod != null) return mod;
            mod = new PhpCodeModule(requiredModuleName);
            _modules.Add(mod);
            return mod;
        }
Beispiel #13
0
 private PhpCodeModule CurrentConfigModule()
 {
     var assemblyTranslationInfo = _info.GetOrMakeTranslationInfo(_info.CurrentAssembly);
     var phpCodeModuleName = new PhpCodeModuleName(assemblyTranslationInfo.ConfigModuleName, assemblyTranslationInfo);
     var phpModule = GetOrMakeModuleByName(phpCodeModuleName);
     return phpModule;
 }
Beispiel #14
0
        void AppendCodeReq(PhpCodeModuleName req, PhpCodeModule current)
        {
            if (req == current.Name)
                return;
            if (req.Name == PhpCodeModuleName.CS2PHP_CONFIG_MODULE_NAME)
            {
                var phpModule = CurrentConfigModule();
                req = phpModule.Name;
            }

            if (req.AssemblyInfo != null && !string.IsNullOrEmpty(req.AssemblyInfo.IncludePathConstOrVarName))
            {
                var isCurrentAssembly = _info.CurrentAssembly == req.AssemblyInfo.Assembly;
                if (!isCurrentAssembly)
                {
                    var tmp = req.AssemblyInfo.IncludePathConstOrVarName;
                    if (tmp.StartsWith("$"))
                        throw new NotSupportedException();
                    // leading slash is not necessary -> config is in global namespace
                    // but full name is a key in dictionary
                    var phpModule = CurrentConfigModule();
                    if (phpModule.DefinedConsts.All(i => i.Key != tmp))
                    {
                        KnownConstInfo value;
                        if (_info.KnownConstsValues.TryGetValue(tmp, out value))
                        {
                            if (!value.UseFixedValue)
                            {
                                var expression = PathUtil.MakePathValueRelatedToFile(value, _info);
                                phpModule.DefinedConsts.Add(new KeyValuePair<string, IPhpValue>(tmp, expression));
                            }
                            else
                                throw new NotImplementedException();
                        }
                        else
                        {
                            _info.Log(MessageLevels.Error,
                                string.Format("const {0} defined in {1} has no known value", tmp, phpModule.Name));
                            phpModule.DefinedConsts.Add(new KeyValuePair<string, IPhpValue>(tmp, new PhpConstValue("UNKNOWN")));
                        }
                    }
                }
            }

            var fileNameExpression = req.MakeIncludePath(current.Name);
            if (fileNameExpression == null) return;
            if (current.RequiredFiles.Any())
            {
                var s = new PhpEmitStyle();
                var code = fileNameExpression.GetPhpCode(s);
                var a = current.RequiredFiles.Select(i => i.GetPhpCode(s)).ToArray();
                if (a.Any(i => i == code))
                    return;
            }

            // if (fileNameExpression1 !=null)
            {
                var fileNameExpressionICodeRelated = fileNameExpression as ICodeRelated;
                // scan nested requests
                var nestedCodeRequests = fileNameExpressionICodeRelated.GetCodeRequests().ToArray();
                if (nestedCodeRequests.Any())
                {
                    var nestedModuleCodeRequests = nestedCodeRequests.OfType<ModuleCodeRequest>();
                    foreach (var nested in nestedModuleCodeRequests)
                        AppendCodeReq(nested.ModuleName, current);
                }
            }
            current.RequiredFiles.Add(fileNameExpression);
        }
Beispiel #15
0
        /*
        /// <summary>
        /// Tworzy instancję obiektu
        /// </summary>
        public PhpCodeModule()
        {
        }

        Przykłady użycia

        implement INotifyPropertyChanged
        implement INotifyPropertyChanged_Passive
        implement ToString ##Name## ##TopComments## ##TopCode## ##BottomCode## ##Classes## ##RequiredFiles## ##DefinedConsts##
        implement ToString Name=##Name##, TopComments=##TopComments##, TopCode=##TopCode##, BottomCode=##BottomCode##, Classes=##Classes##, RequiredFiles=##RequiredFiles##, DefinedConsts=##DefinedConsts##
        implement equals Name, TopComments, TopCode, BottomCode, Classes, RequiredFiles, DefinedConsts
        implement equals *
        implement equals *, ~exclude1, ~exclude2
        */
        #region Constructors
        /// <summary>
        /// Tworzy instancję obiektu
        /// <param name="name">nazwa pliku</param>
        /// </summary>
        public PhpCodeModule(PhpCodeModuleName name)
        {
            _name = name;
        }