Stage 3 Draft / January 2, 2018

Integrated methods proposal

Introduction

This document adds to the class fields proposal by introducing private methods and accessors. See the explainer for an overview.

This specification draft is phrased as a diff against the class fields proposal.

1Syntax

1.1Updated Productions

MethodDefinition[Yield, Await]:PropertyName ClassElementName[?Yield, ?Await] ( UniqueFormalParameters[~Yield, ~Await] ) { FunctionBody[~Yield, ~Await] } GeneratorMethod[?Yield, ?Await] AsyncMethod[?Yield, ?Await] get PropertyNameClassElementName[?Yield, ?Await] ( ) { FunctionBody[~Yield, ~Await] } set PropertyNameClassElementName[?Yield, ?Await] ( PropertySetParameterList ) { FunctionBody[~Yield, ~Await] } GeneratorMethod[Yield, Await]:* PropertyNameClassElementName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } AsyncMethod[Yield, Await]:async[no LineTerminator here] PropertyNameClassElementName[?Yield, ?Await] ( UniqueFormalParameters[~Yield, +Await] ) { AsyncFunctionBody }

1.2Static Semantics: Early Errors

ClassBody:ClassElementList
  • It is a Syntax Error if PrivateBoundNames of ClassBody contains any duplicate entries, unless the name is used once for a getter and once for a setter and in no other entries.
PropertyDefinition:MethodDefinition Editor's Note
In a follow-on proposal, object literals may be permitted to have private methods, fields and accessors.
ClassElement:staticMethodDefinition Editor's Note
In this specification, private static methods are not supported. This support may be provided by a follow-on proposal static class features.

2Modified algorithms

2.1Static Semantics: PropName

FieldDefinition:ClassElementNameInitializeropt
  1. Return PropName of ClassElementName.
ClassElementName[Yield, Await]:PropertyName[?Yield, ?Await]
  1. Return PropName of PropertyName.
ClassElementName[Yield, Await]:PrivateName
  1. Return empty.

2.2Runtime Semantics: Evaluation

ClassElementName[Yield, Await]:PropertyName[?Yield, ?Await]
  1. Return the result of evaluating PropertyName.
ClassElementName[Yield, Await]:PrivateName
  1. Let bindingName be StringValue of PrivateName.
  2. Let scope be the running execution context's PrivateNameEnvironment.
  3. Let scopeEnvRec be scope's EnvironmentRecord.
  4. Let field be NewPrivateName(bindingName).
  5. Perform ! scopeEnvRec.InitializeBinding(bindingName, field).
  6. Assert: scopeEnvRec has a binding for bindingName.
  7. If scopeEnvRec's binding for bindingName is uninitialized,
    1. Let field be NewPrivateName(bindingName).
    2. Perform ! scopeEnvRec.InitializeBinding(bindingName, field).
  8. Otherwise,
    1. Let field be scopeEnvRec.GetBindingValue(bindingName).
    2. NOTE: The only case where this may occur is in getter/setter pairs; other duplicates are prohibited as a Syntax Error.
  9. Assert: field.[[Description]] is bindingName.
  10. Return field.
Editor's Note
Each time a class declaration executes, distinct internal Private Names are created. This means, that they cannot directly access each other's private state if a method of one is called with the other as a receiver.

2.3DefineClassElement(receiver, element)

  1. Assert: Type(receiver) is Object.
  2. Assert: element is a Record as created by ClassElementEvaluation.
  3. Let key be element.[[Key]].
  4. Let descriptor be element.[[Descriptor]].
  5. If element.[[Kind]] is "field",
    1. Let initializer be element.[[Initializer]].
    2. If initializer is empty, let value be undefined.
    3. Otherwise, value be ? Call(initializer, receiver).
    4. Let descriptor be a new Property Descriptor identical to descriptor but with the [[Value]] slot replaced by value.
  6. If key is a Private Name,
    1. Perform ? PrivateFieldDefine(receiver, key, descriptor).
  7. Otherwise, key is a Property Key,
    1. Perform ? DefinePropertyOrThrow(receiver, key, descriptor).

2.4InitializeClassElements(F, proto)

  1. Assert: Type(F) is Object and Type(proto) is Object.
  2. Assert: F is an ECMAScript function object.
  3. Assert: proto is ! Get(C, "prototype").
  4. Let elements be the value of F's [[Elements]] internal slot.
  5. For each item element in order from elements,
    1. Assert: If element.[[Placement]] is "prototype" or "static", then element.[[Key]] is not a Private Name.
    2. If element.[[Kind]] is "method",
      1. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto.
      2. Perform ? DefineClassElement(receiver, element).
  6. For each item element in order from elements,
    1. If element.[[Kind]] is "field" and element.[[Placement]] is "static" or "prototype",
      1. Assert: element.[[Descriptor]] does not have a [[Value]], [[Get]] or [[Set]] slot.
      2. Let receiver be F if element.[[Placement]] is "static", else let receiver be proto.
      3. Perform ? DefineClassElement(receiver, element).
  7. Return.
Editor's Note
Value properties are added before initializers so that all methods are visible from all initializers

2.5InitializeInstanceElements ( O, constructor )

  1. Assert: Type ( O ) is Object.
  2. Assert: Assert constructor is an ECMAScript function object.
  3. Let elements be the value of F's [[Elements]] internal slot.
  4. For each item element in order from elements,
    1. If element.[[Placement]] is "own" and element.[[Kind]] is "method",
      1. Perform ? DefineClassElement(O, element).
  5. For each item element in order from elements,
    1. If element.[[Placement]] is "own" and element.[[Kind]] is "field",
      1. Assert: element.[[Descriptor]] does not have a [[Value]], [[Get]] or [[Set]] slot.
      2. Perform ? DefineClassElement(O, element).
  6. Return.
Editor's Note
Value properties are added before initializers so that private methods are visible from all initializers.
Editor's Note
Private fields are added to the object one by one, interspersed with evaluation of the initializers, following the construction of the receiver. These semantics allow for a later initializer to refer to a previously private field.

2.6Static Semantics: PrivateBoundNames

ClassElement:MethodDefinition ClassElement:staticMethodDefinition
  1. Return PrivateBoundNames of MethodDefinition.
MethodDefinition[Yield, Await]:PropertyName ClassElementName[?Yield, ?Await] ( UniqueFormalParameters[~Yield, ~Await] ) { FunctionBody[~Yield, ~Await] } get PropertyNameClassElementName[?Yield, ?Await] ( ) { FunctionBody[~Yield, ~Await] } set PropertyNameClassElementName[?Yield, ?Await] ( PropertySetParameterList ) { FunctionBody[~Yield, ~Await] } GeneratorMethod[Yield, Await]:* PropertyNameClassElementName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } AsyncMethod[Yield, Await]:async[no LineTerminator here] PropertyNameClassElementName[?Yield, ?Await] ( UniqueFormalParameters[~Yield, +Await] ) { AsyncFunctionBody }
  1. Return PrivateBoundNames of ClassElementName.
MethodDefinition[Yield, Await]:GeneratorMethod[?Yield, ?Await]
  1. Return PrivateBoundNames of GeneratorMethod.
MethodDefinition[Yield, Await]:AsyncMethod[?Yield, ?Await]
  1. Return PrivateBoundNames of AsyncMethod.

2.7Runtime Semantics: ClassDefinitionEvaluation

With parameter className.

ClassTail:ClassHeritageopt{ClassBodyopt}
  1. Let lex be the LexicalEnvironment of the running execution context.
  2. Let classScope be NewDeclarativeEnvironment(lex).
  3. Let classScopeEnvRec be classScope's EnvironmentRecord.
  4. If className is not undefined, then
    1. Perform classScopeEnvRec.CreateImmutableBinding(className, true).
  5. Let outerPrivateEnvironment be the PrivateNameEnvironment of the running execution context.
  6. Let classPrivateEnvironment be NewDeclarativeEnvironment(outerPrivateEnvironment).
  7. Let classPrivateEnvRec be classPrivateEnvironment's EnvironmentRecord.
  8. If ClassBodyopt is present, then
    1. For each element dn of the PrivateBoundNames of ClassBodyopt,
      1. Perform classPrivateEnvRec.CreateImmutableBinding(dn, true).
  9. If ClassHeritageopt is not present, then
    1. Let protoParent be the intrinsic object %ObjectPrototype%.
    2. Let constructorParent be the intrinsic object %FunctionPrototype%.
  10. Else,
    1. Set the running execution context's LexicalEnvironment to classScope.
    2. Let superclass be the result of evaluating ClassHeritage.
    3. Set the running execution context's LexicalEnvironment to lex.
    4. ReturnIfAbrupt(superclass).
    5. If superclass is null, then
      1. Let protoParent be null.
      2. Let constructorParent be the intrinsic object %FunctionPrototype%.
    6. Else if IsConstructor(superclass) is false, throw a TypeError exception.
    7. Else,
      1. Let protoParent be ? Get(superclass, "prototype").
      2. If Type(protoParent) is neither Object nor Null, throw a TypeError exception.
      3. Let constructorParent be superclass.
  11. Let proto be ObjectCreate(protoParent).
  12. If ClassBodyopt is not present, let constructor be empty.
  13. Else, let constructor be ConstructorMethod of ClassBody.
  14. If constructor is empty, then
    1. If ClassHeritageopt is present and protoParent is not null, then
      1. Let constructor be the result of parsing the source text
        constructor(... args){ super (...args);}
        using the syntactic grammar with the goal symbol MethodDefinition[~Yield].
    2. Else,
      1. Let constructor be the result of parsing the source text
        constructor( ){ }
        using the syntactic grammar with the goal symbol MethodDefinition[~Yield].
  15. Set the running execution context's LexicalEnvironment to classScope.
  16. Set the running execution context's PrivateNameEnvironment to classPrivateEnvironment.
  17. Let constructorInfo be the result of performing DefineMethod for constructor with arguments proto and constructorParent as the optional functionPrototype argument.
  18. Assert: constructorInfo is not an abrupt completion.
  19. Let F be constructorInfo.[[Closure]].
  20. If ClassHeritageopt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived".
  21. Perform MakeConstructor(F, false, proto).
  22. Perform MakeClassConstructor(F).
  23. Perform CreateMethodProperty(proto, "constructor", F).
  24. If ClassBodyopt is not present, let methodselements be a new empty List.
  25. Else, let methodsdefinitions be NonConstructorMethodDefinitionsNonConstructorElementDefinitions of ClassBody. NOTE: Simply renaming this internal algorithm will be enough; it includes fields.
  26. Let elements be a new empty List.
  27. For each ClassElement md in order from methodsdefinitions,
    1. If IsStatic of m is false, then
      1. Let status be the result of performing PropertyDefinitionEvaluation for m with arguments proto and false.
    2. Else,
      1. Let status be the result of performing PropertyDefinitionEvaluation for m with arguments F and false.
    3. Let newElements be the result of performing ClassElementEvaluation for d with arguments F, false, and empty.
    4. If statusnewElements is an abrupt completion, then
      1. Set the running execution context's LexicalEnvironment to lex.
      2. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
      3. Return Completion(status).
    5. Append newElements to elements
  28. Let elements be CoalescePrivateAccessors(elements).
  29. Set the running execution context's LexicalEnvironment to lex.
  30. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
  31. If className is not undefined, then
    1. Perform classScopeEnvRec.InitializeBinding(className, F).
  32. Set the value of F's [[Elements]] internal slot to elements.
  33. Perform ? InitializeClassElements(F, proto).
  34. Return F.

2.8DefaultMethodDescriptor ( key, closure, enumerable, placement )

  1. Perform SetFunctionName(closure, key).
  2. If key is a Private Name,
    1. Set enumerable to false.
    2. Let configurable be false.
    3. Let writable be false.
    4. If placement is "prototype", set placement to "own".
  3. Else,
    1. Let configurable be true.
    2. Let writable be true.
  4. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: writable, [[Enumerable]]: enumerable, [[Configurable]]: configurable}.
  5. Let element be the Record { [[Kind]]: "method", [[Key]]: key, [[Descriptor]]: desc, [[Placement]]: placement }
  6. Return a List containing element.

2.9CoalescePrivateAccessors ( elements )

  1. Let newElements be an empty List.
  2. For element in elements,
    1. If element.[[Key]] is a Private Name and newElements contains a Record other where other.[[Key]] is element.[[Key]],
      1. Assert: element.[[Kind]] is "method".
      2. If element.[[Descriptor]] has a [[Get]] field,
        1. Assert: other.[[Descriptor]] has a [[Set]] field.
        2. Set other.[[Descriptor]].[[Get]] to element.[[Descriptor]].[[Get]].
      3. Otherwise,
        1. Assert: element.[[Descriptor]] has a [[Set]] field.
        2. Assert: other.[[Descriptor]] has a [[Get]] field.
        3. Set other.[[Descriptor]].[[Set]] to element.[[Descriptor]].[[Set]].
    2. Append element to newElements.
  3. Return newElements.

2.10Runtime Semantics: ClassElementEvaluation

With parameters homeObject, enumerable and placement.

ClassElementEvaluation returns a List of Records of the form { [[Kind]]: "method" or "field", [[Key]]: Property Key or Private Name, [[Descriptor]]: a Property Descriptor, [[Placement]]: "static", "prototype" or "own", [[Initializer]]: optional function for initial value which exists only for fields }.

ClassElement:MethodDefinition
  1. Return ClassElementEvaluation of MethodDefinition with arguments ! Get(homeObject, "prototype"),enumerable, and "prototype".
ClassElement:staticMethodDefinition
  1. Return ClassElementEvaluation of MethodDefinition with arguments homeObject, enumerable and "static".
MethodDefinition:PropertyName(UniqueFormalParameters){FunctionBody}
  1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject.
  2. ReturnIfAbrupt(methodDef).
  3. Perform SetFunctionName(methodDef.[[Closure]], methodDef.[[Key]]).
  4. Let desc be the PropertyDescriptor{[[Value]]: methodDef.[[Closure]], [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}.
  5. Return ? DefinePropertyOrThrow(homeObject, methodDef.[[Key]], desc).DefaultMethodDescriptor(methodDef.[[Key]], methodDef.[[Closure]], enumerable, placement).
MethodDefinition:getPropertyName(){FunctionBody}
  1. Let propKey be the result of evaluating PropertyName.
  2. ReturnIfAbrupt(propKey).
  3. If the function code for this MethodDefinition is strict mode code, let strict be true. Otherwise let strict be false.
  4. Let scope be the running execution context's LexicalEnvironment.
  5. Let formalParameterList be an instance of the production FormalParameters:[empty] .
  6. Let closure be FunctionCreate(Method, formalParameterList, FunctionBody, scope, strict).
  7. Perform MakeMethod(closure, homeObject).
  8. Perform SetFunctionName(closure, propKey, "get").
  9. Let desc be the PropertyDescriptor{[[Get]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: true}.
  10. Return ? DefinePropertyOrThrow(homeObject, propKey, desc).
  11. If key is a Private Name,
    1. Set enumerable to false.
    2. Let configurable be false.
    3. If placement is "prototype", set placement to "own".
  12. Else,
    1. Let configurable be true.
  13. Let desc be the PropertyDescriptor{[[Get]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: configurable}.
  14. Let element be the Record { [[Kind]]: "method", [[Key]]: key, [[Descriptor]]: desc, [[Placement]]: placement }
  15. Return a List containing element.
MethodDefinition:setPropertyName(PropertySetParameterList){FunctionBody}
  1. Let propKey be the result of evaluating PropertyName.
  2. ReturnIfAbrupt(propKey).
  3. If the function code for this MethodDefinition is strict mode code, let strict be true. Otherwise let strict be false.
  4. Let scope be the running execution context's LexicalEnvironment.
  5. Let closure be FunctionCreate(Method, PropertySetParameterList, FunctionBody, scope, strict).
  6. Perform MakeMethod(closure, homeObject).
  7. Perform SetFunctionName(closure, propKey, "set").
  8. Let desc be the PropertyDescriptor{[[Set]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: true}.
  9. Return ? DefinePropertyOrThrow(homeObject, propKey, desc).
  10. If key is a Private Name,
    1. Set enumerable to false.
    2. Let configurable be false.
    3. If placement is "prototype", set placement to "own".
  11. Else,
    1. Let configurable be true.
  12. Let desc be the PropertyDescriptor{[[Set]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: configurable}.
  13. Let element be the Record { [[Kind]]: "method", [[Key]]: key, [[Descriptor]]: desc, [[Placement]]: placement }
  14. Return a List containing element.
GeneratorMethod:*PropertyName(UniqueFormalParameters){GeneratorBody}
  1. Let propKey be the result of evaluating PropertyName.
  2. ReturnIfAbrupt(propKey).
  3. If the function code for this GeneratorMethod is strict mode code, let strict be true. Otherwise let strict be false.
  4. Let scope be the running execution context's LexicalEnvironment.
  5. Let closure be GeneratorFunctionCreate(Method, UniqueFormalParameters, GeneratorBody, scope, strict).
  6. Perform MakeMethod(closure, homeObject).
  7. Let prototype be ObjectCreate(%GeneratorPrototype%).
  8. Perform DefinePropertyOrThrow(closure, "prototype", PropertyDescriptor{[[Value]]: prototype, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false}).
  9. Perform SetFunctionName(closure, propKey).
  10. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}.
  11. Return ? DefinePropertyOrThrow(homeObject, propKey, desc).
  12. Return DefaultMethodDescriptor(propKey, closure, enumerable, placement).
AsyncMethod:async[no LineTerminator here]PropertyName(UniqueFormalParameters){AsyncFunctionBody}
  1. Let propKey be the result of evaluating PropertyName.
  2. ReturnIfAbrupt(propKey).
  3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise let strict be false.
  4. Let scope be the LexicalEnvironment of the running execution context.
  5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, scope, strict).
  6. Perform ! MakeMethod(closure, homeObject).
  7. Perform ! SetFunctionName(closure, propKey).
  8. Let desc be the PropertyDescriptor{[[Value]]: closure, [[Writable]]: true, [[Enumerable]]: enumerable, [[Configurable]]: true}.
  9. Return ? DefinePropertyOrThrow(homeObject, propKey, desc).
  10. Return DefaultMethodDescriptor(propKey, closure, enumerable, placement).
ClassElement:staticFieldDefinitionList;
  1. Return ClassFieldDefinitionEvaluation of FieldDefinitionList with parameters "static" and homeObject.
ClassElement:FieldDefinitionList;
  1. Return ClassFieldDefinitionEvaluation of FieldDefinitionList with parameters "own" and ! Get(homeObject, "prototype").

2.11The super Keyword

2.11.1Runtime Semantics: Evaluation

SuperCall:superArguments
  1. Let newTarget be GetNewTarget().
  2. If newTarget is undefined, throw a ReferenceError exception.
  3. Let func be ? GetSuperConstructor().
  4. Let argList be ArgumentListEvaluation of Arguments.
  5. ReturnIfAbrupt(argList).
  6. Let result be ? Construct(func, argList, newTarget).
  7. Let thisER be GetThisEnvironment( ).
  8. Let F be thisER.[[FunctionObject]].
  9. Assert: F is an ECMAScript function object.
  10. Perform ? InitializeInstanceElements(result, F).
  11. Return ? thisER.BindThisValue(result).

2.12[[Construct]] ( argumentsList, newTarget)

The [[Construct]] internal method for an ECMAScript Function object F is called with parameters argumentsList and newTarget. argumentsList is a possibly empty List of ECMAScript language values. The following steps are taken:

  1. Assert: F is an ECMAScript function object.
  2. Assert: Type(newTarget) is Object.
  3. Let callerContext be the running execution context.
  4. Let kind be F.[[ConstructorKind]].
  5. If kind is "base", then
    1. Let thisArgument be ? OrdinaryCreateFromConstructor(newTarget, "%ObjectPrototype%").
  6. Let calleeContext be PrepareForOrdinaryCall(F, newTarget).
  7. Assert: calleeContext is now the running execution context.
  8. If kind is "base", then
    1. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
    2. Let result be InitializeInstanceElements(thisArgument, F).
    3. If result is an abrupt completion, then
      1. Remove calleeContext from execution context stack and restore callerContext as the running execution context.
      2. Return Completion(result).
  9. Let constructorEnv be the LexicalEnvironment of calleeContext.
  10. Let envRec be constructorEnv's EnvironmentRecord.
  11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
  12. Remove calleeContext from the execution context stack and restore callerContext as the running execution context.
  13. If result.[[Type]] is return, then
    1. If Type(result.[[Value]]) is Object, return NormalCompletion(result.[[Value]]).
    2. If kind is "base", return NormalCompletion(thisArgument).
    3. If result.[[Value]] is not undefined, throw a TypeError exception.
  14. Else, ReturnIfAbrupt(result).
  15. Return ? envRec.GetThisBinding().
Editor's Note
Fields are added by the base class constructor when the super chain reaches up to that, rather than by the subclass constructor when creating the object, in order to be analogous to ES2015 subclassable builtins. See this GitHub thread for more discussion.

3Private Names and references

3.1PrivateFieldDefine (P, O, desc)

  1. Assert: P is a Private Name value.
  2. Assert: desc is a Property Descriptor.
  3. If O is not an object, throw a TypeError exception.
  4. Let entry be PrivateFieldFind(P, O).
  5. If entry is not empty, throw a TypeError exception.
  6. Append { [[PrivateName]]: P, [[PrivateFieldDescriptor]]: desc } to O.[[PrivateFieldDescriptors]].

3.2PrivateFieldGet (P, O )

  1. Assert: P is a Private Name value.
  2. If O is not an object, throw a TypeError exception.
  3. Let entry be PrivateFieldFind(P, O).
  4. If entry is empty, throw a TypeError exception.
  5. Return entry.[[PrivateFieldValue]].
  6. Let desc be entry.[[PrivateFieldDescriptor]].
  7. If IsDataDescriptor(desc) is true, return desc.[[Value]].
  8. Assert: IsAccessorDescriptor(desc) is true.
  9. Let getter be desc.[[Get]].
  10. If getter is undefined, throw a TypeError exception.
  11. Return ? Call(getter, O).

3.3PrivateFieldSet (P, O, value )

  1. Assert: P is a Private Name value.
  2. If O is not an object, throw a TypeError exception.
  3. Let entry be PrivateFieldFind(P, O).
  4. If entry is empty, throw a TypeError exception.
  5. Set entry.[[PrivateFieldValue]] to value.
  6. Let desc be entry.[[PrivateFieldDescriptor]].
  7. If IsDataDescriptor(desc) is true,
    1. If desc.[[Writable]] is false, return false.
    2. Set desc.[[Value]] to value.
  8. Else,
    1. Assert: IsAccessorDescriptor(desc) is true.
    2. Let setter be desc.[[Set]].
    3. If setter is undefined, return false.
    4. Perform ? Call(setter, O, value).

ACopyright & Software License

Copyright Notice

© 2018 Daniel Ehrenberg, Jeff Morrison, Kevin Smith, Kevin Gibbons

Software License

All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT http://www.ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the authors nor Ecma International may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.