Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-concurrency
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
Xavier Thompson
typon-concurrency
Commits
b3ad6c19
Commit
b3ad6c19
authored
Jul 07, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add field to store whether type is reference
parent
f8194eae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
trans/transpiler/phases/emit_cpp/expr.py
trans/transpiler/phases/emit_cpp/expr.py
+1
-1
trans/transpiler/phases/typing/types.py
trans/transpiler/phases/typing/types.py
+3
-1
No files found.
trans/transpiler/phases/emit_cpp/expr.py
View file @
b3ad6c19
...
...
@@ -176,7 +176,7 @@ class ExpressionVisitor(NodeVisitor):
def
visit_Attribute
(
self
,
node
:
ast
.
Attribute
)
->
Iterable
[
str
]:
yield
from
self
.
prec
(
"."
).
visit
(
node
.
value
)
if
isinstance
(
node
.
value
.
type
,
UserType
)
:
if
node
.
value
.
type
.
resolve
().
is_reference
:
yield
"->"
else
:
yield
"."
...
...
trans/transpiler/phases/typing/types.py
View file @
b3ad6c19
...
...
@@ -18,6 +18,7 @@ class BaseType(ABC):
parents
:
List
[
"BaseType"
]
=
field
(
default_factory
=
list
,
init
=
False
)
typevars
:
List
[
"TypeVariable"
]
=
field
(
default_factory
=
list
,
init
=
False
)
def
get_parents
(
self
)
->
List
[
"BaseType"
]:
return
self
.
parents
...
...
@@ -124,6 +125,7 @@ class TypeOperator(BaseType, ABC):
is_protocol
:
bool
=
False
is_protocol_gen
:
ClassVar
[
bool
]
=
False
match_cache
:
set
[
"TypeOperator"
]
=
field
(
default_factory
=
set
,
init
=
False
)
is_reference
:
bool
=
False
@
staticmethod
def
make_type
(
name
:
str
):
...
...
@@ -421,7 +423,7 @@ class Future(Promise):
class
UserType
(
TypeOperator
):
def
__init__
(
self
,
name
:
str
):
super
().
__init__
([],
name
=
name
)
super
().
__init__
([],
name
=
name
,
is_reference
=
True
)
def
unify_internal
(
self
,
other
:
"BaseType"
):
if
type
(
self
)
!=
type
(
other
):
...
...
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