@@ -13,7 +13,7 @@ var one = zwitch('type')
1313var all = mapz ( one , { key : 'children' , indices : false } )
1414
1515var customProps = [
16- '__location ' ,
16+ 'sourceCodeLocation ' ,
1717 'childNodes' ,
1818 'content' ,
1919 'parentNode' ,
@@ -108,8 +108,8 @@ function doctype(node) {
108108 return wrap ( node , {
109109 nodeName : '#documentType' ,
110110 name : node . name ,
111- publicId : node . public || null ,
112- systemId : node . system || null
111+ publicId : node . public || '' ,
112+ systemId : node . system || ''
113113 } )
114114}
115115
@@ -129,12 +129,16 @@ function comment(node) {
129129
130130/* Patch position. */
131131function wrap ( node , ast , content ) {
132- if ( node . position && node . position . start && node . position . end ) {
133- ast . __location = {
134- line : node . position . start . line ,
135- col : node . position . start . column ,
136- startOffset : node . position . start . offset ,
137- endOffset : node . position . end . offset
132+ var position = node . position
133+
134+ if ( position && position . start && position . end ) {
135+ ast . sourceCodeLocation = {
136+ startLine : position . start . line ,
137+ startCol : position . start . column ,
138+ startOffset : position . start . offset ,
139+ endLine : position . end . line ,
140+ endCol : position . end . column ,
141+ endOffset : position . end . offset
138142 }
139143 }
140144
@@ -148,7 +152,7 @@ function wrap(node, ast, content) {
148152/* Patch a tree recursively, by adding namespaces
149153 * and parent references where needed. */
150154function patch ( node , parent , ns ) {
151- var location = node . __location
155+ var location = node . sourceCodeLocation
152156 var children = node . childNodes
153157 var name = node . tagName
154158 var replacement = { }
@@ -189,7 +193,7 @@ function patch(node, parent, ns) {
189193 }
190194
191195 if ( location ) {
192- replacement . __location = location
196+ replacement . sourceCodeLocation = location
193197 }
194198
195199 return replacement
0 commit comments