Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

A couple of tests for lexical lookup/binding in an inner block.

  • Loading branch information...
commit b505a996f40abb89c298338c3299d563658698e7 1 parent 68f99e6
@jnthn jnthn authored
Showing with 42 additions and 1 deletion.
  1. +42 −1 t/qast/qast.t
View
43 t/qast/qast.t
@@ -1,6 +1,6 @@
use QRegex;
-plan(35);
+plan(37);
# Following a test infrastructure.
sub compile_qast($qast) {
@@ -418,3 +418,44 @@ is_qast(
),
302,
'callmethod with two args, name is computed');
+
+is_qast(
+ QAST::Block.new(
+ QAST::Op.new(
+ :op('bind'),
+ QAST::Var.new( :name('$x'), :scope('lexical'), :decl('var') ),
+ QAST::WVal.new( :value(B) )
+ ),
+ QAST::Block.new(
+ :blocktype('immediate'),
+ QAST::Op.new(
+ :op('callmethod'), :name('m'),
+ QAST::Var.new( :name('$x'), :scope('lexical') )
+ )
+ )
+ ),
+ 'b',
+ 'lexical lookup in a nested block');
+
+is_qast(
+ QAST::Block.new(
+ QAST::Op.new(
+ :op('bind'),
+ QAST::Var.new( :name('$x'), :scope('lexical'), :decl('var') ),
+ QAST::WVal.new( :value(B) )
+ ),
+ QAST::Block.new(
+ :blocktype('immediate'),
+ QAST::Op.new(
+ :op('bind'),
+ QAST::Var.new( :name('$x'), :scope('lexical') ),
+ QAST::WVal.new( :value(A) )
+ )
+ ),
+ QAST::Op.new(
+ :op('callmethod'), :name('m'),
+ QAST::Var.new( :name('$x'), :scope('lexical') )
+ )
+ ),
+ 'a',
+ 'lexical binding in a nested block');
Please sign in to comment.
Something went wrong with that request. Please try again.