Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
2802-stdlib-Add-option-location-to-erl_parse-ab...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2802-stdlib-Add-option-location-to-erl_parse-abstract-2.patch of Package erlang
From f384bf793fbce369cf384ec2916ee329fd2e0586 Mon Sep 17 00:00:00 2001 From: Hans Bolinder <hasse@erlang.org> Date: Wed, 3 Feb 2021 08:33:03 +0100 Subject: [PATCH] stdlib: Add option 'location' to erl_parse:abstract/2 Fix of commit 7dbee868ab3ab82a5c1faf88cae2cf0429f91a0b: a location {Line, Column} can be given as second argument. --- lib/stdlib/src/erl_parse.yrl | 10 +++++----- lib/stdlib/test/erl_scan_SUITE.erl | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/stdlib/src/erl_parse.yrl b/lib/stdlib/src/erl_parse.yrl index f6d747901f..9beab0ac25 100644 --- a/lib/stdlib/src/erl_parse.yrl +++ b/lib/stdlib/src/erl_parse.yrl @@ -1431,7 +1431,7 @@ abstract(T) -> %%% abstract/2 takes line and encoding options -spec abstract(Data, Options) -> AbsTerm when Data :: term(), - Options :: Line | [Option], + Options :: Location | [Option], Option :: {encoding, Encoding} | {line, Line} | {location, Location}, @@ -1440,9 +1440,6 @@ abstract(T) -> Location :: erl_anno:location(), AbsTerm :: abstract_expr(). -abstract(T, Line) when is_integer(Line) -> - Anno = erl_anno:new(Line), - abstract(T, Anno, enc_func(epp:default_encoding())); abstract(T, Options) when is_list(Options) -> Encoding = proplists:get_value(encoding, Options,epp:default_encoding()), EncFunc = enc_func(Encoding), @@ -1454,7 +1451,10 @@ abstract(T, Options) when is_list(Options) -> Loc end, Anno = erl_anno:new(Location), - abstract(T, Anno, EncFunc). + abstract(T, Anno, EncFunc); +abstract(T, Location) -> + Anno = erl_anno:new(Location), + abstract(T, Anno, enc_func(epp:default_encoding())). -define(UNICODE(C), (C < 16#D800 orelse diff --git a/lib/stdlib/test/erl_scan_SUITE.erl b/lib/stdlib/test/erl_scan_SUITE.erl index 50e2bc1a35..963bc2a6fc 100644 --- a/lib/stdlib/test/erl_scan_SUITE.erl +++ b/lib/stdlib/test/erl_scan_SUITE.erl @@ -1207,6 +1207,7 @@ otp_17024(Config) when is_list(Config) -> Opts1 = [{location,Line}], {integer,Line,1} = erl_parse_abstract(1, Opts1), Location = {17, 42}, + {integer,Location,1} = erl_parse_abstract(1, Location), Opts2 = [{location,Location}], {integer,Location,1} = erl_parse_abstract(1, Opts2), ok. -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor