diff options
author | Linus Groh <mail@linusgroh.de> | 2020-06-08 12:08:35 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-08 14:01:31 +0200 |
commit | 5072d4e02d914a6d7d09b3ebb79ead2230997a21 (patch) | |
tree | 9a018d6cafeee27772d37017fcba0311614b68d5 /Libraries/LibWeb/Layout/LayoutBlock.h | |
parent | 89004a3a40cc88f7abb19650bc59a15ca35dcd46 (diff) | |
download | serenity-5072d4e02d914a6d7d09b3ebb79ead2230997a21.zip |
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
>
Diffstat (limited to 'Libraries/LibWeb/Layout/LayoutBlock.h')
0 files changed, 0 insertions, 0 deletions