Skip to content
Browse files

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

…, to override default path name in the PackfileView
  • Loading branch information...
1 parent 7ad94d6 commit 81de279cb362b21b81f9b4d8a8e3d4f75a37762f @Whiteknight Whiteknight committed
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/pmc/imccompiler.pmc
View
15 src/pmc/imccompiler.pmc
@@ -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,6 +208,8 @@ 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);
@@ -214,8 +217,9 @@ pmclass IMCCompiler auto_attrs provides HLLCompiler provide invokable {
}
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.
Something went wrong with that request. Please try again.