Skip to content

fix(docs): restore jsligo keywords#89

Open
timothymcmackin wants to merge 1 commit intorinderknecht@new_jsligofrom
tpm/keywords
Open

fix(docs): restore jsligo keywords#89
timothymcmackin wants to merge 1 commit intorinderknecht@new_jsligofrom
tpm/keywords

Conversation

@timothymcmackin
Copy link
Contributor

We removed the list of JsLIGO keywords because you can no longer escape them, but it seems to me that we should still have a list of reserved words, because using these words as variable names can crash the compiler. For example, I'll post a contract below that seems to lock up the compiler.

@EduardoRFS This is the list of keywords from jsligo 1.x with the @ keywords removed because apparently you can't create a variable name that starts with @. Is there a way to get the full list from the code?

type storage_type = nat;
type return_type = [list<operation>, storage_type];

class Counter {

  @entry
  static add = (value: nat, store: storage_type): return_type => {
    const else = 5 as nat;
    const export = 5 as nat;
    const false = 5 as nat;
    const for = 5 as nat;
    const from = 5 as nat;
    const if = 5 as nat;
    const implements = 5 as nat;
    const interface = 5 as nat;
    const let = 5 as nat;
    const match = 5 as nat;
    const namespace = 5 as nat;
    const of = 5 as nat;
    const parameter_of = 5 as nat;
    const return = 5 as nat;
    const switch = 5 as nat;
    const true = 5 as nat;
    const type = 5 as nat;
    const when = 5 as nat;
    const while = 5 as nat;
    const sum = else + export + false + for + from + if + implements + interface + let + match + namespace + of + parameter_of + return + switch + true + type + when + while;
    return [[], store + value];
  }

  @entry
  static sub = (value: nat, store: storage_type): return_type =>
    [[], abs(store - value)];

  @view
  static getValue = (_: unit, storage: storage_type): storage_type =>
    storage;
}

@timothymcmackin timothymcmackin self-assigned this Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant