I changed the class to allow subclassing. I don’t think I messed anything up. I’m guessing XML(_children[i]) really was meant to be: (_children[i] as XML)...
Harbs > On Jun 26, 2022, at 6:09 PM, Harbs <harbs.li...@gmail.com> wrote: > > I just noticed that the changes to XML using XML.conversion broke my app. > > I have an optimization where I subclass XML and override toString and > toXMLString so there’s no need to create, parse and convert many parts of XML > which don’t need that. > > I call it StringXML. > > This code: > strArr.push(XML.conversion(this._children[i])._toXMLString(nextIndentLevel, > declarations.concat(ancestors))); > > causes my instance to go through XML.conversion and ends up with this: return > new XML(xml); where xml is a StringXML. > > That obviously does not work. > > What is the purpose of calling conversion on an XML node? > > That’s caused by > strArr.push(XML(_children[i])._toXMLString(nextIndentLevel,declarations.concat(ancestors))); > > The compiler changes XML to XML.conversion. > > I don’t understand why that change was made. > > The code originally looked like: > > strArr.push(_children[i].toXMLString(nextIndentLevel,ancestors.concat(declarations))); > > Greg, any input?