mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-11-04 07:10:57 +00:00 
			
		
		
		
	Before this we attempted to hack around this by only overriding has_binding. However this did not cover all cases, for example when assigning to variables before their declaration it didn't throw. By using the new find_binding_and_index virtual method we can just pretend the indirect bindings are real. Since indirect binding do come from a normal environment we need to ensure you cannot modify the binding and that properties like mutable are false as expected by the spec for such an indirect binding.
		
			
				
	
	
		
			17 lines
		
	
	
	
		
			465 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
	
		
			465 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
let passed = true;
 | 
						|
 | 
						|
if (importedVarValue !== undefined)
 | 
						|
    throw new Error("Expected importedVarValue === undefined; got " + importedVarValue);
 | 
						|
 | 
						|
try {
 | 
						|
    importedVarValue = 0;
 | 
						|
    passed = false;
 | 
						|
} catch (e) {
 | 
						|
    if (!(e instanceof TypeError))
 | 
						|
        throw new Error("Expected importedVarValue = 0; to throw TypeError got " + e);
 | 
						|
}
 | 
						|
 | 
						|
import { value as importedVarValue } from "./accessing-var-import-before-decl.mjs";
 | 
						|
export var value = 123;
 | 
						|
 | 
						|
export { passed };
 |