Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
typon
typon-compiler
Commits
e33bf6d1
Commit
e33bf6d1
authored
Mar 26, 2024
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix call_sync for bound methods
parent
c307f373
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
17 deletions
+32
-17
typon/include/python/builtins.hpp
typon/include/python/builtins.hpp
+29
-14
typon/include/python/builtins/mutex.hpp
typon/include/python/builtins/mutex.hpp
+2
-2
typon/include/python/builtins/range.hpp
typon/include/python/builtins/range.hpp
+1
-1
No files found.
typon/include/python/builtins.hpp
View file @
e33bf6d1
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
#include <typon/typon.hpp>
#include <typon/typon.hpp>
#ifdef __cpp_lib_unreachable
#ifdef __cpp_lib_unreachable
#include <utility>
#include <utility>
[[
noreturn
]]
inline
void
TYPON_UNREACHABLE
()
{
std
::
unreachable
();
}
[[
noreturn
]]
inline
void
TYPON_UNREACHABLE
()
{
std
::
unreachable
();
}
...
@@ -394,6 +393,21 @@ using InterpGuard = py::scoped_interpreter;
...
@@ -394,6 +393,21 @@ using InterpGuard = py::scoped_interpreter;
template
<
typename
T
>
template
<
typename
T
>
concept
HasSync
=
requires
(
T
t
)
{
typename
T
::
has_sync
;
};
concept
HasSync
=
requires
(
T
t
)
{
typename
T
::
has_sync
;
};
template
<
typename
T
>
struct
HasBoundSync_t
{
static
constexpr
bool
value
=
false
;
};
template
<
typename
S
,
typename
F
>
struct
HasBoundSync_t
<
referencemodel
::
boundmethod
<
S
,
F
>>
{
static
constexpr
bool
value
=
HasSync
<
F
>
;
auto
operator
()(
auto
...
args
)
{
return
F
{}.
typon
$$
sync
(
S
{},
std
::
forward
<
decltype
(
args
)
>
(
args
)...);
}
};
template
<
typename
T
>
concept
HasBoundSync
=
HasBoundSync_t
<
T
>::
value
;
/*auto call_sync(auto f, auto... args) {
/*auto call_sync(auto f, auto... args) {
if constexpr (HasSync<decltype(f)>) {
if constexpr (HasSync<decltype(f)>) {
return f.sync(std::forward<decltype(args)>(args)...);
return f.sync(std::forward<decltype(args)>(args)...);
...
@@ -407,6 +421,8 @@ auto call_sync(auto f) {
...
@@ -407,6 +421,8 @@ auto call_sync(auto f) {
return
[
f
](
auto
...
args
)
{
return
[
f
](
auto
...
args
)
{
return
f
.
typon
$$
sync
(
std
::
forward
<
decltype
(
args
)
>
(
args
)...);
return
f
.
typon
$$
sync
(
std
::
forward
<
decltype
(
args
)
>
(
args
)...);
};
};
}
else
if
constexpr
(
HasBoundSync
<
decltype
(
f
)
>
)
{
return
HasBoundSync_t
<
decltype
(
f
)
>
{};
}
else
{
}
else
{
return
f
;
return
f
;
}
}
...
@@ -425,20 +441,19 @@ struct {
...
@@ -425,20 +441,19 @@ struct {
using
has_sync
=
std
::
true_type
;
using
has_sync
=
std
::
true_type
;
template
<
typename
T
>
template
<
typename
T
>
auto
typon
$$
sync
(
T
value
)
const
->
decltype
(
referencemodel
::
Rc
(
future
(
std
::
declval
<
Task
<
T
>>
())))
auto
typon
$$
sync
(
T
value
)
const
{
->
decltype
(
referencemodel
::
Rc
(
future
(
std
::
declval
<
Task
<
T
>>
())))
{
//
return referencemodel::Rc(future(task));
//
return referencemodel::Rc(future(task));
throw
;
throw
;
}
}
template
<
typename
Task
>
template
<
typename
Task
>
auto
operator
()(
Task
task
)
const
->
typon
::
Task
<
decltype
(
referencemodel
::
Rc
(
future
(
std
::
move
(
task
))))
>
auto
operator
()(
Task
task
)
const
{
->
typon
::
Task
<
decltype
(
referencemodel
::
Rc
(
future
(
std
::
move
(
task
))))
>
{
co_return
referencemodel
::
Rc
(
co_await
future
(
std
::
move
(
task
)));
co_return
referencemodel
::
Rc
(
co_await
future
(
std
::
move
(
task
)));
}
}
}
static
constexpr
future_stdlib
{};
}
static
constexpr
future_stdlib
{};
}
;
// namespace typon
}
;
// namespace typon
#endif // TYPON_BUILTINS_HPP
#endif // TYPON_BUILTINS_HPP
typon/include/python/builtins/mutex.hpp
View file @
e33bf6d1
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
namespace
view
=
std
::
views
;
namespace
view
=
std
::
views
;
#include <python/basedef.hpp>
#include "print.hpp"
#include "print.hpp"
#include <python/basedef.hpp>
namespace
typon
{
namespace
typon
{
using
namespace
referencemodel
;
using
namespace
referencemodel
;
...
...
typon/include/python/builtins/range.hpp
View file @
e33bf6d1
...
@@ -9,8 +9,8 @@
...
@@ -9,8 +9,8 @@
namespace
view
=
std
::
views
;
namespace
view
=
std
::
views
;
#include <python/basedef.hpp>
#include "int.hpp"
#include "int.hpp"
#include <python/basedef.hpp>
auto
stride
=
[](
int
n
)
{
auto
stride
=
[](
int
n
)
{
return
[
s
=
-
1
,
n
](
auto
const
&
)
mutable
{
return
[
s
=
-
1
,
n
](
auto
const
&
)
mutable
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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