ladybird/Libraries/LibJS
Linus Groh 5072d4e02d LibJS+js: Support getting last value from "_" variable
The interpreter now has an "underscore is last value" flag, which makes
Interpreter::get_variable() return the last value if:

- The m_underscore_is_last_value flag is enabled
- The name of the variable lookup is "_"
- The result of that lookup is an empty value

That means "_" can still be used as a regular variable and will stop
doing its magic once anything is assigned to it.

Example REPL session:

> 1
1
> _ + _
2
> _ + _
4
> _ = "foo"
"foo"
> 1
1
> _
"foo"
> delete _
true
> 1
1
> _
1
>
2020-06-08 14:01:31 +02:00
..
Heap LibJS: Fix undefined behavior in HeapBlock 2020-06-01 17:37:44 +02:00
Runtime LibJS+LibWeb: Remove a bunch of calls to Interpreter::global_object() 2020-06-08 12:25:45 +02:00
Tests LibJS: Add BigInt 2020-06-07 19:29:40 +02:00
AST.cpp LibJS: Add interpreter exception checks 2020-06-08 09:57:29 +02:00
AST.h LibJS: Add BigInt 2020-06-07 19:29:40 +02:00
CMakeLists.txt LibJS: Add BigInt 2020-06-07 19:29:40 +02:00
Console.cpp LibJS: Move Interpreter::get_trace() to ConsoleClient 2020-06-02 15:22:34 +02:00
Console.h LibJS: Move Interpreter::get_trace() to ConsoleClient 2020-06-02 15:22:34 +02:00
Forward.h LibJS: Add BigInt 2020-06-07 19:29:40 +02:00
Interpreter.cpp LibJS+js: Support getting last value from "_" variable 2020-06-08 14:01:31 +02:00
Interpreter.h LibJS+js: Support getting last value from "_" variable 2020-06-08 14:01:31 +02:00
Lexer.cpp LibJS: Move regex logic to main Lexer if statement 2020-06-08 09:18:27 +02:00
Lexer.h LibJS: Lex and parse regex literals, add RegExp objects 2020-06-07 19:06:55 +02:00
MarkupGenerator.cpp LibJS: Add BigInt 2020-06-07 19:29:40 +02:00
MarkupGenerator.h Meta: Add a script check the presence of "#pragma once" in header files 2020-05-29 07:59:45 +02:00
Parser.cpp LibJS: Add BigInt 2020-06-07 19:29:40 +02:00
Parser.h LibJS: Lex and parse regex literals, add RegExp objects 2020-06-07 19:06:55 +02:00
Token.cpp LibJS: Fix out-of-bounds read when parsing escape sequences 2020-06-01 17:37:44 +02:00
Token.h LibJS: Add BigInt 2020-06-07 19:29:40 +02:00