public string Compile(HaJSCompiler compiler, HaJSSwitchFeature feature, bool first) { if (defCase) { return("else"); } StringBuilder sb = new StringBuilder(); sb.Append(first ? "if (" : "else if ("); if (arbitrary) { sb.Append(ArbitraryJSTranslator.Translate(compiler, value.Replace("$x", feature.GetLeft(compiler)))); } else { string[] rvalues = value.Split(",".ToCharArray()); sb.Append(rvalues.Select(x => feature.Compile(compiler, x)).Aggregate((x, y) => x + " || " + y)); } sb.Append(")"); return(sb.ToString()); }
public SwitchElement(HaJSSwitchFeature type) { this.type = type; }