TelluIoT / ThingML

The ThingML modelling language
https://github.com/TelluIoT/ThingML
Apache License 2.0
101 stars 32 forks source link

Invalid generated code when a message parameter and the instance share the same name #264

Closed fungiboletus closed 5 years ago

fungiboletus commented 5 years ago

ThingML model to reproduce the problem

thing fragment StatusMsg {
    message stalled(status: Boolean)
}
thing fragment StatusProvidedPort includes StatusMsg {
    provided port statusInput {
        receives stalled
    }
}
thing Status includes StatusProvidedPort {
    statechart init default {
        state default {
            internal event e.statusInput?stalled guard e.status == true action print "Stalled"
        }
    }
}
configuration Whatever {
    ...
    instance status:Status
    ...
    connector otherThing.statusInput => status.statusInput
    ...
}

Generated code

controller.bus.on('statusInput?stalled', (status) => status.receivestalledOnstatusInput(status));

Problem

status is not the status instance but the status boolean parameter. In other words, a message parameter may override the instance reference.

brice-morin commented 5 years ago

Are you fixing it?

fungiboletus commented 5 years ago

It's very very... very far on my todo list. I just renamed the message parameter.

Le ven. 16 nov. 2018 à 14:51, Brice Morin notifications@github.com a écrit :

Are you fixing it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TelluIoT/ThingML/issues/264#issuecomment-439398832, or mute the thread https://github.com/notifications/unsubscribe-auth/AACyrEuJCPcuVxn7ezE-KXgoxdAr63ulks5uvsLpgaJpZM4Yl_2I .