merged in latest cython-devel
authorStefan Behnel <scoder@users.berlios.de>
Sat, 1 May 2010 16:54:43 +0000 (18:54 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 1 May 2010 16:54:43 +0000 (18:54 +0200)
1  2 
Cython/Compiler/ExprNodes.py
Cython/Compiler/ModuleNode.py
Cython/Compiler/Nodes.py
Cython/Compiler/Optimize.py
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/Parsing.py

Simple merge
Simple merge
index a0de3210c5a705801fe5c858758458555b1cc07c,d4d3a556a00cbc3b09c67fdb009b5819db124bb3..f789cc7070c4ec49890c414fb458352a40901107
@@@ -4039,41 -3880,17 +4047,23 @@@ class IfStatNode(StatNode)
          if self.else_clause:
              self.else_clause.analyse_expressions(env)
  
-         # eliminate dead code based on constant condition results
-         if_clauses = []
-         condition_result = None
-         for if_clause in self.if_clauses:
-             condition_result = if_clause.get_constant_condition_result()
-             if condition_result != False:
-                 if_clauses.append(if_clause)
-                 if condition_result == True:
-                     # other conditions can no longer apply
-                     self.else_clause = None
-                     break
-         self.if_clauses = if_clauses
-         # FIXME: if only one active code body is left here, we can
-         # replace the whole node
      def generate_execution_code(self, code):
          code.mark_pos(self.pos)
-         if self.if_clauses:
-             end_label = code.new_label()
-             for if_clause in self.if_clauses:
-                 if_clause.generate_execution_code(code, end_label)
-             if self.else_clause:
-                 code.putln("/*else*/ {")
-                 self.else_clause.generate_execution_code(code)
-                 code.putln("}")
-             code.put_label(end_label)
-         elif self.else_clause:
+         end_label = code.new_label()
+         for if_clause in self.if_clauses:
+             if_clause.generate_execution_code(code, end_label)
+         if self.else_clause:
+             code.putln("/*else*/ {")
              self.else_clause.generate_execution_code(code)
+             code.putln("}")
+         code.put_label(end_label)
  
 +    def generate_function_definitions(self, env, code):
 +        for clause in self.if_clauses:
 +            clause.generate_function_definitions(env, code)
 +        if self.else_clause is not None:
 +            self.else_clause.generate_function_definitions(env, code)
 +
      def annotate(self, code):
          for if_clause in self.if_clauses:
              if_clause.annotate(code)
Simple merge
index fcbc4184ef4aa4b75a56fbdb7d1eeffac6a2d8b3,13bf1a2102b7f40d0b7d9dbd1d250723ca3e8c0f..e9556efad89319b976575ee7cb38ce0797b1d87c
@@@ -2450,24 -2393,9 +2450,24 @@@ def p_def_statement(s, decorators=None)
      pos = s.position()
      s.next()
      name = EncodedString( p_ident(s) )
 -    #args = []
      s.expect('(');
 -    args = p_c_arg_list(s, in_pyfunc = 1, nonempty_declarators = 1)
 +    args, star_arg, starstar_arg = p_varargslist(s, terminator=')')
 +    s.expect(')')
 +    if p_nogil(s):
-         error(s.pos, "Python function cannot be declared nogil")
++        error(pos, "Python function cannot be declared nogil")
 +    return_type_annotation = None
 +    if s.sy == '->':
 +        s.next()
 +        return_type_annotation = p_simple_expr(s)
 +    doc, body = p_suite(s, Ctx(level = 'function'), with_doc = 1)
 +    return Nodes.DefNode(pos, name = name, args = args, 
 +        star_arg = star_arg, starstar_arg = starstar_arg,
 +        doc = doc, body = body, decorators = decorators,
 +        return_type_annotation = return_type_annotation)
 +
 +def p_varargslist(s, terminator=')', annotated=1):
 +    args = p_c_arg_list(s, in_pyfunc = 1, nonempty_declarators = 1,
 +                        annotated = annotated)
      star_arg = None
      starstar_arg = None
      if s.sy == '*':