diff options
author | Hans Bolinder <[email protected]> | 2017-12-21 14:15:47 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2018-01-09 16:52:14 +0100 |
commit | 9ab233d389bfc40ddaa56af80ace5cc78470a92b (patch) | |
tree | 34d147cf48674aff810dd5a3ce563e7987907f18 | |
parent | cf3b2c808e8b7eccd39bedbb9c62432f7da5ca59 (diff) | |
download | otp-9ab233d389bfc40ddaa56af80ace5cc78470a92b.tar.gz otp-9ab233d389bfc40ddaa56af80ace5cc78470a92b.tar.bz2 otp-9ab233d389bfc40ddaa56af80ace5cc78470a92b.zip |
syntax_tools: Correct handling of stacktrace variable
A quick fix to make the test suite work with the updated erl_eval.
[I think that if "A:B:_" is allowed, it should have a representation
in the abstract format, but that's another story. The pretty printer
should not modify the source code, just print it nicely, IMHO. (But
removing parentheses is OK)]
-rw-r--r-- | lib/syntax_tools/src/erl_prettypr.erl | 3 | ||||
-rw-r--r-- | lib/syntax_tools/src/erl_syntax.erl | 10 |
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/syntax_tools/src/erl_prettypr.erl b/lib/syntax_tools/src/erl_prettypr.erl index f03f326278..60a15c8e3f 100644 --- a/lib/syntax_tools/src/erl_prettypr.erl +++ b/lib/syntax_tools/src/erl_prettypr.erl @@ -780,8 +780,7 @@ lay_2(Node, Ctxt) -> '_' -> beside(D1, beside(text(":"), D2)); _ -> - D3 = lay(erl_syntax:class_qualifier_stacktrace(Node), - Ctxt1), + D3 = lay(Stacktrace, Ctxt1), beside(D1, beside(beside(text(":"), D2), beside(text(":"), D3))) end; diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl index ed552b73df..b816c0699c 100644 --- a/lib/syntax_tools/src/erl_syntax.erl +++ b/lib/syntax_tools/src/erl_syntax.erl @@ -3895,7 +3895,9 @@ fold_try_clause({clause, Pos, [P], Guard, Body}) -> unfold_try_clauses(Cs) -> [unfold_try_clause(C) || C <- Cs]. -unfold_try_clause({clause, Pos, [{tuple, _, [{atom, _, throw}, V, _]}], +unfold_try_clause({clause, Pos, [{tuple, _, [{atom, _, throw}, + V, + [{var, _, '_'}]]}], Guard, Body}) -> {clause, Pos, [V], Guard, Body}; unfold_try_clause({clause, Pos, [{tuple, _, [C, V, Stacktrace]}], @@ -7761,8 +7763,9 @@ subtrees(T) -> catch_expr -> [[catch_expr_body(T)]]; class_qualifier -> - [[class_qualifier_argument(T)], - [class_qualifier_body(T)]]; + [[class_qualifier_argument(T)], + [class_qualifier_body(T)], + [class_qualifier_stacktrace(T)]]; clause -> case clause_guard(T) of none -> @@ -7983,6 +7986,7 @@ make_tree(block_expr, [B]) -> block_expr(B); make_tree(case_expr, [[A], C]) -> case_expr(A, C); make_tree(catch_expr, [[B]]) -> catch_expr(B); make_tree(class_qualifier, [[A], [B]]) -> class_qualifier(A, B); +make_tree(class_qualifier, [[A], [B], [C]]) -> class_qualifier(A, B, C); make_tree(clause, [P, B]) -> clause(P, none, B); make_tree(clause, [P, [G], B]) -> clause(P, G, B); make_tree(cond_expr, [C]) -> cond_expr(C); |