Skip to content

Commit

Permalink
store appropriate index in main_sub
Browse files Browse the repository at this point in the history
  • Loading branch information
plobsing committed Dec 26, 2010
1 parent 2921e19 commit 3ff38d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions compilers/imcc/imc.h
Expand Up @@ -561,6 +561,7 @@ typedef struct _imc_info_t {
int compiler_state; /* see PBC_* flags */
int verbose;
int write_pbc;
int seen_main; /* seen an explicitly :main-flagged sub */
opcode_t npc;
} imc_info_t;

Expand Down
9 changes: 9 additions & 0 deletions compilers/imcc/pbc.c
Expand Up @@ -1582,6 +1582,15 @@ add_const_pmc_sub(PARROT_INTERP, ARGMOD(SymReg *r), size_t offs, size_t end)
: Parrot_str_new(interp, "*none*", 0));
}

if (r->pcc_sub->pragma & P_MAIN
&& !IMCC_INFO(interp)->seen_main) {
interp->code->main_sub = k;
IMCC_INFO(interp)->seen_main = 1;
}
else if (interp->code->main_sub < 0) {
interp->code->main_sub = k;
}

return k;
}
}
Expand Down

0 comments on commit 3ff38d4

Please sign in to comment.