Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[dotnet] Stub in block handlers setup.
  • Loading branch information
jnthn committed Oct 29, 2010
1 parent 25487a2 commit 083fa12
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
23 changes: 19 additions & 4 deletions dotnet/compiler/PAST2DNSTCompiler.pm
Expand Up @@ -172,7 +172,8 @@ sub make_blocks_init_method($name) {
:on('CodeObjectUtility'), :name('BuildStaticBlockInfo'),
:type('RakudoCodeRef.Instance'),
'null', 'null',
DNST::ArrayLiteral.new( :type('String') )
DNST::ArrayLiteral.new( :type('String') ),
'null'
)
),
DNST::Bind.new(
Expand Down Expand Up @@ -205,7 +206,8 @@ sub make_constants_init_method($name) {
:type('RakudoCodeRef.Instance'),
'null',
'StaticBlockInfo[1]',
DNST::ArrayLiteral.new( :type('string') )
DNST::ArrayLiteral.new( :type('string') ),
'null'
),
'TC.CurrentContext',
'null'
Expand Down Expand Up @@ -246,6 +248,7 @@ our multi sub dnst_for(PAST::Block $block) {
# We'll collect all the parameter nodes and lexical declarations.
my @*PARAMS;
my @*LEXICALS;
my @*HANDLERS;

# Update namespace.
my @*CURRENT_NS;
Expand Down Expand Up @@ -331,7 +334,8 @@ our multi sub dnst_for(PAST::Block $block) {
:type('RakudoCodeRef.Instance'),
'null',
"StaticBlockInfo[$our_sbi]",
DNST::ArrayLiteral.new( :type('string') )
DNST::ArrayLiteral.new( :type('string') ),
'null'
),
'TC.CurrentContext',
'null'
Expand Down Expand Up @@ -382,7 +386,7 @@ our multi sub dnst_for(PAST::Block $block) {
@*INNER_BLOCKS.push($_);
}

# Finish geneating code setup block call.
# Set up body, static outer and lexicals in the code setup block call.
$our_sbi_setup.push(DNST::New.new(
:type('Func<ThreadContext, RakudoObject, RakudoObject, RakudoObject>'),
$result.name
Expand All @@ -394,6 +398,17 @@ our multi sub dnst_for(PAST::Block $block) {
}
$our_sbi_setup.push($lex_setup);

# Add handlers.
if +@*HANDLERS {
my $handler_node := DNST::ArrayLiteral.new( :type('Exception.Handler') );
for @*HANDLERS {
}
$our_sbi_setup.push($handler_node);
}
else {
$our_sbi_setup.push('null');
}

# Clear up this PAST::Block from the blocks list.
@*PAST_BLOCKS.shift;

Expand Down
5 changes: 3 additions & 2 deletions dotnet/runtime/Runtime/CodeObjectUtility.cs
Expand Up @@ -40,14 +40,15 @@ public static RakudoObject WrapNativeMethod(Func<ThreadContext, RakudoObject, Ra
/// <returns></returns>
public static RakudoCodeRef.Instance BuildStaticBlockInfo(
Func<ThreadContext, RakudoObject, RakudoObject, RakudoObject> Code,
RakudoCodeRef.Instance Outer, string[] LexNames)
RakudoCodeRef.Instance Outer, string[] LexNames, Exceptions.Handler[] Handlers)
{
// Create code wrapper object.
var Result = (RakudoCodeRef.Instance)LLCodeTypeObject.STable.REPR.instance_of(null, LLCodeTypeObject);

// Put body, outer and signature in place.
// Put body, outer and handlers in place.
Result.Body = Code;
Result.OuterBlock = Outer;
Result.Handlers = Handlers;

// Setup static lexpad.
Result.StaticLexPad = new Lexpad(LexNames);
Expand Down

0 comments on commit 083fa12

Please sign in to comment.