Compile error when passing empty directive names

pull/6300/head
mhmd-22 3 years ago
parent 086cff2272
commit ac8718b3a4

@ -378,6 +378,13 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
if (type) {
const [directive_name, ...modifiers] = name.slice(colon_index + 1).split('|');
if (directive_name === '') {
parser.error({
code: 'empty-directive-name',
message: `${type} name cannot be empty`
}, start+colon_index);
}
if (type === 'Binding' && directive_name !== 'this') {
check_unique(directive_name);
} else if (type !== 'EventHandler' && type !== 'Action') {
@ -391,13 +398,6 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
}, start);
}
if (type === 'Class' && directive_name === '') {
parser.error({
code: 'invalid-class-directive',
message: 'Class binding name cannot be empty'
}, start + colon_index + 1);
}
if (value[0]) {
if ((value as any[]).length > 1 || value[0].type === 'Text') {
parser.error({

@ -1,10 +0,0 @@
{
"code": "invalid-class-directive",
"message": "Class binding name cannot be empty",
"start": {
"line": 1,
"column": 10,
"character": 10
},
"pos": 10
}

@ -0,0 +1,10 @@
{
"code": "empty-directive-name",
"message": "Action name cannot be empty",
"start": {
"line": 1,
"column": 7,
"character": 7
},
"pos": 7
}
Loading…
Cancel
Save