rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
158 stars 46 forks source link

Const compilation issue #666

Closed tomek-r closed 2 years ago

tomek-r commented 2 years ago

Hey I am experiencing some issues when working with consts

Error when calling plugin BscPlugin.beforeFileTranspile: TypeError: Cannot read property 'getConstFileLink' of undefined at BrsFilePreTranspileProcessor.processExpression (/node_modules/brighterscript/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js:70:46

brighterscript version is 0.55.0 the code:

namespace Settings
    const KEY = "Key"
end namespace

It compiles after all but produces the error. I have no additional plugins installed.

TwitchBronBron commented 2 years ago

I can't seem to reproduce this. Would you be able to put together either a) some steps on how to reproduce this issue? b) a small sample app that reproduces the issue?

xgouchet commented 2 years ago

I'm running on the same issue when I started setting up bslint + roca.

Because I want bslint to apply on my test files as well, I'm using the following bsconfig.json:

{
    "rootDir": "src",
    "files": [
        "manifest",
        "source/**/*.*",
        "components/**/*.*",
        "images/**/*.*",
        "tests/**/*.*"
    ],
    "plugins": [
        "@rokucommunity/bslint"
    ]
}

And then in my src/tests folder, I have a sample roca test:

function main(args as object) as object
    return roca(args).describe("test suite", sub()
        m.pass()
    end sub)
end function

I don't have any other *.brs or *.xml files in my source or components folders.

TwitchBronBron commented 2 years ago

@xgouchet great, thanks! I was able to reproduce this issue with that example. I'll looking into what's causing this crash.

image