Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
f9992af3
Commit
f9992af3
authored
May 30, 2014
by
Vinzenz Feenstra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applied make format
Signed-off-by:
Vinzenz Feenstra
<
evilissimo@gmail.com
>
parent
b90aa69d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+16
-16
No files found.
src/runtime/builtin_modules/builtins.cpp
View file @
f9992af3
...
...
@@ -34,45 +34,45 @@ extern "C" Box* trap() {
return
None
;
}
extern
"C"
Box
*
dir1
(
Box
*
obj
)
{
extern
"C"
Box
*
dir1
(
Box
*
obj
)
{
// TODO: Recursive class traversal for lookup of types and eliminating
// duplicates afterwards
BoxedList
*
result
=
nullptr
;
if
(
obj
->
cls
->
hasattrs
)
{
BoxedList
*
result
=
nullptr
;
if
(
obj
->
cls
->
hasattrs
)
{
// If __dir__ is present just call it and return what it returns
HCBox
*
hcb
=
static_cast
<
HCBox
*>
(
obj
);
Box
*
obj_dir
=
hcb
->
cls
->
getattr
(
"__dir__"
,
nullptr
,
nullptr
);
if
(
obj_dir
)
{
HCBox
*
hcb
=
static_cast
<
HCBox
*>
(
obj
);
Box
*
obj_dir
=
hcb
->
cls
->
getattr
(
"__dir__"
,
nullptr
,
nullptr
);
if
(
obj_dir
)
{
return
runtimeCall
(
obj_dir
,
1
,
obj
,
nullptr
,
nullptr
,
nullptr
);
}
// If __dict__ is present use its keys and add the reset below
Box
*
obj_dict
=
hcb
->
cls
->
getattr
(
"__dict__"
,
nullptr
,
nullptr
);
if
(
obj_dict
)
{
Box
*
obj_dict
=
hcb
->
cls
->
getattr
(
"__dict__"
,
nullptr
,
nullptr
);
if
(
obj_dict
)
{
result
=
new
BoxedList
();
assert
(
obj_dict
->
cls
==
dict_cls
);
for
(
auto
&
kv
:
static_cast
<
BoxedDict
*>
(
obj_dict
)
->
d
)
{
for
(
auto
&
kv
:
static_cast
<
BoxedDict
*>
(
obj_dict
)
->
d
)
{
listAppend
(
result
,
kv
.
first
);
}
}
}
if
(
!
result
)
{
if
(
!
result
)
{
result
=
new
BoxedList
();
}
for
(
auto
const
&
kv
:
obj
->
cls
->
hcls
->
attr_offsets
)
{
for
(
auto
const
&
kv
:
obj
->
cls
->
hcls
->
attr_offsets
)
{
listAppend
(
result
,
boxString
(
kv
.
first
));
}
if
(
obj
->
cls
->
hasattrs
)
{
HCBox
*
hcb
=
static_cast
<
HCBox
*>
(
obj
);
for
(
auto
const
&
kv
:
hcb
->
hcls
->
attr_offsets
)
{
if
(
obj
->
cls
->
hasattrs
)
{
HCBox
*
hcb
=
static_cast
<
HCBox
*>
(
obj
);
for
(
auto
const
&
kv
:
hcb
->
hcls
->
attr_offsets
)
{
listAppend
(
result
,
boxString
(
kv
.
first
));
}
}
return
result
;
}
extern
"C"
Box
*
dir0
()
{
extern
"C"
Box
*
dir0
()
{
// TODO: This should actually return the elements in the current local
// scope not the content of the builtins_module
return
dir1
(
builtins_module
);
...
...
@@ -550,7 +550,7 @@ void setupBuiltins() {
builtins_module
->
giveAttr
(
"map"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
map2
,
LIST
,
2
,
false
)));
builtins_module
->
giveAttr
(
"zip"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
zip2
,
LIST
,
2
,
false
)));
CLFunction
*
dir_clf
=
boxRTFunction
((
void
*
)
dir0
,
LIST
,
0
,
false
);
CLFunction
*
dir_clf
=
boxRTFunction
((
void
*
)
dir0
,
LIST
,
0
,
false
);
addRTFunction
(
dir_clf
,
(
void
*
)
dir1
,
LIST
,
1
,
false
);
builtins_module
->
giveAttr
(
"dir"
,
new
BoxedFunction
(
dir_clf
));
builtins_module
->
giveAttr
(
"object"
,
object_cls
);
...
...
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