github / github/codeql

Ruby: &[SPACE][identifier] syntax breaks Ruby parsing

Aperta
#21,801 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
question
Lingua principale
CodeQL
Stelle
10.1k
Fork
2.1k
Merge medio
2g 15h
PR unite (30g)
141

Descrizione

CodeQL's Ruby breaks parsing breaks for the following code:

```ruby
sorted_array = array.sort(& custom_sorts[params[:sortby]])
```

I understand that the following *should* be how this is written, but sometimes people put weird syntax in and it shouldn't break a whole file being parsed:

```ruby
sorted_array = array.sort(&custom_sorts[params[:sortby]])
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start by reproducing the Ruby parser failure with the two sort examples in the issue, focusing on the space between `&` and the identifier. Trace the parser entry point that handles this syntax and verify that both forms are accepted without preventing the rest of the file from being parsed.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
ruby
Ambito
compilers
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.