public override string ToString() { string result = Value; if (AfterVar) { result = "var " + result; } if (GivenType != null) { result += GivenType.ToString(); } if (NextChild != null) { Type t = NextChild.GetType(); if (t != typeof(OperatorFragment)) { result += " "; } } return(result); }
public override string ToString() { string result = MethodName.ToString(); if (Brackets != null) { result += Brackets.ToString(); } if (GivenType != null) { result += GivenType.ToString(); } return(result); }
public override string ToString() { if (Bracket == StringReader.NULL) { return(base.ToString()); } string result = Bracket + base.ToString() + CloseBracket; if (GivenType != null) { result += GivenType.ToString(); } return(result); }
public override CompiledFragment Compile(CompiledMethod method) { if (!IsParent) { return(null); } CodeFragment child = FirstChild; while (child != null) { CodeFragment next = child.NextChild; CompiledFragment cfrag = child.Compile(method); if (cfrag != null) { cfrag.AddAfter(child); } child.Remove(); child = next; } if (GivenType != null) { Type toType = GivenType.FindType(method.Script); if (toType == null) { Error("Type not found: " + GivenType.ToString() + "."); } CompiledFragment compiledKid = (CompiledFragment)FirstChild; CompiledFragment result = Types.TryCast(method, compiledKid, toType); if (result == null) { Error("Cannot cast " + compiledKid.OutputType() + " to " + toType + "."); } return(result); } return((CompiledFragment)FirstChild); }
public override CompiledFragment Compile(CompiledMethod method) { if (!IsParent) { return(null); } CodeFragment child = FirstChild; while (child != null) { CodeFragment next = child.NextChild; CompiledFragment cfrag = child.Compile(method); if (cfrag != null) { cfrag.AddAfter(child); } child.Remove(); child = next; } // Is this a cast? if (GivenType != null) { // Get the type being cast to: Type toType = GivenType.FindType(method.Script); if (toType == null) { Error("Type to cast to was not found: " + GivenType.ToString() + "."); } // Get the object being cast: CompiledFragment compiledKid = (CompiledFragment)FirstChild; // Create a cast operation with it: return(new CastOperation(method, compiledKid, toType)); } return((CompiledFragment)FirstChild); }