Skip to content

Compiler crashes when compiler file whose only content is return #323

@IsaacOscar

Description

@IsaacOscar

Literally what the title says: create a grace file with body return, and mgc will crash:

BoundsError: index 5 but list has size 4
  raised from list.at(_) at /root/GraceTC/minigrace/collections.grace:423
  requested from suggestion.new.getLine(_) at /root/GraceTC/minigrace/errormessages.grace:269
  requested from suggestion.new.deleteRange(_,_)onLine(_) at /root/GraceTC/minigrace/errormessages.grace:66
  requested from suggestion.new.deleteToken(_)leading(_)trailing(_) at /root/GraceTC/minigrace/errormessages.grace:170
  requested from doreturn at /root/GraceTC/minigrace/parser.grace:2778
  requested from statement at /root/GraceTC/minigrace/parser.grace:2982
  requested from block.apply at /root/GraceTC/minigrace/parser.grace:3208
  requested from while(_)do(_) at intrinsic.grace:111
  requested from parse(_) at /root/GraceTC/minigrace/parser.grace:3184
  requested from block.apply at /root/GraceTC/minigrace/compiler.grace:39
  requested from compileInputFile at /root/GraceTC/minigrace/compiler.grace:23
  requested from module initialization at /root/GraceTC/minigrace/compiler.grace:16
 422:         method at(n) { 423:             native "js" code ‹var idx = var_n._value; 424:                 var result = this._value[idx-1];

Obviously this is such an unlikely case, it's a not a major issue. I just wanted to see if returns were allowed inside modules and what would happen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions