summaryrefslogtreecommitdiff
path: root/ecomp-c/ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-c/ec.c')
-rw-r--r--ecomp-c/ec.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/ecomp-c/ec.c b/ecomp-c/ec.c
index dfd9d76..1e8dc63 100644
--- a/ecomp-c/ec.c
+++ b/ecomp-c/ec.c
@@ -1601,12 +1601,27 @@ static void parseProcedureCall( Scope *scope )
}
}
- /* TODO: check parameter list types, not only cardinality
- */
+ /* check cardinality of parameters */
if( nof_actual_params != nof_expected_params ) {
Abort( "procedure '%s' expects %d parameter(s), but %d were given", symbol->name, nof_expected_params, nof_actual_params );
}
-
+
+ /* check types */
+ if( nof_expected_params > 0 ) {
+ node = head;
+ param = symbol->scope->symbol;
+ while( param != NULL ) {
+ if( param->offset < 0 ) {
+ param = param->next;
+ continue;
+ }
+ fprintf( stderr, "%s <?> %s\n", node->actual_type->name,
+ symbol->scope->symbol->type->name );
+ node = node->next;
+ param = param->next;
+ }
+ }
+
/* emit assembly comments */
Emit( "; CALL %s", symbol->label );
if( nof_actual_params > 0 ) {
@@ -2275,6 +2290,10 @@ static void parseProcedureDeclaration( Scope *scope )
}
}
+ /* TODO: free only locals, keep parameters in scope,
+ * they are needed for type checks when calling the
+ * procedure
+ */
free_scope( symbol->scope );
}