uuosio / ascdk

MIT License
12 stars 9 forks source link

Resolve actual type for decorator #44

Closed jafri closed 2 years ago

jafri commented 2 years ago

Current resolution:

const name123 = "name"

@table(name123)
class Table {}

This will currently resolve to a table name of name123 in the ABI, but it should resolve to "name"

learnforpractice commented 2 years ago

Table decorator doesn't support variable as table name currently, it always treats it as a string, whether or not within a pair of quotation marks. I think the transform should throw an error if the table name is not a string within a pair of quotation marks.

jafri commented 2 years ago

Is supporting variable resolution there difficult?

It is very useful to specify a variable there as you can ensure constants in a seperate file, having random strings all over your project is not good for maintability

learnforpractice commented 2 years ago

Decorators don't support variables I think.

Transform is been called before compiling, it has no idea what a variable is.

jafri commented 2 years ago

Okay @learnforpractice, lets switch it to string only and throw error if isQuoted is false