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
clean-compiler-and-rts
compiler
Commits
01e1cf9f
Commit
01e1cf9f
authored
Dec 14, 2004
by
John van Groningen
Browse files
remove workaround for a bug in Clean 2.0, that seems to have been fixed already
parent
92107a1e
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/postparse.icl
View file @
01e1cf9f
...
...
@@ -964,23 +964,10 @@ makeComprehensions [{tq_generators, tq_filter, tq_end, tq_call, tq_lhs_args, tq_
case_with_default
case_ident
expr
expr_is_uselect
pattern
=:(
PE_Ident
ident
)
rhs
=:{
rhs_alts
=
UnGuardedExpr
ung_exp
=:{
ewl_nodes
,
ewl_expr
,
ewl_locals
=
LocalParsedDefs
[],
ewl_position
},
rhs_locals
=
LocalParsedDefs
[]}
default_rhs
#
new_node
={
ndwl_strict
=
False
,
ndwl_def
={
bind_src
=
expr
,
bind_dst
=
pattern
},
ndwl_locals
=
LocalParsedDefs
[],
ndwl_position
=
ewl_position
}
=
{
rhs
&
rhs_alts
=
UnGuardedExpr
{
ung_exp
&
ewl_nodes
=[
new_node
:
ewl_nodes
]}}
/* Clean 2.0 generates incorrect code for:
case_with_default
case_ident
expr
expr_is_uselect
=:
True
pattern
=:(
PE_Tuple
[
PE_Ident
ident1
,
ident2_exp
=:
PE_Ident
ident2
])
rhs
=:{
rhs_alts
=
UnGuardedExpr
ung_exp
=:{
ewl_nodes
,
ewl_expr
,
ewl_locals
=
LocalParsedDefs
[],
ewl_position
},
rhs_locals
=
LocalParsedDefs
[]}
default_rhs
#
new_node1
={
ndwl_strict
=
False
,
ndwl_def
={
bind_src
=
expr
,
bind_dst
=
pattern
},
ndwl_locals
=
LocalParsedDefs
[],
ndwl_position
=
ewl_position
}
#
new_node2
={
ndwl_strict
=
True
,
ndwl_def
={
bind_src
=
ident2_exp
,
bind_dst
=
ident2_exp
},
ndwl_locals
=
LocalParsedDefs
[],
ndwl_position
=
ewl_position
}
=
{
rhs
&
rhs_alts
=
UnGuardedExpr
{
ung_exp
&
ewl_nodes
=[
new_node1
,
new_node2
:
ewl_nodes
]}}
we therefore use:
*/
case_with_default
case_ident
expr
expr_is_uselect
pattern
=:(
PE_Tuple
[
PE_Ident
ident1
,
ident2_exp
=:
PE_Ident
ident2
])
rhs
=:{
rhs_alts
=
UnGuardedExpr
ung_exp
=:{
ewl_nodes
,
ewl_expr
,
ewl_locals
=
LocalParsedDefs
[],
ewl_position
},
rhs_locals
=
LocalParsedDefs
[]}
default_rhs
|
expr_is_uselect
#
new_node1
={
ndwl_strict
=
False
,
ndwl_def
={
bind_src
=
expr
,
bind_dst
=
pattern
},
ndwl_locals
=
LocalParsedDefs
[],
ndwl_position
=
ewl_position
}
#
new_node2
={
ndwl_strict
=
True
,
ndwl_def
={
bind_src
=
ident2_exp
,
bind_dst
=
ident2_exp
},
ndwl_locals
=
LocalParsedDefs
[],
ndwl_position
=
ewl_position
}
=
{
rhs
&
rhs_alts
=
UnGuardedExpr
{
ung_exp
&
ewl_nodes
=[
new_node1
,
new_node2
:
ewl_nodes
]}}
=
exprToRhs
(
PE_Case
case_ident
expr
[
{
calt_pattern
=
pattern
,
calt_rhs
=
rhs
}
,
{
calt_pattern
=
PE_WildCard
,
calt_rhs
=
exprToRhs
default_rhs
}
])
/**/
case_with_default
case_ident
expr
expr_is_uselect
PE_Empty
rhs
default_rhs
=
rhs
case_with_default
case_ident
expr
expr_is_uselect
pattern
rhs
default_rhs
...
...
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