Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initialization by non constant value at declaration of variable statement #8

Closed
r-koubou opened this issue Apr 7, 2018 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@r-koubou
Copy link
Owner

r-koubou commented Apr 7, 2018

[EXPECT]

on init
    declare $i := 0 {OK: 0 is constant value}
    declare $k := get_engine_par( $ENGINE_PAR_VOLUME,-1,-1,-1 )
    {NG: Command may returns non constant value}
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end on

2018-04-07 17 36 27

[NOW]

on init
    declare $i := 0 {OK: 0 is constant value}
    declare $k := get_engine_par( $ENGINE_PAR_VOLUME,-1,-1,-1 )   {OK: Allowed}
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
end on
@r-koubou r-koubou added the bug Something isn't working label Apr 7, 2018
@r-koubou r-koubou added this to the vsce-0.4.1 milestone Apr 7, 2018
@r-koubou r-koubou self-assigned this Apr 7, 2018
@r-koubou
Copy link
Owner Author

r-koubou commented Apr 7, 2018

Done.
It going to be contained in vsce 0.4.1.

@r-koubou r-koubou closed this as completed Apr 7, 2018
@r-koubou r-koubou changed the title Variable initialization from non constant value when declared initialization by non constant value at declaration of variable statement Apr 7, 2018
@r-koubou
Copy link
Owner Author

Reopen.

By behavior of KONTAKT is unknown, errors are currently erroneously detected. I will adjust.

@r-koubou r-koubou reopened this Apr 12, 2018
@r-koubou
Copy link
Owner Author

r-koubou commented Apr 12, 2018

Plan of fixes:

  1. Allow initialization by non constant values. == rollback to previous version's behavior.

  2. Constant variable: deny initializer by return value of KSP command.

declare $X := num_element( %ARRAY ) {OK}
declare const $Y := num_element( %ARRAY )
{
    NG: Because KSP built-in command returns value will maybe undefined
    until running script on KONTAKT. Compiler cannot detect it.
}

@r-koubou
Copy link
Owner Author

Status update: work in progress
Repository: https://github.com/r-koubou/KSPSyntaxParser/tree/bug/20180412_issue8

@r-koubou
Copy link
Owner Author

Done.

r-koubou added a commit to r-koubou/vscode-ksp that referenced this issue Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant