diff options
author | Björn-Egil Dahlberg <[email protected]> | 2014-03-18 12:17:47 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2014-03-18 12:17:47 +0100 |
commit | 8d66a2823c29cbe44cf80e4de0c58f2ed5c29bd4 (patch) | |
tree | 9e15b0d71d52176905fd1c45fe1160b09be07dfd /lib/debugger/src/dbg_ieval.erl | |
parent | fb0a5a669e43590de66d662b99c2762e596c01e3 (diff) | |
parent | 4185be0ad649bccb15bb67a15b618b6cc14fe253 (diff) | |
download | otp-8d66a2823c29cbe44cf80e4de0c58f2ed5c29bd4.tar.gz otp-8d66a2823c29cbe44cf80e4de0c58f2ed5c29bd4.tar.bz2 otp-8d66a2823c29cbe44cf80e4de0c58f2ed5c29bd4.zip |
Merge branch 'nox/maps-eval-empty-update'
* nox/maps-eval-empty-update:
Fix evaluation of empty map patterns in erl_lint
Fix evaluation of empty map updates in the debugger
Fix evaluation of empty map updates in erl_eval
Diffstat (limited to 'lib/debugger/src/dbg_ieval.erl')
-rw-r--r-- | lib/debugger/src/dbg_ieval.erl | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/debugger/src/dbg_ieval.erl b/lib/debugger/src/dbg_ieval.erl index 1d36aae8ee..0653ce4c00 100644 --- a/lib/debugger/src/dbg_ieval.erl +++ b/lib/debugger/src/dbg_ieval.erl @@ -663,12 +663,16 @@ expr({map,Line,Fs0}, Bs0, Ieval) -> expr({map,Line,E0,Fs0}, Bs0, Ieval0) -> Ieval = Ieval0#ieval{line=Line,top=false}, {value,E,Bs1} = expr(E0, Bs0, Ieval), - {Fs,Bs2} = eval_map_fields(Fs0, Bs1, Ieval), - Value = lists:foldl(fun ({map_assoc,K,V}, Mi) -> maps:put(K,V,Mi); - ({map_exact,K,V}, Mi) -> maps:update(K,V,Mi) end, - E, Fs), - {value,Value,Bs2}; - + case E of + #{} -> + {Fs,Bs2} = eval_map_fields(Fs0, Bs1, Ieval), + Value = lists:foldl(fun ({map_assoc,K,V}, Mi) -> maps:put(K,V,Mi); + ({map_exact,K,V}, Mi) -> maps:update(K,V,Mi) + end, E, Fs), + {value,Value,Bs2}; + _ -> + exception(error, {badarg,E}, Bs1, Ieval) + end; %% A block of statements expr({block,Line,Es},Bs,Ieval) -> seq(Es, Bs, Ieval#ieval{line=Line}); |