]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor: restore SourceLocation.source
authorEvan You <yyx990803@gmail.com>
Sat, 25 Nov 2023 11:22:39 +0000 (19:22 +0800)
committerEvan You <yyx990803@gmail.com>
Sat, 25 Nov 2023 11:22:39 +0000 (19:22 +0800)
this is used extensively in @vue/language-tools and does not have
noticeable impact on performance

packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap
packages/compiler-core/__tests__/parse.spec.ts
packages/compiler-core/src/ast.ts
packages/compiler-core/src/parser.ts
packages/compiler-core/src/transforms/transformElement.ts
packages/compiler-core/src/transforms/transformExpression.ts
packages/compiler-core/src/transforms/vModel.ts
packages/compiler-dom/__tests__/parse.spec.ts
packages/compiler-dom/src/transforms/Transition.ts

index b3a3d6b93b0b1e59114e8a6c90018c069390fc85..348076cb61e0d2313dd4a0a7150a87553c95c3c6 100644 (file)
@@ -13,6 +13,7 @@ exports[`compiler: parse > Errors > CDATA_IN_HTML_CONTENT > <template><![CDATA[c
           "line": 1,
           "offset": 38,
         },
+        "source": "<template><![CDATA[cdata]]></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -38,6 +39,7 @@ exports[`compiler: parse > Errors > CDATA_IN_HTML_CONTENT > <template><![CDATA[c
       "line": 1,
       "offset": 38,
     },
+    "source": "<template><![CDATA[cdata]]></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -66,6 +68,7 @@ exports[`compiler: parse > Errors > CDATA_IN_HTML_CONTENT > <template><svg><![CD
                   "line": 1,
                   "offset": 29,
                 },
+                "source": "cdata",
                 "start": {
                   "column": 25,
                   "line": 1,
@@ -82,6 +85,7 @@ exports[`compiler: parse > Errors > CDATA_IN_HTML_CONTENT > <template><svg><![CD
               "line": 1,
               "offset": 38,
             },
+            "source": "<svg><![CDATA[cdata]]></svg>",
             "start": {
               "column": 11,
               "line": 1,
@@ -102,6 +106,7 @@ exports[`compiler: parse > Errors > CDATA_IN_HTML_CONTENT > <template><svg><![CD
           "line": 1,
           "offset": 49,
         },
+        "source": "<template><svg><![CDATA[cdata]]></svg></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -127,6 +132,7 @@ exports[`compiler: parse > Errors > CDATA_IN_HTML_CONTENT > <template><svg><![CD
       "line": 1,
       "offset": 49,
     },
+    "source": "<template><svg><![CDATA[cdata]]></svg></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -154,6 +160,7 @@ exports[`compiler: parse > Errors > DUPLICATE_ATTRIBUTE > <template><div id="" i
               "line": 1,
               "offset": 33,
             },
+            "source": "<div id=\\"\\" id=\\"\\"></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -169,6 +176,7 @@ exports[`compiler: parse > Errors > DUPLICATE_ATTRIBUTE > <template><div id="" i
                   "line": 1,
                   "offset": 20,
                 },
+                "source": "id=\\"\\"",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -182,6 +190,7 @@ exports[`compiler: parse > Errors > DUPLICATE_ATTRIBUTE > <template><div id="" i
                   "line": 1,
                   "offset": 17,
                 },
+                "source": "id",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -197,6 +206,7 @@ exports[`compiler: parse > Errors > DUPLICATE_ATTRIBUTE > <template><div id="" i
                     "line": 1,
                     "offset": 20,
                   },
+                  "source": "\\"\\"",
                   "start": {
                     "column": 19,
                     "line": 1,
@@ -213,6 +223,7 @@ exports[`compiler: parse > Errors > DUPLICATE_ATTRIBUTE > <template><div id="" i
                   "line": 1,
                   "offset": 26,
                 },
+                "source": "id=\\"\\"",
                 "start": {
                   "column": 22,
                   "line": 1,
@@ -226,6 +237,7 @@ exports[`compiler: parse > Errors > DUPLICATE_ATTRIBUTE > <template><div id="" i
                   "line": 1,
                   "offset": 23,
                 },
+                "source": "id",
                 "start": {
                   "column": 22,
                   "line": 1,
@@ -241,6 +253,7 @@ exports[`compiler: parse > Errors > DUPLICATE_ATTRIBUTE > <template><div id="" i
                     "line": 1,
                     "offset": 26,
                   },
+                  "source": "\\"\\"",
                   "start": {
                     "column": 25,
                     "line": 1,
@@ -263,6 +276,7 @@ exports[`compiler: parse > Errors > DUPLICATE_ATTRIBUTE > <template><div id="" i
           "line": 1,
           "offset": 44,
         },
+        "source": "<template><div id=\\"\\" id=\\"\\"></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -288,6 +302,7 @@ exports[`compiler: parse > Errors > DUPLICATE_ATTRIBUTE > <template><div id="" i
       "line": 1,
       "offset": 44,
     },
+    "source": "<template><div id=\\"\\" id=\\"\\"></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -314,6 +329,7 @@ exports[`compiler: parse > Errors > EOF_BEFORE_TAG_NAME > <template>< 1`] = `
               "line": 1,
               "offset": 11,
             },
+            "source": "<",
             "start": {
               "column": 11,
               "line": 1,
@@ -330,6 +346,7 @@ exports[`compiler: parse > Errors > EOF_BEFORE_TAG_NAME > <template>< 1`] = `
           "line": 1,
           "offset": 12,
         },
+        "source": "<template><",
         "start": {
           "column": 1,
           "line": 1,
@@ -355,6 +372,7 @@ exports[`compiler: parse > Errors > EOF_BEFORE_TAG_NAME > <template>< 1`] = `
       "line": 1,
       "offset": 11,
     },
+    "source": "<template><",
     "start": {
       "column": 1,
       "line": 1,
@@ -381,6 +399,7 @@ exports[`compiler: parse > Errors > EOF_BEFORE_TAG_NAME > <template></ 1`] = `
               "line": 1,
               "offset": 12,
             },
+            "source": "</",
             "start": {
               "column": 11,
               "line": 1,
@@ -397,6 +416,7 @@ exports[`compiler: parse > Errors > EOF_BEFORE_TAG_NAME > <template></ 1`] = `
           "line": 1,
           "offset": 13,
         },
+        "source": "<template></",
         "start": {
           "column": 1,
           "line": 1,
@@ -422,6 +442,7 @@ exports[`compiler: parse > Errors > EOF_BEFORE_TAG_NAME > <template></ 1`] = `
       "line": 1,
       "offset": 12,
     },
+    "source": "<template></",
     "start": {
       "column": 1,
       "line": 1,
@@ -449,6 +470,7 @@ exports[`compiler: parse > Errors > EOF_IN_CDATA > <template><svg><![CDATA[ 1`]
               "line": 1,
               "offset": 25,
             },
+            "source": "<svg><![CDATA[",
             "start": {
               "column": 11,
               "line": 1,
@@ -469,6 +491,7 @@ exports[`compiler: parse > Errors > EOF_IN_CDATA > <template><svg><![CDATA[ 1`]
           "line": 1,
           "offset": 25,
         },
+        "source": "<template><svg><![CDATA[",
         "start": {
           "column": 1,
           "line": 1,
@@ -494,6 +517,7 @@ exports[`compiler: parse > Errors > EOF_IN_CDATA > <template><svg><![CDATA[ 1`]
       "line": 1,
       "offset": 24,
     },
+    "source": "<template><svg><![CDATA[",
     "start": {
       "column": 1,
       "line": 1,
@@ -522,6 +546,7 @@ exports[`compiler: parse > Errors > EOF_IN_CDATA > <template><svg><![CDATA[cdata
                   "line": 1,
                   "offset": 29,
                 },
+                "source": "cdata",
                 "start": {
                   "column": 25,
                   "line": 1,
@@ -538,6 +563,7 @@ exports[`compiler: parse > Errors > EOF_IN_CDATA > <template><svg><![CDATA[cdata
               "line": 1,
               "offset": 30,
             },
+            "source": "<svg><![CDATA[cdata",
             "start": {
               "column": 11,
               "line": 1,
@@ -558,6 +584,7 @@ exports[`compiler: parse > Errors > EOF_IN_CDATA > <template><svg><![CDATA[cdata
           "line": 1,
           "offset": 30,
         },
+        "source": "<template><svg><![CDATA[cdata",
         "start": {
           "column": 1,
           "line": 1,
@@ -583,6 +610,7 @@ exports[`compiler: parse > Errors > EOF_IN_CDATA > <template><svg><![CDATA[cdata
       "line": 1,
       "offset": 29,
     },
+    "source": "<template><svg><![CDATA[cdata",
     "start": {
       "column": 1,
       "line": 1,
@@ -608,6 +636,7 @@ exports[`compiler: parse > Errors > EOF_IN_COMMENT > <template><!-- 1`] = `
           "line": 1,
           "offset": 15,
         },
+        "source": "<template><!--",
         "start": {
           "column": 1,
           "line": 1,
@@ -633,6 +662,7 @@ exports[`compiler: parse > Errors > EOF_IN_COMMENT > <template><!-- 1`] = `
       "line": 1,
       "offset": 14,
     },
+    "source": "<template><!--",
     "start": {
       "column": 1,
       "line": 1,
@@ -659,6 +689,7 @@ exports[`compiler: parse > Errors > EOF_IN_COMMENT > <template><!--comment 1`] =
               "line": 1,
               "offset": 24,
             },
+            "source": "<!--comment",
             "start": {
               "column": 11,
               "line": 1,
@@ -675,6 +706,7 @@ exports[`compiler: parse > Errors > EOF_IN_COMMENT > <template><!--comment 1`] =
           "line": 1,
           "offset": 22,
         },
+        "source": "<template><!--comment",
         "start": {
           "column": 1,
           "line": 1,
@@ -700,6 +732,7 @@ exports[`compiler: parse > Errors > EOF_IN_COMMENT > <template><!--comment 1`] =
       "line": 1,
       "offset": 21,
     },
+    "source": "<template><!--comment",
     "start": {
       "column": 1,
       "line": 1,
@@ -725,6 +758,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <div></div 1`] = `
           "line": 1,
           "offset": 11,
         },
+        "source": "<div></div",
         "start": {
           "column": 1,
           "line": 1,
@@ -750,6 +784,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <div></div 1`] = `
       "line": 1,
       "offset": 10,
     },
+    "source": "<div></div",
     "start": {
       "column": 1,
       "line": 1,
@@ -775,6 +810,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div  1`] = `
           "line": 1,
           "offset": 16,
         },
+        "source": "<template><div ",
         "start": {
           "column": 1,
           "line": 1,
@@ -800,6 +836,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div  1`] = `
       "line": 1,
       "offset": 15,
     },
+    "source": "<template><div ",
     "start": {
       "column": 1,
       "line": 1,
@@ -825,6 +862,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div 1`] = `
           "line": 1,
           "offset": 15,
         },
+        "source": "<template><div",
         "start": {
           "column": 1,
           "line": 1,
@@ -850,6 +888,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div 1`] = `
       "line": 1,
       "offset": 14,
     },
+    "source": "<template><div",
     "start": {
       "column": 1,
       "line": 1,
@@ -875,6 +914,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id  1`] = `
           "line": 1,
           "offset": 19,
         },
+        "source": "<template><div id ",
         "start": {
           "column": 1,
           "line": 1,
@@ -900,6 +940,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id  1`] = `
       "line": 1,
       "offset": 18,
     },
+    "source": "<template><div id ",
     "start": {
       "column": 1,
       "line": 1,
@@ -925,6 +966,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id = 1`] = `
           "line": 1,
           "offset": 20,
         },
+        "source": "<template><div id =",
         "start": {
           "column": 1,
           "line": 1,
@@ -950,6 +992,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id = 1`] = `
       "line": 1,
       "offset": 19,
     },
+    "source": "<template><div id =",
     "start": {
       "column": 1,
       "line": 1,
@@ -975,6 +1018,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id 1`] = `
           "line": 1,
           "offset": 18,
         },
+        "source": "<template><div id",
         "start": {
           "column": 1,
           "line": 1,
@@ -1000,6 +1044,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id 1`] = `
       "line": 1,
       "offset": 17,
     },
+    "source": "<template><div id",
     "start": {
       "column": 1,
       "line": 1,
@@ -1025,6 +1070,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id="abc 1`] = `
           "line": 1,
           "offset": 23,
         },
+        "source": "<template><div id=\\"abc",
         "start": {
           "column": 1,
           "line": 1,
@@ -1050,6 +1096,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id="abc 1`] = `
       "line": 1,
       "offset": 22,
     },
+    "source": "<template><div id=\\"abc",
     "start": {
       "column": 1,
       "line": 1,
@@ -1075,6 +1122,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id="abc" 1`] = `
           "line": 1,
           "offset": 24,
         },
+        "source": "<template><div id=\\"abc\\"",
         "start": {
           "column": 1,
           "line": 1,
@@ -1100,6 +1148,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id="abc" 1`] = `
       "line": 1,
       "offset": 23,
     },
+    "source": "<template><div id=\\"abc\\"",
     "start": {
       "column": 1,
       "line": 1,
@@ -1126,6 +1175,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id="abc"/ 1`] =
               "line": 1,
               "offset": 24,
             },
+            "source": "/",
             "start": {
               "column": 0,
               "line": 1,
@@ -1142,6 +1192,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id="abc"/ 1`] =
           "line": 1,
           "offset": 25,
         },
+        "source": "<template><div id=\\"abc\\"/",
         "start": {
           "column": 1,
           "line": 1,
@@ -1167,6 +1218,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id="abc"/ 1`] =
       "line": 1,
       "offset": 24,
     },
+    "source": "<template><div id=\\"abc\\"/",
     "start": {
       "column": 1,
       "line": 1,
@@ -1192,6 +1244,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id='abc 1`] = `
           "line": 1,
           "offset": 23,
         },
+        "source": "<template><div id='abc",
         "start": {
           "column": 1,
           "line": 1,
@@ -1217,6 +1270,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id='abc 1`] = `
       "line": 1,
       "offset": 22,
     },
+    "source": "<template><div id='abc",
     "start": {
       "column": 1,
       "line": 1,
@@ -1242,6 +1296,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id='abc' 1`] = `
           "line": 1,
           "offset": 24,
         },
+        "source": "<template><div id='abc'",
         "start": {
           "column": 1,
           "line": 1,
@@ -1267,6 +1322,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id='abc' 1`] = `
       "line": 1,
       "offset": 23,
     },
+    "source": "<template><div id='abc'",
     "start": {
       "column": 1,
       "line": 1,
@@ -1293,6 +1349,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id='abc'/ 1`] =
               "line": 1,
               "offset": 24,
             },
+            "source": "/",
             "start": {
               "column": 0,
               "line": 1,
@@ -1309,6 +1366,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id='abc'/ 1`] =
           "line": 1,
           "offset": 25,
         },
+        "source": "<template><div id='abc'/",
         "start": {
           "column": 1,
           "line": 1,
@@ -1334,6 +1392,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id='abc'/ 1`] =
       "line": 1,
       "offset": 24,
     },
+    "source": "<template><div id='abc'/",
     "start": {
       "column": 1,
       "line": 1,
@@ -1360,6 +1419,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id=abc / 1`] = `
               "line": 1,
               "offset": 23,
             },
+            "source": "/",
             "start": {
               "column": 0,
               "line": 1,
@@ -1376,6 +1436,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id=abc / 1`] = `
           "line": 1,
           "offset": 24,
         },
+        "source": "<template><div id=abc /",
         "start": {
           "column": 1,
           "line": 1,
@@ -1401,6 +1462,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id=abc / 1`] = `
       "line": 1,
       "offset": 23,
     },
+    "source": "<template><div id=abc /",
     "start": {
       "column": 1,
       "line": 1,
@@ -1426,6 +1488,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id=abc 1`] = `
           "line": 1,
           "offset": 22,
         },
+        "source": "<template><div id=abc",
         "start": {
           "column": 1,
           "line": 1,
@@ -1451,6 +1514,7 @@ exports[`compiler: parse > Errors > EOF_IN_TAG > <template><div id=abc 1`] = `
       "line": 1,
       "offset": 21,
     },
+    "source": "<template><div id=abc",
     "start": {
       "column": 1,
       "line": 1,
@@ -1478,6 +1542,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
               "line": 1,
               "offset": 27,
             },
+            "source": "<div id= /></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -1493,6 +1558,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
                   "line": 1,
                   "offset": 20,
                 },
+                "source": "id= /",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -1506,6 +1572,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
                   "line": 1,
                   "offset": 17,
                 },
+                "source": "id",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -1521,6 +1588,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
                     "line": 1,
                     "offset": 20,
                   },
+                  "source": "/",
                   "start": {
                     "column": 20,
                     "line": 1,
@@ -1543,6 +1611,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
           "line": 1,
           "offset": 38,
         },
+        "source": "<template><div id= /></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -1568,6 +1637,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
       "line": 1,
       "offset": 38,
     },
+    "source": "<template><div id= /></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -1595,6 +1665,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
               "line": 1,
               "offset": 26,
             },
+            "source": "<div id= ></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -1610,6 +1681,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
                   "line": 1,
                   "offset": 19,
                 },
+                "source": "id= ",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -1623,6 +1695,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
                   "line": 1,
                   "offset": 17,
                 },
+                "source": "id",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -1638,6 +1711,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
                     "line": 1,
                     "offset": 19,
                   },
+                  "source": "",
                   "start": {
                     "column": 20,
                     "line": 1,
@@ -1660,6 +1734,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
           "line": 1,
           "offset": 37,
         },
+        "source": "<template><div id= ></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -1685,6 +1760,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
       "line": 1,
       "offset": 37,
     },
+    "source": "<template><div id= ></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -1712,6 +1788,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
               "line": 1,
               "offset": 25,
             },
+            "source": "<div id=></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -1727,6 +1804,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
                   "line": 1,
                   "offset": 18,
                 },
+                "source": "id=",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -1740,6 +1818,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
                   "line": 1,
                   "offset": 17,
                 },
+                "source": "id",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -1755,6 +1834,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
                     "line": 1,
                     "offset": 18,
                   },
+                  "source": "",
                   "start": {
                     "column": 19,
                     "line": 1,
@@ -1777,6 +1857,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
           "line": 1,
           "offset": 36,
         },
+        "source": "<template><div id=></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -1802,6 +1883,7 @@ exports[`compiler: parse > Errors > MISSING_ATTRIBUTE_VALUE > <template><div id=
       "line": 1,
       "offset": 36,
     },
+    "source": "<template><div id=></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -1827,6 +1909,7 @@ exports[`compiler: parse > Errors > MISSING_END_TAG_NAME > <template></></templa
           "line": 1,
           "offset": 24,
         },
+        "source": "<template></></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -1852,6 +1935,7 @@ exports[`compiler: parse > Errors > MISSING_END_TAG_NAME > <template></></templa
       "line": 1,
       "offset": 24,
     },
+    "source": "<template></></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -1879,6 +1963,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
               "line": 1,
               "offset": 29,
             },
+            "source": "<div a\\"bc=''></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -1894,6 +1979,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
                   "line": 1,
                   "offset": 22,
                 },
+                "source": "a\\"bc=''",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -1907,6 +1993,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
                   "line": 1,
                   "offset": 19,
                 },
+                "source": "a\\"bc",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -1922,6 +2009,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
                     "line": 1,
                     "offset": 22,
                   },
+                  "source": "''",
                   "start": {
                     "column": 21,
                     "line": 1,
@@ -1944,6 +2032,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
           "line": 1,
           "offset": 40,
         },
+        "source": "<template><div a\\"bc=''></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -1969,6 +2058,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
       "line": 1,
       "offset": 40,
     },
+    "source": "<template><div a\\"bc=''></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -1996,6 +2086,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
               "line": 1,
               "offset": 29,
             },
+            "source": "<div a'bc=''></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -2011,6 +2102,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
                   "line": 1,
                   "offset": 22,
                 },
+                "source": "a'bc=''",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2024,6 +2116,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
                   "line": 1,
                   "offset": 19,
                 },
+                "source": "a'bc",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2039,6 +2132,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
                     "line": 1,
                     "offset": 22,
                   },
+                  "source": "''",
                   "start": {
                     "column": 21,
                     "line": 1,
@@ -2061,6 +2155,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
           "line": 1,
           "offset": 40,
         },
+        "source": "<template><div a'bc=''></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -2086,6 +2181,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
       "line": 1,
       "offset": 40,
     },
+    "source": "<template><div a'bc=''></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -2113,6 +2209,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
               "line": 1,
               "offset": 29,
             },
+            "source": "<div a<bc=''></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -2128,6 +2225,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
                   "line": 1,
                   "offset": 22,
                 },
+                "source": "a<bc=''",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2141,6 +2239,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
                   "line": 1,
                   "offset": 19,
                 },
+                "source": "a<bc",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2156,6 +2255,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
                     "line": 1,
                     "offset": 22,
                   },
+                  "source": "''",
                   "start": {
                     "column": 21,
                     "line": 1,
@@ -2178,6 +2278,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
           "line": 1,
           "offset": 40,
         },
+        "source": "<template><div a<bc=''></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -2203,6 +2304,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME > <te
       "line": 1,
       "offset": 40,
     },
+    "source": "<template><div a<bc=''></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -2230,6 +2332,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
               "line": 1,
               "offset": 30,
             },
+            "source": "<div foo=bar\\"></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -2245,6 +2348,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                   "line": 1,
                   "offset": 23,
                 },
+                "source": "foo=bar\\"",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2258,6 +2362,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                   "line": 1,
                   "offset": 18,
                 },
+                "source": "foo",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2273,6 +2378,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                     "line": 1,
                     "offset": 23,
                   },
+                  "source": "bar\\"",
                   "start": {
                     "column": 20,
                     "line": 1,
@@ -2295,6 +2401,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
           "line": 1,
           "offset": 41,
         },
+        "source": "<template><div foo=bar\\"></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -2320,6 +2427,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
       "line": 1,
       "offset": 41,
     },
+    "source": "<template><div foo=bar\\"></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -2347,6 +2455,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
               "line": 1,
               "offset": 30,
             },
+            "source": "<div foo=bar'></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -2362,6 +2471,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                   "line": 1,
                   "offset": 23,
                 },
+                "source": "foo=bar'",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2375,6 +2485,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                   "line": 1,
                   "offset": 18,
                 },
+                "source": "foo",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2390,6 +2501,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                     "line": 1,
                     "offset": 23,
                   },
+                  "source": "bar'",
                   "start": {
                     "column": 20,
                     "line": 1,
@@ -2412,6 +2524,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
           "line": 1,
           "offset": 41,
         },
+        "source": "<template><div foo=bar'></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -2437,6 +2550,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
       "line": 1,
       "offset": 41,
     },
+    "source": "<template><div foo=bar'></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -2464,6 +2578,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
               "line": 1,
               "offset": 33,
             },
+            "source": "<div foo=bar<div></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -2479,6 +2594,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                   "line": 1,
                   "offset": 26,
                 },
+                "source": "foo=bar<div",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2492,6 +2608,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                   "line": 1,
                   "offset": 18,
                 },
+                "source": "foo",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2507,6 +2624,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                     "line": 1,
                     "offset": 26,
                   },
+                  "source": "bar<div",
                   "start": {
                     "column": 20,
                     "line": 1,
@@ -2529,6 +2647,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
           "line": 1,
           "offset": 44,
         },
+        "source": "<template><div foo=bar<div></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -2554,6 +2673,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
       "line": 1,
       "offset": 44,
     },
+    "source": "<template><div foo=bar<div></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -2581,6 +2701,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
               "line": 1,
               "offset": 33,
             },
+            "source": "<div foo=bar=baz></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -2596,6 +2717,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                   "line": 1,
                   "offset": 26,
                 },
+                "source": "foo=bar=baz",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2609,6 +2731,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                   "line": 1,
                   "offset": 18,
                 },
+                "source": "foo",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2624,6 +2747,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                     "line": 1,
                     "offset": 26,
                   },
+                  "source": "bar=baz",
                   "start": {
                     "column": 20,
                     "line": 1,
@@ -2646,6 +2770,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
           "line": 1,
           "offset": 44,
         },
+        "source": "<template><div foo=bar=baz></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -2671,6 +2796,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
       "line": 1,
       "offset": 44,
     },
+    "source": "<template><div foo=bar=baz></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -2698,6 +2824,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
               "line": 1,
               "offset": 30,
             },
+            "source": "<div foo=bar\`></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -2713,6 +2840,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                   "line": 1,
                   "offset": 23,
                 },
+                "source": "foo=bar\`",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2726,6 +2854,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                   "line": 1,
                   "offset": 18,
                 },
+                "source": "foo",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2741,6 +2870,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
                     "line": 1,
                     "offset": 23,
                   },
+                  "source": "bar\`",
                   "start": {
                     "column": 20,
                     "line": 1,
@@ -2763,6 +2893,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
           "line": 1,
           "offset": 41,
         },
+        "source": "<template><div foo=bar\`></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -2788,6 +2919,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_V
       "line": 1,
       "offset": 41,
     },
+    "source": "<template><div foo=bar\`></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -2815,6 +2947,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
               "line": 1,
               "offset": 23,
             },
+            "source": "<div =></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -2830,6 +2963,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
                   "line": 1,
                   "offset": 16,
                 },
+                "source": "=",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2843,6 +2977,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
                   "line": 1,
                   "offset": 16,
                 },
+                "source": "=",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2865,6 +3000,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
           "line": 1,
           "offset": 34,
         },
+        "source": "<template><div =></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -2890,6 +3026,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
       "line": 1,
       "offset": 34,
     },
+    "source": "<template><div =></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -2917,6 +3054,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
               "line": 1,
               "offset": 30,
             },
+            "source": "<div =foo=bar></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -2932,6 +3070,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
                   "line": 1,
                   "offset": 23,
                 },
+                "source": "=foo=bar",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2945,6 +3084,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
                   "line": 1,
                   "offset": 19,
                 },
+                "source": "=foo",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -2960,6 +3100,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
                     "line": 1,
                     "offset": 23,
                   },
+                  "source": "bar",
                   "start": {
                     "column": 21,
                     "line": 1,
@@ -2982,6 +3123,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
           "line": 1,
           "offset": 41,
         },
+        "source": "<template><div =foo=bar></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -3007,6 +3149,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
       "line": 1,
       "offset": 41,
     },
+    "source": "<template><div =foo=bar></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -3032,6 +3175,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME
           "line": 1,
           "offset": 28,
         },
+        "source": "<template><?xml?></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -3057,6 +3201,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME
       "line": 1,
       "offset": 28,
     },
+    "source": "<template><?xml?></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -3084,6 +3229,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_SOLIDUS_IN_TAG > <template><div a
               "line": 1,
               "offset": 25,
             },
+            "source": "<div a/b></div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -3099,6 +3245,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_SOLIDUS_IN_TAG > <template><div a
                   "line": 1,
                   "offset": 16,
                 },
+                "source": "a",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -3112,6 +3259,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_SOLIDUS_IN_TAG > <template><div a
                   "line": 1,
                   "offset": 16,
                 },
+                "source": "a",
                 "start": {
                   "column": 16,
                   "line": 1,
@@ -3128,6 +3276,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_SOLIDUS_IN_TAG > <template><div a
                   "line": 1,
                   "offset": 18,
                 },
+                "source": "b",
                 "start": {
                   "column": 18,
                   "line": 1,
@@ -3141,6 +3290,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_SOLIDUS_IN_TAG > <template><div a
                   "line": 1,
                   "offset": 18,
                 },
+                "source": "b",
                 "start": {
                   "column": 18,
                   "line": 1,
@@ -3163,6 +3313,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_SOLIDUS_IN_TAG > <template><div a
           "line": 1,
           "offset": 36,
         },
+        "source": "<template><div a/b></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -3188,6 +3339,7 @@ exports[`compiler: parse > Errors > UNEXPECTED_SOLIDUS_IN_TAG > <template><div a
       "line": 1,
       "offset": 36,
     },
+    "source": "<template><div a/b></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -3214,6 +3366,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <svg><![CDATA[</div>]]><
               "line": 1,
               "offset": 20,
             },
+            "source": "</div>",
             "start": {
               "column": 15,
               "line": 1,
@@ -3230,6 +3383,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <svg><![CDATA[</div>]]><
           "line": 1,
           "offset": 29,
         },
+        "source": "<svg><![CDATA[</div>]]></svg>",
         "start": {
           "column": 1,
           "line": 1,
@@ -3255,6 +3409,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <svg><![CDATA[</div>]]><
       "line": 1,
       "offset": 29,
     },
+    "source": "<svg><![CDATA[</div>]]></svg>",
     "start": {
       "column": 1,
       "line": 1,
@@ -3281,6 +3436,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <svg><!--</div>--></svg>
               "line": 1,
               "offset": 18,
             },
+            "source": "<!--</div>-->",
             "start": {
               "column": 6,
               "line": 1,
@@ -3297,6 +3453,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <svg><!--</div>--></svg>
           "line": 1,
           "offset": 24,
         },
+        "source": "<svg><!--</div>--></svg>",
         "start": {
           "column": 1,
           "line": 1,
@@ -3322,6 +3479,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <svg><!--</div>--></svg>
       "line": 1,
       "offset": 24,
     },
+    "source": "<svg><!--</div>--></svg>",
     "start": {
       "column": 1,
       "line": 1,
@@ -3347,6 +3505,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <template></div></div></
           "line": 1,
           "offset": 33,
         },
+        "source": "<template></div></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -3372,6 +3531,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <template></div></div></
       "line": 1,
       "offset": 33,
     },
+    "source": "<template></div></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -3397,6 +3557,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <template></div></templa
           "line": 1,
           "offset": 27,
         },
+        "source": "<template></div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -3422,6 +3583,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <template></div></templa
       "line": 1,
       "offset": 27,
     },
+    "source": "<template></div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -3451,6 +3613,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <template>{{'</div>'}}</
                 "line": 1,
                 "offset": 20,
               },
+              "source": "'</div>'",
               "start": {
                 "column": 13,
                 "line": 1,
@@ -3465,6 +3628,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <template>{{'</div>'}}</
               "line": 1,
               "offset": 22,
             },
+            "source": "{{'</div>'}}",
             "start": {
               "column": 11,
               "line": 1,
@@ -3481,6 +3645,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <template>{{'</div>'}}</
           "line": 1,
           "offset": 33,
         },
+        "source": "<template>{{'</div>'}}</template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -3506,6 +3671,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <template>{{'</div>'}}</
       "line": 1,
       "offset": 33,
     },
+    "source": "<template>{{'</div>'}}</template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -3532,6 +3698,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <template>a </ b</templa
               "line": 1,
               "offset": 12,
             },
+            "source": "a ",
             "start": {
               "column": 11,
               "line": 1,
@@ -3548,6 +3715,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <template>a </ b</templa
           "line": 1,
           "offset": 27,
         },
+        "source": "<template>a </ b</template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -3573,6 +3741,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <template>a </ b</templa
       "line": 1,
       "offset": 27,
     },
+    "source": "<template>a </ b</template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -3599,6 +3768,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <textarea></div></textar
               "line": 1,
               "offset": 16,
             },
+            "source": "</div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -3615,6 +3785,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <textarea></div></textar
           "line": 1,
           "offset": 27,
         },
+        "source": "<textarea></div></textarea>",
         "start": {
           "column": 1,
           "line": 1,
@@ -3640,6 +3811,7 @@ exports[`compiler: parse > Errors > X_INVALID_END_TAG > <textarea></div></textar
       "line": 1,
       "offset": 27,
     },
+    "source": "<textarea></div></textarea>",
     "start": {
       "column": 1,
       "line": 1,
@@ -3665,6 +3837,7 @@ exports[`compiler: parse > Errors > X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END > <
           "line": 1,
           "offset": 24,
         },
+        "source": "<div v-foo:[sef fsef] />",
         "start": {
           "column": 1,
           "line": 1,
@@ -3684,6 +3857,7 @@ exports[`compiler: parse > Errors > X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END > <
                 "line": 1,
                 "offset": 16,
               },
+              "source": "[sef ",
               "start": {
                 "column": 12,
                 "line": 1,
@@ -3699,6 +3873,7 @@ exports[`compiler: parse > Errors > X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END > <
               "line": 1,
               "offset": 15,
             },
+            "source": "v-foo:[sef",
             "start": {
               "column": 6,
               "line": 1,
@@ -3718,6 +3893,7 @@ exports[`compiler: parse > Errors > X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END > <
               "line": 1,
               "offset": 21,
             },
+            "source": "fsef]",
             "start": {
               "column": 17,
               "line": 1,
@@ -3731,6 +3907,7 @@ exports[`compiler: parse > Errors > X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END > <
               "line": 1,
               "offset": 21,
             },
+            "source": "fsef]",
             "start": {
               "column": 17,
               "line": 1,
@@ -3758,6 +3935,7 @@ exports[`compiler: parse > Errors > X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END > <
       "line": 1,
       "offset": 24,
     },
+    "source": "<div v-foo:[sef fsef] />",
     "start": {
       "column": 1,
       "line": 1,
@@ -3785,6 +3963,7 @@ exports[`compiler: parse > Errors > X_MISSING_END_TAG > <template><div> 1`] = `
               "line": 1,
               "offset": 15,
             },
+            "source": "<div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -3805,6 +3984,7 @@ exports[`compiler: parse > Errors > X_MISSING_END_TAG > <template><div> 1`] = `
           "line": 1,
           "offset": 15,
         },
+        "source": "<template><div>",
         "start": {
           "column": 1,
           "line": 1,
@@ -3830,6 +4010,7 @@ exports[`compiler: parse > Errors > X_MISSING_END_TAG > <template><div> 1`] = `
       "line": 1,
       "offset": 15,
     },
+    "source": "<template><div>",
     "start": {
       "column": 1,
       "line": 1,
@@ -3857,6 +4038,7 @@ exports[`compiler: parse > Errors > X_MISSING_END_TAG > <template><div></templat
               "line": 1,
               "offset": 15,
             },
+            "source": "<div>",
             "start": {
               "column": 11,
               "line": 1,
@@ -3877,6 +4059,7 @@ exports[`compiler: parse > Errors > X_MISSING_END_TAG > <template><div></templat
           "line": 1,
           "offset": 26,
         },
+        "source": "<template><div></template>",
         "start": {
           "column": 1,
           "line": 1,
@@ -3902,6 +4085,7 @@ exports[`compiler: parse > Errors > X_MISSING_END_TAG > <template><div></templat
       "line": 1,
       "offset": 26,
     },
+    "source": "<template><div></template>",
     "start": {
       "column": 1,
       "line": 1,
@@ -3928,6 +4112,7 @@ exports[`compiler: parse > Errors > X_MISSING_INTERPOLATION_END > <div>{{ foo</d
               "line": 1,
               "offset": 17,
             },
+            "source": "{{ foo</div>",
             "start": {
               "column": 6,
               "line": 1,
@@ -3944,6 +4129,7 @@ exports[`compiler: parse > Errors > X_MISSING_INTERPOLATION_END > <div>{{ foo</d
           "line": 1,
           "offset": 17,
         },
+        "source": "<div>{{ foo</div>",
         "start": {
           "column": 1,
           "line": 1,
@@ -3969,6 +4155,7 @@ exports[`compiler: parse > Errors > X_MISSING_INTERPOLATION_END > <div>{{ foo</d
       "line": 1,
       "offset": 17,
     },
+    "source": "<div>{{ foo</div>",
     "start": {
       "column": 1,
       "line": 1,
@@ -3993,6 +4180,7 @@ exports[`compiler: parse > Errors > X_MISSING_INTERPOLATION_END > {{ 1`] = `
           "line": 1,
           "offset": 2,
         },
+        "source": "{{",
         "start": {
           "column": 1,
           "line": 1,
@@ -4014,6 +4202,7 @@ exports[`compiler: parse > Errors > X_MISSING_INTERPOLATION_END > {{ 1`] = `
       "line": 1,
       "offset": 2,
     },
+    "source": "{{",
     "start": {
       "column": 1,
       "line": 1,
@@ -4038,6 +4227,7 @@ exports[`compiler: parse > Errors > X_MISSING_INTERPOLATION_END > {{ foo 1`] = `
           "line": 1,
           "offset": 6,
         },
+        "source": "{{ foo",
         "start": {
           "column": 1,
           "line": 1,
@@ -4059,6 +4249,7 @@ exports[`compiler: parse > Errors > X_MISSING_INTERPOLATION_END > {{ foo 1`] = `
       "line": 1,
       "offset": 6,
     },
+    "source": "{{ foo",
     "start": {
       "column": 1,
       "line": 1,
@@ -4086,6 +4277,7 @@ exports[`compiler: parse > Errors > X_MISSING_INTERPOLATION_END > {{}} 1`] = `
             "line": 1,
             "offset": 2,
           },
+          "source": "",
           "start": {
             "column": 3,
             "line": 1,
@@ -4100,6 +4292,7 @@ exports[`compiler: parse > Errors > X_MISSING_INTERPOLATION_END > {{}} 1`] = `
           "line": 1,
           "offset": 4,
         },
+        "source": "{{}}",
         "start": {
           "column": 1,
           "line": 1,
@@ -4121,6 +4314,7 @@ exports[`compiler: parse > Errors > X_MISSING_INTERPOLATION_END > {{}} 1`] = `
       "line": 1,
       "offset": 4,
     },
+    "source": "{{}}",
     "start": {
       "column": 1,
       "line": 1,
@@ -4148,6 +4342,8 @@ exports[`compiler: parse > invalid html 1`] = `
               "line": 3,
               "offset": 13,
             },
+            "source": "<span>
+",
             "start": {
               "column": 1,
               "line": 2,
@@ -4168,6 +4364,9 @@ exports[`compiler: parse > invalid html 1`] = `
           "line": 3,
           "offset": 19,
         },
+        "source": "<div>
+<span>
+</div>",
         "start": {
           "column": 1,
           "line": 1,
@@ -4193,6 +4392,10 @@ exports[`compiler: parse > invalid html 1`] = `
       "line": 4,
       "offset": 27,
     },
+    "source": "<div>
+<span>
+</div>
+</span>",
     "start": {
       "column": 1,
       "line": 1,
@@ -4221,6 +4424,7 @@ exports[`compiler: parse > self closing multiple tag 1`] = `
           "line": 1,
           "offset": 36,
         },
+        "source": "<div :class=\\"{ some: condition }\\" />",
         "start": {
           "column": 1,
           "line": 1,
@@ -4240,6 +4444,7 @@ exports[`compiler: parse > self closing multiple tag 1`] = `
                 "line": 1,
                 "offset": 11,
               },
+              "source": "class",
               "start": {
                 "column": 7,
                 "line": 1,
@@ -4258,6 +4463,7 @@ exports[`compiler: parse > self closing multiple tag 1`] = `
                 "line": 1,
                 "offset": 32,
               },
+              "source": "{ some: condition }",
               "start": {
                 "column": 14,
                 "line": 1,
@@ -4272,6 +4478,7 @@ exports[`compiler: parse > self closing multiple tag 1`] = `
               "line": 1,
               "offset": 33,
             },
+            "source": ":class=\\"{ some: condition }\\"",
             "start": {
               "column": 6,
               "line": 1,
@@ -4298,6 +4505,7 @@ exports[`compiler: parse > self closing multiple tag 1`] = `
           "line": 2,
           "offset": 73,
         },
+        "source": "<p v-bind:style=\\"{ color: 'red' }\\"/>",
         "start": {
           "column": 1,
           "line": 2,
@@ -4317,6 +4525,7 @@ exports[`compiler: parse > self closing multiple tag 1`] = `
                 "line": 2,
                 "offset": 52,
               },
+              "source": "style",
               "start": {
                 "column": 11,
                 "line": 2,
@@ -4335,6 +4544,7 @@ exports[`compiler: parse > self closing multiple tag 1`] = `
                 "line": 2,
                 "offset": 70,
               },
+              "source": "{ color: 'red' }",
               "start": {
                 "column": 18,
                 "line": 2,
@@ -4349,6 +4559,7 @@ exports[`compiler: parse > self closing multiple tag 1`] = `
               "line": 2,
               "offset": 71,
             },
+            "source": "v-bind:style=\\"{ color: 'red' }\\"",
             "start": {
               "column": 4,
               "line": 2,
@@ -4379,6 +4590,8 @@ exports[`compiler: parse > self closing multiple tag 1`] = `
       "line": 2,
       "offset": 73,
     },
+    "source": "<div :class=\\"{ some: condition }\\" />
+<p v-bind:style=\\"{ color: 'red' }\\"/>",
     "start": {
       "column": 1,
       "line": 1,
@@ -4407,6 +4620,7 @@ exports[`compiler: parse > valid html 1`] = `
               "line": 2,
               "offset": 73,
             },
+            "source": "<p v-bind:style=\\"{ color: 'red' }\\"/>",
             "start": {
               "column": 3,
               "line": 2,
@@ -4426,6 +4640,7 @@ exports[`compiler: parse > valid html 1`] = `
                     "line": 2,
                     "offset": 52,
                   },
+                  "source": "style",
                   "start": {
                     "column": 13,
                     "line": 2,
@@ -4444,6 +4659,7 @@ exports[`compiler: parse > valid html 1`] = `
                     "line": 2,
                     "offset": 70,
                   },
+                  "source": "{ color: 'red' }",
                   "start": {
                     "column": 20,
                     "line": 2,
@@ -4458,6 +4674,7 @@ exports[`compiler: parse > valid html 1`] = `
                   "line": 2,
                   "offset": 71,
                 },
+                "source": "v-bind:style=\\"{ color: 'red' }\\"",
                 "start": {
                   "column": 6,
                   "line": 2,
@@ -4483,6 +4700,7 @@ exports[`compiler: parse > valid html 1`] = `
               "line": 3,
               "offset": 116,
             },
+            "source": "<!-- a comment with <html> inside it -->",
             "start": {
               "column": 3,
               "line": 3,
@@ -4499,6 +4717,10 @@ exports[`compiler: parse > valid html 1`] = `
           "line": 4,
           "offset": 123,
         },
+        "source": "<div :class=\\"{ some: condition }\\">
+  <p v-bind:style=\\"{ color: 'red' }\\"/>
+  <!-- a comment with <html> inside it -->
+</div>",
         "start": {
           "column": 1,
           "line": 1,
@@ -4518,6 +4740,7 @@ exports[`compiler: parse > valid html 1`] = `
                 "line": 1,
                 "offset": 11,
               },
+              "source": "class",
               "start": {
                 "column": 7,
                 "line": 1,
@@ -4536,6 +4759,7 @@ exports[`compiler: parse > valid html 1`] = `
                 "line": 1,
                 "offset": 32,
               },
+              "source": "{ some: condition }",
               "start": {
                 "column": 14,
                 "line": 1,
@@ -4550,6 +4774,7 @@ exports[`compiler: parse > valid html 1`] = `
               "line": 1,
               "offset": 33,
             },
+            "source": ":class=\\"{ some: condition }\\"",
             "start": {
               "column": 6,
               "line": 1,
@@ -4580,6 +4805,10 @@ exports[`compiler: parse > valid html 1`] = `
       "line": 4,
       "offset": 123,
     },
+    "source": "<div :class=\\"{ some: condition }\\">
+  <p v-bind:style=\\"{ color: 'red' }\\"/>
+  <!-- a comment with <html> inside it -->
+</div>",
     "start": {
       "column": 1,
       "line": 1,
index 584644b2d1738a74e46ebd63fb513e3ee3c22c3b..e0f1d16ed8f8305bd7f991f40907c946057f0306 100644 (file)
@@ -28,7 +28,8 @@ describe('compiler: parse', () => {
         content: 'some text',
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 9, line: 1, column: 10 }
+          end: { offset: 9, line: 1, column: 10 },
+          source: 'some text'
         }
       })
     })
@@ -55,7 +56,8 @@ describe('compiler: parse', () => {
         content: 'some text',
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 9, line: 1, column: 10 }
+          end: { offset: 9, line: 1, column: 10 },
+          source: 'some text'
         }
       })
     })
@@ -70,7 +72,8 @@ describe('compiler: parse', () => {
         content: 'some ',
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 5, line: 1, column: 6 }
+          end: { offset: 5, line: 1, column: 6 },
+          source: 'some '
         }
       })
       expect(text2).toStrictEqual({
@@ -78,7 +81,8 @@ describe('compiler: parse', () => {
         content: ' text',
         loc: {
           start: { offset: 20, line: 1, column: 21 },
-          end: { offset: 25, line: 1, column: 26 }
+          end: { offset: 25, line: 1, column: 26 },
+          source: ' text'
         }
       })
     })
@@ -93,7 +97,8 @@ describe('compiler: parse', () => {
         content: 'some ',
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 5, line: 1, column: 6 }
+          end: { offset: 5, line: 1, column: 6 },
+          source: 'some '
         }
       })
       expect(text2).toStrictEqual({
@@ -101,7 +106,8 @@ describe('compiler: parse', () => {
         content: ' text',
         loc: {
           start: { offset: 21, line: 1, column: 22 },
-          end: { offset: 26, line: 1, column: 27 }
+          end: { offset: 26, line: 1, column: 27 },
+          source: ' text'
         }
       })
     })
@@ -116,7 +122,8 @@ describe('compiler: parse', () => {
         content: 'some ',
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 5, line: 1, column: 6 }
+          end: { offset: 5, line: 1, column: 6 },
+          source: 'some '
         }
       })
       expect(text2).toStrictEqual({
@@ -124,7 +131,8 @@ describe('compiler: parse', () => {
         content: ' text',
         loc: {
           start: { offset: 32, line: 1, column: 33 },
-          end: { offset: 37, line: 1, column: 38 }
+          end: { offset: 37, line: 1, column: 38 },
+          source: ' text'
         }
       })
     })
@@ -144,7 +152,8 @@ describe('compiler: parse', () => {
         content: 'a < b',
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 5, line: 1, column: 6 }
+          end: { offset: 5, line: 1, column: 6 },
+          source: 'a < b'
         }
       })
     })
@@ -164,7 +173,8 @@ describe('compiler: parse', () => {
         content: 'a {{ b',
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 6, line: 1, column: 7 }
+          end: { offset: 6, line: 1, column: 7 },
+          source: 'a {{ b'
         }
       })
     })
@@ -184,12 +194,14 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.NOT_CONSTANT,
           loc: {
             start: { offset: 2, line: 1, column: 3 },
-            end: { offset: 9, line: 1, column: 10 }
+            end: { offset: 9, line: 1, column: 10 },
+            source: 'message'
           }
         },
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 11, line: 1, column: 12 }
+          end: { offset: 11, line: 1, column: 12 },
+          source: '{{message}}'
         }
       })
     })
@@ -207,12 +219,14 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.NOT_CONSTANT,
           loc: {
             start: { offset: 3, line: 1, column: 4 },
-            end: { offset: 6, line: 1, column: 7 }
+            end: { offset: 6, line: 1, column: 7 },
+            source: 'a<b'
           }
         },
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 9, line: 1, column: 10 }
+          end: { offset: 9, line: 1, column: 10 },
+          source: '{{ a<b }}'
         }
       })
     })
@@ -231,12 +245,14 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.NOT_CONSTANT,
           loc: {
             start: { offset: 3, line: 1, column: 4 },
-            end: { offset: 6, line: 1, column: 7 }
+            end: { offset: 6, line: 1, column: 7 },
+            source: 'a<b'
           }
         },
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 9, line: 1, column: 10 }
+          end: { offset: 9, line: 1, column: 10 },
+          source: '{{ a<b }}'
         }
       })
 
@@ -249,12 +265,14 @@ describe('compiler: parse', () => {
           content: 'c>d',
           loc: {
             start: { offset: 12, line: 1, column: 13 },
-            end: { offset: 15, line: 1, column: 16 }
+            end: { offset: 15, line: 1, column: 16 },
+            source: 'c>d'
           }
         },
         loc: {
           start: { offset: 9, line: 1, column: 10 },
-          end: { offset: 18, line: 1, column: 19 }
+          end: { offset: 18, line: 1, column: 19 },
+          source: '{{ c>d }}'
         }
       })
     })
@@ -274,12 +292,14 @@ describe('compiler: parse', () => {
           content: '"</div>"',
           loc: {
             start: { offset: 8, line: 1, column: 9 },
-            end: { offset: 16, line: 1, column: 17 }
+            end: { offset: 16, line: 1, column: 17 },
+            source: '"</div>"'
           }
         },
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 19, line: 1, column: 20 }
+          end: { offset: 19, line: 1, column: 20 },
+          source: '{{ "</div>" }}'
         }
       })
     })
@@ -300,12 +320,14 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.NOT_CONSTANT,
           loc: {
             start: { offset: 4, line: 1, column: 5 },
-            end: { offset: 7, line: 1, column: 8 }
+            end: { offset: 7, line: 1, column: 8 },
+            source: 'msg'
           }
         },
         loc: {
           start: { offset: 3, line: 1, column: 4 },
-          end: { offset: 8, line: 1, column: 9 }
+          end: { offset: 8, line: 1, column: 9 },
+          source: '{msg}'
         }
       })
     })
@@ -321,7 +343,8 @@ describe('compiler: parse', () => {
         content: '',
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 7, line: 1, column: 8 }
+          end: { offset: 7, line: 1, column: 8 },
+          source: '<!---->'
         }
       })
     })
@@ -335,7 +358,8 @@ describe('compiler: parse', () => {
         content: 'abc',
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 10, line: 1, column: 11 }
+          end: { offset: 10, line: 1, column: 11 },
+          source: '<!--abc-->'
         }
       })
     })
@@ -350,7 +374,8 @@ describe('compiler: parse', () => {
         content: 'abc',
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 10, line: 1, column: 11 }
+          end: { offset: 10, line: 1, column: 11 },
+          source: '<!--abc-->'
         }
       })
       expect(comment2).toStrictEqual({
@@ -358,7 +383,8 @@ describe('compiler: parse', () => {
         content: 'def',
         loc: {
           start: { offset: 10, line: 1, column: 11 },
-          end: { offset: 20, line: 1, column: 21 }
+          end: { offset: 20, line: 1, column: 21 },
+          source: '<!--def-->'
         }
       })
     })
@@ -430,13 +456,15 @@ describe('compiler: parse', () => {
             content: 'hello',
             loc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 10, line: 1, column: 11 }
+              end: { offset: 10, line: 1, column: 11 },
+              source: 'hello'
             }
           }
         ],
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 16, line: 1, column: 17 }
+          end: { offset: 16, line: 1, column: 17 },
+          source: '<div>hello</div>'
         }
       })
     })
@@ -455,7 +483,8 @@ describe('compiler: parse', () => {
         children: [],
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 11, line: 1, column: 12 }
+          end: { offset: 11, line: 1, column: 12 },
+          source: '<div></div>'
         }
       })
     })
@@ -474,7 +503,8 @@ describe('compiler: parse', () => {
         children: [],
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 6, line: 1, column: 7 }
+          end: { offset: 6, line: 1, column: 7 },
+          source: '<div/>'
         }
       })
     })
@@ -495,7 +525,8 @@ describe('compiler: parse', () => {
         children: [],
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 5, line: 1, column: 6 }
+          end: { offset: 5, line: 1, column: 6 },
+          source: '<img>'
         }
       })
     })
@@ -516,7 +547,8 @@ describe('compiler: parse', () => {
         children: [],
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 6, line: 1, column: 7 }
+          end: { offset: 6, line: 1, column: 7 },
+          source: '<img/>'
         }
       })
     })
@@ -703,12 +735,14 @@ describe('compiler: parse', () => {
             name: 'id',
             nameLoc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 7, line: 1, column: 8 }
+              end: { offset: 7, line: 1, column: 8 },
+              source: 'id'
             },
             value: undefined,
             loc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 7, line: 1, column: 8 }
+              end: { offset: 7, line: 1, column: 8 },
+              source: 'id'
             }
           }
         ],
@@ -716,7 +750,8 @@ describe('compiler: parse', () => {
         children: [],
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 14, line: 1, column: 15 }
+          end: { offset: 14, line: 1, column: 15 },
+          source: '<div id></div>'
         }
       })
     })
@@ -737,19 +772,22 @@ describe('compiler: parse', () => {
             name: 'id',
             nameLoc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 7, line: 1, column: 8 }
+              end: { offset: 7, line: 1, column: 8 },
+              source: 'id'
             },
             value: {
               type: NodeTypes.TEXT,
               content: '',
               loc: {
                 start: { offset: 8, line: 1, column: 9 },
-                end: { offset: 10, line: 1, column: 11 }
+                end: { offset: 10, line: 1, column: 11 },
+                source: '""'
               }
             },
             loc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 10, line: 1, column: 11 }
+              end: { offset: 10, line: 1, column: 11 },
+              source: 'id=""'
             }
           }
         ],
@@ -757,7 +795,8 @@ describe('compiler: parse', () => {
         children: [],
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 17, line: 1, column: 18 }
+          end: { offset: 17, line: 1, column: 18 },
+          source: '<div id=""></div>'
         }
       })
     })
@@ -778,19 +817,22 @@ describe('compiler: parse', () => {
             name: 'id',
             nameLoc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 7, line: 1, column: 8 }
+              end: { offset: 7, line: 1, column: 8 },
+              source: 'id'
             },
             value: {
               type: NodeTypes.TEXT,
               content: '',
               loc: {
                 start: { offset: 8, line: 1, column: 9 },
-                end: { offset: 10, line: 1, column: 11 }
+                end: { offset: 10, line: 1, column: 11 },
+                source: "''"
               }
             },
             loc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 10, line: 1, column: 11 }
+              end: { offset: 10, line: 1, column: 11 },
+              source: "id=''"
             }
           }
         ],
@@ -798,7 +840,8 @@ describe('compiler: parse', () => {
         children: [],
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 17, line: 1, column: 18 }
+          end: { offset: 17, line: 1, column: 18 },
+          source: "<div id=''></div>"
         }
       })
     })
@@ -819,19 +862,22 @@ describe('compiler: parse', () => {
             name: 'id',
             nameLoc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 7, line: 1, column: 8 }
+              end: { offset: 7, line: 1, column: 8 },
+              source: 'id'
             },
             value: {
               type: NodeTypes.TEXT,
               content: ">'",
               loc: {
                 start: { offset: 8, line: 1, column: 9 },
-                end: { offset: 12, line: 1, column: 13 }
+                end: { offset: 12, line: 1, column: 13 },
+                source: '">\'"'
               }
             },
             loc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 12, line: 1, column: 13 }
+              end: { offset: 12, line: 1, column: 13 },
+              source: 'id=">\'"'
             }
           }
         ],
@@ -839,7 +885,8 @@ describe('compiler: parse', () => {
         children: [],
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 19, line: 1, column: 20 }
+          end: { offset: 19, line: 1, column: 20 },
+          source: '<div id=">\'"></div>'
         }
       })
     })
@@ -860,19 +907,22 @@ describe('compiler: parse', () => {
             name: 'id',
             nameLoc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 7, line: 1, column: 8 }
+              end: { offset: 7, line: 1, column: 8 },
+              source: 'id'
             },
             value: {
               type: NodeTypes.TEXT,
               content: '>"',
               loc: {
                 start: { offset: 8, line: 1, column: 9 },
-                end: { offset: 12, line: 1, column: 13 }
+                end: { offset: 12, line: 1, column: 13 },
+                source: "'>\"'"
               }
             },
             loc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 12, line: 1, column: 13 }
+              end: { offset: 12, line: 1, column: 13 },
+              source: "id='>\"'"
             }
           }
         ],
@@ -880,7 +930,8 @@ describe('compiler: parse', () => {
         children: [],
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 19, line: 1, column: 20 }
+          end: { offset: 19, line: 1, column: 20 },
+          source: "<div id='>\"'></div>"
         }
       })
     })
@@ -901,19 +952,22 @@ describe('compiler: parse', () => {
             name: 'id',
             nameLoc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 7, line: 1, column: 8 }
+              end: { offset: 7, line: 1, column: 8 },
+              source: 'id'
             },
             value: {
               type: NodeTypes.TEXT,
               content: 'a/',
               loc: {
                 start: { offset: 8, line: 1, column: 9 },
-                end: { offset: 10, line: 1, column: 11 }
+                end: { offset: 10, line: 1, column: 11 },
+                source: 'a/'
               }
             },
             loc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 10, line: 1, column: 11 }
+              end: { offset: 10, line: 1, column: 11 },
+              source: 'id=a/'
             }
           }
         ],
@@ -921,7 +975,8 @@ describe('compiler: parse', () => {
         children: [],
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 17, line: 1, column: 18 }
+          end: { offset: 17, line: 1, column: 18 },
+          source: '<div id=a/></div>'
         }
       })
     })
@@ -942,19 +997,22 @@ describe('compiler: parse', () => {
             name: 'id',
             nameLoc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 7, line: 1, column: 8 }
+              end: { offset: 7, line: 1, column: 8 },
+              source: 'id'
             },
             value: {
               type: NodeTypes.TEXT,
               content: 'a',
               loc: {
                 start: { offset: 8, line: 1, column: 9 },
-                end: { offset: 9, line: 1, column: 10 }
+                end: { offset: 9, line: 1, column: 10 },
+                source: 'a'
               }
             },
             loc: {
               start: { offset: 5, line: 1, column: 6 },
-              end: { offset: 9, line: 1, column: 10 }
+              end: { offset: 9, line: 1, column: 10 },
+              source: 'id=a'
             }
           },
           {
@@ -962,19 +1020,22 @@ describe('compiler: parse', () => {
             name: 'class',
             nameLoc: {
               start: { offset: 10, line: 1, column: 11 },
-              end: { offset: 15, line: 1, column: 16 }
+              end: { offset: 15, line: 1, column: 16 },
+              source: 'class'
             },
             value: {
               type: NodeTypes.TEXT,
               content: 'c',
               loc: {
                 start: { offset: 16, line: 1, column: 17 },
-                end: { offset: 19, line: 1, column: 20 }
+                end: { offset: 19, line: 1, column: 20 },
+                source: '"c"'
               }
             },
             loc: {
               start: { offset: 10, line: 1, column: 11 },
-              end: { offset: 19, line: 1, column: 20 }
+              end: { offset: 19, line: 1, column: 20 },
+              source: 'class="c"'
             }
           },
           {
@@ -982,12 +1043,14 @@ describe('compiler: parse', () => {
             name: 'inert',
             nameLoc: {
               start: { offset: 20, line: 1, column: 21 },
-              end: { offset: 25, line: 1, column: 26 }
+              end: { offset: 25, line: 1, column: 26 },
+              source: 'inert'
             },
             value: undefined,
             loc: {
               start: { offset: 20, line: 1, column: 21 },
-              end: { offset: 25, line: 1, column: 26 }
+              end: { offset: 25, line: 1, column: 26 },
+              source: 'inert'
             }
           },
           {
@@ -995,19 +1058,22 @@ describe('compiler: parse', () => {
             name: 'style',
             nameLoc: {
               start: { offset: 26, line: 1, column: 27 },
-              end: { offset: 31, line: 1, column: 32 }
+              end: { offset: 31, line: 1, column: 32 },
+              source: 'style'
             },
             value: {
               type: NodeTypes.TEXT,
               content: '',
               loc: {
                 start: { offset: 32, line: 1, column: 33 },
-                end: { offset: 34, line: 1, column: 35 }
+                end: { offset: 34, line: 1, column: 35 },
+                source: "''"
               }
             },
             loc: {
               start: { offset: 26, line: 1, column: 27 },
-              end: { offset: 34, line: 1, column: 35 }
+              end: { offset: 34, line: 1, column: 35 },
+              source: "style=''"
             }
           }
         ],
@@ -1015,7 +1081,8 @@ describe('compiler: parse', () => {
         children: [],
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 41, line: 1, column: 42 }
+          end: { offset: 41, line: 1, column: 42 },
+          source: '<div id=a class="c" inert style=\'\'></div>'
         }
       })
     })
@@ -1030,7 +1097,8 @@ describe('compiler: parse', () => {
         codegenNode: undefined,
         loc: {
           start: { column: 1, line: 1, offset: 0 },
-          end: { column: 10, line: 3, offset: 29 }
+          end: { column: 10, line: 3, offset: 29 },
+          source: '<div class=" \n\t c \t\n "></div>'
         },
         ns: Namespaces.HTML,
         props: [
@@ -1038,20 +1106,23 @@ describe('compiler: parse', () => {
             name: 'class',
             nameLoc: {
               start: { column: 6, line: 1, offset: 5 },
-              end: { column: 11, line: 1, offset: 10 }
+              end: { column: 11, line: 1, offset: 10 },
+              source: 'class'
             },
             type: NodeTypes.ATTRIBUTE,
             value: {
               content: 'c',
               loc: {
                 start: { column: 12, line: 1, offset: 11 },
-                end: { column: 3, line: 3, offset: 22 }
+                end: { column: 3, line: 3, offset: 22 },
+                source: '" \n\t c \t\n "'
               },
               type: NodeTypes.TEXT
             },
             loc: {
               start: { column: 6, line: 1, offset: 5 },
-              end: { column: 3, line: 3, offset: 22 }
+              end: { column: 3, line: 3, offset: 22 },
+              source: 'class=" \n\t c \t\n "'
             }
           }
         ],
@@ -1075,7 +1146,8 @@ describe('compiler: parse', () => {
         rawExp: undefined,
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 9, line: 1, column: 10 }
+          end: { offset: 9, line: 1, column: 10 },
+          source: 'v-if'
         }
       })
     })
@@ -1097,13 +1169,15 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.NOT_CONSTANT,
           loc: {
             start: { offset: 11, line: 1, column: 12 },
-            end: { offset: 12, line: 1, column: 13 }
+            end: { offset: 12, line: 1, column: 13 },
+            source: 'a'
           }
         },
         rawExp: 'a',
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 13, line: 1, column: 14 }
+          end: { offset: 13, line: 1, column: 14 },
+          source: 'v-if="a"'
         }
       })
     })
@@ -1123,7 +1197,8 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.CAN_STRINGIFY,
           loc: {
             start: { column: 11, line: 1, offset: 10 },
-            end: { column: 16, line: 1, offset: 15 }
+            end: { column: 16, line: 1, offset: 15 },
+            source: 'click'
           }
         },
         modifiers: [],
@@ -1131,7 +1206,8 @@ describe('compiler: parse', () => {
         rawExp: undefined,
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 15, line: 1, column: 16 }
+          end: { offset: 15, line: 1, column: 16 },
+          source: 'v-on:click'
         }
       })
     })
@@ -1178,7 +1254,8 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.NOT_CONSTANT,
           loc: {
             start: { column: 11, line: 1, offset: 10 },
-            end: { column: 18, line: 1, offset: 17 }
+            end: { column: 18, line: 1, offset: 17 },
+            source: '[event]'
           }
         },
         modifiers: [],
@@ -1186,7 +1263,8 @@ describe('compiler: parse', () => {
         rawExp: undefined,
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 17, line: 1, column: 18 }
+          end: { offset: 17, line: 1, column: 18 },
+          source: 'v-on:[event]'
         }
       })
     })
@@ -1205,7 +1283,8 @@ describe('compiler: parse', () => {
         rawExp: undefined,
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 15, line: 1, column: 16 }
+          end: { offset: 15, line: 1, column: 16 },
+          source: 'v-on.enter'
         }
       })
     })
@@ -1224,7 +1303,8 @@ describe('compiler: parse', () => {
         rawExp: undefined,
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 21, line: 1, column: 22 }
+          end: { offset: 21, line: 1, column: 22 },
+          source: 'v-on.enter.exact'
         }
       })
     })
@@ -1244,7 +1324,8 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.CAN_STRINGIFY,
           loc: {
             start: { column: 11, line: 1, offset: 10 },
-            end: { column: 16, line: 1, offset: 15 }
+            end: { column: 16, line: 1, offset: 15 },
+            source: 'click'
           }
         },
         modifiers: ['enter', 'exact'],
@@ -1252,7 +1333,8 @@ describe('compiler: parse', () => {
         rawExp: undefined,
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 27, line: 1, column: 28 }
+          end: { offset: 27, line: 1, column: 28 },
+          source: 'v-on:click.enter.exact'
         }
       })
     })
@@ -1272,7 +1354,8 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.NOT_CONSTANT,
           loc: {
             start: { column: 11, line: 1, offset: 10 },
-            end: { column: 16, line: 1, offset: 15 }
+            end: { column: 16, line: 1, offset: 15 },
+            source: '[a.b]'
           }
         },
         modifiers: ['camel'],
@@ -1280,7 +1363,8 @@ describe('compiler: parse', () => {
         rawExp: undefined,
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 21, line: 1, column: 22 }
+          end: { offset: 21, line: 1, column: 22 },
+          source: 'v-on:[a.b].camel'
         }
       })
     })
@@ -1301,11 +1385,13 @@ describe('compiler: parse', () => {
         value: undefined,
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 7, line: 1, column: 8 }
+          end: { offset: 7, line: 1, column: 8 },
+          source: 'v-'
         },
         nameLoc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 7, line: 1, column: 8 }
+          end: { offset: 7, line: 1, column: 8 },
+          source: 'v-'
         }
       })
     })
@@ -1325,7 +1411,8 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.CAN_STRINGIFY,
           loc: {
             start: { column: 7, line: 1, offset: 6 },
-            end: { column: 8, line: 1, offset: 7 }
+            end: { column: 8, line: 1, offset: 7 },
+            source: 'a'
           }
         },
         modifiers: [],
@@ -1336,13 +1423,15 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.NOT_CONSTANT,
           loc: {
             start: { offset: 8, line: 1, column: 9 },
-            end: { offset: 9, line: 1, column: 10 }
+            end: { offset: 9, line: 1, column: 10 },
+            source: 'b'
           }
         },
         rawExp: 'b',
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 9, line: 1, column: 10 }
+          end: { offset: 9, line: 1, column: 10 },
+          source: ':a=b'
         }
       })
     })
@@ -1362,7 +1451,8 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.CAN_STRINGIFY,
           loc: {
             start: { column: 7, line: 1, offset: 6 },
-            end: { column: 8, line: 1, offset: 7 }
+            end: { column: 8, line: 1, offset: 7 },
+            source: 'a'
           }
         },
         modifiers: ['prop'],
@@ -1373,13 +1463,15 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.NOT_CONSTANT,
           loc: {
             start: { offset: 8, line: 1, column: 9 },
-            end: { offset: 9, line: 1, column: 10 }
+            end: { offset: 9, line: 1, column: 10 },
+            source: 'b'
           }
         },
         rawExp: 'b',
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 9, line: 1, column: 10 }
+          end: { offset: 9, line: 1, column: 10 },
+          source: '.a=b'
         }
       })
     })
@@ -1399,7 +1491,8 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.CAN_STRINGIFY,
           loc: {
             start: { column: 7, line: 1, offset: 6 },
-            end: { column: 8, line: 1, offset: 7 }
+            end: { column: 8, line: 1, offset: 7 },
+            source: 'a'
           }
         },
         modifiers: ['sync'],
@@ -1411,13 +1504,15 @@ describe('compiler: parse', () => {
 
           loc: {
             start: { offset: 13, line: 1, column: 14 },
-            end: { offset: 14, line: 1, column: 15 }
+            end: { offset: 14, line: 1, column: 15 },
+            source: 'b'
           }
         },
         rawExp: 'b',
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 14, line: 1, column: 15 }
+          end: { offset: 14, line: 1, column: 15 },
+          source: ':a.sync=b'
         }
       })
     })
@@ -1437,7 +1532,8 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.CAN_STRINGIFY,
           loc: {
             start: { column: 7, line: 1, offset: 6 },
-            end: { column: 8, line: 1, offset: 7 }
+            end: { column: 8, line: 1, offset: 7 },
+            source: 'a'
           }
         },
         modifiers: [],
@@ -1449,13 +1545,15 @@ describe('compiler: parse', () => {
 
           loc: {
             start: { offset: 8, line: 1, column: 9 },
-            end: { offset: 9, line: 1, column: 10 }
+            end: { offset: 9, line: 1, column: 10 },
+            source: 'b'
           }
         },
         rawExp: 'b',
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 9, line: 1, column: 10 }
+          end: { offset: 9, line: 1, column: 10 },
+          source: '@a=b'
         }
       })
     })
@@ -1475,7 +1573,8 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.CAN_STRINGIFY,
           loc: {
             start: { column: 7, line: 1, offset: 6 },
-            end: { column: 8, line: 1, offset: 7 }
+            end: { column: 8, line: 1, offset: 7 },
+            source: 'a'
           }
         },
         modifiers: ['enter'],
@@ -1487,13 +1586,15 @@ describe('compiler: parse', () => {
 
           loc: {
             start: { offset: 14, line: 1, column: 15 },
-            end: { offset: 15, line: 1, column: 16 }
+            end: { offset: 15, line: 1, column: 16 },
+            source: 'b'
           }
         },
         rawExp: 'b',
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 15, line: 1, column: 16 }
+          end: { offset: 15, line: 1, column: 16 },
+          source: '@a.enter=b'
         }
       })
     })
@@ -1513,7 +1614,8 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.CAN_STRINGIFY,
           loc: {
             start: { column: 8, line: 1, offset: 7 },
-            end: { column: 9, line: 1, offset: 8 }
+            end: { column: 9, line: 1, offset: 8 },
+            source: 'a'
           }
         },
         modifiers: [],
@@ -1525,13 +1627,15 @@ describe('compiler: parse', () => {
           constType: ConstantTypes.NOT_CONSTANT,
           loc: {
             start: { offset: 10, line: 1, column: 11 },
-            end: { offset: 15, line: 1, column: 16 }
+            end: { offset: 15, line: 1, column: 16 },
+            source: '{ b }'
           }
         },
         rawExp: '{ b }',
         loc: {
           start: { offset: 6, line: 1, column: 7 },
-          end: { offset: 16, line: 1, column: 17 }
+          end: { offset: 16, line: 1, column: 17 },
+          source: '#a="{ b }"'
         }
       })
     })
@@ -1697,7 +1801,8 @@ describe('compiler: parse', () => {
         content: 'hello',
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 10, line: 1, column: 11 }
+          end: { offset: 10, line: 1, column: 11 },
+          source: 'hello'
         }
       })
     })
index d16fc1f538d98a4c2b30ddb9398fa87858075d8e..22736aab0170f815c24684678d9c14644e1f23d8 100644 (file)
@@ -76,6 +76,7 @@ export interface Node {
 export interface SourceLocation {
   start: Position
   end: Position
+  source: string
 }
 
 export interface Position {
@@ -198,11 +199,6 @@ export interface DirectiveNode extends Node {
    */
   rawName?: string
   exp: ExpressionNode | undefined
-  /**
-   * the raw expression as a string
-   * only required on directives parsed from templates
-   */
-  rawExp?: string
   arg: ExpressionNode | undefined
   modifiers: string[]
   /**
@@ -570,7 +566,8 @@ export interface ForIteratorExpression extends FunctionExpression {
 // Container types like CompoundExpression also don't need a real location.
 export const locStub: SourceLocation = {
   start: { line: 1, column: 1, offset: 0 },
-  end: { line: 1, column: 1, offset: 0 }
+  end: { line: 1, column: 1, offset: 0 },
+  source: ''
 }
 
 export function createRoot(
index 9b87c3949dfbbf167fcf259967430caeaee97855..7a808044219c57a6489635cbbb5a003d1f7c6071 100644 (file)
@@ -218,7 +218,6 @@ const tokenizer = new Tokenizer(stack, {
         name,
         rawName: raw,
         exp: undefined,
-        rawExp: undefined,
         arg: undefined,
         modifiers: raw === '.' ? ['prop'] : [],
         loc: getLoc(start)
@@ -241,7 +240,7 @@ const tokenizer = new Tokenizer(stack, {
     const arg = getSlice(start, end)
     if (inVPre) {
       ;(currentProp as AttributeNode).name += arg
-      ;(currentProp as AttributeNode).nameLoc.end = tokenizer.getPos(end)
+      setLocEnd((currentProp as AttributeNode).nameLoc, end)
     } else {
       const isStatic = arg[0] !== `[`
       ;(currentProp as DirectiveNode).arg = createSimpleExpression(
@@ -257,14 +256,14 @@ const tokenizer = new Tokenizer(stack, {
     const mod = getSlice(start, end)
     if (inVPre) {
       ;(currentProp as AttributeNode).name += '.' + mod
-      ;(currentProp as AttributeNode).nameLoc.end = tokenizer.getPos(end)
+      setLocEnd((currentProp as AttributeNode).nameLoc, end)
     } else if ((currentProp as DirectiveNode).name === 'slot') {
       // slot has no modifiers, special case for edge cases like
       // https://github.com/vuejs/language-tools/issues/2710
       const arg = (currentProp as DirectiveNode).arg
       if (arg) {
         ;(arg as SimpleExpressionNode).content += '.' + mod
-        arg.loc.end = tokenizer.getPos(end)
+        setLocEnd(arg.loc, end)
       }
     } else {
       ;(currentProp as DirectiveNode).modifiers.push(mod)
@@ -302,7 +301,7 @@ const tokenizer = new Tokenizer(stack, {
   onattribend(quote, end) {
     if (currentOpenTag && currentProp) {
       // finalize end pos
-      currentProp.loc.end = tokenizer.getPos(end)
+      setLocEnd(currentProp.loc, end)
 
       if (quote !== QuoteType.NoValue) {
         if (__BROWSER__ && currentAttrValue.includes('&')) {
@@ -345,7 +344,6 @@ const tokenizer = new Tokenizer(stack, {
           }
         } else {
           // directive
-          currentProp.rawExp = currentAttrValue
           currentProp.exp = createSimpleExpression(
             currentAttrValue,
             false,
@@ -562,7 +560,7 @@ function onText(content: string, start: number, end: number) {
   if (lastNode?.type === NodeTypes.TEXT) {
     // merge
     lastNode.content += content
-    lastNode.loc.end = tokenizer.getPos(end)
+    setLocEnd(lastNode.loc, end)
   } else {
     parent.children.push({
       type: NodeTypes.TEXT,
@@ -576,9 +574,9 @@ function onCloseTag(el: ElementNode, end: number, isImplied = false) {
   // attach end position
   if (isImplied) {
     // implied close, end should be backtracked to close
-    el.loc.end = tokenizer.getPos(backTrack(end, CharCodes.Lt))
+    setLocEnd(el.loc, backTrack(end, CharCodes.Lt))
   } else {
-    el.loc.end = tokenizer.getPos(end + fastForward(end, CharCodes.Gt) + 1)
+    setLocEnd(el.loc, end + fastForward(end, CharCodes.Gt) + 1)
   }
 
   if (tokenizer.inSFCRoot) {
@@ -588,6 +586,10 @@ function onCloseTag(el: ElementNode, end: number, isImplied = false) {
     } else {
       el.innerLoc!.end = extend({}, el.innerLoc!.start)
     }
+    el.innerLoc!.source = getSlice(
+      el.innerLoc!.start.offset,
+      el.innerLoc!.end.offset
+    )
   }
 
   // refine element type
@@ -885,10 +887,17 @@ function getLoc(start: number, end?: number): SourceLocation {
   return {
     start: tokenizer.getPos(start),
     // @ts-expect-error allow late attachment
-    end: end && tokenizer.getPos(end)
+    end: end == null ? end : tokenizer.getPos(end),
+    // @ts-expect-error allow late attachment
+    source: end == null ? end : getSlice(start, end)
   }
 }
 
+function setLocEnd(loc: SourceLocation, end: number) {
+  loc.end = tokenizer.getPos(end)
+  loc.source = getSlice(loc.start.offset, end)
+}
+
 function dirToAttr(dir: DirectiveNode): AttributeNode {
   const attr: AttributeNode = {
     type: NodeTypes.ATTRIBUTE,
index 03ccceb410150e96ef8bccdbbd3a371b32cdfac2..921f61234e71430af4e68314a8201f7ca73872a9 100644 (file)
@@ -158,7 +158,8 @@ export const transformElement: NodeTransform = (node, context) => {
           context.onError(
             createCompilerError(ErrorCodes.X_KEEP_ALIVE_INVALID_CHILDREN, {
               start: node.children[0].loc.start,
-              end: node.children[node.children.length - 1].loc.end
+              end: node.children[node.children.length - 1].loc.end,
+              source: ''
             })
           )
         }
index 22d7a43ed8f6543ff923e7c0a686f72f058980f8..4d9a2497886d259419b604adf52b1e3086ba743a 100644 (file)
@@ -337,7 +337,8 @@ export function processExpression(
         false,
         {
           start: advancePositionWithClone(node.loc.start, source, start),
-          end: advancePositionWithClone(node.loc.start, source, end)
+          end: advancePositionWithClone(node.loc.start, source, end),
+          source
         },
         id.isConstant ? ConstantTypes.CAN_STRINGIFY : ConstantTypes.NOT_CONSTANT
       )
index 3e0e1be29cdfb1a0594d80fa30034daf6b78a83e..525801f523e240327e9bfc7bb1f526edf1bf14c1 100644 (file)
@@ -31,7 +31,7 @@ export const transformModel: DirectiveTransform = (dir, node, context) => {
 
   // we assume v-model directives are always parsed
   // (not artificially created by a transform)
-  const rawExp = dir.rawExp!
+  const rawExp = exp.loc.source
   const expString =
     exp.type === NodeTypes.SIMPLE_EXPRESSION ? exp.content : rawExp
 
index bda24656b6fa2e582a380335f88a2dfa396b1cce..62c21f40dbcf8ff06fadfef06399bc9069735c78 100644 (file)
@@ -26,7 +26,8 @@ describe('DOM parser', () => {
         content: 'some<div>text</div>and<!--comment-->',
         loc: {
           start: { offset: 10, line: 1, column: 11 },
-          end: { offset: 46, line: 1, column: 47 }
+          end: { offset: 46, line: 1, column: 47 },
+          source: 'some<div>text</div>and<!--comment-->'
         }
       })
     })
@@ -41,7 +42,8 @@ describe('DOM parser', () => {
         content: '&',
         loc: {
           start: { offset: 10, line: 1, column: 11 },
-          end: { offset: 15, line: 1, column: 16 }
+          end: { offset: 15, line: 1, column: 16 },
+          source: '&amp;'
         }
       })
     })
@@ -75,7 +77,8 @@ describe('DOM parser', () => {
         content: 'some<div>text</div>and<!--comment-->',
         loc: {
           start: { offset: 7, line: 1, column: 8 },
-          end: { offset: 43, line: 1, column: 44 }
+          end: { offset: 43, line: 1, column: 44 },
+          source: 'some<div>text</div>and<!--comment-->'
         }
       })
     })
@@ -90,7 +93,8 @@ describe('DOM parser', () => {
         content: '&amp;',
         loc: {
           start: { offset: 7, line: 1, column: 8 },
-          end: { offset: 12, line: 1, column: 13 }
+          end: { offset: 12, line: 1, column: 13 },
+          source: '&amp;'
         }
       })
     })
@@ -104,7 +108,8 @@ describe('DOM parser', () => {
         content: 'some text',
         loc: {
           start: { offset: 14, line: 1, column: 15 },
-          end: { offset: 23, line: 1, column: 24 }
+          end: { offset: 23, line: 1, column: 24 },
+          source: 'some text'
         }
       })
     })
@@ -175,7 +180,8 @@ describe('DOM parser', () => {
         content: '&ersand;',
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 11, line: 1, column: 12 }
+          end: { offset: 11, line: 1, column: 12 },
+          source: '&ampersand;'
         }
       })
     })
@@ -196,7 +202,8 @@ describe('DOM parser', () => {
         content: '&ampersand;',
         loc: {
           start: { offset: 7, line: 1, column: 8 },
-          end: { offset: 20, line: 1, column: 21 }
+          end: { offset: 20, line: 1, column: 21 },
+          source: '"&ampersand;"'
         }
       })
       expect(text2).toStrictEqual({
@@ -204,7 +211,8 @@ describe('DOM parser', () => {
         content: '&ersand;',
         loc: {
           start: { offset: 23, line: 1, column: 24 },
-          end: { offset: 37, line: 1, column: 38 }
+          end: { offset: 37, line: 1, column: 38 },
+          source: '"&amp;ersand;"'
         }
       })
       expect(text3).toStrictEqual({
@@ -212,7 +220,8 @@ describe('DOM parser', () => {
         content: '&!',
         loc: {
           start: { offset: 40, line: 1, column: 41 },
-          end: { offset: 47, line: 1, column: 48 }
+          end: { offset: 47, line: 1, column: 48 },
+          source: '"&amp!"'
         }
       })
     })
@@ -226,7 +235,8 @@ describe('DOM parser', () => {
         content: '†',
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 6, line: 1, column: 7 }
+          end: { offset: 6, line: 1, column: 7 },
+          source: '&#x86;'
         }
       })
     })
@@ -247,12 +257,14 @@ describe('DOM parser', () => {
           constType: ConstantTypes.NOT_CONSTANT,
           loc: {
             start: { offset: 8, line: 1, column: 9 },
-            end: { offset: 16, line: 1, column: 17 }
+            end: { offset: 16, line: 1, column: 17 },
+            source: 'a &lt; b'
           }
         },
         loc: {
           start: { offset: 5, line: 1, column: 6 },
-          end: { offset: 19, line: 1, column: 20 }
+          end: { offset: 19, line: 1, column: 20 },
+          source: '{{ a &lt; b }}'
         }
       })
     })
@@ -272,7 +284,8 @@ describe('DOM parser', () => {
         children: [],
         loc: {
           start: { offset: 0, line: 1, column: 1 },
-          end: { offset: 5, line: 1, column: 6 }
+          end: { offset: 5, line: 1, column: 6 },
+          source: '<img>'
         },
         codegenNode: undefined
       })
@@ -314,7 +327,8 @@ describe('DOM parser', () => {
         content: 'hello</textarea</textarea0>',
         loc: {
           start: { offset: 10, line: 1, column: 11 },
-          end: { offset: 37, line: 1, column: 38 }
+          end: { offset: 37, line: 1, column: 38 },
+          source: 'hello</textarea</textarea0>'
         }
       })
     })
index d9e6b988d77296eb8413811b2f6d998f0e760bc5..970f16faf6a601347a926322a0aa9469354bb9c5 100644 (file)
@@ -27,7 +27,8 @@ export const transformTransition: NodeTransform = (node, context) => {
               DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN,
               {
                 start: node.children[0].loc.start,
-                end: node.children[node.children.length - 1].loc.end
+                end: node.children[node.children.length - 1].loc.end,
+                source: ''
               }
             )
           )