Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
[Merge chakra-core/ChakraCore@4bf0562ceb] [1.6>master] [MERGE #3078 @…
Browse files Browse the repository at this point in the history
…aneeshdk] Avoid casting with scope object to Dynamic Object

Merge pull request #3078 from aneeshdk:ArrowWithEvalThis

We were wrongly casting with scope object to a Dynamic Object while trying to access this.
  • Loading branch information
chakrabot committed Jun 1, 2017
1 parent eb45304 commit 334056b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,7 @@ namespace Js
for (int i = 0; i < length; i += 1)
{
Var value;
DynamicObject *obj = DynamicObject::FromVar(pScope->GetItem(i));
RecyclableObject *obj = RecyclableObject::FromVar(pScope->GetItem(i));
if (JavascriptOperators::GetProperty(obj, Js::PropertyIds::_lexicalThisSlotSymbol, &value, scriptContext))
{
return value;
Expand Down
7 changes: 7 additions & 0 deletions deps/chakrashim/core/test/es6/lambda1.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,13 @@ var tests = [
assert.areEqual(globalObject, globalEvalLambdaThisWithNestedEval(), "globalEvalLambdaThisWithNestedEval() should equal the global object");
assert.areEqual(globalObject, globalEvalNestedEvalLambdaThis(), "globalEvalNestedEvalLambdaThis() should equal the global object");
assert.areEqual(globalObject, globalEvalNestedEvalLambdaThisWithNestedEval(), "globalEvalNestedEvalLambdaThisWithNestedEval() should equal the global object");

this.x = 10;
with ({x : 100}) {
lambdaInsideWithEval = (s) => eval(s);
assert.areEqual(10, lambdaInsideWithEval("this.x"), "Arrow function should be able to access this variable within eval");
assert.areEqual(100, x, "Property access on the with construct should work with eval and arrow in the body");
}
}

test.call(thisVal);
Expand Down

0 comments on commit 334056b

Please sign in to comment.