Skip to content

Expression missing two characters #50

Closed
@ekulabuhov

Description

@ekulabuhov

Hey guys! Very nice library! Found a bug while researching this issue: vuejs/vetur#1319

I'm not familiar with the way parser works. Is there anyone who could take a look at this? Thank you!

Code to reproduce:

const { parse } = require('vue-eslint-parser') 

const templateCode = decodeURI("%3Ctemplate%3E%0D%0A%20%20%20%20%3Cdiv%20@click=%22flag%20=%20false%22%20%3E%0D%0A%20%20%20%20%20%20%20%20%7B%7Bgreeting%7D%7D%0D%0A%20%20%20%20%3C/div%3E%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%0A%20%0A%20%0A%3C/template%3E");

const program = parse(templateCode, { sourceType: 'module' });
const handlerExpression = program.templateBody.children[1].startTag.attributes[0].value.expression;
const range = handlerExpression.range;

console.log(templateCode.slice(range[0], range[1]))

Expected:
"flag = false"

Actual:
lag = false"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions