Add ellipsis constants.

pull/1/head
Stella Laurenzo 2020-06-07 15:49:39 -07:00
parent f3829b1d4f
commit a1e6ff4ab7
2 changed files with 9 additions and 0 deletions

View File

@ -61,3 +61,10 @@ def joined_string_constant():
a = "I am" " still here"
return a
# CHECK-LABEL: func @ellipsis
@import_global
def ellipsis():
# CHECK: %[[A:.*]] = basicpy.singleton : !basicpy.EllipsisType
# CHECK: basicpy.unknown_cast %[[A]]
a = ...
return a

View File

@ -210,6 +210,8 @@ class ExpressionImporter(BaseNodeVisitor):
self.fctx.abort("unknown named constant '%r'" % (ast_node.value,))
elif isinstance(ast_node, ast.Str):
self.value = ir_h.basicpy_str_constant_op(ast_node.s).result
elif isinstance(ast_node, ast.Ellipsis):
self.value = ir_h.basicpy_singleton_op(ir_h.basicpy_EllipsisType).result
else:
self.fctx.abort("unknown constant type %s" %
(ast_node.__class__.__name__))