Skip to content

Commit

Permalink
fullgen: fix global lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Mar 8, 2012
1 parent 21484e3 commit 5260221
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/x64/fullgen-x64.cc
Expand Up @@ -376,7 +376,11 @@ AstNode* Fullgen::VisitValue(AstNode* node) {

AstNode* member = new AstNode(AstNode::kMember);
member->children()->Push(new FAstOperand(slot()));
member->children()->Push(value->name());
AstNode* property = new AstNode(AstNode::kString);
property->value(value->name()->value());
property->length(value->name()->length());

member->children()->Push(property);
VisitForSlot(member, slot(), result());
} else {
// Context variables
Expand Down
11 changes: 11 additions & 0 deletions test/test-api.cc
Expand Up @@ -59,4 +59,15 @@ TEST_START("API test")
Value* result = callback->Call(NULL, 1, argv);
assert(result->As<Number>()->Value() == 1234);
})

FUN_TEST("return () { scope g\n return g }", {
assert(result->Is<Function>());
Value* argv[0];

Handle<Object> global(Object::New());
global->Set(String::New("g", 1), Number::NewIntegral(1234));

Value* ret = result->As<Function>()->Call(*global, 0, argv);
assert(ret->As<Number>()->Value() == 1234);
})
TEST_END("API test")

0 comments on commit 5260221

Please sign in to comment.