mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-02 04:48:27 +00:00
compiler: Fix identifier normalization function
`__1` is a valid identifier, which we normalized to `--1`, which is invalid. This changes the nromalization function to leave a `_` in the first position.
This commit is contained in:
parent
6e4e98af4e
commit
63f7533dc9
7 changed files with 84 additions and 55 deletions
|
|
@ -461,8 +461,15 @@ function loadSlint(loadData: LoadData): Object {
|
|||
|
||||
// globals
|
||||
instance!.definition().globals.forEach((globalName) => {
|
||||
if (componentHandle[globalName] !== undefined) {
|
||||
console.warn("Duplicated property name " + globalName);
|
||||
const jsName = translateName(globalName);
|
||||
if (componentHandle[jsName] !== undefined) {
|
||||
console.warn(
|
||||
"Duplicated property name " +
|
||||
globalName +
|
||||
" (In JS: " +
|
||||
jsName +
|
||||
")",
|
||||
);
|
||||
} else {
|
||||
const globalObject = Object.create({});
|
||||
|
||||
|
|
@ -576,7 +583,7 @@ function loadSlint(loadData: LoadData): Object {
|
|||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(componentHandle, globalName, {
|
||||
Object.defineProperty(componentHandle, jsName, {
|
||||
get() {
|
||||
return globalObject;
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue