public static void Parse(TheConstructor pConstructor, CodeBuilder pBuilder, FactoryExpressionCreator pCreator) {
			if (pConstructor.IsStaticConstructor) {
				pBuilder.Append("{");

			} else {
				pBuilder.AppendFormat("{4}{0}function {1}({2}){3} {{",
								ClassParser.IsMainClass ? "private " : As3Helpers.ConvertModifiers(pConstructor.Modifiers, _notValidConstructorMod),
								ClassParser.IsMainClass ? @"$ctor" : pConstructor.Name,
								As3Helpers.GetParameters(pConstructor.Arguments),
								ClassParser.IsMainClass ? ":void" : string.Empty,// pConstructor.MyClass.Name,
								pConstructor.OverridesBaseConstructor ? "override " : string.Empty
					);
			}

			pBuilder.AppendLine();

			if (pConstructor.HasBaseCall) {
				pBuilder.AppendFormat("\tsuper({0});", As3Helpers.GetCallingArguments(pConstructor.BaseArguments));
				pBuilder.AppendLine();
			}
		
			BlockParser.Parse(pConstructor.CodeBlock, pBuilder, pCreator);

			pBuilder.AppendLine("}");
			pBuilder.AppendLine();
		}
Exemple #2
0
        public static void Parse(TheConstructor pConstructor, CodeBuilder pBuilder, FactoryExpressionCreator pCreator)
        {
            if (pConstructor.IsStaticConstructor)
            {
                pBuilder.Append("{");
            }
            else
            {
                pBuilder.AppendFormat("{4}{0}function {1}({2}){3} {{",
                                      ClassParser.IsMainClass ? "private " : As3Helpers.ConvertModifiers(pConstructor.Modifiers, _notValidConstructorMod),
                                      ClassParser.IsMainClass ? @"$ctor" : pConstructor.Name,
                                      As3Helpers.GetParameters(pConstructor.Arguments),
                                      ClassParser.IsMainClass ? ":void" : string.Empty,                          // pConstructor.MyClass.Name,
                                      pConstructor.OverridesBaseConstructor ? "override " : string.Empty
                                      );
            }

            pBuilder.AppendLine();

            if (pConstructor.HasBaseCall)
            {
                pBuilder.AppendFormat("\tsuper({0});", As3Helpers.GetCallingArguments(pConstructor.BaseArguments));
                pBuilder.AppendLine();
            }

            BlockParser.Parse(pConstructor.CodeBlock, pBuilder, pCreator);

            pBuilder.AppendLine("}");
            pBuilder.AppendLine();
        }
Exemple #3
0
 private T GetT()
 {
     if (TheConstructor != null)
     {
         return((T)TheConstructor.Invoke(Param));
     }
     return(new T());
 }
Exemple #4
0
        private T GetT()
        {
            T x;

            if (TheConstructor != null)
            {
                x = (T)TheConstructor.Invoke(Param);
            }
            else
            {
                x = new T();
            }

            if (ObjectCreateRunTime != null)
            {
                x = ObjectCreateRunTime(x, this);
            }

            return(x);
        }