summaryrefslogtreecommitdiff
path: root/type-check.c
diff options
context:
space:
mode:
authorSøren Sandmann <sandmann@redhat.com>2007-09-02 01:15:47 -0400
committerSøren Sandmann <sandmann@redhat.com>2007-09-02 01:15:47 -0400
commit0d3746a1ccd3848fb2d2cfa33b857674dd4eeb7a (patch)
treeb7ece2b683a57366817fa776ea8af388b2e14218 /type-check.c
parentfb03de44dbacaf81dcdc81af75224e6d6afc04df (diff)
Various fixes for lambda functions
Diffstat (limited to 'type-check.c')
-rw-r--r--type-check.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/type-check.c b/type-check.c
index 911a89c..a6df653 100644
--- a/type-check.c
+++ b/type-check.c
@@ -18,6 +18,11 @@
#include "ast.h"
+#if 0
+#define FALSE ({ g_print ("return at %d\n", __LINE__); 0; })
+#endif
+
+
/*
* Various helpers
*/
@@ -168,13 +173,22 @@ static void
type_check_pass1 (ast_t *ast)
{
GList *list;
+ ast_function_definition_t *function = NULL;
if (ast_is (ast, AST_DEFINITION, AST_FUNCTION_DEFINITION))
{
+ function = &ast->definition.function;
+ }
+ else if (ast_is (ast, AST_EXPRESSION, AST_LAMBDA_EXPRESSION))
+ {
+ function = ast->expression.lambda.function;
+ }
+
+ if (function)
+ {
GPtrArray *type_specs;
ast_type_spec_t **parameter_types;
int i;
- ast_function_definition_t *function = &ast->definition.function;
/* Parameter types */
type_specs = g_ptr_array_new ();
@@ -534,10 +548,11 @@ type_check_expression (ast_expression_t *expr)
break;
case AST_LAMBDA_EXPRESSION:
- if (!type_check_pass2 ((ast_t *)expr->lambda.function->body));
+ if (!type_check_pass2 ((ast_t *)expr->lambda.function->body))
return FALSE;
-
+
expr->common.type_spec = expr->lambda.function->type_spec;
+ g_assert (expr->common.type_spec);
break;
case AST_CALL_EXPRESSION: