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(); }
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(); }
private T GetT() { if (TheConstructor != null) { return((T)TheConstructor.Invoke(Param)); } return(new T()); }
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); }