Permalink
Browse files

Add a named 'path' argument to IMCCompiler.compiler and .compile_file…

…, to override default path name in the PackfileView
  • Loading branch information...
Whiteknight committed Nov 30, 2011
1 parent 7ad94d6 commit 81de279cb362b21b81f9b4d8a8e3d4f75a37762f
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/pmc/imccompiler.pmc
View
@@ -186,8 +186,9 @@ pmclass IMCCompiler auto_attrs provides HLLCompiler provide invokable {
}
METHOD compile(STRING *source,
- STRING *target :named("target") :optional, INTVAL has_target :opt_flag,
- PMC *outer_ctx :named("outer_ctx") :optional, INTVAL has_ctx :opt_flag)
+ STRING *path :named("path") :optional, INTVAL has_path :opt_flag,
+ STRING *target :named("target") :optional, INTVAL has_target :opt_flag,
+ PMC *outer_ctx :named("outer_ctx") :optional, INTVAL has_ctx :opt_flag)
{
Parrot_IMCCompiler_attributes * const attrs = PARROT_IMCCOMPILER(SELF);
PMC * pf;
@@ -207,15 +208,18 @@ pmclass IMCCompiler auto_attrs provides HLLCompiler provide invokable {
ERROR_IMCC_COMPILE(interp);
Parrot_ex_throw_from_c_args(INTERP, NULL, code, "%Ss", msg);
}
+ if (has_path)
+ VTABLE_set_string_native(INTERP, pf, path);
END_IMCC_COMPILE(interp);
RETURN(PMC *pf);
}
METHOD compile_file(STRING *filename,
- STRING *target :named("target") :optional, INTVAL has_target :opt_flag,
- PMC *outer_ctx :named("outer_ctx") :optional, INTVAL has_ctx :opt_flag)
+ STRING *path :named("path") :optional, INTVAL has_path :opt_flag,
+ STRING *target :named("target") :optional, INTVAL has_target :opt_flag,
+ PMC *outer_ctx :named("outer_ctx") :optional, INTVAL has_ctx :opt_flag)
{
Parrot_IMCCompiler_attributes * const attrs = PARROT_IMCCOMPILER(SELF);
PMC * pf = PMCNULL;
@@ -236,6 +240,9 @@ pmclass IMCCompiler auto_attrs provides HLLCompiler provide invokable {
Parrot_ex_throw_from_c_args(INTERP, NULL, code, "%Ss", msg);
}
+ if (has_path)
+ VTABLE_set_string_native(INTERP, pf, path);
+
END_IMCC_COMPILE(interp);
RETURN(PMC *pf);

0 comments on commit 81de279

Please sign in to comment.