Lint and format src/compiler/parse/read/script.js

pull/8569/head
Simon Holthausen 3 years ago
parent b5d4f92f95
commit db8b24eff5

@ -12,8 +12,7 @@ const regex_starts_with_closing_script_tag = /^<\/script\s*>/;
*/
function get_context(parser, attributes, start) {
const context = attributes.find((attribute) => attribute.name === 'context');
if (!context)
return 'default';
if (!context) return 'default';
if (context.value.length !== 1 || context.value[0].type !== 'Text') {
parser.error(parser_errors.invalid_script_context_attribute, start);
}
@ -36,7 +35,8 @@ export default function read_script(parser, start, attributes) {
if (parser.index >= parser.template.length) {
parser.error(parser_errors.unclosed_script);
}
const source = parser.template.slice(0, script_start).replace(regex_not_newline_characters, ' ') + data;
const source =
parser.template.slice(0, script_start).replace(regex_not_newline_characters, ' ') + data;
parser.read(regex_starts_with_closing_script_tag);
/**
@ -45,8 +45,7 @@ export default function read_script(parser, start, attributes) {
let ast;
try {
ast = acorn.parse(source);
}
catch (err) {
} catch (err) {
parser.acorn_error(err);
}
// TODO is this necessary?
@ -59,7 +58,3 @@ export default function read_script(parser, start, attributes) {
content: ast
};
}

Loading…
Cancel
Save