Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Kirill Smelkov
cpython
Commits
288a60f9
Commit
288a60f9
authored
Dec 16, 1991
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New argument passing.
parent
9c7b861a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
Python/compile.c
Python/compile.c
+17
-14
No files found.
Python/compile.c
View file @
288a60f9
...
...
@@ -193,6 +193,7 @@ static int com_add PROTO((struct compiling *, object *, object *));
static
int
com_addconst
PROTO
((
struct
compiling
*
,
object
*
));
static
int
com_addname
PROTO
((
struct
compiling
*
,
object
*
));
static
void
com_addopname
PROTO
((
struct
compiling
*
,
int
,
node
*
));
static
void
com_list
PROTO
((
struct
compiling
*
,
node
*
,
int
));
static
int
com_init
(
c
,
filename
)
...
...
@@ -655,10 +656,13 @@ com_call_function(c, n)
node
*
n
;
/* EITHER testlist OR ')' */
{
if
(
TYPE
(
n
)
==
RPAR
)
{
com_addbyte
(
c
,
UNARY_CALL
);
com_addoparg
(
c
,
BUILD_TUPLE
,
0
);
com_addbyte
(
c
,
BINARY_CALL
);
}
else
{
com_node
(
c
,
n
);
int
i
;
REQ
(
n
,
testlist
);
com_list
(
c
,
n
,
1
);
com_addbyte
(
c
,
BINARY_CALL
);
}
}
...
...
@@ -1047,12 +1051,13 @@ com_test(c, n)
}
static
void
com_list
(
c
,
n
)
com_list
(
c
,
n
,
toplevel
)
struct
compiling
*
c
;
node
*
n
;
int
toplevel
;
/* If nonzero, *always* build a tuple */
{
/* exprlist: expr (',' expr)* [',']; likewise for testlist */
if
(
NCH
(
n
)
==
1
)
{
if
(
NCH
(
n
)
==
1
&&
!
toplevel
)
{
com_node
(
c
,
CHILD
(
n
,
0
));
}
else
{
...
...
@@ -1864,7 +1869,7 @@ com_node(c, n)
/* Expression nodes */
case
testlist
:
com_list
(
c
,
n
);
com_list
(
c
,
n
,
0
);
break
;
case
test
:
com_test
(
c
,
n
);
...
...
@@ -1879,7 +1884,7 @@ com_node(c, n)
com_comparison
(
c
,
n
);
break
;
case
exprlist
:
com_list
(
c
,
n
);
com_list
(
c
,
n
,
0
);
break
;
case
expr
:
com_expr
(
c
,
n
);
...
...
@@ -1970,10 +1975,13 @@ compile_funcdef(c, n)
ch
=
CHILD
(
n
,
2
);
/* parameters: '(' [fplist] ')' */
ch
=
CHILD
(
ch
,
1
);
/* ')' | fplist */
if
(
TYPE
(
ch
)
==
RPAR
)
com_add
byte
(
c
,
REFUSE_ARGS
);
com_add
oparg
(
c
,
UNPACK_ARG
,
0
);
else
{
com_addbyte
(
c
,
REQUIRE_ARGS
);
com_fplist
(
c
,
ch
);
int
i
;
REQ
(
ch
,
fplist
);
/* fplist: fpdef (',' fpdef)* */
com_addoparg
(
c
,
UNPACK_ARG
,
(
NCH
(
ch
)
+
1
)
/
2
);
for
(
i
=
0
;
i
<
NCH
(
ch
);
i
+=
2
)
com_fpdef
(
c
,
CHILD
(
ch
,
i
));
}
c
->
c_infunction
=
1
;
com_node
(
c
,
CHILD
(
n
,
4
));
...
...
@@ -1993,7 +2001,6 @@ compile_node(c, n)
case
single_input
:
/* One interactive command */
/* NEWLINE | simple_stmt | compound_stmt NEWLINE */
com_addbyte
(
c
,
REFUSE_ARGS
);
n
=
CHILD
(
n
,
0
);
if
(
TYPE
(
n
)
!=
NEWLINE
)
com_node
(
c
,
n
);
...
...
@@ -2002,20 +2009,17 @@ compile_node(c, n)
break
;
case
file_input
:
/* A whole file, or built-in function exec() */
com_addbyte
(
c
,
REFUSE_ARGS
);
com_file_input
(
c
,
n
);
com_addoparg
(
c
,
LOAD_CONST
,
com_addconst
(
c
,
None
));
com_addbyte
(
c
,
RETURN_VALUE
);
break
;
case
expr_input
:
/* Built-in function eval() */
com_addbyte
(
c
,
REFUSE_ARGS
);
com_node
(
c
,
CHILD
(
n
,
0
));
com_addbyte
(
c
,
RETURN_VALUE
);
break
;
case
eval_input
:
/* Built-in function input() */
com_addbyte
(
c
,
REFUSE_ARGS
);
com_node
(
c
,
CHILD
(
n
,
0
));
com_addbyte
(
c
,
RETURN_VALUE
);
break
;
...
...
@@ -2028,7 +2032,6 @@ compile_node(c, n)
/* classdef: 'class' NAME
['(' testlist ')' |'(' ')' ['=' baselist]]
':' suite */
com_addbyte
(
c
,
REFUSE_ARGS
);
com_node
(
c
,
CHILD
(
n
,
NCH
(
n
)
-
1
));
/* The suite */
com_addbyte
(
c
,
LOAD_LOCALS
);
com_addbyte
(
c
,
RETURN_VALUE
);
...
...
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