Last active
August 1, 2025 17:57
-
-
Save ben221199/e17745d14b661ae3e1e491190030acf6 to your computer and use it in GitHub Desktop.
ECMAScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @since ES5 | |
*/ | |
public class DeclarativeEnvironmentRecord extends EnvironmentRecord{ | |
/** | |
* @since ES5 | |
*/ | |
public Object HasBinding(Object N){ | |
Object envRec = this; | |
} | |
//TODO HasBinding | |
//TODO CreateMutableBinding | |
//TODO SetMutableBinding | |
//TODO GetBindingValue | |
//TODO DeleteBinding | |
//TODO ImplicitThisValue | |
//TODO CreateImmutableBinding | |
//TODO InitializeImmutableBinding | |
/** | |
* @deprecated ES6 | |
* @since ES5 | |
*/ | |
@Override | |
public Object ImplicitThisValue(){ | |
return ESUndefined.UNDEFINED; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @since ES5 | |
*/ | |
abstract class EnvironmentRecord{ | |
/** | |
* @since ES5 | |
*/ | |
public abstract Object HasBinding(Object N); | |
/** | |
* @since ES5 | |
*/ | |
public abstract Object CreateMutableBinding(Object N,Object D); | |
/** | |
* @since ES6 | |
*/ | |
public abstract Object CreateImmutableBinding(Object N,Object S); | |
/** | |
* @since ES6 | |
*/ | |
public abstract Object InitializeBinding(Object N,Object V); | |
/** | |
* @since ES5 | |
*/ | |
public abstract Object SetMutableBinding(Object N,Object V,Object S); | |
/** | |
* @since ES5 | |
*/ | |
public abstract Object GetBindingValue(Object N,Object S); | |
/** | |
* @since ES5 | |
*/ | |
public abstract Object DeleteBinding(Object N); | |
/** | |
* @since ES6 | |
*/ | |
public abstract Object HasThisBinding(); | |
/** | |
* @since ES6 | |
*/ | |
public abstract Object HasSuperBinding(); | |
/** | |
* @since ES6 | |
*/ | |
public abstract Object WithBaseObject(); | |
/** | |
* @deprecated ES6 | |
* @since ES5 | |
*/ | |
public abstract Object ImplicitThisValue(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @since ES5 | |
*/ | |
public class ObjectEnvironmentRecord extends EnvironmentRecord{ | |
public Object BindingObject; | |
/** | |
* Boolean. Old names: provideThis, withEnvironment | |
*/ | |
public Object IsWithEnvironment; | |
@Override | |
public Object HasBinding(Object N){ | |
Object envRec = this; | |
//TODO get bindings | |
return bindings.HasProperty(N); | |
} | |
@Override | |
public Object CreateMutableBinding(Object N,Object D){ | |
Object envRec = this; | |
//TODO get bindings | |
assert bindings.HasProperty(N)==false; | |
Object configValue = D; | |
bindings.DefineOwnProperty(N,...,false); | |
} | |
//TODO CreateMutableBinding | |
//TODO SetMutableBinding | |
//TODO GetBindingValue | |
//TODO DeleteBinding | |
/** | |
* @deprecated ES6 | |
* @since ES5 | |
*/ | |
@Override | |
public Object ImplicitThisValue(){ | |
Object envRec = this; | |
if(envRec.IsWithEnvironment){ | |
//TODO return binding object; | |
} | |
return ESUndefined.UNDEFINED; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment