jsjs icon indicating copy to clipboard operation
jsjs copied to clipboard

函数声明应该用var,可以重复声明

Open axetroy opened this issue 7 years ago • 2 comments

https://github.com/bramblex/jsjs/blob/e705a21686c9a462c2fa7577642e8b568570d4b3/src/eval.ts#L194

function test(){}

function test(){}

函数声明是可以重复的,应该使用scope.$var去声明

scope.$var这里要改

https://github.com/bramblex/jsjs/blob/e705a21686c9a462c2fa7577642e8b568570d4b3/src/scope.ts#L103

var是可以重复声明的,无论如何都应该返回true,新变量把旧变量覆盖掉

axetroy avatar Mar 05 '18 17:03 axetroy

scope.$var这里要改

jsjs/src/scope.ts

Line 103 in e705a21

if (!$var) { var是可以重复声明的,无论如何都应该返回true,新变量把旧变量覆盖掉

var这里不应该是覆盖掉,而是应该在新的scope里声明,外层的scope里的var依然存在吧

yu521088 avatar Nov 25 '18 17:11 yu521088

弱问,你们有办法实现Function.apply么

loooog avatar Dec 22 '19 07:12 loooog