Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thierry Martinez
override
Commits
c2af83d3
Commit
c2af83d3
authored
Jul 04, 2019
by
Thierry Martinez
Browse files
Distribute override internal attributes over [%%types]
parent
9f4f546f
Pipeline
#85453
passed with stages
in 19 minutes and 26 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/override.ml
View file @
c2af83d3
...
...
@@ -1271,13 +1271,26 @@ module Make_mapper (Wrapper : Ast_wrapper.S) = struct
fun
(
item
:
Symbol_table
.
item
)
->
begin
match
item
with
|
Type
group
->
let
rev_override_attrs
,
rev_other_attrs
=
attrs
|>
List
.
fold_left
begin
fun
(
rev_override_attrs
,
rev_other_attrs
)
(
attr
:
Parsetree
.
attribute
)
->
let
attr_name
=
(
fst
attr
)
.
txt
in
if
attr_name
=
attr_from
||
attr_name
=
attr_rewrite
||
attr_name
=
attr_remove
then
(
attr
::
rev_override_attrs
,
rev_other_attrs
)
else
(
rev_override_attrs
,
attr
::
rev_other_attrs
)
end
([]
,
[]
)
in
let
override_attrs
=
List
.
rev
rev_override_attrs
in
let
other_attrs
=
List
.
rev
rev_other_attrs
in
begin
match
decl_of_list
~
loc
[]
modident
decl_of_list
~
loc
override_attrs
modident
rewrite_context
group
.
decls
context
.
overriden_ref
context
.
defined_ref
with
|
[]
->
None
|
hd
::
tl
->
let
ptype_attributes
=
attrs
@
hd
.
ptype_attributes
in
let
ptype_attributes
=
other_
attrs
@
hd
.
ptype_attributes
in
let
decls
=
{
hd
with
ptype_attributes
}
::
tl
in
Some
(
mk_type
~
loc
context
group
.
rec_flag
decls
)
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment