diff --git a/packages/@lwc/errors/src/compiler/error-info/index.ts b/packages/@lwc/errors/src/compiler/error-info/index.ts index 55f70e8f28..4129bedf60 100644 --- a/packages/@lwc/errors/src/compiler/error-info/index.ts +++ b/packages/@lwc/errors/src/compiler/error-info/index.ts @@ -5,7 +5,7 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ /** - * Next error code: 1207 + * Next error code: 1209 */ export * from './compiler'; diff --git a/packages/@lwc/errors/src/compiler/error-info/template-transform.ts b/packages/@lwc/errors/src/compiler/error-info/template-transform.ts index 3a86c7f486..70fa8f14b0 100644 --- a/packages/@lwc/errors/src/compiler/error-info/template-transform.ts +++ b/packages/@lwc/errors/src/compiler/error-info/template-transform.ts @@ -979,4 +979,20 @@ export const ParserDiagnostics = { level: DiagnosticLevel.Error, url: '', }, + + COMPUTED_PROPERTY_ACCESS_NOT_ALLOWED_COMPLEX: { + code: 1207, + message: + 'Template expression doesn\'t allow computed property access unless the expression is surrounded by quotes: "{0}"', + level: DiagnosticLevel.Error, + url: '', + }, + + INVALID_NODE_COMPLEX: { + code: 1208, + message: + 'Template expression doesn\'t allow {0} unless the expression is surrounded by quotes: "{1}"', + level: DiagnosticLevel.Error, + url: '', + }, }; diff --git a/packages/@lwc/perf-benchmarks-components/src/benchmark/expression/expression.html b/packages/@lwc/perf-benchmarks-components/src/benchmark/expression/expression.html index 357a427a1b..465cb4a1ee 100644 --- a/packages/@lwc/perf-benchmarks-components/src/benchmark/expression/expression.html +++ b/packages/@lwc/perf-benchmarks-components/src/benchmark/expression/expression.html @@ -5,7 +5,7 @@ For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT --> \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/compatibility/directive-if/template-expression/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/compatibility/directive-if/template-expression/ast.json index c5ea53b27b..02313ea19c 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/compatibility/directive-if/template-expression/ast.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/compatibility/directive-if/template-expression/ast.json @@ -112,39 +112,41 @@ "raw": "{foo}", "value": { "type": "Identifier", - "start": 80, - "end": 83, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 16 - } - }, - "range": [ - 80, - 83 - ], + "start": 1, + "end": 4, "name": "foo", "location": { - "startLine": 4, - "startColumn": 13, - "endLine": 5, - "endColumn": 13, - "start": 79, - "end": 97 + "startLine": 3, + "startColumn": 42, + "endLine": 6, + "endColumn": 9, + "start": 66, + "end": 111 } }, "location": { - "startLine": 4, - "startColumn": 13, - "endLine": 5, - "endColumn": 13, - "start": 79, - "end": 97 + "startLine": 3, + "startColumn": 42, + "endLine": 6, + "endColumn": 9, + "start": 66, + "end": 111 + } + }, + { + "type": "Text", + "raw": " ", + "value": { + "type": "Literal", + "value": " " + }, + "location": { + "startLine": 3, + "startColumn": 42, + "endLine": 6, + "endColumn": 9, + "start": 66, + "end": 111 } }, { @@ -152,38 +154,24 @@ "raw": "{bar}", "value": { "type": "Identifier", - "start": 98, - "end": 101, - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 16 - } - }, - "range": [ - 98, - 101 - ], + "start": 7, + "end": 10, "name": "bar", "location": { - "startLine": 5, - "startColumn": 13, + "startLine": 3, + "startColumn": 42, "endLine": 6, "endColumn": 9, - "start": 97, + "start": 66, "end": 111 } }, "location": { - "startLine": 5, - "startColumn": 13, + "startLine": 3, + "startColumn": 42, "endLine": 6, "endColumn": 9, - "start": 97, + "start": 66, "end": 111 } } diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/compatibility/directive-if/template-expression/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/compatibility/directive-if/template-expression/expected.js index 7486a6129e..3d0477e12e 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/compatibility/directive-if/template-expression/expected.js +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/compatibility/directive-if/template-expression/expected.js @@ -9,7 +9,9 @@ function tmpl($api, $cmp, $slotset, $ctx) { return [ api_element("section", stc0, [ $cmp.state.isTrue - ? api_text(api_dynamic_text($cmp.foo) + api_dynamic_text($cmp.bar)) + ? api_text( + api_dynamic_text($cmp.foo) + " " + api_dynamic_text($cmp.bar) + ) : null, ]), ]; diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-async/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-async/actual.html index 7b9d86cc8b..98c17f9430 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-async/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-async/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-async/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-async/metadata.json index 072ad08348..125a391f66 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-async/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-async/metadata.json @@ -6,9 +6,9 @@ "level": 1, "location": { "line": 3, - "column": 25, - "start": 50, - "length": 25 + "column": 17, + "start": 41, + "length": 37 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-block-body/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-block-body/actual.html index 83c8c6fd6e..4119f90fe5 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-block-body/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-block-body/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-block-body/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-block-body/metadata.json index 834029698c..13f365157e 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-block-body/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/arrow-function-block-body/metadata.json @@ -6,9 +6,9 @@ "level": 1, "location": { "line": 3, - "column": 25, - "start": 50, - "length": 24 + "column": 17, + "start": 41, + "length": 36 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/assignment-outside-arrow/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/assignment-outside-arrow/actual.html index 5372eeb66a..462eb584fa 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/assignment-outside-arrow/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/assignment-outside-arrow/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/assignment-outside-arrow/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/assignment-outside-arrow/metadata.json index 1afa9ed630..42d78ad3e4 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/assignment-outside-arrow/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/assignment-outside-arrow/metadata.json @@ -6,9 +6,9 @@ "level": 1, "location": { "line": 3, - "column": 25, - "start": 50, - "length": 15 + "column": 17, + "start": 41, + "length": 27 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/await/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/await/actual.html index 443d261dfe..8b79924f62 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/await/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/await/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/await/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/await/metadata.json index 7cd08ff00b..c72b606d59 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/await/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/await/metadata.json @@ -6,9 +6,9 @@ "level": 1, "location": { "line": 3, - "column": 25, - "start": 50, - "length": 11 + "column": 17, + "start": 41, + "length": 23 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/bigint-literal/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/bigint-literal/actual.html index df48808c74..c1bbb84453 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/bigint-literal/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/bigint-literal/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/bigint-literal/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/bigint-literal/metadata.json index c98ec2989a..ac275cc1e9 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/bigint-literal/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/bigint-literal/metadata.json @@ -6,9 +6,9 @@ "level": 1, "location": { "line": 3, - "column": 22, - "start": 47, - "length": 19 + "column": 18, + "start": 42, + "length": 27 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/class-expr/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/class-expr/actual.html index 904ab24ee9..2014e4c04c 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/class-expr/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/class-expr/actual.html @@ -1,9 +1,9 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/class-expr/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/class-expr/metadata.json index c855828f9a..dfbce8e407 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/class-expr/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/class-expr/metadata.json @@ -5,10 +5,10 @@ "message": "Invalid expression {\n class Bar {\n method() {}\n }\n } - LWC1196: Use of classes is disallowed within template expressions.", "level": 1, "location": { - "line": 4, - "column": 12, - "start": 62, - "length": 53 + "line": 3, + "column": 16, + "start": 40, + "length": 87 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comma-operator/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comma-operator/actual.html index 8a19cbc670..7e4c3e9d56 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comma-operator/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comma-operator/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comma-operator/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comma-operator/metadata.json index da7a6c9568..2d44455d65 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comma-operator/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comma-operator/metadata.json @@ -2,13 +2,13 @@ "warnings": [ { "code": 1196, - "message": "Invalid expression {(one(), two(), three(), iAmTheCount())} - LWC1196: Use of comma operators is disallowed within template expressions.", + "message": "Invalid expression {one(), two(), three(), iAmTheCount()} - LWC1196: Use of comma operators is disallowed within template expressions.", "level": 1, "location": { "line": 3, - "column": 26, - "start": 51, - "length": 36 + "column": 17, + "start": 41, + "length": 48 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comments/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comments/actual.html index 1e892981b3..d006bf86ee 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comments/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comments/actual.html @@ -1,8 +1,8 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comments/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comments/metadata.json index 12515509a7..c9c7d80c15 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comments/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/comments/metadata.json @@ -2,8 +2,14 @@ "warnings": [ { "code": 1197, - "message": "Unexpected compilation error: LWC1197: Use of comments is disallowed within template expressions.", - "level": 1 + "message": "Invalid expression {\n /* what do you think ? */\n someValue\n } - LWC1197: Use of comments is disallowed within template expressions.", + "level": 1, + "location": { + "line": 3, + "column": 16, + "start": 40, + "length": 79 + } } ] } \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/delete-operator/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/delete-operator/actual.html index 6bcb80ee5e..ada7d2e1eb 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/delete-operator/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/delete-operator/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/delete-operator/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/delete-operator/metadata.json index af2fa0e971..bb5a747c95 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/delete-operator/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/delete-operator/metadata.json @@ -6,9 +6,9 @@ "level": 1, "location": { "line": 3, - "column": 25, - "start": 50, - "length": 16 + "column": 17, + "start": 41, + "length": 28 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/function-expr/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/function-expr/actual.html index 28b8ea3fe9..b5cce8563d 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/function-expr/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/function-expr/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/function-expr/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/function-expr/metadata.json index fdcd8ef506..5ac6889b0d 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/function-expr/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/function-expr/metadata.json @@ -6,9 +6,9 @@ "level": 1, "location": { "line": 3, - "column": 33, - "start": 58, - "length": 40 + "column": 18, + "start": 42, + "length": 59 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/actual.html new file mode 100644 index 0000000000..aa8e27f77f --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/actual.html @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/ast.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/ast.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/config.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/config.json new file mode 100644 index 0000000000..1f1b15380f --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/config.json @@ -0,0 +1,3 @@ +{ + "experimentalComplexExpressions": true +} diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/expected.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/metadata.json new file mode 100644 index 0000000000..b84381cd83 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true-attr/metadata.json @@ -0,0 +1,15 @@ +{ + "warnings": [ + { + "code": 1083, + "message": "LWC1083: Error parsing template expression: Invalid expression {foo < bar} - Unexpected character '6' (1:7)", + "level": 1, + "location": { + "line": 3, + "column": 12, + "start": 125, + "length": 15 + } + } + ] +} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/actual.html new file mode 100644 index 0000000000..aa8e27f77f --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/actual.html @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/ast.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/ast.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/config.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/config.json new file mode 100644 index 0000000000..1f1b15380f --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/config.json @@ -0,0 +1,3 @@ +{ + "experimentalComplexExpressions": true +} diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/expected.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/metadata.json new file mode 100644 index 0000000000..b84381cd83 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/experimental-complex-expressions-true/metadata.json @@ -0,0 +1,15 @@ +{ + "warnings": [ + { + "code": 1083, + "message": "LWC1083: Error parsing template expression: Invalid expression {foo < bar} - Unexpected character '6' (1:7)", + "level": 1, + "location": { + "line": 3, + "column": 12, + "start": 125, + "length": 15 + } + } + ] +} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/actual.html new file mode 100644 index 0000000000..81f6959315 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/actual.html @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/ast.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/ast.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/config.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/config.json new file mode 100644 index 0000000000..7f94823d90 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/config.json @@ -0,0 +1,4 @@ +{ + "enableStaticContentOptimization": false, + "experimentalComplexExpressions": true +} diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/expected.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/metadata.json new file mode 100644 index 0000000000..7fb90a1841 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false-attr/metadata.json @@ -0,0 +1,15 @@ +{ + "warnings": [ + { + "code": 1083, + "message": "LWC1083: Error parsing template expression: Invalid expression {foo < bar} - Unexpected character '6' (1:7)", + "level": 1, + "location": { + "line": 3, + "column": 12, + "start": 125, + "length": 22 + } + } + ] +} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/actual.html new file mode 100644 index 0000000000..81f6959315 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/actual.html @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/ast.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/ast.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/config.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/config.json new file mode 100644 index 0000000000..7f94823d90 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/config.json @@ -0,0 +1,4 @@ +{ + "enableStaticContentOptimization": false, + "experimentalComplexExpressions": true +} diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/expected.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/metadata.json new file mode 100644 index 0000000000..7fb90a1841 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-decoding/static-content-optimization-false/metadata.json @@ -0,0 +1,15 @@ +{ + "warnings": [ + { + "code": 1083, + "message": "LWC1083: Error parsing template expression: Invalid expression {foo < bar} - Unexpected character '6' (1:7)", + "level": 1, + "location": { + "line": 3, + "column": 12, + "start": 125, + "length": 22 + } + } + ] +} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/actual.html new file mode 100644 index 0000000000..5026819d07 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/actual.html @@ -0,0 +1,5 @@ + diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/ast.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/ast.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/config.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/config.json new file mode 100644 index 0000000000..1f1b15380f --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/config.json @@ -0,0 +1,3 @@ +{ + "experimentalComplexExpressions": true +} diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/expected.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/metadata.json new file mode 100644 index 0000000000..0a7f9f7841 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-attr/metadata.json @@ -0,0 +1,15 @@ +{ + "warnings": [ + { + "code": 1083, + "message": "LWC1083: Error parsing template expression: Invalid expression {() => call( - Unexpected token (1:12)", + "level": 1, + "location": { + "line": 3, + "column": 16, + "start": 40, + "length": 19 + } + } + ] +} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/actual.html new file mode 100644 index 0000000000..c9310065d6 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/actual.html @@ -0,0 +1,7 @@ + diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/ast.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/ast.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/config.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/config.json new file mode 100644 index 0000000000..1f1b15380f --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/config.json @@ -0,0 +1,3 @@ +{ + "experimentalComplexExpressions": true +} diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/expected.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/metadata.json new file mode 100644 index 0000000000..1d43449667 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/html-special-chars-text-node/metadata.json @@ -0,0 +1,15 @@ +{ + "warnings": [ + { + "code": 1083, + "message": "LWC1083: Error parsing template expression: Invalid expression {() => foo(\"} - Unterminated string constant (1:11)", + "level": 1, + "location": { + "line": 3, + "column": 16, + "start": 40, + "length": 26 + } + } + ] +} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import-meta/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import-meta/actual.html index 84ff5ed962..bcb68ac353 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import-meta/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import-meta/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import-meta/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import-meta/metadata.json index 929441d4a4..75fcb100f3 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import-meta/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import-meta/metadata.json @@ -1,12 +1,14 @@ { "warnings": [ { - "code": 1052, - "message": "Unexpected compilation error: LWC1052: Error parsing attribute: Cannot use 'import.meta' outside a module (3:39)", + "code": 1083, + "message": "LWC1083: Error parsing template expression: Invalid expression {() => doThing(import.meta.env.SSR)} - Cannot use 'import.meta' outside a module (1:15)", "level": 1, "location": { "line": 3, - "column": 39 + "column": 17, + "start": 41, + "length": 46 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import/actual.html index 2e433ccc0c..cfb4be22af 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import/metadata.json index 022f61d079..8f5504f00c 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/import/metadata.json @@ -6,9 +6,9 @@ "level": 1, "location": { "line": 3, - "column": 25, - "start": 50, - "length": 40 + "column": 17, + "start": 41, + "length": 52 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/actual.html new file mode 100644 index 0000000000..e83d5652f5 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/actual.html @@ -0,0 +1,10 @@ + diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/ast.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/ast.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/config.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/config.json new file mode 100644 index 0000000000..1f1b15380f --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/config.json @@ -0,0 +1,3 @@ +{ + "experimentalComplexExpressions": true +} diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/expected.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/metadata.json new file mode 100644 index 0000000000..897b276e26 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/less-than-unsupported-text-node/metadata.json @@ -0,0 +1,15 @@ +{ + "warnings": [ + { + "code": 1058, + "message": "LWC1058: Invalid HTML syntax: invalid-first-character-of-tag-name. For more information, please visit https://html.spec.whatwg.org/multipage/parsing.html#parse-error-invalid-first-character-of-tag-name", + "level": 1, + "location": { + "line": 8, + "column": 22, + "start": 262, + "length": 0 + } + } + ] +} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/new-operator/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/new-operator/actual.html index 7d707ee56d..4455ae723f 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/new-operator/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/new-operator/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/new-operator/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/new-operator/metadata.json index a1c04d87e7..3f63509ea2 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/new-operator/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/new-operator/metadata.json @@ -6,9 +6,9 @@ "level": 1, "location": { "line": 3, - "column": 23, - "start": 48, - "length": 15 + "column": 16, + "start": 40, + "length": 26 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/regexp-literal/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/regexp-literal/actual.html index 80884d319c..0220011fed 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/regexp-literal/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/regexp-literal/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/regexp-literal/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/regexp-literal/metadata.json index 044f6cb402..9609d0a88f 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/regexp-literal/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/regexp-literal/metadata.json @@ -6,9 +6,9 @@ "level": 1, "location": { "line": 3, - "column": 25, - "start": 50, - "length": 10 + "column": 18, + "start": 42, + "length": 21 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/super/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/super/actual.html index 7ddb82cacc..ad3588ca52 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/super/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/super/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/super/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/super/metadata.json index e67c88ebce..7f1124c446 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/super/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/super/metadata.json @@ -1,12 +1,14 @@ { "warnings": [ { - "code": 1052, - "message": "Unexpected compilation error: LWC1052: Error parsing attribute: 'super' keyword outside a method (3:25)", + "code": 1083, + "message": "LWC1083: Error parsing template expression: Invalid expression {super('duper')} - 'super' keyword outside a method (1:1)", "level": 1, "location": { "line": 3, - "column": 25 + "column": 17, + "start": 41, + "length": 26 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/this/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/this/actual.html index f983765faa..c827c92ac8 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/this/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/this/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/this/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/this/metadata.json index 622b89a5ab..d6788165cd 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/this/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/this/metadata.json @@ -6,9 +6,9 @@ "level": 1, "location": { "line": 3, - "column": 21, - "start": 46, - "length": 8 + "column": 17, + "start": 41, + "length": 16 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/throw/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/throw/actual.html index 40674b5e76..efae0e536e 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/throw/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/throw/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/throw/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/throw/metadata.json index e568c58e26..192fbcc47b 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/throw/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/throw/metadata.json @@ -1,12 +1,14 @@ { "warnings": [ { - "code": 1052, - "message": "Unexpected compilation error: LWC1052: Error parsing attribute: Unexpected token (3:31)", + "code": 1083, + "message": "LWC1083: Error parsing template expression: Invalid expression {() => throw 'oh no!'} - Unexpected token (1:7)", "level": 1, "location": { "line": 3, - "column": 31 + "column": 17, + "start": 41, + "length": 32 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/actual.html new file mode 100644 index 0000000000..40f0011197 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/actual.html @@ -0,0 +1,6 @@ + diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/ast.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/ast.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/config.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/config.json new file mode 100644 index 0000000000..1f1b15380f --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/config.json @@ -0,0 +1,3 @@ +{ + "experimentalComplexExpressions": true +} diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/expected.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/metadata.json new file mode 100644 index 0000000000..9b150de722 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-complex-expression/metadata.json @@ -0,0 +1,15 @@ +{ + "warnings": [ + { + "code": 1208, + "message": "Invalid expression {bar()} - LWC1208: Template expression doesn't allow CallExpression unless the expression is surrounded by quotes: \"{bar()}\"", + "level": 1, + "location": { + "line": 4, + "column": 16, + "start": 111, + "length": 12 + } + } + ] +} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/actual.html new file mode 100644 index 0000000000..2a6042b7f3 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/actual.html @@ -0,0 +1,6 @@ + diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/ast.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/ast.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/config.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/config.json new file mode 100644 index 0000000000..1f1b15380f --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/config.json @@ -0,0 +1,3 @@ +{ + "experimentalComplexExpressions": true +} diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/expected.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/metadata.json new file mode 100644 index 0000000000..b522807464 --- /dev/null +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/unquoted-attribute-computed-expression/metadata.json @@ -0,0 +1,15 @@ +{ + "warnings": [ + { + "code": 1207, + "message": "Invalid expression {list[0].name} - LWC1207: Template expression doesn't allow computed property access unless the expression is surrounded by quotes: \"{list[0].name}\"", + "level": 1, + "location": { + "line": 4, + "column": 16, + "start": 111, + "length": 19 + } + } + ] +} \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/update-outside-arrow/attribute/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/update-outside-arrow/attribute/actual.html index 6bd8e6d6f1..ae69cb6f91 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/update-outside-arrow/attribute/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/update-outside-arrow/attribute/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/update-outside-arrow/attribute/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/update-outside-arrow/attribute/metadata.json index 6c64ab33ed..62bc290eed 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/update-outside-arrow/attribute/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/update-outside-arrow/attribute/metadata.json @@ -6,9 +6,9 @@ "level": 1, "location": { "line": 3, - "column": 25, - "start": 50, - "length": 5 + "column": 17, + "start": 41, + "length": 17 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/update-outside-arrow/text-content/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/update-outside-arrow/text-content/metadata.json index a0820de186..70275ffbdd 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/update-outside-arrow/text-content/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/update-outside-arrow/text-content/metadata.json @@ -7,8 +7,8 @@ "location": { "line": 3, "column": 17, - "start": 42, - "length": 10 + "start": 41, + "length": 12 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/yield/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/yield/actual.html index 319c6e31cb..03d93b30ef 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/yield/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/yield/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/yield/metadata.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/yield/metadata.json index 92e737301b..961c5e28d3 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/yield/metadata.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/invalid/yield/metadata.json @@ -2,8 +2,14 @@ "warnings": [ { "code": 1083, - "message": "Unexpected compilation error: LWC1083: Error parsing template expression: expression must end with curly brace.", - "level": 1 + "message": "Invalid expression {yield bar} - LWC1083: Error parsing template expression: expression must end with curly brace.", + "level": 1, + "location": { + "line": 3, + "column": 17, + "start": 41, + "length": 17 + } } ] } \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/array-expr/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/array-expr/actual.html index 703e2345f4..4375831f07 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/array-expr/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/array-expr/actual.html @@ -1,6 +1,6 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/array-expr/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/array-expr/ast.json index 1077cc1416..244f5d23ab 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/array-expr/ast.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/array-expr/ast.json @@ -7,7 +7,7 @@ "endLine": 6, "endColumn": 12, "start": 0, - "end": 136, + "end": 138, "startTag": { "startLine": 1, "startColumn": 1, @@ -21,8 +21,8 @@ "startColumn": 1, "endLine": 6, "endColumn": 12, - "start": 125, - "end": 136 + "start": 127, + "end": 138 } }, "directives": [], @@ -37,7 +37,7 @@ "endLine": 5, "endColumn": 15, "start": 15, - "end": 124, + "end": 126, "startTag": { "startLine": 2, "startColumn": 5, @@ -51,8 +51,8 @@ "startColumn": 5, "endLine": 5, "endColumn": 15, - "start": 114, - "end": 124 + "start": 116, + "end": 126 } }, "attributes": [], @@ -68,24 +68,24 @@ "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 48, + "endColumn": 50, "start": 33, - "end": 72, + "end": 74, "startTag": { "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 39, + "endColumn": 41, "start": 33, - "end": 63 + "end": 65 }, "endTag": { "startLine": 3, - "startColumn": 39, + "startColumn": 41, "endLine": 3, - "endColumn": 48, - "start": 63, - "end": 72 + "endColumn": 50, + "start": 65, + "end": 74 } }, "attributes": [], @@ -124,18 +124,18 @@ "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 38, + "endColumn": 40, "start": 41, - "end": 62 + "end": 64 } }, "location": { "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 38, + "endColumn": 40, "start": 41, - "end": 62 + "end": 64 } } ], @@ -148,118 +148,34 @@ "raw": "{['flop', floo, 2].join('')}", "value": { "type": "CallExpression", - "start": 82, - "end": 108, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 35 - } - }, - "range": [ - 82, - 108 - ], + "start": 1, + "end": 27, "callee": { "type": "MemberExpression", - "start": 82, - "end": 104, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 31 - } - }, - "range": [ - 82, - 104 - ], + "start": 1, + "end": 23, "object": { "type": "ArrayExpression", - "start": 82, - "end": 99, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 26 - } - }, - "range": [ - 82, - 99 - ], + "start": 1, + "end": 18, "elements": [ { "type": "Literal", - "start": 83, - "end": 89, - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 16 - } - }, - "range": [ - 83, - 89 - ], + "start": 2, + "end": 8, "value": "flop", "raw": "'flop'" }, { "type": "Identifier", - "start": 91, - "end": 95, - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 22 - } - }, - "range": [ - 91, - 95 - ], + "start": 10, + "end": 14, "name": "floo" }, { "type": "Literal", - "start": 97, - "end": 98, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 25 - } - }, - "range": [ - 97, - 98 - ], + "start": 16, + "end": 17, "value": 2, "raw": "2" } @@ -267,22 +183,8 @@ }, "property": { "type": "Identifier", - "start": 100, - "end": 104, - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 31 - } - }, - "range": [ - 100, - 104 - ], + "start": 19, + "end": 23, "name": "join" }, "computed": false, @@ -291,43 +193,29 @@ "arguments": [ { "type": "Literal", - "start": 105, - "end": 107, - "loc": { - "start": { - "line": 4, - "column": 32 - }, - "end": { - "line": 4, - "column": 34 - } - }, - "range": [ - 105, - 107 - ], + "start": 24, + "end": 26, "value": "", "raw": "''" } ], "optional": false, "location": { - "startLine": 4, - "startColumn": 9, - "endLine": 4, - "endColumn": 37, - "start": 81, - "end": 109 + "startLine": 3, + "startColumn": 50, + "endLine": 5, + "endColumn": 5, + "start": 74, + "end": 116 } }, "location": { - "startLine": 4, - "startColumn": 9, - "endLine": 4, - "endColumn": 37, - "start": 81, - "end": 109 + "startLine": 3, + "startColumn": 50, + "endLine": 5, + "endColumn": 5, + "start": 74, + "end": 116 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/arrowfn-scoped-vars/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/arrowfn-scoped-vars/actual.html index a3a103a836..7faed23141 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/arrowfn-scoped-vars/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/arrowfn-scoped-vars/actual.html @@ -1,10 +1,10 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/arrowfn-scoped-vars/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/arrowfn-scoped-vars/ast.json index 2d6f2180bb..ed667367ba 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/arrowfn-scoped-vars/ast.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/arrowfn-scoped-vars/ast.json @@ -7,7 +7,7 @@ "endLine": 10, "endColumn": 12, "start": 0, - "end": 188, + "end": 190, "startTag": { "startLine": 1, "startColumn": 1, @@ -21,8 +21,8 @@ "startColumn": 1, "endLine": 10, "endColumn": 12, - "start": 177, - "end": 188 + "start": 179, + "end": 190 } }, "directives": [], @@ -37,22 +37,22 @@ "endLine": 9, "endColumn": 15, "start": 15, - "end": 176, + "end": 178, "startTag": { "startLine": 2, "startColumn": 5, "endLine": 9, "endColumn": 6, "start": 15, - "end": 167 + "end": 169 }, "endTag": { "startLine": 9, "startColumn": 6, "endLine": 9, "endColumn": 15, - "start": 167, - "end": 176 + "start": 169, + "end": 178 } }, "attributes": [], @@ -178,18 +178,18 @@ "startLine": 3, "startColumn": 9, "endLine": 8, - "endColumn": 11, + "endColumn": 12, "start": 31, - "end": 161 + "end": 163 } }, "location": { "startLine": 3, "startColumn": 9, "endLine": 8, - "endColumn": 11, + "endColumn": 12, "start": 31, - "end": 161 + "end": 163 } } ], diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/assignment-inside-arrow/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/assignment-inside-arrow/actual.html index 6a2cc5fce1..f8eaca1ae9 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/assignment-inside-arrow/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/assignment-inside-arrow/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/assignment-inside-arrow/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/assignment-inside-arrow/ast.json index 98640a30a1..c0cf7aefcd 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/assignment-inside-arrow/ast.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/assignment-inside-arrow/ast.json @@ -7,7 +7,7 @@ "endLine": 5, "endColumn": 12, "start": 0, - "end": 109, + "end": 111, "startTag": { "startLine": 1, "startColumn": 1, @@ -21,8 +21,8 @@ "startColumn": 1, "endLine": 5, "endColumn": 12, - "start": 98, - "end": 109 + "start": 100, + "end": 111 } }, "directives": [], @@ -37,7 +37,7 @@ "endLine": 4, "endColumn": 15, "start": 15, - "end": 97, + "end": 99, "startTag": { "startLine": 2, "startColumn": 5, @@ -51,8 +51,8 @@ "startColumn": 5, "endLine": 4, "endColumn": 15, - "start": 87, - "end": 97 + "start": 89, + "end": 99 } }, "attributes": [], @@ -68,24 +68,24 @@ "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 58, + "endColumn": 60, "start": 33, - "end": 82, + "end": 84, "startTag": { "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 49, + "endColumn": 51, "start": 33, - "end": 73 + "end": 75 }, "endTag": { "startLine": 3, - "startColumn": 49, + "startColumn": 51, "endLine": 3, - "endColumn": 58, - "start": 73, - "end": 82 + "endColumn": 60, + "start": 75, + "end": 84 } }, "attributes": [], @@ -127,18 +127,18 @@ "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 48, + "endColumn": 50, "start": 41, - "end": 72 + "end": 74 } }, "location": { "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 48, + "endColumn": 50, "start": 41, - "end": 72 + "end": 74 } } ], diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-arithmetic/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-arithmetic/actual.html index 4dfe3589c4..fddd0ca932 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-arithmetic/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-arithmetic/actual.html @@ -1,8 +1,8 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-arithmetic/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-arithmetic/ast.json index 481bf10998..5e3ca422c5 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-arithmetic/ast.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-arithmetic/ast.json @@ -7,7 +7,7 @@ "endLine": 8, "endColumn": 12, "start": 0, - "end": 269, + "end": 277, "startTag": { "startLine": 1, "startColumn": 1, @@ -21,8 +21,8 @@ "startColumn": 1, "endLine": 8, "endColumn": 12, - "start": 258, - "end": 269 + "start": 266, + "end": 277 } }, "directives": [], @@ -37,7 +37,7 @@ "endLine": 7, "endColumn": 15, "start": 15, - "end": 257, + "end": 265, "startTag": { "startLine": 2, "startColumn": 5, @@ -51,8 +51,8 @@ "startColumn": 5, "endLine": 7, "endColumn": 15, - "start": 247, - "end": 257 + "start": 255, + "end": 265 } }, "attributes": [], @@ -68,24 +68,24 @@ "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 54, + "endColumn": 56, "start": 33, - "end": 78, + "end": 80, "startTag": { "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 34, + "endColumn": 36, "start": 33, - "end": 58 + "end": 60 }, "endTag": { "startLine": 3, - "startColumn": 45, + "startColumn": 47, "endLine": 3, - "endColumn": 54, - "start": 69, - "end": 78 + "endColumn": 56, + "start": 71, + "end": 80 } }, "attributes": [], @@ -115,18 +115,18 @@ "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 33, + "endColumn": 35, "start": 41, - "end": 57 + "end": 59 } }, "location": { "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 33, + "endColumn": 35, "start": 41, - "end": 57 + "end": 59 } } ], @@ -138,79 +138,37 @@ "raw": "{foo + bar}", "value": { "type": "BinaryExpression", - "start": 59, - "end": 68, - "loc": { - "start": { - "line": 3, - "column": 34 - }, - "end": { - "line": 3, - "column": 43 - } - }, - "range": [ - 59, - 68 - ], + "start": 1, + "end": 10, "left": { "type": "Identifier", - "start": 59, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 34 - }, - "end": { - "line": 3, - "column": 37 - } - }, - "range": [ - 59, - 62 - ], + "start": 1, + "end": 4, "name": "foo" }, "operator": "+", "right": { "type": "Identifier", - "start": 65, - "end": 68, - "loc": { - "start": { - "line": 3, - "column": 40 - }, - "end": { - "line": 3, - "column": 43 - } - }, - "range": [ - 65, - 68 - ], + "start": 7, + "end": 10, "name": "bar" }, "location": { "startLine": 3, - "startColumn": 34, + "startColumn": 36, "endLine": 3, - "endColumn": 45, - "start": 58, - "end": 69 + "endColumn": 47, + "start": 60, + "end": 71 } }, "location": { "startLine": 3, - "startColumn": 34, + "startColumn": 36, "endLine": 3, - "endColumn": 45, - "start": 58, - "end": 69 + "endColumn": 47, + "start": 60, + "end": 71 } } ] @@ -223,24 +181,24 @@ "startLine": 4, "startColumn": 9, "endLine": 4, - "endColumn": 54, - "start": 87, - "end": 132, + "endColumn": 56, + "start": 89, + "end": 136, "startTag": { "startLine": 4, "startColumn": 9, "endLine": 4, - "endColumn": 34, - "start": 87, - "end": 112 + "endColumn": 36, + "start": 89, + "end": 116 }, "endTag": { "startLine": 4, - "startColumn": 45, + "startColumn": 47, "endLine": 4, - "endColumn": 54, - "start": 123, - "end": 132 + "endColumn": 56, + "start": 127, + "end": 136 } }, "attributes": [], @@ -270,18 +228,18 @@ "startLine": 4, "startColumn": 17, "endLine": 4, - "endColumn": 33, - "start": 95, - "end": 111 + "endColumn": 35, + "start": 97, + "end": 115 } }, "location": { "startLine": 4, "startColumn": 17, "endLine": 4, - "endColumn": 33, - "start": 95, - "end": 111 + "endColumn": 35, + "start": 97, + "end": 115 } } ], @@ -293,79 +251,37 @@ "raw": "{foo / bar}", "value": { "type": "BinaryExpression", - "start": 113, - "end": 122, - "loc": { - "start": { - "line": 4, - "column": 34 - }, - "end": { - "line": 4, - "column": 43 - } - }, - "range": [ - 113, - 122 - ], + "start": 1, + "end": 10, "left": { "type": "Identifier", - "start": 113, - "end": 116, - "loc": { - "start": { - "line": 4, - "column": 34 - }, - "end": { - "line": 4, - "column": 37 - } - }, - "range": [ - 113, - 116 - ], + "start": 1, + "end": 4, "name": "foo" }, "operator": "/", "right": { "type": "Identifier", - "start": 119, - "end": 122, - "loc": { - "start": { - "line": 4, - "column": 40 - }, - "end": { - "line": 4, - "column": 43 - } - }, - "range": [ - 119, - 122 - ], + "start": 7, + "end": 10, "name": "bar" }, "location": { "startLine": 4, - "startColumn": 34, + "startColumn": 36, "endLine": 4, - "endColumn": 45, - "start": 112, - "end": 123 + "endColumn": 47, + "start": 116, + "end": 127 } }, "location": { "startLine": 4, - "startColumn": 34, + "startColumn": 36, "endLine": 4, - "endColumn": 45, - "start": 112, - "end": 123 + "endColumn": 47, + "start": 116, + "end": 127 } } ] @@ -378,24 +294,24 @@ "startLine": 5, "startColumn": 9, "endLine": 5, - "endColumn": 56, - "start": 141, - "end": 188, + "endColumn": 58, + "start": 145, + "end": 194, "startTag": { "startLine": 5, "startColumn": 9, "endLine": 5, - "endColumn": 35, - "start": 141, - "end": 167 + "endColumn": 37, + "start": 145, + "end": 173 }, "endTag": { "startLine": 5, - "startColumn": 47, + "startColumn": 49, "endLine": 5, - "endColumn": 56, - "start": 179, - "end": 188 + "endColumn": 58, + "start": 185, + "end": 194 } }, "attributes": [], @@ -425,18 +341,18 @@ "startLine": 5, "startColumn": 17, "endLine": 5, - "endColumn": 34, - "start": 149, - "end": 166 + "endColumn": 36, + "start": 153, + "end": 172 } }, "location": { "startLine": 5, "startColumn": 17, "endLine": 5, - "endColumn": 34, - "start": 149, - "end": 166 + "endColumn": 36, + "start": 153, + "end": 172 } } ], @@ -448,79 +364,37 @@ "raw": "{foo ** bar}", "value": { "type": "BinaryExpression", - "start": 168, - "end": 178, - "loc": { - "start": { - "line": 5, - "column": 35 - }, - "end": { - "line": 5, - "column": 45 - } - }, - "range": [ - 168, - 178 - ], + "start": 1, + "end": 11, "left": { "type": "Identifier", - "start": 168, - "end": 171, - "loc": { - "start": { - "line": 5, - "column": 35 - }, - "end": { - "line": 5, - "column": 38 - } - }, - "range": [ - 168, - 171 - ], + "start": 1, + "end": 4, "name": "foo" }, "operator": "**", "right": { "type": "Identifier", - "start": 175, - "end": 178, - "loc": { - "start": { - "line": 5, - "column": 42 - }, - "end": { - "line": 5, - "column": 45 - } - }, - "range": [ - 175, - 178 - ], + "start": 8, + "end": 11, "name": "bar" }, "location": { "startLine": 5, - "startColumn": 35, + "startColumn": 37, "endLine": 5, - "endColumn": 47, - "start": 167, - "end": 179 + "endColumn": 49, + "start": 173, + "end": 185 } }, "location": { "startLine": 5, - "startColumn": 35, + "startColumn": 37, "endLine": 5, - "endColumn": 47, - "start": 167, - "end": 179 + "endColumn": 49, + "start": 173, + "end": 185 } } ] @@ -533,24 +407,24 @@ "startLine": 6, "startColumn": 9, "endLine": 6, - "endColumn": 54, - "start": 197, - "end": 242, + "endColumn": 56, + "start": 203, + "end": 250, "startTag": { "startLine": 6, "startColumn": 9, "endLine": 6, - "endColumn": 34, - "start": 197, - "end": 222 + "endColumn": 36, + "start": 203, + "end": 230 }, "endTag": { "startLine": 6, - "startColumn": 45, + "startColumn": 47, "endLine": 6, - "endColumn": 54, - "start": 233, - "end": 242 + "endColumn": 56, + "start": 241, + "end": 250 } }, "attributes": [], @@ -580,18 +454,18 @@ "startLine": 6, "startColumn": 17, "endLine": 6, - "endColumn": 33, - "start": 205, - "end": 221 + "endColumn": 35, + "start": 211, + "end": 229 } }, "location": { "startLine": 6, "startColumn": 17, "endLine": 6, - "endColumn": 33, - "start": 205, - "end": 221 + "endColumn": 35, + "start": 211, + "end": 229 } } ], @@ -603,79 +477,37 @@ "raw": "{foo - bar}", "value": { "type": "BinaryExpression", - "start": 223, - "end": 232, - "loc": { - "start": { - "line": 6, - "column": 34 - }, - "end": { - "line": 6, - "column": 43 - } - }, - "range": [ - 223, - 232 - ], + "start": 1, + "end": 10, "left": { "type": "Identifier", - "start": 223, - "end": 226, - "loc": { - "start": { - "line": 6, - "column": 34 - }, - "end": { - "line": 6, - "column": 37 - } - }, - "range": [ - 223, - 226 - ], + "start": 1, + "end": 4, "name": "foo" }, "operator": "-", "right": { "type": "Identifier", - "start": 229, - "end": 232, - "loc": { - "start": { - "line": 6, - "column": 40 - }, - "end": { - "line": 6, - "column": 43 - } - }, - "range": [ - 229, - 232 - ], + "start": 7, + "end": 10, "name": "bar" }, "location": { "startLine": 6, - "startColumn": 34, + "startColumn": 36, "endLine": 6, - "endColumn": 45, - "start": 222, - "end": 233 + "endColumn": 47, + "start": 230, + "end": 241 } }, "location": { "startLine": 6, - "startColumn": 34, + "startColumn": 36, "endLine": 6, - "endColumn": 45, - "start": 222, - "end": 233 + "endColumn": 47, + "start": 230, + "end": 241 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bit-shift/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bit-shift/actual.html index fb7858046c..302bc9f9c4 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bit-shift/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bit-shift/actual.html @@ -1,7 +1,7 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bit-shift/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bit-shift/ast.json index b9656bd8a8..dbfb86a83c 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bit-shift/ast.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bit-shift/ast.json @@ -7,7 +7,7 @@ "endLine": 7, "endColumn": 12, "start": 0, - "end": 190, + "end": 196, "startTag": { "startLine": 1, "startColumn": 1, @@ -21,8 +21,8 @@ "startColumn": 1, "endLine": 7, "endColumn": 12, - "start": 179, - "end": 190 + "start": 185, + "end": 196 } }, "directives": [], @@ -37,7 +37,7 @@ "endLine": 6, "endColumn": 15, "start": 15, - "end": 178, + "end": 184, "startTag": { "startLine": 2, "startColumn": 5, @@ -51,8 +51,8 @@ "startColumn": 5, "endLine": 6, "endColumn": 15, - "start": 168, - "end": 178 + "start": 174, + "end": 184 } }, "attributes": [], @@ -68,24 +68,24 @@ "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 46, + "endColumn": 48, "start": 33, - "end": 70, + "end": 72, "startTag": { "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 36, + "endColumn": 38, "start": 33, - "end": 60 + "end": 62 }, "endTag": { "startLine": 3, - "startColumn": 36, + "startColumn": 38, "endLine": 3, - "endColumn": 46, - "start": 60, - "end": 70 + "endColumn": 48, + "start": 62, + "end": 72 } }, "attributes": [], @@ -115,18 +115,18 @@ "startLine": 3, "startColumn": 18, "endLine": 3, - "endColumn": 35, + "endColumn": 37, "start": 42, - "end": 59 + "end": 61 } }, "location": { "startLine": 3, "startColumn": 18, "endLine": 3, - "endColumn": 35, + "endColumn": 37, "start": 42, - "end": 59 + "end": 61 } } ], @@ -142,24 +142,24 @@ "startLine": 4, "startColumn": 9, "endLine": 4, - "endColumn": 46, - "start": 79, - "end": 116, + "endColumn": 48, + "start": 81, + "end": 120, "startTag": { "startLine": 4, "startColumn": 9, "endLine": 4, - "endColumn": 36, - "start": 79, - "end": 106 + "endColumn": 38, + "start": 81, + "end": 110 }, "endTag": { "startLine": 4, - "startColumn": 36, + "startColumn": 38, "endLine": 4, - "endColumn": 46, - "start": 106, - "end": 116 + "endColumn": 48, + "start": 110, + "end": 120 } }, "attributes": [], @@ -189,18 +189,18 @@ "startLine": 4, "startColumn": 18, "endLine": 4, - "endColumn": 35, - "start": 88, - "end": 105 + "endColumn": 37, + "start": 90, + "end": 109 } }, "location": { "startLine": 4, "startColumn": 18, "endLine": 4, - "endColumn": 35, - "start": 88, - "end": 105 + "endColumn": 37, + "start": 90, + "end": 109 } } ], @@ -216,24 +216,24 @@ "startLine": 5, "startColumn": 9, "endLine": 5, - "endColumn": 47, - "start": 125, - "end": 163, + "endColumn": 49, + "start": 129, + "end": 169, "startTag": { "startLine": 5, "startColumn": 9, "endLine": 5, - "endColumn": 37, - "start": 125, - "end": 153 + "endColumn": 39, + "start": 129, + "end": 159 }, "endTag": { "startLine": 5, - "startColumn": 37, + "startColumn": 39, "endLine": 5, - "endColumn": 47, - "start": 153, - "end": 163 + "endColumn": 49, + "start": 159, + "end": 169 } }, "attributes": [], @@ -263,18 +263,18 @@ "startLine": 5, "startColumn": 18, "endLine": 5, - "endColumn": 36, - "start": 134, - "end": 152 + "endColumn": 38, + "start": 138, + "end": 158 } }, "location": { "startLine": 5, "startColumn": 18, "endLine": 5, - "endColumn": 36, - "start": 134, - "end": 152 + "endColumn": 38, + "start": 138, + "end": 158 } } ], diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bitwise/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bitwise/actual.html index a2627f0f3e..c05cd3307b 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bitwise/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bitwise/actual.html @@ -1,7 +1,7 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bitwise/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bitwise/ast.json index fcb1bd4e1c..bb84d2a90e 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bitwise/ast.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-bitwise/ast.json @@ -7,7 +7,7 @@ "endLine": 7, "endColumn": 12, "start": 0, - "end": 219, + "end": 225, "startTag": { "startLine": 1, "startColumn": 1, @@ -21,8 +21,8 @@ "startColumn": 1, "endLine": 7, "endColumn": 12, - "start": 208, - "end": 219 + "start": 214, + "end": 225 } }, "directives": [], @@ -37,7 +37,7 @@ "endLine": 6, "endColumn": 15, "start": 15, - "end": 207, + "end": 213, "startTag": { "startLine": 2, "startColumn": 5, @@ -51,8 +51,8 @@ "startColumn": 5, "endLine": 6, "endColumn": 15, - "start": 197, - "end": 207 + "start": 203, + "end": 213 } }, "attributes": [], @@ -68,24 +68,24 @@ "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 56, + "endColumn": 58, "start": 33, - "end": 80, + "end": 82, "startTag": { "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 35, + "endColumn": 37, "start": 33, - "end": 59 + "end": 61 }, "endTag": { "startLine": 3, - "startColumn": 46, + "startColumn": 48, "endLine": 3, - "endColumn": 56, - "start": 70, - "end": 80 + "endColumn": 58, + "start": 72, + "end": 82 } }, "attributes": [], @@ -115,18 +115,18 @@ "startLine": 3, "startColumn": 18, "endLine": 3, - "endColumn": 34, + "endColumn": 36, "start": 42, - "end": 58 + "end": 60 } }, "location": { "startLine": 3, "startColumn": 18, "endLine": 3, - "endColumn": 34, + "endColumn": 36, "start": 42, - "end": 58 + "end": 60 } } ], @@ -138,79 +138,37 @@ "raw": "{foo & bar}", "value": { "type": "BinaryExpression", - "start": 60, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 44 - } - }, - "range": [ - 60, - 69 - ], + "start": 1, + "end": 10, "left": { "type": "Identifier", - "start": 60, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 38 - } - }, - "range": [ - 60, - 63 - ], + "start": 1, + "end": 4, "name": "foo" }, "operator": "&", "right": { "type": "Identifier", - "start": 66, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 44 - } - }, - "range": [ - 66, - 69 - ], + "start": 7, + "end": 10, "name": "bar" }, "location": { "startLine": 3, - "startColumn": 35, + "startColumn": 37, "endLine": 3, - "endColumn": 46, - "start": 59, - "end": 70 + "endColumn": 48, + "start": 61, + "end": 72 } }, "location": { "startLine": 3, - "startColumn": 35, + "startColumn": 37, "endLine": 3, - "endColumn": 46, - "start": 59, - "end": 70 + "endColumn": 48, + "start": 61, + "end": 72 } } ] @@ -223,24 +181,24 @@ "startLine": 4, "startColumn": 9, "endLine": 4, - "endColumn": 56, - "start": 89, - "end": 136, + "endColumn": 58, + "start": 91, + "end": 140, "startTag": { "startLine": 4, "startColumn": 9, "endLine": 4, - "endColumn": 35, - "start": 89, - "end": 115 + "endColumn": 37, + "start": 91, + "end": 119 }, "endTag": { "startLine": 4, - "startColumn": 46, + "startColumn": 48, "endLine": 4, - "endColumn": 56, - "start": 126, - "end": 136 + "endColumn": 58, + "start": 130, + "end": 140 } }, "attributes": [], @@ -270,18 +228,18 @@ "startLine": 4, "startColumn": 18, "endLine": 4, - "endColumn": 34, - "start": 98, - "end": 114 + "endColumn": 36, + "start": 100, + "end": 118 } }, "location": { "startLine": 4, "startColumn": 18, "endLine": 4, - "endColumn": 34, - "start": 98, - "end": 114 + "endColumn": 36, + "start": 100, + "end": 118 } } ], @@ -293,79 +251,37 @@ "raw": "{foo | bar}", "value": { "type": "BinaryExpression", - "start": 116, - "end": 125, - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 44 - } - }, - "range": [ - 116, - 125 - ], + "start": 1, + "end": 10, "left": { "type": "Identifier", - "start": 116, - "end": 119, - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 38 - } - }, - "range": [ - 116, - 119 - ], + "start": 1, + "end": 4, "name": "foo" }, "operator": "|", "right": { "type": "Identifier", - "start": 122, - "end": 125, - "loc": { - "start": { - "line": 4, - "column": 41 - }, - "end": { - "line": 4, - "column": 44 - } - }, - "range": [ - 122, - 125 - ], + "start": 7, + "end": 10, "name": "bar" }, "location": { "startLine": 4, - "startColumn": 35, + "startColumn": 37, "endLine": 4, - "endColumn": 46, - "start": 115, - "end": 126 + "endColumn": 48, + "start": 119, + "end": 130 } }, "location": { "startLine": 4, - "startColumn": 35, + "startColumn": 37, "endLine": 4, - "endColumn": 46, - "start": 115, - "end": 126 + "endColumn": 48, + "start": 119, + "end": 130 } } ] @@ -378,24 +294,24 @@ "startLine": 5, "startColumn": 9, "endLine": 5, - "endColumn": 56, - "start": 145, - "end": 192, + "endColumn": 58, + "start": 149, + "end": 198, "startTag": { "startLine": 5, "startColumn": 9, "endLine": 5, - "endColumn": 35, - "start": 145, - "end": 171 + "endColumn": 37, + "start": 149, + "end": 177 }, "endTag": { "startLine": 5, - "startColumn": 46, + "startColumn": 48, "endLine": 5, - "endColumn": 56, - "start": 182, - "end": 192 + "endColumn": 58, + "start": 188, + "end": 198 } }, "attributes": [], @@ -425,18 +341,18 @@ "startLine": 5, "startColumn": 18, "endLine": 5, - "endColumn": 34, - "start": 154, - "end": 170 + "endColumn": 36, + "start": 158, + "end": 176 } }, "location": { "startLine": 5, "startColumn": 18, "endLine": 5, - "endColumn": 34, - "start": 154, - "end": 170 + "endColumn": 36, + "start": 158, + "end": 176 } } ], @@ -448,79 +364,37 @@ "raw": "{foo ^ bar}", "value": { "type": "BinaryExpression", - "start": 172, - "end": 181, - "loc": { - "start": { - "line": 5, - "column": 35 - }, - "end": { - "line": 5, - "column": 44 - } - }, - "range": [ - 172, - 181 - ], + "start": 1, + "end": 10, "left": { "type": "Identifier", - "start": 172, - "end": 175, - "loc": { - "start": { - "line": 5, - "column": 35 - }, - "end": { - "line": 5, - "column": 38 - } - }, - "range": [ - 172, - 175 - ], + "start": 1, + "end": 4, "name": "foo" }, "operator": "^", "right": { "type": "Identifier", - "start": 178, - "end": 181, - "loc": { - "start": { - "line": 5, - "column": 41 - }, - "end": { - "line": 5, - "column": 44 - } - }, - "range": [ - 178, - 181 - ], + "start": 7, + "end": 10, "name": "bar" }, "location": { "startLine": 5, - "startColumn": 35, + "startColumn": 37, "endLine": 5, - "endColumn": 46, - "start": 171, - "end": 182 + "endColumn": 48, + "start": 177, + "end": 188 } }, "location": { "startLine": 5, - "startColumn": 35, + "startColumn": 37, "endLine": 5, - "endColumn": 46, - "start": 171, - "end": 182 + "endColumn": 48, + "start": 177, + "end": 188 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-logical/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-logical/actual.html index 2cf4c0826d..ac4be05d34 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-logical/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-logical/actual.html @@ -1,6 +1,6 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-logical/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-logical/ast.json index b86f36d766..db136b7671 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-logical/ast.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-logical/ast.json @@ -7,7 +7,7 @@ "endLine": 6, "endColumn": 12, "start": 0, - "end": 163, + "end": 167, "startTag": { "startLine": 1, "startColumn": 1, @@ -21,8 +21,8 @@ "startColumn": 1, "endLine": 6, "endColumn": 12, - "start": 152, - "end": 163 + "start": 156, + "end": 167 } }, "directives": [], @@ -37,7 +37,7 @@ "endLine": 5, "endColumn": 15, "start": 15, - "end": 151, + "end": 155, "startTag": { "startLine": 2, "startColumn": 5, @@ -51,8 +51,8 @@ "startColumn": 5, "endLine": 5, "endColumn": 15, - "start": 141, - "end": 151 + "start": 145, + "end": 155 } }, "attributes": [], @@ -68,24 +68,24 @@ "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 56, + "endColumn": 58, "start": 33, - "end": 80, + "end": 82, "startTag": { "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 35, + "endColumn": 37, "start": 33, - "end": 59 + "end": 61 }, "endTag": { "startLine": 3, - "startColumn": 47, + "startColumn": 49, "endLine": 3, - "endColumn": 56, - "start": 71, - "end": 80 + "endColumn": 58, + "start": 73, + "end": 82 } }, "attributes": [], @@ -115,18 +115,18 @@ "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 34, + "endColumn": 36, "start": 41, - "end": 58 + "end": 60 } }, "location": { "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 34, + "endColumn": 36, "start": 41, - "end": 58 + "end": 60 } } ], @@ -138,79 +138,37 @@ "raw": "{foo || bar}", "value": { "type": "LogicalExpression", - "start": 60, - "end": 70, - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 45 - } - }, - "range": [ - 60, - 70 - ], + "start": 1, + "end": 11, "left": { "type": "Identifier", - "start": 60, - "end": 63, - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 38 - } - }, - "range": [ - 60, - 63 - ], + "start": 1, + "end": 4, "name": "foo" }, "operator": "||", "right": { "type": "Identifier", - "start": 67, - "end": 70, - "loc": { - "start": { - "line": 3, - "column": 42 - }, - "end": { - "line": 3, - "column": 45 - } - }, - "range": [ - 67, - 70 - ], + "start": 8, + "end": 11, "name": "bar" }, "location": { "startLine": 3, - "startColumn": 35, + "startColumn": 37, "endLine": 3, - "endColumn": 47, - "start": 59, - "end": 71 + "endColumn": 49, + "start": 61, + "end": 73 } }, "location": { "startLine": 3, - "startColumn": 35, + "startColumn": 37, "endLine": 3, - "endColumn": 47, - "start": 59, - "end": 71 + "endColumn": 49, + "start": 61, + "end": 73 } } ] @@ -223,24 +181,24 @@ "startLine": 4, "startColumn": 9, "endLine": 4, - "endColumn": 56, - "start": 89, - "end": 136, + "endColumn": 58, + "start": 91, + "end": 140, "startTag": { "startLine": 4, "startColumn": 9, "endLine": 4, - "endColumn": 35, - "start": 89, - "end": 115 + "endColumn": 37, + "start": 91, + "end": 119 }, "endTag": { "startLine": 4, - "startColumn": 47, + "startColumn": 49, "endLine": 4, - "endColumn": 56, - "start": 127, - "end": 136 + "endColumn": 58, + "start": 131, + "end": 140 } }, "attributes": [], @@ -270,18 +228,18 @@ "startLine": 4, "startColumn": 17, "endLine": 4, - "endColumn": 34, - "start": 97, - "end": 114 + "endColumn": 36, + "start": 99, + "end": 118 } }, "location": { "startLine": 4, "startColumn": 17, "endLine": 4, - "endColumn": 34, - "start": 97, - "end": 114 + "endColumn": 36, + "start": 99, + "end": 118 } } ], @@ -293,79 +251,37 @@ "raw": "{foo && bar}", "value": { "type": "LogicalExpression", - "start": 116, - "end": 126, - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 45 - } - }, - "range": [ - 116, - 126 - ], + "start": 1, + "end": 11, "left": { "type": "Identifier", - "start": 116, - "end": 119, - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 38 - } - }, - "range": [ - 116, - 119 - ], + "start": 1, + "end": 4, "name": "foo" }, "operator": "&&", "right": { "type": "Identifier", - "start": 123, - "end": 126, - "loc": { - "start": { - "line": 4, - "column": 42 - }, - "end": { - "line": 4, - "column": 45 - } - }, - "range": [ - 123, - 126 - ], + "start": 8, + "end": 11, "name": "bar" }, "location": { "startLine": 4, - "startColumn": 35, + "startColumn": 37, "endLine": 4, - "endColumn": 47, - "start": 115, - "end": 127 + "endColumn": 49, + "start": 119, + "end": 131 } }, "location": { "startLine": 4, - "startColumn": 35, + "startColumn": 37, "endLine": 4, - "endColumn": 47, - "start": 115, - "end": 127 + "endColumn": 49, + "start": 119, + "end": 131 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-relational/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-relational/actual.html index 0a33a38fef..66cec028d0 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-relational/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-relational/actual.html @@ -1,6 +1,11 @@ + \ No newline at end of file diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-relational/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-relational/ast.json index 0b63da31df..adaf026b43 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-relational/ast.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-relational/ast.json @@ -4,10 +4,10 @@ "location": { "startLine": 1, "startColumn": 1, - "endLine": 6, + "endLine": 11, "endColumn": 12, "start": 0, - "end": 159, + "end": 369, "startTag": { "startLine": 1, "startColumn": 1, @@ -17,12 +17,12 @@ "end": 10 }, "endTag": { - "startLine": 6, + "startLine": 11, "startColumn": 1, - "endLine": 6, + "endLine": 11, "endColumn": 12, - "start": 148, - "end": 159 + "start": 358, + "end": 369 } }, "directives": [], @@ -34,10 +34,10 @@ "location": { "startLine": 2, "startColumn": 5, - "endLine": 5, + "endLine": 10, "endColumn": 15, "start": 15, - "end": 147, + "end": 357, "startTag": { "startLine": 2, "startColumn": 5, @@ -47,12 +47,12 @@ "end": 24 }, "endTag": { - "startLine": 5, + "startLine": 10, "startColumn": 5, - "endLine": 5, + "endLine": 10, "endColumn": 15, - "start": 137, - "end": 147 + "start": 347, + "end": 357 } }, "attributes": [], @@ -68,24 +68,24 @@ "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 54, + "endColumn": 56, "start": 33, - "end": 78, + "end": 80, "startTag": { "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 34, + "endColumn": 36, "start": 33, - "end": 58 + "end": 60 }, "endTag": { "startLine": 3, - "startColumn": 45, + "startColumn": 47, "endLine": 3, - "endColumn": 54, - "start": 69, - "end": 78 + "endColumn": 56, + "start": 71, + "end": 80 } }, "attributes": [], @@ -115,18 +115,18 @@ "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 33, + "endColumn": 35, "start": 41, - "end": 57 + "end": 59 } }, "location": { "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 33, + "endColumn": 35, "start": 41, - "end": 57 + "end": 59 } } ], @@ -138,109 +138,80 @@ "raw": "{foo > bar}", "value": { "type": "BinaryExpression", - "start": 59, - "end": 68, - "loc": { - "start": { - "line": 3, - "column": 34 - }, - "end": { - "line": 3, - "column": 43 - } - }, - "range": [ - 59, - 68 - ], + "start": 1, + "end": 10, "left": { "type": "Identifier", - "start": 59, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 34 - }, - "end": { - "line": 3, - "column": 37 - } - }, - "range": [ - 59, - 62 - ], + "start": 1, + "end": 4, "name": "foo" }, "operator": ">", "right": { "type": "Identifier", - "start": 65, - "end": 68, - "loc": { - "start": { - "line": 3, - "column": 40 - }, - "end": { - "line": 3, - "column": 43 - } - }, - "range": [ - 65, - 68 - ], + "start": 7, + "end": 10, "name": "bar" }, "location": { "startLine": 3, - "startColumn": 34, + "startColumn": 36, "endLine": 3, - "endColumn": 45, - "start": 58, - "end": 69 + "endColumn": 47, + "start": 60, + "end": 71 } }, "location": { "startLine": 3, - "startColumn": 34, + "startColumn": 36, "endLine": 3, - "endColumn": 45, - "start": 58, - "end": 69 + "endColumn": 47, + "start": 60, + "end": 71 } } ] }, + { + "type": "Comment", + "raw": " \n Using > in a text node (foo < bar) would couse a html parsing error.\n It is not supported and has a dedicated test. Any expression must be HTML\n compliant \n ", + "value": " \n Using > in a text node (foo < bar) would couse a html parsing error.\n It is not supported and has a dedicated test. Any expression must be HTML\n compliant \n ", + "location": { + "startLine": 4, + "startColumn": 9, + "endLine": 8, + "endColumn": 12, + "start": 89, + "end": 296 + } + }, { "type": "Component", "name": "x-pert", "namespace": "http://www.w3.org/1999/xhtml", "location": { - "startLine": 4, + "startLine": 9, "startColumn": 9, - "endLine": 4, - "endColumn": 54, - "start": 87, - "end": 132, + "endLine": 9, + "endColumn": 45, + "start": 305, + "end": 341, "startTag": { - "startLine": 4, + "startLine": 9, "startColumn": 9, - "endLine": 4, - "endColumn": 34, - "start": 87, - "end": 112 + "endLine": 9, + "endColumn": 36, + "start": 305, + "end": 332 }, "endTag": { - "startLine": 4, - "startColumn": 45, - "endLine": 4, - "endColumn": 54, - "start": 123, - "end": 132 + "startLine": 9, + "startColumn": 36, + "endLine": 9, + "endColumn": 45, + "start": 332, + "end": 341 } }, "attributes": [], @@ -267,108 +238,27 @@ "name": "bar" }, "location": { - "startLine": 4, + "startLine": 9, "startColumn": 17, - "endLine": 4, - "endColumn": 33, - "start": 95, - "end": 111 + "endLine": 9, + "endColumn": 35, + "start": 313, + "end": 331 } }, "location": { - "startLine": 4, + "startLine": 9, "startColumn": 17, - "endLine": 4, - "endColumn": 33, - "start": 95, - "end": 111 + "endLine": 9, + "endColumn": 35, + "start": 313, + "end": 331 } } ], "directives": [], "listeners": [], - "children": [ - { - "type": "Text", - "raw": "{foo < bar}", - "value": { - "type": "BinaryExpression", - "start": 113, - "end": 122, - "loc": { - "start": { - "line": 4, - "column": 34 - }, - "end": { - "line": 4, - "column": 43 - } - }, - "range": [ - 113, - 122 - ], - "left": { - "type": "Identifier", - "start": 113, - "end": 116, - "loc": { - "start": { - "line": 4, - "column": 34 - }, - "end": { - "line": 4, - "column": 37 - } - }, - "range": [ - 113, - 116 - ], - "name": "foo" - }, - "operator": "<", - "right": { - "type": "Identifier", - "start": 119, - "end": 122, - "loc": { - "start": { - "line": 4, - "column": 40 - }, - "end": { - "line": 4, - "column": 43 - } - }, - "range": [ - 119, - 122 - ], - "name": "bar" - }, - "location": { - "startLine": 4, - "startColumn": 34, - "endLine": 4, - "endColumn": 45, - "start": 112, - "end": 123 - } - }, - "location": { - "startLine": 4, - "startColumn": 34, - "endLine": 4, - "endColumn": 45, - "start": 112, - "end": 123 - } - } - ] + "children": [] } ] } diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-relational/expected.js b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-relational/expected.js index bf577106fe..ccf5fac001 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-relational/expected.js +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/binary-expr-relational/expected.js @@ -25,17 +25,12 @@ function tmpl($api, $cmp, $slotset, $ctx) { }, [api_text(api_dynamic_text($cmp.foo > $cmp.bar))] ), - api_custom_element( - "x-pert", - _xPert, - { - props: { - attr: $cmp.foo < $cmp.bar, - }, - key: 2, + api_custom_element("x-pert", _xPert, { + props: { + attr: $cmp.foo < $cmp.bar, }, - [api_text(api_dynamic_text($cmp.foo < $cmp.bar))] - ), + key: 2, + }), ]), ]; /*LWC compiler vX.X.X*/ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/boolean-literal/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/boolean-literal/actual.html index 5c35107920..a7394d4fbe 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/boolean-literal/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/boolean-literal/actual.html @@ -1,6 +1,6 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/boolean-literal/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/boolean-literal/ast.json index f2b7c2141f..b5feb71e79 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/boolean-literal/ast.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/boolean-literal/ast.json @@ -7,7 +7,7 @@ "endLine": 6, "endColumn": 12, "start": 0, - "end": 141, + "end": 145, "startTag": { "startLine": 1, "startColumn": 1, @@ -21,8 +21,8 @@ "startColumn": 1, "endLine": 6, "endColumn": 12, - "start": 130, - "end": 141 + "start": 134, + "end": 145 } }, "directives": [], @@ -37,7 +37,7 @@ "endLine": 5, "endColumn": 15, "start": 15, - "end": 129, + "end": 133, "startTag": { "startLine": 2, "startColumn": 5, @@ -51,8 +51,8 @@ "startColumn": 5, "endLine": 5, "endColumn": 15, - "start": 119, - "end": 129 + "start": 123, + "end": 133 } }, "attributes": [], @@ -68,24 +68,24 @@ "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 44, + "endColumn": 46, "start": 33, - "end": 68, + "end": 70, "startTag": { "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 29, + "endColumn": 31, "start": 33, - "end": 53 + "end": 55 }, "endTag": { "startLine": 3, - "startColumn": 35, + "startColumn": 37, "endLine": 3, - "endColumn": 44, - "start": 59, - "end": 68 + "endColumn": 46, + "start": 61, + "end": 70 } }, "attributes": [], @@ -104,18 +104,18 @@ "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 28, + "endColumn": 30, "start": 41, - "end": 52 + "end": 54 } }, "location": { "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 28, + "endColumn": 30, "start": 41, - "end": 52 + "end": 54 } } ], @@ -127,40 +127,26 @@ "raw": "{true}", "value": { "type": "Literal", - "start": 54, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 29 - }, - "end": { - "line": 3, - "column": 33 - } - }, - "range": [ - 54, - 58 - ], + "start": 1, + "end": 5, "value": true, "raw": "true", "location": { "startLine": 3, - "startColumn": 29, + "startColumn": 31, "endLine": 3, - "endColumn": 35, - "start": 53, - "end": 59 + "endColumn": 37, + "start": 55, + "end": 61 } }, "location": { "startLine": 3, - "startColumn": 29, + "startColumn": 31, "endLine": 3, - "endColumn": 35, - "start": 53, - "end": 59 + "endColumn": 37, + "start": 55, + "end": 61 } } ] @@ -173,24 +159,24 @@ "startLine": 4, "startColumn": 9, "endLine": 4, - "endColumn": 46, - "start": 77, - "end": 114, + "endColumn": 48, + "start": 79, + "end": 118, "startTag": { "startLine": 4, "startColumn": 9, "endLine": 4, - "endColumn": 30, - "start": 77, - "end": 98 + "endColumn": 32, + "start": 79, + "end": 102 }, "endTag": { "startLine": 4, - "startColumn": 37, + "startColumn": 39, "endLine": 4, - "endColumn": 46, - "start": 105, - "end": 114 + "endColumn": 48, + "start": 109, + "end": 118 } }, "attributes": [], @@ -209,18 +195,18 @@ "startLine": 4, "startColumn": 17, "endLine": 4, - "endColumn": 29, - "start": 85, - "end": 97 + "endColumn": 31, + "start": 87, + "end": 101 } }, "location": { "startLine": 4, "startColumn": 17, "endLine": 4, - "endColumn": 29, - "start": 85, - "end": 97 + "endColumn": 31, + "start": 87, + "end": 101 } } ], @@ -232,40 +218,26 @@ "raw": "{false}", "value": { "type": "Literal", - "start": 99, - "end": 104, - "loc": { - "start": { - "line": 4, - "column": 30 - }, - "end": { - "line": 4, - "column": 35 - } - }, - "range": [ - 99, - 104 - ], + "start": 1, + "end": 6, "value": false, "raw": "false", "location": { "startLine": 4, - "startColumn": 30, + "startColumn": 32, "endLine": 4, - "endColumn": 37, - "start": 98, - "end": 105 + "endColumn": 39, + "start": 102, + "end": 109 } }, "location": { "startLine": 4, - "startColumn": 30, + "startColumn": 32, "endLine": 4, - "endColumn": 37, - "start": 98, - "end": 105 + "endColumn": 39, + "start": 102, + "end": 109 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/call-expr/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/call-expr/actual.html index 87d57d81b8..f0e76a6e56 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/call-expr/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/call-expr/actual.html @@ -1,5 +1,5 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/call-expr/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/call-expr/ast.json index 61be6f3ead..fe2840d84a 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/call-expr/ast.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/call-expr/ast.json @@ -7,7 +7,7 @@ "endLine": 5, "endColumn": 12, "start": 0, - "end": 103, + "end": 105, "startTag": { "startLine": 1, "startColumn": 1, @@ -21,8 +21,8 @@ "startColumn": 1, "endLine": 5, "endColumn": 12, - "start": 92, - "end": 103 + "start": 94, + "end": 105 } }, "directives": [], @@ -37,7 +37,7 @@ "endLine": 4, "endColumn": 15, "start": 15, - "end": 91, + "end": 93, "startTag": { "startLine": 2, "startColumn": 5, @@ -51,8 +51,8 @@ "startColumn": 5, "endLine": 4, "endColumn": 15, - "start": 81, - "end": 91 + "start": 83, + "end": 93 } }, "attributes": [], @@ -68,24 +68,24 @@ "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 52, + "endColumn": 54, "start": 33, - "end": 76, + "end": 78, "startTag": { "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 33, + "endColumn": 35, "start": 33, - "end": 57 + "end": 59 }, "endTag": { "startLine": 3, - "startColumn": 43, + "startColumn": 45, "endLine": 3, - "endColumn": 52, - "start": 67, - "end": 76 + "endColumn": 54, + "start": 69, + "end": 78 } }, "attributes": [], @@ -110,18 +110,18 @@ "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 32, + "endColumn": 34, "start": 41, - "end": 56 + "end": 58 } }, "location": { "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 32, + "endColumn": 34, "start": 41, - "end": 56 + "end": 58 } } ], @@ -133,60 +133,32 @@ "raw": "{getBaz()}", "value": { "type": "CallExpression", - "start": 58, - "end": 66, - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 41 - } - }, - "range": [ - 58, - 66 - ], + "start": 1, + "end": 9, "callee": { "type": "Identifier", - "start": 58, - "end": 64, - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 39 - } - }, - "range": [ - 58, - 64 - ], + "start": 1, + "end": 7, "name": "getBaz" }, "arguments": [], "optional": false, "location": { "startLine": 3, - "startColumn": 33, + "startColumn": 35, "endLine": 3, - "endColumn": 43, - "start": 57, - "end": 67 + "endColumn": 45, + "start": 59, + "end": 69 } }, "location": { "startLine": 3, - "startColumn": 33, + "startColumn": 35, "endLine": 3, - "endColumn": 43, - "start": 57, - "end": 67 + "endColumn": 45, + "start": 59, + "end": 69 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/computed-property/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/computed-property/actual.html index b6b8ed78d9..0dc80e2b6f 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/computed-property/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/computed-property/actual.html @@ -1,3 +1,3 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/computed-property/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/computed-property/ast.json index 5fd09af8f9..db2579040d 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/computed-property/ast.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/computed-property/ast.json @@ -7,7 +7,7 @@ "endLine": 3, "endColumn": 12, "start": 0, - "end": 123, + "end": 125, "startTag": { "startLine": 1, "startColumn": 1, @@ -21,8 +21,8 @@ "startColumn": 1, "endLine": 3, "endColumn": 12, - "start": 112, - "end": 123 + "start": 114, + "end": 125 } }, "directives": [], @@ -35,24 +35,24 @@ "startLine": 2, "startColumn": 5, "endLine": 2, - "endColumn": 101, + "endColumn": 103, "start": 15, - "end": 111, + "end": 113, "startTag": { "startLine": 2, "startColumn": 5, "endLine": 2, - "endColumn": 37, + "endColumn": 39, "start": 15, - "end": 47 + "end": 49 }, "endTag": { "startLine": 2, - "startColumn": 91, + "startColumn": 93, "endLine": 2, - "endColumn": 101, - "start": 101, - "end": 111 + "endColumn": 103, + "start": 103, + "end": 113 } }, "attributes": [], @@ -97,18 +97,18 @@ "startLine": 2, "startColumn": 14, "endLine": 2, - "endColumn": 36, + "endColumn": 38, "start": 24, - "end": 46 + "end": 48 } }, "location": { "startLine": 2, "startColumn": 14, "endLine": 2, - "endColumn": 36, + "endColumn": 38, "start": 24, - "end": 46 + "end": 48 } } ], @@ -118,78 +118,22 @@ "raw": "{bar.arr[baz]}", "value": { "type": "MemberExpression", - "start": 48, - "end": 60, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 49 - } - }, - "range": [ - 48, - 60 - ], + "start": 1, + "end": 13, "object": { "type": "MemberExpression", - "start": 48, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 44 - } - }, - "range": [ - 48, - 55 - ], + "start": 1, + "end": 8, "object": { "type": "Identifier", - "start": 48, - "end": 51, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 40 - } - }, - "range": [ - 48, - 51 - ], + "start": 1, + "end": 4, "name": "bar" }, "property": { "type": "Identifier", - "start": 52, - "end": 55, - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 44 - } - }, - "range": [ - 52, - 55 - ], + "start": 5, + "end": 8, "name": "arr" }, "computed": false, @@ -197,42 +141,28 @@ }, "property": { "type": "Identifier", - "start": 56, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 45 - }, - "end": { - "line": 2, - "column": 48 - } - }, - "range": [ - 56, - 59 - ], + "start": 9, + "end": 12, "name": "baz" }, "computed": true, "optional": false, "location": { "startLine": 2, - "startColumn": 37, + "startColumn": 39, "endLine": 2, - "endColumn": 51, - "start": 47, - "end": 61 + "endColumn": 93, + "start": 49, + "end": 103 } }, "location": { "startLine": 2, - "startColumn": 37, + "startColumn": 39, "endLine": 2, - "endColumn": 51, - "start": 47, - "end": 61 + "endColumn": 93, + "start": 49, + "end": 103 } }, { @@ -244,11 +174,11 @@ }, "location": { "startLine": 2, - "startColumn": 51, + "startColumn": 39, "endLine": 2, - "endColumn": 52, - "start": 61, - "end": 62 + "endColumn": 93, + "start": 49, + "end": 103 } }, { @@ -256,96 +186,26 @@ "raw": "{bar.baz.arr[quux]}", "value": { "type": "MemberExpression", - "start": 63, - "end": 80, - "loc": { - "start": { - "line": 2, - "column": 52 - }, - "end": { - "line": 2, - "column": 69 - } - }, - "range": [ - 63, - 80 - ], + "start": 16, + "end": 33, "object": { "type": "MemberExpression", - "start": 63, - "end": 74, - "loc": { - "start": { - "line": 2, - "column": 52 - }, - "end": { - "line": 2, - "column": 63 - } - }, - "range": [ - 63, - 74 - ], + "start": 16, + "end": 27, "object": { "type": "MemberExpression", - "start": 63, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 52 - }, - "end": { - "line": 2, - "column": 59 - } - }, - "range": [ - 63, - 70 - ], + "start": 16, + "end": 23, "object": { "type": "Identifier", - "start": 63, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 52 - }, - "end": { - "line": 2, - "column": 55 - } - }, - "range": [ - 63, - 66 - ], + "start": 16, + "end": 19, "name": "bar" }, "property": { "type": "Identifier", - "start": 67, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 56 - }, - "end": { - "line": 2, - "column": 59 - } - }, - "range": [ - 67, - 70 - ], + "start": 20, + "end": 23, "name": "baz" }, "computed": false, @@ -353,22 +213,8 @@ }, "property": { "type": "Identifier", - "start": 71, - "end": 74, - "loc": { - "start": { - "line": 2, - "column": 60 - }, - "end": { - "line": 2, - "column": 63 - } - }, - "range": [ - 71, - 74 - ], + "start": 24, + "end": 27, "name": "arr" }, "computed": false, @@ -376,42 +222,28 @@ }, "property": { "type": "Identifier", - "start": 75, - "end": 79, - "loc": { - "start": { - "line": 2, - "column": 64 - }, - "end": { - "line": 2, - "column": 68 - } - }, - "range": [ - 75, - 79 - ], + "start": 28, + "end": 32, "name": "quux" }, "computed": true, "optional": false, "location": { "startLine": 2, - "startColumn": 52, + "startColumn": 39, "endLine": 2, - "endColumn": 71, - "start": 62, - "end": 81 + "endColumn": 93, + "start": 49, + "end": 103 } }, "location": { "startLine": 2, - "startColumn": 52, + "startColumn": 39, "endLine": 2, - "endColumn": 71, - "start": 62, - "end": 81 + "endColumn": 93, + "start": 49, + "end": 103 } }, { @@ -423,11 +255,11 @@ }, "location": { "startLine": 2, - "startColumn": 71, + "startColumn": 39, "endLine": 2, - "endColumn": 72, - "start": 81, - "end": 82 + "endColumn": 93, + "start": 49, + "end": 103 } }, { @@ -435,78 +267,22 @@ "raw": "{bar.arr[baz.quux]}", "value": { "type": "MemberExpression", - "start": 83, - "end": 100, - "loc": { - "start": { - "line": 2, - "column": 72 - }, - "end": { - "line": 2, - "column": 89 - } - }, - "range": [ - 83, - 100 - ], + "start": 36, + "end": 53, "object": { "type": "MemberExpression", - "start": 83, - "end": 90, - "loc": { - "start": { - "line": 2, - "column": 72 - }, - "end": { - "line": 2, - "column": 79 - } - }, - "range": [ - 83, - 90 - ], + "start": 36, + "end": 43, "object": { "type": "Identifier", - "start": 83, - "end": 86, - "loc": { - "start": { - "line": 2, - "column": 72 - }, - "end": { - "line": 2, - "column": 75 - } - }, - "range": [ - 83, - 86 - ], + "start": 36, + "end": 39, "name": "bar" }, "property": { "type": "Identifier", - "start": 87, - "end": 90, - "loc": { - "start": { - "line": 2, - "column": 76 - }, - "end": { - "line": 2, - "column": 79 - } - }, - "range": [ - 87, - 90 - ], + "start": 40, + "end": 43, "name": "arr" }, "computed": false, @@ -514,60 +290,18 @@ }, "property": { "type": "MemberExpression", - "start": 91, - "end": 99, - "loc": { - "start": { - "line": 2, - "column": 80 - }, - "end": { - "line": 2, - "column": 88 - } - }, - "range": [ - 91, - 99 - ], + "start": 44, + "end": 52, "object": { "type": "Identifier", - "start": 91, - "end": 94, - "loc": { - "start": { - "line": 2, - "column": 80 - }, - "end": { - "line": 2, - "column": 83 - } - }, - "range": [ - 91, - 94 - ], + "start": 44, + "end": 47, "name": "baz" }, "property": { "type": "Identifier", - "start": 95, - "end": 99, - "loc": { - "start": { - "line": 2, - "column": 84 - }, - "end": { - "line": 2, - "column": 88 - } - }, - "range": [ - 95, - 99 - ], + "start": 48, + "end": 52, "name": "quux" }, "computed": false, @@ -577,20 +311,20 @@ "optional": false, "location": { "startLine": 2, - "startColumn": 72, + "startColumn": 39, "endLine": 2, - "endColumn": 91, - "start": 82, - "end": 101 + "endColumn": 93, + "start": 49, + "end": 103 } }, "location": { "startLine": 2, - "startColumn": 72, + "startColumn": 39, "endLine": 2, - "endColumn": 91, - "start": 82, - "end": 101 + "endColumn": 93, + "start": 49, + "end": 103 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/identifier/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/identifier/actual.html index 377329abac..539e57b89e 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/identifier/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/identifier/actual.html @@ -1,8 +1,8 @@ diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/identifier/ast.json b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/identifier/ast.json index dc3eebe9b1..ba35e43be6 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/identifier/ast.json +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/identifier/ast.json @@ -7,7 +7,7 @@ "endLine": 8, "endColumn": 12, "start": 0, - "end": 235, + "end": 246, "startTag": { "startLine": 1, "startColumn": 1, @@ -21,8 +21,8 @@ "startColumn": 1, "endLine": 8, "endColumn": 12, - "start": 224, - "end": 235 + "start": 235, + "end": 246 } }, "directives": [], @@ -37,7 +37,7 @@ "endLine": 7, "endColumn": 15, "start": 15, - "end": 223, + "end": 234, "startTag": { "startLine": 2, "startColumn": 5, @@ -51,8 +51,8 @@ "startColumn": 5, "endLine": 7, "endColumn": 15, - "start": 213, - "end": 223 + "start": 224, + "end": 234 } }, "attributes": [], @@ -68,24 +68,24 @@ "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 42, + "endColumn": 44, "start": 33, - "end": 66, + "end": 68, "startTag": { "startLine": 3, "startColumn": 9, "endLine": 3, - "endColumn": 28, + "endColumn": 30, "start": 33, - "end": 52 + "end": 54 }, "endTag": { "startLine": 3, - "startColumn": 33, + "startColumn": 35, "endLine": 3, - "endColumn": 42, - "start": 57, - "end": 66 + "endColumn": 44, + "start": 59, + "end": 68 } }, "attributes": [], @@ -103,18 +103,18 @@ "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 27, + "endColumn": 29, "start": 41, - "end": 51 + "end": 53 } }, "location": { "startLine": 3, "startColumn": 17, "endLine": 3, - "endColumn": 27, + "endColumn": 29, "start": 41, - "end": 51 + "end": 53 } } ], @@ -126,39 +126,25 @@ "raw": "{foo}", "value": { "type": "Identifier", - "start": 53, - "end": 56, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 31 - } - }, - "range": [ - 53, - 56 - ], + "start": 1, + "end": 4, "name": "foo", "location": { "startLine": 3, - "startColumn": 28, + "startColumn": 30, "endLine": 3, - "endColumn": 33, - "start": 52, - "end": 57 + "endColumn": 35, + "start": 54, + "end": 59 } }, "location": { "startLine": 3, - "startColumn": 28, + "startColumn": 30, "endLine": 3, - "endColumn": 33, - "start": 52, - "end": 57 + "endColumn": 35, + "start": 54, + "end": 59 } } ] @@ -171,24 +157,24 @@ "startLine": 4, "startColumn": 9, "endLine": 4, - "endColumn": 46, - "start": 75, - "end": 112, + "endColumn": 48, + "start": 77, + "end": 116, "startTag": { "startLine": 4, "startColumn": 9, "endLine": 4, - "endColumn": 30, - "start": 75, - "end": 96 + "endColumn": 32, + "start": 77, + "end": 100 }, "endTag": { "startLine": 4, - "startColumn": 37, + "startColumn": 39, "endLine": 4, - "endColumn": 46, - "start": 103, - "end": 112 + "endColumn": 48, + "start": 107, + "end": 116 } }, "attributes": [], @@ -206,18 +192,18 @@ "startLine": 4, "startColumn": 17, "endLine": 4, - "endColumn": 29, - "start": 83, - "end": 95 + "endColumn": 31, + "start": 85, + "end": 99 } }, "location": { "startLine": 4, "startColumn": 17, "endLine": 4, - "endColumn": 29, - "start": 83, - "end": 95 + "endColumn": 31, + "start": 85, + "end": 99 } } ], @@ -229,39 +215,25 @@ "raw": "{ foo }", "value": { "type": "Identifier", - "start": 98, - "end": 101, - "loc": { - "start": { - "line": 4, - "column": 31 - }, - "end": { - "line": 4, - "column": 34 - } - }, - "range": [ - 98, - 101 - ], + "start": 2, + "end": 5, "name": "foo", "location": { "startLine": 4, - "startColumn": 30, + "startColumn": 32, "endLine": 4, - "endColumn": 37, - "start": 96, - "end": 103 + "endColumn": 39, + "start": 100, + "end": 107 } }, "location": { "startLine": 4, - "startColumn": 30, + "startColumn": 32, "endLine": 4, - "endColumn": 37, - "start": 96, - "end": 103 + "endColumn": 39, + "start": 100, + "end": 107 } } ] @@ -274,24 +246,24 @@ "startLine": 5, "startColumn": 9, "endLine": 5, - "endColumn": 48, - "start": 121, - "end": 160, + "endColumn": 52, + "start": 125, + "end": 168, "startTag": { "startLine": 5, "startColumn": 9, "endLine": 5, - "endColumn": 30, - "start": 121, - "end": 142 + "endColumn": 34, + "start": 125, + "end": 150 }, "endTag": { "startLine": 5, - "startColumn": 39, + "startColumn": 43, "endLine": 5, - "endColumn": 48, - "start": 151, - "end": 160 + "endColumn": 52, + "start": 159, + "end": 168 } }, "attributes": [], @@ -302,25 +274,25 @@ "attributeName": "attr", "value": { "type": "Identifier", - "start": 2, - "end": 5, + "start": 3, + "end": 6, "name": "foo", "location": { "startLine": 5, "startColumn": 17, "endLine": 5, - "endColumn": 29, - "start": 129, - "end": 141 + "endColumn": 33, + "start": 133, + "end": 149 } }, "location": { "startLine": 5, "startColumn": 17, "endLine": 5, - "endColumn": 29, - "start": 129, - "end": 141 + "endColumn": 33, + "start": 133, + "end": 149 } } ], @@ -332,39 +304,25 @@ "raw": "{ (foo )}", "value": { "type": "Identifier", - "start": 145, - "end": 148, - "loc": { - "start": { - "line": 5, - "column": 32 - }, - "end": { - "line": 5, - "column": 35 - } - }, - "range": [ - 145, - 148 - ], + "start": 3, + "end": 6, "name": "foo", "location": { "startLine": 5, - "startColumn": 30, + "startColumn": 34, "endLine": 5, - "endColumn": 39, - "start": 142, - "end": 151 + "endColumn": 43, + "start": 150, + "end": 159 } }, "location": { "startLine": 5, - "startColumn": 30, + "startColumn": 34, "endLine": 5, - "endColumn": 39, - "start": 142, - "end": 151 + "endColumn": 43, + "start": 150, + "end": 159 } } ] @@ -377,24 +335,24 @@ "startLine": 6, "startColumn": 9, "endLine": 6, - "endColumn": 48, - "start": 169, - "end": 208, + "endColumn": 51, + "start": 177, + "end": 219, "startTag": { "startLine": 6, "startColumn": 9, "endLine": 6, - "endColumn": 31, - "start": 169, - "end": 191 + "endColumn": 34, + "start": 177, + "end": 202 }, "endTag": { "startLine": 6, - "startColumn": 39, + "startColumn": 42, "endLine": 6, - "endColumn": 48, - "start": 199, - "end": 208 + "endColumn": 51, + "start": 210, + "end": 219 } }, "attributes": [], @@ -405,25 +363,25 @@ "attributeName": "attr", "value": { "type": "Identifier", - "start": 2, - "end": 5, + "start": 3, + "end": 6, "name": "foo", "location": { "startLine": 6, "startColumn": 17, "endLine": 6, - "endColumn": 30, - "start": 177, - "end": 190 + "endColumn": 33, + "start": 185, + "end": 201 } }, "location": { "startLine": 6, "startColumn": 17, "endLine": 6, - "endColumn": 30, - "start": 177, - "end": 190 + "endColumn": 33, + "start": 185, + "end": 201 } } ], @@ -435,39 +393,25 @@ "raw": "{( foo)}", "value": { "type": "Identifier", - "start": 194, - "end": 197, - "loc": { - "start": { - "line": 6, - "column": 33 - }, - "end": { - "line": 6, - "column": 36 - } - }, - "range": [ - 194, - 197 - ], + "start": 3, + "end": 6, "name": "foo", "location": { "startLine": 6, - "startColumn": 31, + "startColumn": 34, "endLine": 6, - "endColumn": 39, - "start": 191, - "end": 199 + "endColumn": 42, + "start": 202, + "end": 210 } }, "location": { "startLine": 6, - "startColumn": 31, + "startColumn": 34, "endLine": 6, - "endColumn": 39, - "start": 191, - "end": 199 + "endColumn": 42, + "start": 202, + "end": 210 } } ] diff --git a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/iterator/actual.html b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/iterator/actual.html index e3570452ee..9756ba3835 100644 --- a/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/iterator/actual.html +++ b/packages/@lwc/template-compiler/src/__tests__/fixtures/expression-complex/valid/iterator/actual.html @@ -1,7 +1,7 @@