[svn:parrot] r41551 - in trunk: src/pmc t/pmc
bacek at svn.parrot.org
bacek at svn.parrot.org
Tue Sep 29 10:34:16 UTC 2009
Author: bacek
Date: Tue Sep 29 10:34:15 2009
New Revision: 41551
URL: https://trac.parrot.org/parrot/changeset/41551
Log:
[core] Expose Context from ParrotInterp
Modified:
trunk/src/pmc/parrotinterpreter.pmc
trunk/t/pmc/parrotinterpreter.t
Modified: trunk/src/pmc/parrotinterpreter.pmc
==============================================================================
--- trunk/src/pmc/parrotinterpreter.pmc Tue Sep 29 10:33:51 2009 (r41550)
+++ trunk/src/pmc/parrotinterpreter.pmc Tue Sep 29 10:34:15 2009 (r41551)
@@ -430,6 +430,7 @@
Introspection interface. C<key> can be:
+ "context" ... return Context PMC
"sub" ... return Sub object of this subroutine
"continuation" ... return Continuation PMC
"lexpad" ... return lexpad PMC for this sub
@@ -509,6 +510,11 @@
if (item == outer)
return Parrot_pcc_get_sub(interp, ctx);
+ s = CONST_STRING(interp, "context");
+
+ if (Parrot_str_equal(interp, item, s))
+ return ctx;
+
s = CONST_STRING(interp, "sub");
if (Parrot_str_equal(interp, item, s))
Modified: trunk/t/pmc/parrotinterpreter.t
==============================================================================
--- trunk/t/pmc/parrotinterpreter.t Tue Sep 29 10:33:51 2009 (r41550)
+++ trunk/t/pmc/parrotinterpreter.t Tue Sep 29 10:34:15 2009 (r41551)
@@ -21,13 +21,13 @@
.sub main :main
.include 'test_more.pir'
- plan(10)
+ plan(11)
test_new() # 1 test
test_hll_map() # 2 tests
# Need for testing
.annotate 'foo', 'bar'
- test_inspect() # 7 tests
+ test_inspect() # 8 tests
.end
.sub test_new
@@ -85,6 +85,11 @@
$S0 = $P0['foo']
is($S0, 'bar', 'Got ParrotInterp.annotations')
+ $P0 = interp['context';0]
+ $I0 = isa $P0, 'Context'
+ ok($I0, 'Got ParrotInterp.context')
+ # Add more tests for Context. E.g. it is correct Context by inspecting it.
+
push_eh cought
$I0 = 1
$P0 = interp['some_field';0]
More information about the parrot-commits
mailing list