Created attachment 71
GlobalDeclarationInstantiation tests
8.1.1.4.14 CanDeclareGlobalVar (N)
8.1.1.4.15 CanDeclareGlobalFunction (N)
8.1.1.4.16 CreateGlobalVarBinding (N, D)
The HasBinding(N) calls should probably be changed to use HasOwnProperty(globalObject, N) instead. Strictly speaking this is a change from ES5, but all implementations tested (*) don't actually follow the ES5 definitions for global declaration instantiation, so I'd say this is a safe change. Well, with the exception of JavaScriptCore which does follow the rules for "var" declarations, but not the rules for "function". More details below.
(*) IE11, SpiderMonkey (latest), V8 (bleeding-edge latest), JavaScriptCore (latest), Nashorn (latest)
Results when executing the attached test case.
Expected results (with HasBinding):
---
Start tests...
... done!
---
Expected results (with HasOwnProperty):
---
Start tests...
testNonConfigDataProtoVar - assertion failed: got 0, expected -1
testConfigAccProtoVar - assertion failed: got undefined, expected set 'configAccProtoVar' to: 0
testConfigAccProtoVar - assertion failed: got undefined, expected get 'configAccProtoVar'
... done!
---
IE11:
---
Start tests...
testNonConfigDataFun - assertion failed: got false, expected true
testNonConfigDataFun - assertion failed: got function nonConfigDataFun(){}, expected -1
testNonConfigDataProtoVar - assertion failed: got 0, expected -1
unexpected set 'configAccFun' to: function configAccFun(){}
unexpected set 'configAccFun' to: function configAccFun(){}
unexpected get 'configAccFun'
testConfigAccFun - assertion failed: got undefined, expected function
testConfigAccProtoVar - assertion failed: got undefined, expected set 'configAccProtoVar' to: 0
testConfigAccProtoVar - assertion failed: got undefined, expected get 'configAccProtoVar'
... done!
---
SpiderMonkey:
---
Start tests...
testNonConfigDataProtoVar - assertion failed: got 0, expected -1
testConfigAccProtoVar - assertion failed: got undefined, expected set 'configAccProtoVar' to: 0
testConfigAccProtoVar - assertion failed: got undefined, expected get 'configAccProtoVar'
... done!
---
V8:
---
Start tests...
testNonConfigDataProtoVar - assertion failed: got 0, expected -1
testConfigAccProtoVar - assertion failed: got undefined, expected set 'configAccProtoVar' to: 0
testConfigAccProtoVar - assertion failed: got undefined, expected get 'configAccProtoVar'
... done!
---
JSC:
---
Start tests...
testNonConfigDataFun - assertion failed: got false, expected true
testNonConfigDataProtoFun - assertion failed: got number, expected function
unexpected set 'configAccFun' to: function configAccFun() {}
unexpected get 'configAccFun'
testConfigAccFun - assertion failed: got undefined, expected function
unexpected set 'configAccProtoFun' to: function configAccProtoFun() {}
unexpected get 'configAccProtoFun'
testConfigAccProtoFun - assertion failed: got undefined, expected function
... done!
---
Nashorn:
---
Start tests...
testNonConfigDataProtoVar - assertion failed: got 0, expected -1
unexpected set 'configAccFun' to: function configAccFun(){}
unexpected get 'configAccFun'
unexpected get 'configAccFun'
testConfigAccFun - assertion failed: got undefined, expected function
testConfigAccProtoVar - assertion failed: got undefined, expected set 'configAccProtoVar' to: 0
testConfigAccProtoVar - assertion failed: got undefined, expected get 'configAccProtoVar'
... done!
---
fixed in rev34 editor's draft
fixed in rev34