Function.prototyp.toString only returns a fixed `[native code]` string
ECMASCript feature Function.prototyp.toString returns the actual javascript implementation in v8. ECMAScript specification
Example code
let f = () => 1 + 1;
console.log(f.toString());
The expected output is () => 1 + 1.
Is it ok to add in Cursor a fields that will collect source_text: Vec<u32> when callable is parsing (if nested callable is parsing then it just will take slice of it) to solve the issue?
Or maybe do it at some lower layer(on BufferedLexer or Lexer) to pass less params?
Is it acceptable to add this fields into Interner? It seems like not fully fit the meaning of Interner, but it looks very convenient because we have &mut Interner in Tokenizer::lex.
Yeah, those changes sound good. I would say that on the AST side it would be the Module and the Script the ones holding the script source, and the rest of nodes would just have a span to index that.
Hmm, do I understand you correctly: collect ALL the source code, and use it whenever we need some part of initial code (e.g. name of functions, string literals, and function source codes)?
Or should it be done only for source codes of functions (it's what I try to do now)?
All the code probably, because we're planning to use that to improve the error messages.