fbtest.js 111KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125
  1. var testFixture;
  2. var fbTestFixture = {
  3. 'XJS': {
  4. '<a />': {
  5. type: "ExpressionStatement",
  6. expression: {
  7. type: "XJSElement",
  8. openingElement: {
  9. type: "XJSOpeningElement",
  10. name: {
  11. type: "XJSIdentifier",
  12. name: "a",
  13. range: [1, 2],
  14. loc: {
  15. start: { line: 1, column: 1 },
  16. end: { line: 1, column: 2 }
  17. }
  18. },
  19. selfClosing: true,
  20. attributes: [],
  21. range: [0, 5],
  22. loc: {
  23. start: { line: 1, column: 0 },
  24. end: { line: 1, column: 5 }
  25. }
  26. },
  27. children: [],
  28. range: [0, 5],
  29. loc: {
  30. start: { line: 1, column: 0 },
  31. end: { line: 1, column: 5 }
  32. }
  33. },
  34. range: [0, 5],
  35. loc: {
  36. start: { line: 1, column: 0 },
  37. end: { line: 1, column: 5 }
  38. }
  39. },
  40. '<n:a n:v />': {
  41. type: "ExpressionStatement",
  42. expression: {
  43. type: "XJSElement",
  44. openingElement: {
  45. type: "XJSOpeningElement",
  46. name: {
  47. type: "XJSIdentifier",
  48. name: "a",
  49. namespace: "n",
  50. range: [1, 4],
  51. loc: {
  52. start: { line: 1, column: 1 },
  53. end: { line: 1, column: 4 }
  54. }
  55. },
  56. selfClosing: true,
  57. attributes: [
  58. {
  59. type: "XJSAttribute",
  60. name: {
  61. type: "XJSIdentifier",
  62. name: "v",
  63. namespace: "n",
  64. range: [5, 8],
  65. loc: {
  66. start: { line: 1, column: 5 },
  67. end: { line: 1, column: 8 }
  68. }
  69. },
  70. range: [5, 8],
  71. loc: {
  72. start: { line: 1, column: 5 },
  73. end: { line: 1, column: 8 }
  74. }
  75. }
  76. ],
  77. range: [0, 11],
  78. loc: {
  79. start: { line: 1, column: 0 },
  80. end: { line: 1, column: 11 }
  81. }
  82. },
  83. children: [],
  84. range: [0, 11],
  85. loc: {
  86. start: { line: 1, column: 0 },
  87. end: { line: 1, column: 11 }
  88. }
  89. },
  90. range: [0, 11],
  91. loc: {
  92. start: { line: 1, column: 0 },
  93. end: { line: 1, column: 11 }
  94. }
  95. },
  96. '<a n:foo="bar"> {value} <b><c /></b></a>': {
  97. type: "ExpressionStatement",
  98. expression: {
  99. type: "XJSElement",
  100. openingElement: {
  101. type: "XJSOpeningElement",
  102. name: {
  103. type: "XJSIdentifier",
  104. name: "a",
  105. range: [1, 2],
  106. loc: {
  107. start: { line: 1, column: 1 },
  108. end: { line: 1, column: 2 }
  109. }
  110. },
  111. selfClosing: false,
  112. attributes: [
  113. {
  114. type: "XJSAttribute",
  115. name: {
  116. type: "XJSIdentifier",
  117. name: "foo",
  118. namespace: "n",
  119. range: [3, 8],
  120. loc: {
  121. start: { line: 1, column: 3 },
  122. end: { line: 1, column: 8 }
  123. }
  124. },
  125. value: {
  126. type: "Literal",
  127. value: "bar",
  128. raw: "\"bar\"",
  129. range: [9, 14],
  130. loc: {
  131. start: { line: 1, column: 9 },
  132. end: { line: 1, column: 14 }
  133. }
  134. },
  135. range: [3, 14],
  136. loc: {
  137. start: { line: 1, column: 3 },
  138. end: { line: 1, column: 14 }
  139. }
  140. }
  141. ],
  142. range: [0, 15],
  143. loc: {
  144. start: { line: 1, column: 0 },
  145. end: { line: 1, column: 15 }
  146. }
  147. },
  148. closingElement: {
  149. type: "XJSClosingElement",
  150. name: {
  151. type: "XJSIdentifier",
  152. name: "a",
  153. range: [38, 39],
  154. loc: {
  155. start: { line: 1, column: 38 },
  156. end: { line: 1, column: 39 }
  157. }
  158. },
  159. range: [36, 40],
  160. loc: {
  161. start: { line: 1, column: 36 },
  162. end: { line: 1, column: 40 }
  163. }
  164. },
  165. children: [
  166. {
  167. type: "Literal",
  168. value: " ",
  169. raw: " ",
  170. range: [15, 16],
  171. loc: {
  172. start: { line: 1, column: 15 },
  173. end: { line: 1, column: 16 }
  174. }
  175. },
  176. {
  177. type: "XJSExpressionContainer",
  178. expression: {
  179. type: "Identifier",
  180. name: "value",
  181. range: [17, 22],
  182. loc: {
  183. start: { line: 1, column: 17 },
  184. end: { line: 1, column: 22 }
  185. }
  186. },
  187. range: [16, 23],
  188. loc: {
  189. start: { line: 1, column: 16 },
  190. end: { line: 1, column: 23 }
  191. }
  192. },
  193. {
  194. type: "Literal",
  195. value: " ",
  196. raw: " ",
  197. range: [23, 24],
  198. loc: {
  199. start: { line: 1, column: 23 },
  200. end: { line: 1, column: 24 }
  201. }
  202. },
  203. {
  204. type: "XJSElement",
  205. openingElement: {
  206. type: "XJSOpeningElement",
  207. name: {
  208. type: "XJSIdentifier",
  209. name: "b",
  210. range: [25, 26],
  211. loc: {
  212. start: { line: 1, column: 25 },
  213. end: { line: 1, column: 26 }
  214. }
  215. },
  216. selfClosing: false,
  217. attributes: [],
  218. range: [24, 27],
  219. loc: {
  220. start: { line: 1, column: 24 },
  221. end: { line: 1, column: 27 }
  222. }
  223. },
  224. closingElement: {
  225. type: "XJSClosingElement",
  226. name: {
  227. type: "XJSIdentifier",
  228. name: "b",
  229. range: [34, 35],
  230. loc: {
  231. start: { line: 1, column: 34 },
  232. end: { line: 1, column: 35 }
  233. }
  234. },
  235. range: [32, 36],
  236. loc: {
  237. start: { line: 1, column: 32 },
  238. end: { line: 1, column: 36 }
  239. }
  240. },
  241. children: [
  242. {
  243. type: "XJSElement",
  244. openingElement: {
  245. type: "XJSOpeningElement",
  246. name: {
  247. type: "XJSIdentifier",
  248. name: "c",
  249. range: [28, 29],
  250. loc: {
  251. start: { line: 1, column: 28 },
  252. end: { line: 1, column: 29 }
  253. }
  254. },
  255. selfClosing: true,
  256. attributes: [],
  257. range: [27, 32],
  258. loc: {
  259. start: { line: 1, column: 27 },
  260. end: { line: 1, column: 32 }
  261. }
  262. },
  263. children: [],
  264. range: [27, 32],
  265. loc: {
  266. start: { line: 1, column: 27 },
  267. end: { line: 1, column: 32 }
  268. }
  269. }
  270. ],
  271. range: [24, 36],
  272. loc: {
  273. start: { line: 1, column: 24 },
  274. end: { line: 1, column: 36 }
  275. }
  276. }
  277. ],
  278. range: [0, 40],
  279. loc: {
  280. start: { line: 1, column: 0 },
  281. end: { line: 1, column: 40 }
  282. }
  283. },
  284. range: [0, 40],
  285. loc: {
  286. start: { line: 1, column: 0 },
  287. end: { line: 1, column: 40 }
  288. }
  289. },
  290. '<a b={" "} c=" " d="&amp;" />': {
  291. type: "ExpressionStatement",
  292. expression: {
  293. type: "XJSElement",
  294. openingElement: {
  295. type: "XJSOpeningElement",
  296. name: {
  297. type: "XJSIdentifier",
  298. name: "a",
  299. range: [1, 2],
  300. loc: {
  301. start: { line: 1, column: 1 },
  302. end: { line: 1, column: 2 }
  303. }
  304. },
  305. selfClosing: true,
  306. attributes: [
  307. {
  308. type: "XJSAttribute",
  309. name: {
  310. type: "XJSIdentifier",
  311. name: "b",
  312. range: [3, 4],
  313. loc: {
  314. start: { line: 1, column: 3 },
  315. end: { line: 1, column: 4 }
  316. }
  317. },
  318. value: {
  319. type: "XJSExpressionContainer",
  320. expression: {
  321. type: "Literal",
  322. value: " ",
  323. raw: "\" \"",
  324. range: [6, 9],
  325. loc: {
  326. start: { line: 1, column: 6 },
  327. end: { line: 1, column: 9 }
  328. }
  329. },
  330. range: [5, 10],
  331. loc: {
  332. start: { line: 1, column: 5 },
  333. end: { line: 1, column: 10 }
  334. }
  335. },
  336. range: [3, 10],
  337. loc: {
  338. start: { line: 1, column: 3 },
  339. end: { line: 1, column: 10 }
  340. }
  341. },
  342. {
  343. type: "XJSAttribute",
  344. name: {
  345. type: "XJSIdentifier",
  346. name: "c",
  347. range: [11, 12],
  348. loc: {
  349. start: { line: 1, column: 11 },
  350. end: { line: 1, column: 12 }
  351. }
  352. },
  353. value: {
  354. type: "Literal",
  355. value: " ",
  356. raw: "\" \"",
  357. range: [13, 16],
  358. loc: {
  359. start: { line: 1, column: 13 },
  360. end: { line: 1, column: 16 }
  361. }
  362. },
  363. range: [11, 16],
  364. loc: {
  365. start: { line: 1, column: 11 },
  366. end: { line: 1, column: 16 }
  367. }
  368. },
  369. {
  370. type: "XJSAttribute",
  371. name: {
  372. type: "XJSIdentifier",
  373. name: "d",
  374. range: [17, 18],
  375. loc: {
  376. start: { line: 1, column: 17 },
  377. end: { line: 1, column: 18 }
  378. }
  379. },
  380. value: {
  381. type: "Literal",
  382. value: "&",
  383. raw: "\"&amp;\"",
  384. range: [19, 26],
  385. loc: {
  386. start: { line: 1, column: 19 },
  387. end: { line: 1, column: 26 }
  388. }
  389. },
  390. range: [17, 26],
  391. loc: {
  392. start: { line: 1, column: 17 },
  393. end: { line: 1, column: 26 }
  394. }
  395. }
  396. ],
  397. range: [0, 29],
  398. loc: {
  399. start: { line: 1, column: 0 },
  400. end: { line: 1, column: 29 }
  401. }
  402. },
  403. children: [],
  404. range: [0, 29],
  405. loc: {
  406. start: { line: 1, column: 0 },
  407. end: { line: 1, column: 29 }
  408. }
  409. },
  410. range: [0, 29],
  411. loc: {
  412. start: { line: 1, column: 0 },
  413. end: { line: 1, column: 29 }
  414. }
  415. },
  416. '<a\n/>': {
  417. type: "ExpressionStatement",
  418. expression: {
  419. type: "XJSElement",
  420. openingElement: {
  421. type: "XJSOpeningElement",
  422. name: {
  423. type: "XJSIdentifier",
  424. name: "a",
  425. range: [
  426. 1,
  427. 2
  428. ],
  429. loc: {
  430. start: {
  431. line: 1,
  432. column: 1
  433. },
  434. end: {
  435. line: 1,
  436. column: 2
  437. }
  438. }
  439. },
  440. selfClosing: true,
  441. attributes: [],
  442. range: [
  443. 0,
  444. 5
  445. ],
  446. loc: {
  447. start: {
  448. line: 1,
  449. column: 0
  450. },
  451. end: {
  452. line: 2,
  453. column: 2
  454. }
  455. }
  456. },
  457. children: [],
  458. range: [
  459. 0,
  460. 5
  461. ],
  462. loc: {
  463. start: {
  464. line: 1,
  465. column: 0
  466. },
  467. end: {
  468. line: 2,
  469. column: 2
  470. }
  471. }
  472. },
  473. range: [
  474. 0,
  475. 5
  476. ],
  477. loc: {
  478. start: {
  479. line: 1,
  480. column: 0
  481. },
  482. end: {
  483. line: 2,
  484. column: 2
  485. }
  486. }
  487. },
  488. '<日本語></日本語>': {
  489. type: "ExpressionStatement",
  490. expression: {
  491. type: "XJSElement",
  492. openingElement: {
  493. type: "XJSOpeningElement",
  494. name: {
  495. type: "XJSIdentifier",
  496. name: "日本語",
  497. range: [
  498. 1,
  499. 4
  500. ],
  501. loc: {
  502. start: {
  503. line: 1,
  504. column: 1
  505. },
  506. end: {
  507. line: 1,
  508. column: 4
  509. }
  510. }
  511. },
  512. selfClosing: false,
  513. attributes: [],
  514. range: [
  515. 0,
  516. 5
  517. ],
  518. loc: {
  519. start: {
  520. line: 1,
  521. column: 0
  522. },
  523. end: {
  524. line: 1,
  525. column: 5
  526. }
  527. }
  528. },
  529. closingElement: {
  530. type: "XJSClosingElement",
  531. name: {
  532. type: "XJSIdentifier",
  533. name: "日本語",
  534. range: [
  535. 7,
  536. 10
  537. ],
  538. loc: {
  539. start: {
  540. line: 1,
  541. column: 7
  542. },
  543. end: {
  544. line: 1,
  545. column: 10
  546. }
  547. }
  548. },
  549. range: [
  550. 5,
  551. 11
  552. ],
  553. loc: {
  554. start: {
  555. line: 1,
  556. column: 5
  557. },
  558. end: {
  559. line: 1,
  560. column: 11
  561. }
  562. }
  563. },
  564. children: [],
  565. range: [
  566. 0,
  567. 11
  568. ],
  569. loc: {
  570. start: {
  571. line: 1,
  572. column: 0
  573. },
  574. end: {
  575. line: 1,
  576. column: 11
  577. }
  578. }
  579. },
  580. range: [
  581. 0,
  582. 11
  583. ],
  584. loc: {
  585. start: {
  586. line: 1,
  587. column: 0
  588. },
  589. end: {
  590. line: 1,
  591. column: 11
  592. }
  593. }
  594. },
  595. '<AbC-def\n test="&#x0026;&#38;">\nbar\nbaz\n</AbC-def>': {
  596. type: "ExpressionStatement",
  597. expression: {
  598. type: "XJSElement",
  599. openingElement: {
  600. type: "XJSOpeningElement",
  601. name: {
  602. type: "XJSIdentifier",
  603. name: "AbC-def",
  604. range: [
  605. 1,
  606. 8
  607. ],
  608. loc: {
  609. start: {
  610. line: 1,
  611. column: 1
  612. },
  613. end: {
  614. line: 1,
  615. column: 8
  616. }
  617. }
  618. },
  619. selfClosing: false,
  620. attributes: [
  621. {
  622. type: "XJSAttribute",
  623. name: {
  624. type: "XJSIdentifier",
  625. name: "test",
  626. range: [
  627. 11,
  628. 15
  629. ],
  630. loc: {
  631. start: {
  632. line: 2,
  633. column: 2
  634. },
  635. end: {
  636. line: 2,
  637. column: 6
  638. }
  639. }
  640. },
  641. value: {
  642. type: "Literal",
  643. value: "&&",
  644. raw: "\"&#x0026;&#38;\"",
  645. range: [
  646. 16,
  647. 31
  648. ],
  649. loc: {
  650. start: {
  651. line: 2,
  652. column: 7
  653. },
  654. end: {
  655. line: 2,
  656. column: 22
  657. }
  658. }
  659. },
  660. range: [
  661. 11,
  662. 31
  663. ],
  664. loc: {
  665. start: {
  666. line: 2,
  667. column: 2
  668. },
  669. end: {
  670. line: 2,
  671. column: 22
  672. }
  673. }
  674. }
  675. ],
  676. range: [
  677. 0,
  678. 32
  679. ],
  680. loc: {
  681. start: {
  682. line: 1,
  683. column: 0
  684. },
  685. end: {
  686. line: 2,
  687. column: 23
  688. }
  689. }
  690. },
  691. closingElement: {
  692. type: "XJSClosingElement",
  693. name: {
  694. type: "XJSIdentifier",
  695. name: "AbC-def",
  696. range: [
  697. 43,
  698. 50
  699. ],
  700. loc: {
  701. start: {
  702. line: 5,
  703. column: 2
  704. },
  705. end: {
  706. line: 5,
  707. column: 9
  708. }
  709. }
  710. },
  711. range: [
  712. 41,
  713. 51
  714. ],
  715. loc: {
  716. start: {
  717. line: 5,
  718. column: 0
  719. },
  720. end: {
  721. line: 5,
  722. column: 10
  723. }
  724. }
  725. },
  726. children: [
  727. {
  728. type: "Literal",
  729. value: "\nbar\nbaz\n",
  730. raw: "\nbar\nbaz\n",
  731. range: [
  732. 32,
  733. 41
  734. ],
  735. loc: {
  736. start: {
  737. line: 2,
  738. column: 23
  739. },
  740. end: {
  741. line: 5,
  742. column: 0
  743. }
  744. }
  745. }
  746. ],
  747. range: [
  748. 0,
  749. 51
  750. ],
  751. loc: {
  752. start: {
  753. line: 1,
  754. column: 0
  755. },
  756. end: {
  757. line: 5,
  758. column: 10
  759. }
  760. }
  761. },
  762. range: [
  763. 0,
  764. 51
  765. ],
  766. loc: {
  767. start: {
  768. line: 1,
  769. column: 0
  770. },
  771. end: {
  772. line: 5,
  773. column: 10
  774. }
  775. }
  776. },
  777. '<a b={x ? <c /> : <d />} />': {
  778. type: "ExpressionStatement",
  779. expression: {
  780. type: "XJSElement",
  781. openingElement: {
  782. type: "XJSOpeningElement",
  783. name: {
  784. type: "XJSIdentifier",
  785. name: "a",
  786. range: [
  787. 1,
  788. 2
  789. ],
  790. loc: {
  791. start: {
  792. line: 1,
  793. column: 1
  794. },
  795. end: {
  796. line: 1,
  797. column: 2
  798. }
  799. }
  800. },
  801. selfClosing: true,
  802. attributes: [
  803. {
  804. type: "XJSAttribute",
  805. name: {
  806. type: "XJSIdentifier",
  807. name: "b",
  808. range: [
  809. 3,
  810. 4
  811. ],
  812. loc: {
  813. start: {
  814. line: 1,
  815. column: 3
  816. },
  817. end: {
  818. line: 1,
  819. column: 4
  820. }
  821. }
  822. },
  823. value: {
  824. type: "XJSExpressionContainer",
  825. expression: {
  826. type: "ConditionalExpression",
  827. test: {
  828. type: "Identifier",
  829. name: "x",
  830. range: [
  831. 6,
  832. 7
  833. ],
  834. loc: {
  835. start: {
  836. line: 1,
  837. column: 6
  838. },
  839. end: {
  840. line: 1,
  841. column: 7
  842. }
  843. }
  844. },
  845. consequent: {
  846. type: "XJSElement",
  847. openingElement: {
  848. type: "XJSOpeningElement",
  849. name: {
  850. type: "XJSIdentifier",
  851. name: "c",
  852. range: [
  853. 11,
  854. 12
  855. ],
  856. loc: {
  857. start: {
  858. line: 1,
  859. column: 11
  860. },
  861. end: {
  862. line: 1,
  863. column: 12
  864. }
  865. }
  866. },
  867. selfClosing: true,
  868. attributes: [],
  869. range: [
  870. 10,
  871. 15
  872. ],
  873. loc: {
  874. start: {
  875. line: 1,
  876. column: 10
  877. },
  878. end: {
  879. line: 1,
  880. column: 15
  881. }
  882. }
  883. },
  884. children: [],
  885. range: [
  886. 10,
  887. 15
  888. ],
  889. loc: {
  890. start: {
  891. line: 1,
  892. column: 10
  893. },
  894. end: {
  895. line: 1,
  896. column: 15
  897. }
  898. }
  899. },
  900. alternate: {
  901. type: "XJSElement",
  902. openingElement: {
  903. type: "XJSOpeningElement",
  904. name: {
  905. type: "XJSIdentifier",
  906. name: "d",
  907. range: [
  908. 19,
  909. 20
  910. ],
  911. loc: {
  912. start: {
  913. line: 1,
  914. column: 19
  915. },
  916. end: {
  917. line: 1,
  918. column: 20
  919. }
  920. }
  921. },
  922. selfClosing: true,
  923. attributes: [],
  924. range: [
  925. 18,
  926. 23
  927. ],
  928. loc: {
  929. start: {
  930. line: 1,
  931. column: 18
  932. },
  933. end: {
  934. line: 1,
  935. column: 23
  936. }
  937. }
  938. },
  939. children: [],
  940. range: [
  941. 18,
  942. 23
  943. ],
  944. loc: {
  945. start: {
  946. line: 1,
  947. column: 18
  948. },
  949. end: {
  950. line: 1,
  951. column: 23
  952. }
  953. }
  954. },
  955. range: [
  956. 6,
  957. 23
  958. ],
  959. loc: {
  960. start: {
  961. line: 1,
  962. column: 6
  963. },
  964. end: {
  965. line: 1,
  966. column: 23
  967. }
  968. }
  969. },
  970. range: [
  971. 5,
  972. 24
  973. ],
  974. loc: {
  975. start: {
  976. line: 1,
  977. column: 5
  978. },
  979. end: {
  980. line: 1,
  981. column: 24
  982. }
  983. }
  984. },
  985. range: [
  986. 3,
  987. 24
  988. ],
  989. loc: {
  990. start: {
  991. line: 1,
  992. column: 3
  993. },
  994. end: {
  995. line: 1,
  996. column: 24
  997. }
  998. }
  999. }
  1000. ],
  1001. range: [
  1002. 0,
  1003. 27
  1004. ],
  1005. loc: {
  1006. start: {
  1007. line: 1,
  1008. column: 0
  1009. },
  1010. end: {
  1011. line: 1,
  1012. column: 27
  1013. }
  1014. }
  1015. },
  1016. children: [],
  1017. range: [
  1018. 0,
  1019. 27
  1020. ],
  1021. loc: {
  1022. start: {
  1023. line: 1,
  1024. column: 0
  1025. },
  1026. end: {
  1027. line: 1,
  1028. column: 27
  1029. }
  1030. }
  1031. },
  1032. range: [
  1033. 0,
  1034. 27
  1035. ],
  1036. loc: {
  1037. start: {
  1038. line: 1,
  1039. column: 0
  1040. },
  1041. end: {
  1042. line: 1,
  1043. column: 27
  1044. }
  1045. }
  1046. },
  1047. '<a>{}</a>': {
  1048. type: 'ExpressionStatement',
  1049. expression: {
  1050. type: 'XJSElement',
  1051. openingElement: {
  1052. type: 'XJSOpeningElement',
  1053. name: {
  1054. type: 'XJSIdentifier',
  1055. name: 'a',
  1056. range: [1, 2],
  1057. loc: {
  1058. start: { line: 1, column: 1 },
  1059. end: { line: 1, column: 2 }
  1060. }
  1061. },
  1062. selfClosing: false,
  1063. attributes: [],
  1064. range: [0, 3],
  1065. loc: {
  1066. start: { line: 1, column: 0 },
  1067. end: { line: 1, column: 3 }
  1068. }
  1069. },
  1070. closingElement: {
  1071. type: 'XJSClosingElement',
  1072. name: {
  1073. type: 'XJSIdentifier',
  1074. name: 'a',
  1075. range: [7, 8],
  1076. loc: {
  1077. start: { line: 1, column: 7 },
  1078. end: { line: 1, column: 8 }
  1079. }
  1080. },
  1081. range: [5, 9],
  1082. loc: {
  1083. start: { line: 1, column: 5 },
  1084. end: { line: 1, column: 9 }
  1085. }
  1086. },
  1087. children: [{
  1088. type: 'XJSExpressionContainer',
  1089. expression: {
  1090. type: 'XJSEmptyExpression',
  1091. range: [4, 4],
  1092. loc: {
  1093. start: { line: 1, column: 4 },
  1094. end: { line: 1, column: 4 }
  1095. }
  1096. },
  1097. range: [3, 5],
  1098. loc: {
  1099. start: { line: 1, column: 3 },
  1100. end: { line: 1, column: 5 }
  1101. }
  1102. }],
  1103. range: [0, 9],
  1104. loc: {
  1105. start: { line: 1, column: 0 },
  1106. end: { line: 1, column: 9 }
  1107. }
  1108. },
  1109. range: [0, 9],
  1110. loc: {
  1111. start: { line: 1, column: 0 },
  1112. end: { line: 1, column: 9 }
  1113. }
  1114. },
  1115. '<a>{/* this is a comment */}</a>': {
  1116. type: 'ExpressionStatement',
  1117. expression: {
  1118. type: 'XJSElement',
  1119. openingElement: {
  1120. type: 'XJSOpeningElement',
  1121. name: {
  1122. type: 'XJSIdentifier',
  1123. name: 'a',
  1124. range: [1, 2],
  1125. loc: {
  1126. start: { line: 1, column: 1 },
  1127. end: { line: 1, column: 2 }
  1128. }
  1129. },
  1130. selfClosing: false,
  1131. attributes: [],
  1132. range: [0, 3],
  1133. loc: {
  1134. start: { line: 1, column: 0 },
  1135. end: { line: 1, column: 3 }
  1136. }
  1137. },
  1138. closingElement: {
  1139. type: 'XJSClosingElement',
  1140. name: {
  1141. type: 'XJSIdentifier',
  1142. name: 'a',
  1143. range: [30, 31],
  1144. loc: {
  1145. start: { line: 1, column: 30 },
  1146. end: { line: 1, column: 31 }
  1147. }
  1148. },
  1149. range: [28, 32],
  1150. loc: {
  1151. start: { line: 1, column: 28 },
  1152. end: { line: 1, column: 32 }
  1153. }
  1154. },
  1155. children: [{
  1156. type: 'XJSExpressionContainer',
  1157. expression: {
  1158. type: 'XJSEmptyExpression',
  1159. range: [4, 27],
  1160. loc: {
  1161. start: { line: 1, column: 4 },
  1162. end: { line: 1, column: 27 }
  1163. }
  1164. },
  1165. range: [3, 28],
  1166. loc: {
  1167. start: { line: 1, column: 3 },
  1168. end: { line: 1, column: 28 }
  1169. }
  1170. }],
  1171. range: [0, 32],
  1172. loc: {
  1173. start: { line: 1, column: 0 },
  1174. end: { line: 1, column: 32 }
  1175. }
  1176. },
  1177. range: [0, 32],
  1178. loc: {
  1179. start: { line: 1, column: 0 },
  1180. end: { line: 1, column: 32 }
  1181. }
  1182. },
  1183. '<div>@test content</div>': {
  1184. type: 'ExpressionStatement',
  1185. expression: {
  1186. type: 'XJSElement',
  1187. openingElement: {
  1188. type: 'XJSOpeningElement',
  1189. name: {
  1190. type: 'XJSIdentifier',
  1191. name: 'div',
  1192. range: [1, 4],
  1193. loc: {
  1194. start: { line: 1, column: 1 },
  1195. end: { line: 1, column: 4 }
  1196. }
  1197. },
  1198. selfClosing: false,
  1199. attributes: [],
  1200. range: [0, 5],
  1201. loc: {
  1202. start: { line: 1, column: 0 },
  1203. end: { line: 1, column: 5 }
  1204. }
  1205. },
  1206. closingElement: {
  1207. type: 'XJSClosingElement',
  1208. name: {
  1209. type: 'XJSIdentifier',
  1210. name: 'div',
  1211. range: [20, 23],
  1212. loc: {
  1213. start: { line: 1, column: 20 },
  1214. end: { line: 1, column: 23 }
  1215. }
  1216. },
  1217. range: [18, 24],
  1218. loc: {
  1219. start: { line: 1, column: 18 },
  1220. end: { line: 1, column: 24 }
  1221. }
  1222. },
  1223. children: [{
  1224. type: 'Literal',
  1225. value: '@test content',
  1226. raw: '@test content',
  1227. range: [5, 18],
  1228. loc: {
  1229. start: { line: 1, column: 5 },
  1230. end: { line: 1, column: 18 }
  1231. }
  1232. }],
  1233. range: [0, 24],
  1234. loc: {
  1235. start: { line: 1, column: 0 },
  1236. end: { line: 1, column: 24 }
  1237. }
  1238. },
  1239. range: [0, 24],
  1240. loc: {
  1241. start: { line: 1, column: 0 },
  1242. end: { line: 1, column: 24 }
  1243. }
  1244. },
  1245. '<div><br />7x invalid-js-identifier</div>': {
  1246. type: 'ExpressionStatement',
  1247. expression: {
  1248. type: 'XJSElement',
  1249. openingElement: {
  1250. type: 'XJSOpeningElement',
  1251. name: {
  1252. type: 'XJSIdentifier',
  1253. name: 'div',
  1254. range: [
  1255. 1,
  1256. 4
  1257. ],
  1258. loc: {
  1259. start: {
  1260. line: 1,
  1261. column: 1
  1262. },
  1263. end: {
  1264. line: 1,
  1265. column: 4
  1266. }
  1267. }
  1268. },
  1269. selfClosing: false,
  1270. attributes: [],
  1271. range: [
  1272. 0,
  1273. 5
  1274. ],
  1275. loc: {
  1276. start: {
  1277. line: 1,
  1278. column: 0
  1279. },
  1280. end: {
  1281. line: 1,
  1282. column: 5
  1283. }
  1284. }
  1285. },
  1286. closingElement: {
  1287. type: 'XJSClosingElement',
  1288. name: {
  1289. type: 'XJSIdentifier',
  1290. name: 'div',
  1291. range: [
  1292. 37,
  1293. 40
  1294. ],
  1295. loc: {
  1296. start: {
  1297. line: 1,
  1298. column: 37
  1299. },
  1300. end: {
  1301. line: 1,
  1302. column: 40
  1303. }
  1304. }
  1305. },
  1306. range: [
  1307. 35,
  1308. 41
  1309. ],
  1310. loc: {
  1311. start: {
  1312. line: 1,
  1313. column: 35
  1314. },
  1315. end: {
  1316. line: 1,
  1317. column: 41
  1318. }
  1319. }
  1320. },
  1321. children: [{
  1322. type: 'XJSElement',
  1323. openingElement: {
  1324. type: 'XJSOpeningElement',
  1325. name: {
  1326. type: 'XJSIdentifier',
  1327. name: 'br',
  1328. range: [
  1329. 6,
  1330. 8
  1331. ],
  1332. loc: {
  1333. start: {
  1334. line: 1,
  1335. column: 6
  1336. },
  1337. end: {
  1338. line: 1,
  1339. column: 8
  1340. }
  1341. }
  1342. },
  1343. selfClosing: true,
  1344. attributes: [],
  1345. range: [
  1346. 5,
  1347. 11
  1348. ],
  1349. loc: {
  1350. start: {
  1351. line: 1,
  1352. column: 5
  1353. },
  1354. end: {
  1355. line: 1,
  1356. column: 11
  1357. }
  1358. }
  1359. },
  1360. children: [],
  1361. range: [
  1362. 5,
  1363. 11
  1364. ],
  1365. loc: {
  1366. start: {
  1367. line: 1,
  1368. column: 5
  1369. },
  1370. end: {
  1371. line: 1,
  1372. column: 11
  1373. }
  1374. }
  1375. }, {
  1376. type: 'Literal',
  1377. value: '7x invalid-js-identifier',
  1378. raw: '7x invalid-js-identifier',
  1379. range: [
  1380. 11,
  1381. 35
  1382. ],
  1383. loc: {
  1384. start: {
  1385. line: 1,
  1386. column: 11
  1387. },
  1388. end: {
  1389. line: 1,
  1390. column: 35
  1391. }
  1392. }
  1393. }],
  1394. range: [
  1395. 0,
  1396. 41
  1397. ],
  1398. loc: {
  1399. start: {
  1400. line: 1,
  1401. column: 0
  1402. },
  1403. end: {
  1404. line: 1,
  1405. column: 41
  1406. }
  1407. }
  1408. },
  1409. range: [
  1410. 0,
  1411. 41
  1412. ],
  1413. loc: {
  1414. start: {
  1415. line: 1,
  1416. column: 0
  1417. },
  1418. end: {
  1419. line: 1,
  1420. column: 41
  1421. }
  1422. }
  1423. },
  1424. '<LeftRight left=<a /> right=<b>monkeys /> gorillas</b> />': {
  1425. "type": "ExpressionStatement",
  1426. "expression": {
  1427. "type": "XJSElement",
  1428. "openingElement": {
  1429. "type": "XJSOpeningElement",
  1430. "name": {
  1431. "type": "XJSIdentifier",
  1432. "name": "LeftRight",
  1433. "range": [
  1434. 1,
  1435. 10
  1436. ],
  1437. "loc": {
  1438. "start": {
  1439. "line": 1,
  1440. "column": 1
  1441. },
  1442. "end": {
  1443. "line": 1,
  1444. "column": 10
  1445. }
  1446. }
  1447. },
  1448. "selfClosing": true,
  1449. "attributes": [
  1450. {
  1451. "type": "XJSAttribute",
  1452. "name": {
  1453. "type": "XJSIdentifier",
  1454. "name": "left",
  1455. "range": [
  1456. 11,
  1457. 15
  1458. ],
  1459. "loc": {
  1460. "start": {
  1461. "line": 1,
  1462. "column": 11
  1463. },
  1464. "end": {
  1465. "line": 1,
  1466. "column": 15
  1467. }
  1468. }
  1469. },
  1470. "value": {
  1471. "type": "XJSElement",
  1472. "openingElement": {
  1473. "type": "XJSOpeningElement",
  1474. "name": {
  1475. "type": "XJSIdentifier",
  1476. "name": "a",
  1477. "range": [
  1478. 17,
  1479. 18
  1480. ],
  1481. "loc": {
  1482. "start": {
  1483. "line": 1,
  1484. "column": 17
  1485. },
  1486. "end": {
  1487. "line": 1,
  1488. "column": 18
  1489. }
  1490. }
  1491. },
  1492. "selfClosing": true,
  1493. "attributes": [],
  1494. "range": [
  1495. 16,
  1496. 21
  1497. ],
  1498. "loc": {
  1499. "start": {
  1500. "line": 1,
  1501. "column": 16
  1502. },
  1503. "end": {
  1504. "line": 1,
  1505. "column": 21
  1506. }
  1507. }
  1508. },
  1509. "children": [],
  1510. "range": [
  1511. 16,
  1512. 21
  1513. ],
  1514. "loc": {
  1515. "start": {
  1516. "line": 1,
  1517. "column": 16
  1518. },
  1519. "end": {
  1520. "line": 1,
  1521. "column": 21
  1522. }
  1523. }
  1524. },
  1525. "range": [
  1526. 11,
  1527. 21
  1528. ],
  1529. "loc": {
  1530. "start": {
  1531. "line": 1,
  1532. "column": 11
  1533. },
  1534. "end": {
  1535. "line": 1,
  1536. "column": 21
  1537. }
  1538. }
  1539. },
  1540. {
  1541. "type": "XJSAttribute",
  1542. "name": {
  1543. "type": "XJSIdentifier",
  1544. "name": "right",
  1545. "range": [
  1546. 22,
  1547. 27
  1548. ],
  1549. "loc": {
  1550. "start": {
  1551. "line": 1,
  1552. "column": 22
  1553. },
  1554. "end": {
  1555. "line": 1,
  1556. "column": 27
  1557. }
  1558. }
  1559. },
  1560. "value": {
  1561. "type": "XJSElement",
  1562. "openingElement": {
  1563. "type": "XJSOpeningElement",
  1564. "name": {
  1565. "type": "XJSIdentifier",
  1566. "name": "b",
  1567. "range": [
  1568. 29,
  1569. 30
  1570. ],
  1571. "loc": {
  1572. "start": {
  1573. "line": 1,
  1574. "column": 29
  1575. },
  1576. "end": {
  1577. "line": 1,
  1578. "column": 30
  1579. }
  1580. }
  1581. },
  1582. "selfClosing": false,
  1583. "attributes": [],
  1584. "range": [
  1585. 28,
  1586. 31
  1587. ],
  1588. "loc": {
  1589. "start": {
  1590. "line": 1,
  1591. "column": 28
  1592. },
  1593. "end": {
  1594. "line": 1,
  1595. "column": 31
  1596. }
  1597. }
  1598. },
  1599. "closingElement": {
  1600. "type": "XJSClosingElement",
  1601. "name": {
  1602. "type": "XJSIdentifier",
  1603. "name": "b",
  1604. "range": [
  1605. 52,
  1606. 53
  1607. ],
  1608. "loc": {
  1609. "start": {
  1610. "line": 1,
  1611. "column": 52
  1612. },
  1613. "end": {
  1614. "line": 1,
  1615. "column": 53
  1616. }
  1617. }
  1618. },
  1619. "range": [
  1620. 50,
  1621. 54
  1622. ],
  1623. "loc": {
  1624. "start": {
  1625. "line": 1,
  1626. "column": 50
  1627. },
  1628. "end": {
  1629. "line": 1,
  1630. "column": 54
  1631. }
  1632. }
  1633. },
  1634. "children": [
  1635. {
  1636. "type": "Literal",
  1637. "value": "monkeys /> gorillas",
  1638. "raw": "monkeys /> gorillas",
  1639. "range": [
  1640. 31,
  1641. 50
  1642. ],
  1643. "loc": {
  1644. "start": {
  1645. "line": 1,
  1646. "column": 31
  1647. },
  1648. "end": {
  1649. "line": 1,
  1650. "column": 50
  1651. }
  1652. }
  1653. }
  1654. ],
  1655. "range": [
  1656. 28,
  1657. 54
  1658. ],
  1659. "loc": {
  1660. "start": {
  1661. "line": 1,
  1662. "column": 28
  1663. },
  1664. "end": {
  1665. "line": 1,
  1666. "column": 54
  1667. }
  1668. }
  1669. },
  1670. "range": [
  1671. 22,
  1672. 54
  1673. ],
  1674. "loc": {
  1675. "start": {
  1676. "line": 1,
  1677. "column": 22
  1678. },
  1679. "end": {
  1680. "line": 1,
  1681. "column": 54
  1682. }
  1683. }
  1684. }
  1685. ],
  1686. "range": [
  1687. 0,
  1688. 57
  1689. ],
  1690. "loc": {
  1691. "start": {
  1692. "line": 1,
  1693. "column": 0
  1694. },
  1695. "end": {
  1696. "line": 1,
  1697. "column": 57
  1698. }
  1699. }
  1700. },
  1701. "children": [],
  1702. "range": [
  1703. 0,
  1704. 57
  1705. ],
  1706. "loc": {
  1707. "start": {
  1708. "line": 1,
  1709. "column": 0
  1710. },
  1711. "end": {
  1712. "line": 1,
  1713. "column": 57
  1714. }
  1715. }
  1716. },
  1717. "range": [
  1718. 0,
  1719. 57
  1720. ],
  1721. "loc": {
  1722. "start": {
  1723. "line": 1,
  1724. "column": 0
  1725. },
  1726. "end": {
  1727. "line": 1,
  1728. "column": 57
  1729. }
  1730. }
  1731. }
  1732. },
  1733. 'Invalid XJS Syntax': {
  1734. '</>': {
  1735. index: 1,
  1736. lineNumber: 1,
  1737. column: 2,
  1738. message: 'Error: Line 1: Unexpected token /',
  1739. description: 'Unexpected token /'
  1740. },
  1741. '<a: />': {
  1742. index: 3,
  1743. lineNumber: 1,
  1744. column: 4,
  1745. message: 'Error: Line 1: XJS tag name can not be empty'
  1746. },
  1747. '<:a />': {
  1748. index: 1,
  1749. lineNumber: 1,
  1750. column: 2,
  1751. message: 'Error: Line 1: Unexpected token :',
  1752. description: 'Unexpected token :'
  1753. },
  1754. '<a b=d />': {
  1755. index: 5,
  1756. lineNumber: 1,
  1757. column: 6,
  1758. message: 'Error: Line 1: XJS value should be either an expression or a quoted XJS text'
  1759. },
  1760. '<a>': {
  1761. index: 3,
  1762. lineNumber: 1,
  1763. column: 4,
  1764. message: 'Error: Line 1: Unexpected end of input'
  1765. },
  1766. '<a></b>': {
  1767. index: 7,
  1768. lineNumber: 1,
  1769. column: 8,
  1770. message: 'Error: Line 1: Expected corresponding XJS closing tag for a'
  1771. },
  1772. '<a foo="bar': {
  1773. index: 11,
  1774. lineNumber: 1,
  1775. column: 12,
  1776. message: "Error: Line 1: Unexpected token ILLEGAL"
  1777. },
  1778. '<a:b></b>': {
  1779. index: 9,
  1780. lineNumber: 1,
  1781. column: 10,
  1782. message: "Error: Line 1: Expected corresponding XJS closing tag for a:b",
  1783. },
  1784. '<a><a />': {
  1785. index: 8,
  1786. lineNumber: 1,
  1787. column: 9,
  1788. message: 'Error: Line 1: Unexpected end of input'
  1789. },
  1790. '<a b={}>': {
  1791. index: 7,
  1792. lineNumber: 1,
  1793. column: 8,
  1794. message: 'Error: Line 1: XJS attributes must only be assigned a non-empty expression'
  1795. },
  1796. '<a>{"str";}</a>': {
  1797. index: 9,
  1798. lineNumber: 1,
  1799. column: 10,
  1800. message: 'Error: Line 1: Unexpected token ;',
  1801. description: 'Unexpected token ;'
  1802. },
  1803. '<span className="a", id="b" />': {
  1804. index: 19,
  1805. lineNumber: 1,
  1806. column: 20,
  1807. message: 'Error: Line 1: Unexpected token ,',
  1808. description: 'Unexpected token ,'
  1809. },
  1810. '<div className"app">': {
  1811. index: 14,
  1812. lineNumber: 1,
  1813. column: 15,
  1814. message: 'Error: Line 1: Unexpected string',
  1815. description: 'Unexpected string'
  1816. }
  1817. },
  1818. 'Type Annotations': {
  1819. 'function foo(numVal: number){}': {
  1820. type: 'FunctionDeclaration',
  1821. id: {
  1822. type: 'Identifier',
  1823. name: 'foo',
  1824. range: [9, 12],
  1825. loc: {
  1826. start: { line: 1, column: 9 },
  1827. end: { line: 1, column: 12 }
  1828. }
  1829. },
  1830. params: [{
  1831. type: 'TypeAnnotatedIdentifier',
  1832. id: {
  1833. type: 'Identifier',
  1834. name: 'numVal',
  1835. range: [13, 19],
  1836. loc: {
  1837. start: { line: 1, column: 13 },
  1838. end: { line: 1, column: 19 }
  1839. }
  1840. },
  1841. annotation: {
  1842. type: 'TypeAnnotation',
  1843. id: {
  1844. type: 'Identifier',
  1845. name: 'number',
  1846. range: [21, 27],
  1847. loc: {
  1848. start: { line: 1, column: 21 },
  1849. end: { line: 1, column: 27 }
  1850. }
  1851. },
  1852. paramTypes: null,
  1853. returnType: null,
  1854. nullable: false,
  1855. range: [19, 27],
  1856. loc: {
  1857. start: { line: 1, column: 19 },
  1858. end: { line: 1, column: 27 }
  1859. }
  1860. },
  1861. range: [13, 27],
  1862. loc: {
  1863. start: { line: 1, column: 13 },
  1864. end: { line: 1, column: 27 }
  1865. }
  1866. }],
  1867. defaults: [],
  1868. body: {
  1869. type: 'BlockStatement',
  1870. body: [],
  1871. range: [28, 30],
  1872. loc: {
  1873. start: { line: 1, column: 28 },
  1874. end: { line: 1, column: 30 }
  1875. }
  1876. },
  1877. rest: null,
  1878. generator: false,
  1879. expression: false,
  1880. range: [0, 30],
  1881. loc: {
  1882. start: { line: 1, column: 0 },
  1883. end: { line: 1, column: 30 }
  1884. }
  1885. },
  1886. 'function foo(numVal: number, strVal: string){}': {
  1887. type: 'FunctionDeclaration',
  1888. id: {
  1889. type: 'Identifier',
  1890. name: 'foo',
  1891. range: [9, 12],
  1892. loc: {
  1893. start: { line: 1, column: 9 },
  1894. end: { line: 1, column: 12 }
  1895. }
  1896. },
  1897. params: [{
  1898. type: 'TypeAnnotatedIdentifier',
  1899. id: {
  1900. type: 'Identifier',
  1901. name: 'numVal',
  1902. range: [13, 19],
  1903. loc: {
  1904. start: { line: 1, column: 13 },
  1905. end: { line: 1, column: 19 }
  1906. }
  1907. },
  1908. annotation: {
  1909. type: 'TypeAnnotation',
  1910. id: {
  1911. type: 'Identifier',
  1912. name: 'number',
  1913. range: [21, 27],
  1914. loc: {
  1915. start: { line: 1, column: 21 },
  1916. end: { line: 1, column: 27 }
  1917. }
  1918. },
  1919. paramTypes: null,
  1920. returnType: null,
  1921. nullable: false,
  1922. range: [19, 27],
  1923. loc: {
  1924. start: { line: 1, column: 19 },
  1925. end: { line: 1, column: 27 }
  1926. }
  1927. },
  1928. range: [13, 27],
  1929. loc: {
  1930. start: { line: 1, column: 13 },
  1931. end: { line: 1, column: 27 }
  1932. }
  1933. }, {
  1934. type: 'TypeAnnotatedIdentifier',
  1935. id: {
  1936. type: 'Identifier',
  1937. name: 'strVal',
  1938. range: [29, 35],
  1939. loc: {
  1940. start: { line: 1, column: 29 },
  1941. end: { line: 1, column: 35 }
  1942. }
  1943. },
  1944. annotation: {
  1945. type: 'TypeAnnotation',
  1946. id: {
  1947. type: 'Identifier',
  1948. name: 'string',
  1949. range: [37, 43],
  1950. loc: {
  1951. start: { line: 1, column: 37 },
  1952. end: { line: 1, column: 43 }
  1953. }
  1954. },
  1955. paramTypes: null,
  1956. returnType: null,
  1957. nullable: false,
  1958. range: [35, 43],
  1959. loc: {
  1960. start: { line: 1, column: 35 },
  1961. end: { line: 1, column: 43 }
  1962. }
  1963. },
  1964. range: [29, 43],
  1965. loc: {
  1966. start: { line: 1, column: 29 },
  1967. end: { line: 1, column: 43 }
  1968. }
  1969. }],
  1970. defaults: [],
  1971. body: {
  1972. type: 'BlockStatement',
  1973. body: [],
  1974. range: [44, 46],
  1975. loc: {
  1976. start: { line: 1, column: 44 },
  1977. end: { line: 1, column: 46 }
  1978. }
  1979. },
  1980. rest: null,
  1981. generator: false,
  1982. expression: false,
  1983. range: [0, 46],
  1984. loc: {
  1985. start: { line: 1, column: 0 },
  1986. end: { line: 1, column: 46 }
  1987. }
  1988. },
  1989. 'function foo(numVal: number, untypedVal){}': {
  1990. type: 'FunctionDeclaration',
  1991. id: {
  1992. type: 'Identifier',
  1993. name: 'foo',
  1994. range: [9, 12],
  1995. loc: {
  1996. start: { line: 1, column: 9 },
  1997. end: { line: 1, column: 12 }
  1998. }
  1999. },
  2000. params: [{
  2001. type: 'TypeAnnotatedIdentifier',
  2002. id: {
  2003. type: 'Identifier',
  2004. name: 'numVal',
  2005. range: [13, 19],
  2006. loc: {
  2007. start: { line: 1, column: 13 },
  2008. end: { line: 1, column: 19 }
  2009. }
  2010. },
  2011. annotation: {
  2012. type: 'TypeAnnotation',
  2013. id: {
  2014. type: 'Identifier',
  2015. name: 'number',
  2016. range: [21, 27],
  2017. loc: {
  2018. start: { line: 1, column: 21 },
  2019. end: { line: 1, column: 27 }
  2020. }
  2021. },
  2022. paramTypes: null,
  2023. returnType: null,
  2024. nullable: false,
  2025. range: [19, 27],
  2026. loc: {
  2027. start: { line: 1, column: 19 },
  2028. end: { line: 1, column: 27 }
  2029. }
  2030. },
  2031. range: [13, 27],
  2032. loc: {
  2033. start: { line: 1, column: 13 },
  2034. end: { line: 1, column: 27 }
  2035. }
  2036. }, {
  2037. type: 'Identifier',
  2038. name: 'untypedVal',
  2039. range: [29, 39],
  2040. loc: {
  2041. start: { line: 1, column: 29 },
  2042. end: { line: 1, column: 39 }
  2043. }
  2044. }],
  2045. defaults: [],
  2046. body: {
  2047. type: 'BlockStatement',
  2048. body: [],
  2049. range: [40, 42],
  2050. loc: {
  2051. start: { line: 1, column: 40 },
  2052. end: { line: 1, column: 42 }
  2053. }
  2054. },
  2055. rest: null,
  2056. generator: false,
  2057. expression: false,
  2058. range: [0, 42],
  2059. loc: {
  2060. start: { line: 1, column: 0 },
  2061. end: { line: 1, column: 42 }
  2062. }
  2063. },
  2064. 'function foo(untypedVal, numVal: number){}': {
  2065. type: 'FunctionDeclaration',
  2066. id: {
  2067. type: 'Identifier',
  2068. name: 'foo',
  2069. range: [9, 12],
  2070. loc: {
  2071. start: { line: 1, column: 9 },
  2072. end: { line: 1, column: 12 }
  2073. }
  2074. },
  2075. params: [{
  2076. type: 'Identifier',
  2077. name: 'untypedVal',
  2078. range: [13, 23],
  2079. loc: {
  2080. start: { line: 1, column: 13 },
  2081. end: { line: 1, column: 23 }
  2082. }
  2083. }, {
  2084. type: 'TypeAnnotatedIdentifier',
  2085. id: {
  2086. type: 'Identifier',
  2087. name: 'numVal',
  2088. range: [25, 31],
  2089. loc: {
  2090. start: { line: 1, column: 25 },
  2091. end: { line: 1, column: 31 }
  2092. }
  2093. },
  2094. annotation: {
  2095. type: 'TypeAnnotation',
  2096. id: {
  2097. type: 'Identifier',
  2098. name: 'number',
  2099. range: [33, 39],
  2100. loc: {
  2101. start: { line: 1, column: 33 },
  2102. end: { line: 1, column: 39 }
  2103. }
  2104. },
  2105. paramTypes: null,
  2106. returnType: null,
  2107. nullable: false,
  2108. range: [31, 39],
  2109. loc: {
  2110. start: { line: 1, column: 31 },
  2111. end: { line: 1, column: 39 }
  2112. }
  2113. },
  2114. range: [25, 39],
  2115. loc: {
  2116. start: { line: 1, column: 25 },
  2117. end: { line: 1, column: 39 }
  2118. }
  2119. }],
  2120. defaults: [],
  2121. body: {
  2122. type: 'BlockStatement',
  2123. body: [],
  2124. range: [40, 42],
  2125. loc: {
  2126. start: { line: 1, column: 40 },
  2127. end: { line: 1, column: 42 }
  2128. }
  2129. },
  2130. rest: null,
  2131. generator: false,
  2132. expression: false,
  2133. range: [0, 42],
  2134. loc: {
  2135. start: { line: 1, column: 0 },
  2136. end: { line: 1, column: 42 }
  2137. }
  2138. },
  2139. 'function foo(nullableNum: ?number){}': {
  2140. type: 'FunctionDeclaration',
  2141. id: {
  2142. type: 'Identifier',
  2143. name: 'foo',
  2144. range: [9, 12],
  2145. loc: {
  2146. start: { line: 1, column: 9 },
  2147. end: { line: 1, column: 12 }
  2148. }
  2149. },
  2150. params: [{
  2151. type: 'TypeAnnotatedIdentifier',
  2152. id: {
  2153. type: 'Identifier',
  2154. name: 'nullableNum',
  2155. range: [13, 24],
  2156. loc: {
  2157. start: { line: 1, column: 13 },
  2158. end: { line: 1, column: 24 }
  2159. }
  2160. },
  2161. annotation: {
  2162. type: 'TypeAnnotation',
  2163. id: {
  2164. type: 'Identifier',
  2165. name: 'number',
  2166. range: [27, 33],
  2167. loc: {
  2168. start: { line: 1, column: 27 },
  2169. end: { line: 1, column: 33 }
  2170. }
  2171. },
  2172. paramTypes: null,
  2173. returnType: null,
  2174. nullable: true,
  2175. range: [24, 33],
  2176. loc: {
  2177. start: { line: 1, column: 24 },
  2178. end: { line: 1, column: 33 }
  2179. }
  2180. },
  2181. range: [13, 33],
  2182. loc: {
  2183. start: { line: 1, column: 13 },
  2184. end: { line: 1, column: 33 }
  2185. }
  2186. }],
  2187. defaults: [],
  2188. body: {
  2189. type: 'BlockStatement',
  2190. body: [],
  2191. range: [34, 36],
  2192. loc: {
  2193. start: { line: 1, column: 34 },
  2194. end: { line: 1, column: 36 }
  2195. }
  2196. },
  2197. rest: null,
  2198. generator: false,
  2199. expression: false,
  2200. range: [0, 36],
  2201. loc: {
  2202. start: { line: 1, column: 0 },
  2203. end: { line: 1, column: 36 }
  2204. }
  2205. },
  2206. 'function foo(callback: () => void){}': {
  2207. type: 'FunctionDeclaration',
  2208. id: {
  2209. type: 'Identifier',
  2210. name: 'foo',
  2211. range: [9, 12],
  2212. loc: {
  2213. start: { line: 1, column: 9 },
  2214. end: { line: 1, column: 12 }
  2215. }
  2216. },
  2217. params: [{
  2218. type: 'TypeAnnotatedIdentifier',
  2219. id: {
  2220. type: 'Identifier',
  2221. name: 'callback',
  2222. range: [13, 21],
  2223. loc: {
  2224. start: { line: 1, column: 13 },
  2225. end: { line: 1, column: 21 }
  2226. }
  2227. },
  2228. annotation: {
  2229. type: 'TypeAnnotation',
  2230. id: null,
  2231. paramTypes: [],
  2232. returnType: null,
  2233. nullable: false,
  2234. range: [21, 33],
  2235. loc: {
  2236. start: { line: 1, column: 21 },
  2237. end: { line: 1, column: 33 }
  2238. }
  2239. },
  2240. range: [13, 33],
  2241. loc: {
  2242. start: { line: 1, column: 13 },
  2243. end: { line: 1, column: 33 }
  2244. }
  2245. }],
  2246. defaults: [],
  2247. body: {
  2248. type: 'BlockStatement',
  2249. body: [],
  2250. range: [34, 36],
  2251. loc: {
  2252. start: { line: 1, column: 34 },
  2253. end: { line: 1, column: 36 }
  2254. }
  2255. },
  2256. rest: null,
  2257. generator: false,
  2258. expression: false,
  2259. range: [0, 36],
  2260. loc: {
  2261. start: { line: 1, column: 0 },
  2262. end: { line: 1, column: 36 }
  2263. }
  2264. },
  2265. 'function foo(callback: () => number){}': {
  2266. type: 'FunctionDeclaration',
  2267. id: {
  2268. type: 'Identifier',
  2269. name: 'foo',
  2270. range: [9, 12],
  2271. loc: {
  2272. start: { line: 1, column: 9 },
  2273. end: { line: 1, column: 12 }
  2274. }
  2275. },
  2276. params: [{
  2277. type: 'TypeAnnotatedIdentifier',
  2278. id: {
  2279. type: 'Identifier',
  2280. name: 'callback',
  2281. range: [13, 21],
  2282. loc: {
  2283. start: { line: 1, column: 13 },
  2284. end: { line: 1, column: 21 }
  2285. }
  2286. },
  2287. annotation: {
  2288. type: 'TypeAnnotation',
  2289. id: null,
  2290. paramTypes: [],
  2291. returnType: {
  2292. type: 'TypeAnnotation',
  2293. id: {
  2294. type: 'Identifier',
  2295. name: 'number',
  2296. range: [29, 35],
  2297. loc: {
  2298. start: { line: 1, column: 29 },
  2299. end: { line: 1, column: 35 }
  2300. }
  2301. },
  2302. paramTypes: null,
  2303. returnType: null,
  2304. nullable: false,
  2305. range: [29, 35],
  2306. loc: {
  2307. start: { line: 1, column: 29 },
  2308. end: { line: 1, column: 35 }
  2309. }
  2310. },
  2311. nullable: false,
  2312. range: [21, 35],
  2313. loc: {
  2314. start: { line: 1, column: 21 },
  2315. end: { line: 1, column: 35 }
  2316. }
  2317. },
  2318. range: [13, 35],
  2319. loc: {
  2320. start: { line: 1, column: 13 },
  2321. end: { line: 1, column: 35 }
  2322. }
  2323. }],
  2324. defaults: [],
  2325. body: {
  2326. type: 'BlockStatement',
  2327. body: [],
  2328. range: [36, 38],
  2329. loc: {
  2330. start: { line: 1, column: 36 },
  2331. end: { line: 1, column: 38 }
  2332. }
  2333. },
  2334. rest: null,
  2335. generator: false,
  2336. expression: false,
  2337. range: [0, 38],
  2338. loc: {
  2339. start: { line: 1, column: 0 },
  2340. end: { line: 1, column: 38 }
  2341. }
  2342. },
  2343. 'function foo(callback: (bool) => number){}': {
  2344. type: 'FunctionDeclaration',
  2345. id: {
  2346. type: 'Identifier',
  2347. name: 'foo',
  2348. range: [9, 12],
  2349. loc: {
  2350. start: { line: 1, column: 9 },
  2351. end: { line: 1, column: 12 }
  2352. }
  2353. },
  2354. params: [{
  2355. type: 'TypeAnnotatedIdentifier',
  2356. id: {
  2357. type: 'Identifier',
  2358. name: 'callback',
  2359. range: [13, 21],
  2360. loc: {
  2361. start: { line: 1, column: 13 },
  2362. end: { line: 1, column: 21 }
  2363. }
  2364. },
  2365. annotation: {
  2366. type: 'TypeAnnotation',
  2367. id: null,
  2368. paramTypes: [{
  2369. type: 'TypeAnnotation',
  2370. id: {
  2371. type: 'Identifier',
  2372. name: 'bool',
  2373. range: [24, 28],
  2374. loc: {
  2375. start: { line: 1, column: 24 },
  2376. end: { line: 1, column: 28 }
  2377. }
  2378. },
  2379. paramTypes: null,
  2380. returnType: null,
  2381. nullable: false,
  2382. range: [24, 28],
  2383. loc: {
  2384. start: { line: 1, column: 24 },
  2385. end: { line: 1, column: 28 }
  2386. }
  2387. }],
  2388. returnType: {
  2389. type: 'TypeAnnotation',
  2390. id: {
  2391. type: 'Identifier',
  2392. name: 'number',
  2393. range: [33, 39],
  2394. loc: {
  2395. start: { line: 1, column: 33 },
  2396. end: { line: 1, column: 39 }
  2397. }
  2398. },
  2399. paramTypes: null,
  2400. returnType: null,
  2401. nullable: false,
  2402. range: [33, 39],
  2403. loc: {
  2404. start: { line: 1, column: 33 },
  2405. end: { line: 1, column: 39 }
  2406. }
  2407. },
  2408. nullable: false,
  2409. range: [21, 39],
  2410. loc: {
  2411. start: { line: 1, column: 21 },
  2412. end: { line: 1, column: 39 }
  2413. }
  2414. },
  2415. range: [13, 39],
  2416. loc: {
  2417. start: { line: 1, column: 13 },
  2418. end: { line: 1, column: 39 }
  2419. }
  2420. }],
  2421. defaults: [],
  2422. body: {
  2423. type: 'BlockStatement',
  2424. body: [],
  2425. range: [40, 42],
  2426. loc: {
  2427. start: { line: 1, column: 40 },
  2428. end: { line: 1, column: 42 }
  2429. }
  2430. },
  2431. rest: null,
  2432. generator: false,
  2433. expression: false,
  2434. range: [0, 42],
  2435. loc: {
  2436. start: { line: 1, column: 0 },
  2437. end: { line: 1, column: 42 }
  2438. }
  2439. },
  2440. 'function foo(callback: (bool, string) => number){}': {
  2441. type: 'FunctionDeclaration',
  2442. id: {
  2443. type: 'Identifier',
  2444. name: 'foo',
  2445. range: [9, 12],
  2446. loc: {
  2447. start: { line: 1, column: 9 },
  2448. end: { line: 1, column: 12 }
  2449. }
  2450. },
  2451. params: [{
  2452. type: 'TypeAnnotatedIdentifier',
  2453. id: {
  2454. type: 'Identifier',
  2455. name: 'callback',
  2456. range: [13, 21],
  2457. loc: {
  2458. start: { line: 1, column: 13 },
  2459. end: { line: 1, column: 21 }
  2460. }
  2461. },
  2462. annotation: {
  2463. type: 'TypeAnnotation',
  2464. id: null,
  2465. paramTypes: [{
  2466. type: 'TypeAnnotation',
  2467. id: {
  2468. type: 'Identifier',
  2469. name: 'bool',
  2470. range: [24, 28],
  2471. loc: {
  2472. start: { line: 1, column: 24 },
  2473. end: { line: 1, column: 28 }
  2474. }
  2475. },
  2476. paramTypes: null,
  2477. returnType: null,
  2478. nullable: false,
  2479. range: [24, 28],
  2480. loc: {
  2481. start: { line: 1, column: 24 },
  2482. end: { line: 1, column: 28 }
  2483. }
  2484. }, {
  2485. type: 'TypeAnnotation',
  2486. id: {
  2487. type: 'Identifier',
  2488. name: 'string',
  2489. range: [30, 36],
  2490. loc: {
  2491. start: { line: 1, column: 30 },
  2492. end: { line: 1, column: 36 }
  2493. }
  2494. },
  2495. paramTypes: null,
  2496. returnType: null,
  2497. nullable: false,
  2498. range: [30, 36],
  2499. loc: {
  2500. start: { line: 1, column: 30 },
  2501. end: { line: 1, column: 36 }
  2502. }
  2503. }],
  2504. returnType: {
  2505. type: 'TypeAnnotation',
  2506. id: {
  2507. type: 'Identifier',
  2508. name: 'number',
  2509. range: [41, 47],
  2510. loc: {
  2511. start: { line: 1, column: 41 },
  2512. end: { line: 1, column: 47 }
  2513. }
  2514. },
  2515. paramTypes: null,
  2516. returnType: null,
  2517. nullable: false,
  2518. range: [41, 47],
  2519. loc: {
  2520. start: { line: 1, column: 41 },
  2521. end: { line: 1, column: 47 }
  2522. }
  2523. },
  2524. nullable: false,
  2525. range: [21, 47],
  2526. loc: {
  2527. start: { line: 1, column: 21 },
  2528. end: { line: 1, column: 47 }
  2529. }
  2530. },
  2531. range: [13, 47],
  2532. loc: {
  2533. start: { line: 1, column: 13 },
  2534. end: { line: 1, column: 47 }
  2535. }
  2536. }],
  2537. defaults: [],
  2538. body: {
  2539. type: 'BlockStatement',
  2540. body: [],
  2541. range: [48, 50],
  2542. loc: {
  2543. start: { line: 1, column: 48 },
  2544. end: { line: 1, column: 50 }
  2545. }
  2546. },
  2547. rest: null,
  2548. generator: false,
  2549. expression: false,
  2550. range: [0, 50],
  2551. loc: {
  2552. start: { line: 1, column: 0 },
  2553. end: { line: 1, column: 50 }
  2554. }
  2555. },
  2556. 'function foo():number{}': {
  2557. type: 'FunctionDeclaration',
  2558. id: {
  2559. type: 'Identifier',
  2560. name: 'foo',
  2561. range: [9, 12],
  2562. loc: {
  2563. start: { line: 1, column: 9 },
  2564. end: { line: 1, column: 12 }
  2565. }
  2566. },
  2567. params: [],
  2568. defaults: [],
  2569. body: {
  2570. type: 'BlockStatement',
  2571. body: [],
  2572. range: [21, 23],
  2573. loc: {
  2574. start: { line: 1, column: 21 },
  2575. end: { line: 1, column: 23 }
  2576. }
  2577. },
  2578. rest: null,
  2579. generator: false,
  2580. expression: false,
  2581. returnType: {
  2582. type: 'TypeAnnotation',
  2583. id: {
  2584. type: 'Identifier',
  2585. name: 'number',
  2586. range: [15, 21],
  2587. loc: {
  2588. start: { line: 1, column: 15 },
  2589. end: { line: 1, column: 21 }
  2590. }
  2591. },
  2592. paramTypes: null,
  2593. returnType: null,
  2594. nullable: false,
  2595. range: [14, 21],
  2596. loc: {
  2597. start: { line: 1, column: 14 },
  2598. end: { line: 1, column: 21 }
  2599. }
  2600. },
  2601. range: [0, 23],
  2602. loc: {
  2603. start: { line: 1, column: 0 },
  2604. end: { line: 1, column: 23 }
  2605. }
  2606. },
  2607. 'function foo():() => void{}': {
  2608. type: 'FunctionDeclaration',
  2609. id: {
  2610. type: 'Identifier',
  2611. name: 'foo',
  2612. range: [9, 12],
  2613. loc: {
  2614. start: { line: 1, column: 9 },
  2615. end: { line: 1, column: 12 }
  2616. }
  2617. },
  2618. params: [],
  2619. defaults: [],
  2620. body: {
  2621. type: 'BlockStatement',
  2622. body: [],
  2623. range: [25, 27],
  2624. loc: {
  2625. start: { line: 1, column: 25 },
  2626. end: { line: 1, column: 27 }
  2627. }
  2628. },
  2629. rest: null,
  2630. generator: false,
  2631. expression: false,
  2632. returnType: {
  2633. type: 'TypeAnnotation',
  2634. id: null,
  2635. paramTypes: [],
  2636. returnType: null,
  2637. nullable: false,
  2638. range: [14, 25],
  2639. loc: {
  2640. start: { line: 1, column: 14 },
  2641. end: { line: 1, column: 25 }
  2642. }
  2643. },
  2644. range: [0, 27],
  2645. loc: {
  2646. start: { line: 1, column: 0 },
  2647. end: { line: 1, column: 27 }
  2648. }
  2649. },
  2650. 'function foo():(bool) => number{}': {
  2651. type: 'FunctionDeclaration',
  2652. id: {
  2653. type: 'Identifier',
  2654. name: 'foo',
  2655. range: [9, 12],
  2656. loc: {
  2657. start: { line: 1, column: 9 },
  2658. end: { line: 1, column: 12 }
  2659. }
  2660. },
  2661. params: [],
  2662. defaults: [],
  2663. body: {
  2664. type: 'BlockStatement',
  2665. body: [],
  2666. range: [31, 33],
  2667. loc: {
  2668. start: { line: 1, column: 31 },
  2669. end: { line: 1, column: 33 }
  2670. }
  2671. },
  2672. rest: null,
  2673. generator: false,
  2674. expression: false,
  2675. returnType: {
  2676. type: 'TypeAnnotation',
  2677. id: null,
  2678. paramTypes: [{
  2679. type: 'TypeAnnotation',
  2680. id: {
  2681. type: 'Identifier',
  2682. name: 'bool',
  2683. range: [16, 20],
  2684. loc: {
  2685. start: { line: 1, column: 16 },
  2686. end: { line: 1, column: 20 }
  2687. }
  2688. },
  2689. paramTypes: null,
  2690. returnType: null,
  2691. nullable: false,
  2692. range: [16, 20],
  2693. loc: {
  2694. start: { line: 1, column: 16 },
  2695. end: { line: 1, column: 20 }
  2696. }
  2697. }],
  2698. returnType: {
  2699. type: 'TypeAnnotation',
  2700. id: {
  2701. type: 'Identifier',
  2702. name: 'number',
  2703. range: [25, 31],
  2704. loc: {
  2705. start: { line: 1, column: 25 },
  2706. end: { line: 1, column: 31 }
  2707. }
  2708. },
  2709. paramTypes: null,
  2710. returnType: null,
  2711. nullable: false,
  2712. range: [25, 31],
  2713. loc: {
  2714. start: { line: 1, column: 25 },
  2715. end: { line: 1, column: 31 }
  2716. }
  2717. },
  2718. nullable: false,
  2719. range: [14, 31],
  2720. loc: {
  2721. start: { line: 1, column: 14 },
  2722. end: { line: 1, column: 31 }
  2723. }
  2724. },
  2725. range: [0, 33],
  2726. loc: {
  2727. start: { line: 1, column: 0 },
  2728. end: { line: 1, column: 33 }
  2729. }
  2730. },
  2731. 'a={set fooProp(value:number){}}': {
  2732. type: 'ExpressionStatement',
  2733. expression: {
  2734. type: 'AssignmentExpression',
  2735. operator: '=',
  2736. left: {
  2737. type: 'Identifier',
  2738. name: 'a',
  2739. range: [0, 1],
  2740. loc: {
  2741. start: { line: 1, column: 0 },
  2742. end: { line: 1, column: 1 }
  2743. }
  2744. },
  2745. right: {
  2746. type: 'ObjectExpression',
  2747. properties: [{
  2748. type: 'Property',
  2749. key: {
  2750. type: 'Identifier',
  2751. name: 'fooProp',
  2752. range: [7, 14],
  2753. loc: {
  2754. start: { line: 1, column: 7 },
  2755. end: { line: 1, column: 14 }
  2756. }
  2757. },
  2758. value: {
  2759. type: 'FunctionExpression',
  2760. id: null,
  2761. params: [{
  2762. type: 'TypeAnnotatedIdentifier',
  2763. id: {
  2764. type: 'Identifier',
  2765. name: 'value',
  2766. range: [15, 20],
  2767. loc: {
  2768. start: { line: 1, column: 15 },
  2769. end: { line: 1, column: 20 }
  2770. }
  2771. },
  2772. annotation: {
  2773. type: 'TypeAnnotation',
  2774. id: {
  2775. type: 'Identifier',
  2776. name: 'number',
  2777. range: [21, 27],
  2778. loc: {
  2779. start: { line: 1, column: 21 },
  2780. end: { line: 1, column: 27 }
  2781. }
  2782. },
  2783. paramTypes: null,
  2784. returnType: null,
  2785. nullable: false,
  2786. range: [20, 27],
  2787. loc: {
  2788. start: { line: 1, column: 20 },
  2789. end: { line: 1, column: 27 }
  2790. }
  2791. },
  2792. range: [15, 27],
  2793. loc: {
  2794. start: { line: 1, column: 15 },
  2795. end: { line: 1, column: 27 }
  2796. }
  2797. }],
  2798. defaults: [],
  2799. body: {
  2800. type: 'BlockStatement',
  2801. body: [],
  2802. range: [28, 30],
  2803. loc: {
  2804. start: { line: 1, column: 28 },
  2805. end: { line: 1, column: 30 }
  2806. }
  2807. },
  2808. rest: null,
  2809. generator: false,
  2810. expression: false,
  2811. range: [28, 30],
  2812. loc: {
  2813. start: { line: 1, column: 28 },
  2814. end: { line: 1, column: 30 }
  2815. }
  2816. },
  2817. kind: 'set',
  2818. method: false,
  2819. shorthand: false,
  2820. range: [3, 30],
  2821. loc: {
  2822. start: { line: 1, column: 3 },
  2823. end: { line: 1, column: 30 }
  2824. }
  2825. }],
  2826. range: [2, 31],
  2827. loc: {
  2828. start: { line: 1, column: 2 },
  2829. end: { line: 1, column: 31 }
  2830. }
  2831. },
  2832. range: [0, 31],
  2833. loc: {
  2834. start: { line: 1, column: 0 },
  2835. end: { line: 1, column: 31 }
  2836. }
  2837. },
  2838. range: [0, 31],
  2839. loc: {
  2840. start: { line: 1, column: 0 },
  2841. end: { line: 1, column: 31 }
  2842. }
  2843. },
  2844. 'class Foo {set fooProp(value:number){}}': {
  2845. type: 'ClassDeclaration',
  2846. id: {
  2847. type: 'Identifier',
  2848. name: 'Foo',
  2849. range: [6, 9],
  2850. loc: {
  2851. start: { line: 1, column: 6 },
  2852. end: { line: 1, column: 9 }
  2853. }
  2854. },
  2855. superClass: null,
  2856. body: {
  2857. type: 'ClassBody',
  2858. body: [{
  2859. type: 'MethodDefinition',
  2860. key: {
  2861. type: 'Identifier',
  2862. name: 'fooProp',
  2863. range: [15, 22],
  2864. loc: {
  2865. start: { line: 1, column: 15 },
  2866. end: { line: 1, column: 22 }
  2867. }
  2868. },
  2869. value: {
  2870. type: 'FunctionExpression',
  2871. id: null,
  2872. params: [{
  2873. type: 'TypeAnnotatedIdentifier',
  2874. id: {
  2875. type: 'Identifier',
  2876. name: 'value',
  2877. range: [23, 28],
  2878. loc: {
  2879. start: { line: 1, column: 23 },
  2880. end: { line: 1, column: 28 }
  2881. }
  2882. },
  2883. annotation: {
  2884. type: 'TypeAnnotation',
  2885. id: {
  2886. type: 'Identifier',
  2887. name: 'number',
  2888. range: [29, 35],
  2889. loc: {
  2890. start: { line: 1, column: 29 },
  2891. end: { line: 1, column: 35 }
  2892. }
  2893. },
  2894. paramTypes: null,
  2895. returnType: null,
  2896. nullable: false,
  2897. range: [28, 35],
  2898. loc: {
  2899. start: { line: 1, column: 28 },
  2900. end: { line: 1, column: 35 }
  2901. }
  2902. },
  2903. range: [23, 35],
  2904. loc: {
  2905. start: { line: 1, column: 23 },
  2906. end: { line: 1, column: 35 }
  2907. }
  2908. }],
  2909. defaults: [],
  2910. body: {
  2911. type: 'BlockStatement',
  2912. body: [],
  2913. range: [36, 38],
  2914. loc: {
  2915. start: { line: 1, column: 36 },
  2916. end: { line: 1, column: 38 }
  2917. }
  2918. },
  2919. rest: null,
  2920. generator: false,
  2921. expression: false,
  2922. range: [36, 38],
  2923. loc: {
  2924. start: { line: 1, column: 36 },
  2925. end: { line: 1, column: 38 }
  2926. }
  2927. },
  2928. kind: 'set',
  2929. 'static': false,
  2930. range: [11, 38],
  2931. loc: {
  2932. start: { line: 1, column: 11 },
  2933. end: { line: 1, column: 38 }
  2934. }
  2935. }],
  2936. range: [10, 39],
  2937. loc: {
  2938. start: { line: 1, column: 10 },
  2939. end: { line: 1, column: 39 }
  2940. }
  2941. },
  2942. range: [0, 39],
  2943. loc: {
  2944. start: { line: 1, column: 0 },
  2945. end: { line: 1, column: 39 }
  2946. }
  2947. },
  2948. 'var numVal:number;': {
  2949. type: 'VariableDeclaration',
  2950. declarations: [{
  2951. type: 'VariableDeclarator',
  2952. id: {
  2953. type: 'TypeAnnotatedIdentifier',
  2954. id: {
  2955. type: 'Identifier',
  2956. name: 'numVal',
  2957. range: [4, 10],
  2958. loc: {
  2959. start: { line: 1, column: 4 },
  2960. end: { line: 1, column: 10 }
  2961. }
  2962. },
  2963. annotation: {
  2964. type: 'TypeAnnotation',
  2965. id: {
  2966. type: 'Identifier',
  2967. name: 'number',
  2968. range: [11, 17],
  2969. loc: {
  2970. start: { line: 1, column: 11 },
  2971. end: { line: 1, column: 17 }
  2972. }
  2973. },
  2974. paramTypes: null,
  2975. returnType: null,
  2976. nullable: false,
  2977. range: [10, 17],
  2978. loc: {
  2979. start: { line: 1, column: 10 },
  2980. end: { line: 1, column: 17 }
  2981. }
  2982. },
  2983. range: [4, 17],
  2984. loc: {
  2985. start: { line: 1, column: 4 },
  2986. end: { line: 1, column: 17 }
  2987. }
  2988. },
  2989. init: null,
  2990. range: [4, 17],
  2991. loc: {
  2992. start: { line: 1, column: 4 },
  2993. end: { line: 1, column: 17 }
  2994. }
  2995. }],
  2996. kind: 'var',
  2997. range: [0, 18],
  2998. loc: {
  2999. start: { line: 1, column: 0 },
  3000. end: { line: 1, column: 18 }
  3001. }
  3002. },
  3003. 'var numVal:number = otherNumVal;': {
  3004. type: 'VariableDeclaration',
  3005. declarations: [{
  3006. type: 'VariableDeclarator',
  3007. id: {
  3008. type: 'TypeAnnotatedIdentifier',
  3009. id: {
  3010. type: 'Identifier',
  3011. name: 'numVal',
  3012. range: [4, 10],
  3013. loc: {
  3014. start: { line: 1, column: 4 },
  3015. end: { line: 1, column: 10 }
  3016. }
  3017. },
  3018. annotation: {
  3019. type: 'TypeAnnotation',
  3020. id: {
  3021. type: 'Identifier',
  3022. name: 'number',
  3023. range: [11, 17],
  3024. loc: {
  3025. start: { line: 1, column: 11 },
  3026. end: { line: 1, column: 17 }
  3027. }
  3028. },
  3029. paramTypes: null,
  3030. returnType: null,
  3031. nullable: false,
  3032. range: [10, 17],
  3033. loc: {
  3034. start: { line: 1, column: 10 },
  3035. end: { line: 1, column: 17 }
  3036. }
  3037. },
  3038. range: [4, 17],
  3039. loc: {
  3040. start: { line: 1, column: 4 },
  3041. end: { line: 1, column: 17 }
  3042. }
  3043. },
  3044. init: {
  3045. type: 'Identifier',
  3046. name: 'otherNumVal',
  3047. range: [20, 31],
  3048. loc: {
  3049. start: { line: 1, column: 20 },
  3050. end: { line: 1, column: 31 }
  3051. }
  3052. },
  3053. range: [4, 31],
  3054. loc: {
  3055. start: { line: 1, column: 4 },
  3056. end: { line: 1, column: 31 }
  3057. }
  3058. }],
  3059. kind: 'var',
  3060. range: [0, 32],
  3061. loc: {
  3062. start: { line: 1, column: 0 },
  3063. end: { line: 1, column: 32 }
  3064. }
  3065. }
  3066. }
  3067. };
  3068. // Merge fbTestFixture in to testFixture
  3069. (function () {
  3070. 'use strict';
  3071. var i, fixtures;
  3072. for (i in fbTestFixture) {
  3073. if (fbTestFixture.hasOwnProperty(i)) {
  3074. fixtures = fbTestFixture[i];
  3075. if (i !== 'Syntax' && testFixture.hasOwnProperty(i)) {
  3076. throw new Error('FB test should not replace existing test for ' + i);
  3077. }
  3078. testFixture[i] = fixtures;
  3079. }
  3080. }
  3081. }());