Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Build signature objects a bit later. This will allow us to add type i…
…nformation to them.
  • Loading branch information
jnthn committed Aug 22, 2010
1 parent b4f8465 commit bfac235
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
15 changes: 9 additions & 6 deletions dotnet/compiler/PAST2DNSTCompiler.pm
Expand Up @@ -114,12 +114,12 @@ method compile(PAST::Node $node) {
:void(1),
'TC'
),
$loadinit_calls,
DNST::Call.new(
:name('constants_init'),
:void(1),
'TC'
),
$loadinit_calls,
$main_block_call
));
}
Expand Down Expand Up @@ -158,8 +158,7 @@ sub make_blocks_init_method($name) {
DNST::MethodCall.new(
:on('CodeObjectUtility'), :name('BuildStaticBlockInfo'),
'null', 'null',
DNST::ArrayLiteral.new( :type('String') ),
'null'
DNST::ArrayLiteral.new( :type('String') )
)
),
DNST::Bind.new(
Expand Down Expand Up @@ -191,8 +190,7 @@ sub make_constants_init_method($name) {
:on('CodeObjectUtility'), :name('BuildStaticBlockInfo'),
'null',
'StaticBlockInfo[1]',
DNST::ArrayLiteral.new( :type('string') ),
'null'
DNST::ArrayLiteral.new( :type('string') )
),
'TC.CurrentContext'
)
Expand Down Expand Up @@ -286,6 +284,12 @@ our multi sub dnst_for(PAST::Block $block) {
}
}

# Add signature generation/setup as a kind of loadinit.
@*LOADINITS.push(DNST::Bind.new(
"StaticBlockInfo[$our_sbi].Sig",
compile_signature(@*PARAMS)
));

# Before start of statements, we want to bind the signature.
$stmts.unshift(DNST::MethodCall.new(
:on('SignatureBinder'), :name('Bind'), :void(1), 'C', 'Capture'
Expand Down Expand Up @@ -320,7 +324,6 @@ our multi sub dnst_for(PAST::Block $block) {
$lex_setup.push(DNST::Literal.new( :value($_), :escape(1) ));
}
$our_sbi_setup.push($lex_setup);
$our_sbi_setup.push(compile_signature(@*PARAMS));

# Clear up this PAST::Block from the blocks list.
@*PAST_BLOCKS.shift;
Expand Down
3 changes: 1 addition & 2 deletions dotnet/runtime/Runtime/CodeObjectUtility.cs
Expand Up @@ -40,15 +40,14 @@ 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, Signature Sig)
RakudoCodeRef.Instance Outer, string[] LexNames)
{
// Create code wrapper object.
var Result = (RakudoCodeRef.Instance)LLCodeTypeObject.STable.REPR.instance_of(LLCodeTypeObject);

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

// Setup static lexpad.
Result.StaticLexPad = new Dictionary<string, RakudoObject>();
Expand Down

0 comments on commit bfac235

Please sign in to comment.