이 operation들은 ECMAScript language의 일부가 아닙니다. 이들은 ECMAScript language의 semantics specification을 돕기 위해서만 여기에 정의됩니다. 더 specialized된 다른 abstract operation은 이 명세 전반에 걸쳐 정의됩니다.
7.1 Type Conversion
ECMAScript language는 필요에 따라 automatic type conversion을 implicitly 수행합니다. 특정 construct의 semantics를 명확히 하기 위해 conversion abstract operation의 set을 정의하는 것이 유용합니다. conversion abstract operation은 polymorphic합니다. 즉, 어떤 ECMAScript language type의 value도 accept할 수 있습니다. 그러나 이러한 operation에는 다른 specification type이 사용되지 않습니다.
BigInt type은 ECMAScript language에서 implicit conversion을 가지지 않습니다. programmer는 다른 type의 value를 convert하려면 BigInt를 명시적으로 호출해야 합니다.
7.1.1 ToPrimitive ( input [ , preferredType ] )
The abstract operation ToPrimitive takes argument input (an ECMAScript language value) and optional argument preferredType (string or number) and returns either a normal completion containing an ECMAScript language value or a throw completion. input argument를 non-Object type으로 convert합니다. object가 둘 이상의 primitive type으로 convert할 수 있으면, optional hint preferredType을 사용하여 그 type을 favour할 수 있습니다. It performs the following steps when called:
ToPrimitive가 hint 없이 호출되면, 일반적으로 hint가 number인 것처럼 behave합니다. 그러나 object는 %Symbol.toPrimitive% method를 정의하여 이 behaviour를 over-ride할 수 있습니다. 이 명세에서 정의된 object 중 Date(21.4.4.45 참조)와 Symbol object(20.4.3.5 참조)만 default ToPrimitive behaviour를 over-ride합니다. Date는 hint의 absence를 hint가 string인 것처럼 취급합니다.
The abstract operation ToBoolean takes argument arg (an ECMAScript language value) and returns a Boolean. arg를 Boolean type의 value로 convert합니다. It performs the following steps when called:
arg가 Boolean이면, arg를 반환한다.
arg가 undefined, null, +0𝔽, -0𝔽, NaN, 0ℤ, 또는 empty String 중 하나이면, false를 반환한다.
The abstract operation RoundMVResult takes argument n (a mathematical value) and returns a Number. n을 implementation-defined 방식으로 Number로 convert합니다. 이 abstract operation의 목적상, digit은 zero가 아니거나 그 왼쪽에 non-zero digit이 있고 그 오른쪽에 non-zero digit이 있으면 significant합니다. 이 abstract operation의 목적상, mathematical value의 representation이 “denoted by”하는 mathematical value는 mathematical value의 “decimal representation of”의 inverse입니다. It performs the following steps when called:
n의 decimal representation이 20개 이하의 significant digit을 가지면, 𝔽(n)을 반환한다.
option1을 n의 decimal representation에서 20번째 뒤의 각 significant digit을 0 digit으로 replacing한 결과가 denoted by하는 mathematical value로 둔다.
option2를 n의 decimal representation에서 20번째 뒤의 각 significant digit을 0 digit으로 replacing한 다음 20번째 position에서 incrementing한 결과가 denoted by하는 mathematical value로 둔다(필요에 따라 carrying).
The abstract operation ToIntegerOrInfinity takes argument arg (an ECMAScript language value) and returns either a normal completion containing either an integer, +∞, or -∞, or a throw completion. arg를 fractional part가 truncated된 Number value를 나타내는 integer로 convert하거나, 그 Number value가 infinite이면 +∞ 또는 -∞로 convert합니다. It performs the following steps when called:
The abstract operation ToFixedSizeInteger takes arguments int (an integer, +∞, or -∞), signed (unsigned or signed), and bitWidth (a positive integer) and returns an integer. int를 0부터 2bitWidth - 1까지의 inclusive interval(signed가 unsigned인 경우) 또는 -2bitWidth - 1부터 2bitWidth - 1 - 1까지의 inclusive interval(signed가 signed인 경우)에 있는 2bitWidth개 integer 중 하나로 map합니다. It performs the following steps when called:
대부분의 다른 ECMAScript integer conversion operation과 달리, ToUint8Clamp는 non-integral value를 truncate하지 않고 round합니다. 또한 “round half to even” tie-breaking을 사용하며, 이는 Math.round의 “round half up” tie-breaking과 다릅니다.
7.1.14 ToBigInt ( arg )
The abstract operation ToBigInt takes argument arg (an ECMAScript language value) and returns either a normal completion containing a BigInt or a throw completion. arg를 BigInt value로 convert하거나, Number로부터의 implicit conversion이 required되면 throw합니다. It performs the following steps when called:
The abstract operation CanonicalNumericIndexString takes argument arg (a String) and returns a Number or undefined. arg가 "-0"이거나 어떤 Number value n에 대해 정확히 ToString(n)과 match하면, 각각의 Number value를 반환합니다. 그렇지 않으면 undefined를 반환합니다. It performs the following steps when called:
The abstract operation IsCallable takes argument arg (an ECMAScript language value) and returns a Boolean. arg가 [[Call]] internal method를 가진 callable function인지 determine합니다. It performs the following steps when called:
arg가 Object가 아니면, false를 반환한다.
arg가 [[Call]] internal method를 가지면, true를 반환한다.
false를 반환한다.
7.2.4 IsConstructor ( arg )
The abstract operation IsConstructor takes argument arg (an ECMAScript language value) and returns a Boolean. arg가 [[Construct]] internal method를 가진 function object인지 determine합니다. It performs the following steps when called:
The abstract operation IsExtensible takes argument obj (an Object) and returns either a normal completion containing a Boolean or a throw completion. additional property가 obj에 added될 수 있는지 determine하는 데 사용됩니다. It performs the following steps when called:
The abstract operation IsStringWellFormedUnicode takes argument string (a String) and returns a Boolean. 6.1.4에 설명된 대로 string을 UTF-16으로 encoded된 code point의 sequence로 interpret하고, 이것이 well formed UTF-16 sequence인지 determine합니다. It performs the following steps when called:
The abstract operation SameType takes arguments x (an ECMAScript language value) and y (an ECMAScript language value) and returns a Boolean. 두 argument가 같은 type인지 여부를 determine합니다. It performs the following steps when called:
x가 undefined이고 y가 undefined이면, true를 반환한다.
x가 null이고 y가 null이면, true를 반환한다.
x가 Boolean이고 y가 Boolean이면, true를 반환한다.
x가 Number이고 y가 Number이면, true를 반환한다.
x가 BigInt이고 y가 BigInt이면, true를 반환한다.
x가 Symbol이고 y가 Symbol이면, true를 반환한다.
x가 String이고 y가 String이면, true를 반환한다.
x가 Object이고 y가 Object이면, true를 반환한다.
false를 반환한다.
7.2.9 SameValue ( x, y )
The abstract operation SameValue takes arguments x (an ECMAScript language value) and y (an ECMAScript language value) and returns a Boolean. 두 argument가 같은 value인지 여부를 determine합니다. It performs the following steps when called:
이 algorithm은 모든 NaN value를 equivalent로 취급하고 +0𝔽와 -0𝔽를 differentiate한다는 점에서 IsStrictlyEqual Algorithm과 다릅니다.
7.2.10 SameValueZero ( x, y )
The abstract operation SameValueZero takes arguments x (an ECMAScript language value) and y (an ECMAScript language value) and returns a Boolean. 두 argument가 같은 value인지 여부를 determine합니다(+0𝔽와 -0𝔽의 차이를 ignoring). It performs the following steps when called:
The abstract operation SameValueNonNumber takes arguments x (an ECMAScript language value, but not a Number) and y (an ECMAScript language value, but not a Number) and returns a Boolean. It performs the following steps when called:
The abstract operation IsLessThan takes arguments x (an ECMAScript language value), y (an ECMAScript language value), and leftFirst (a Boolean) and returns either a normal completion containing either a Boolean or undefined, or a throw completion. comparison x < y에 대한 semantics를 제공하며, true, false, 또는 undefined(operand가 같은 numeric type의 comparable value로 coerced될 수 없음을 나타냄)를 반환합니다. leftFirst flag는 potentially visible side-effect가 있는 operation이 x와 y에 대해 수행되는 order를 control하는 데 사용됩니다. 이는 ECMAScript가 expression의 left to right evaluation을 specify하기 때문에 필요합니다. leftFirst가 true이면, x parameter는 y parameter에 대응하는 expression의 왼쪽에 나타나는 expression에 대응합니다. leftFirst가 false이면, 그 반대이며 operation은 x보다 y에 먼저 수행되어야 합니다. It performs the following steps when called:
Step 3는 logical-or operation 대신 logical-and operation을 사용한다는 점에서 addition operator +(13.15.3)를 handle하는 algorithm의 step 1.c와 다릅니다.
Note 2
String의 comparison은 UTF-16 code unit value의 sequence에 대한 simple lexicographic ordering을 사용합니다. Unicode specification에 정의된 character 또는 string equality와 collating order의 더 complex하고 semantically oriented definition을 사용하려는 attempt는 없습니다. 따라서 Unicode Standard에 따라 canonically equal하지만 같은 normalization form이 아닌 String value는 unequal로 test될 수 있습니다. 또한 code unit에 의한 lexicographic ordering은 surrogate pair를 포함하는 String에서 code point에 의한 ordering과 다르다는 점에 유의하십시오.
The abstract operation IsStrictlyEqual takes arguments x (an ECMAScript language value) and y (an ECMAScript language value) and returns a Boolean. === operator에 대한 semantics를 제공합니다. It performs the following steps when called:
이 algorithm은 signed zero와 NaN의 treatment에서 SameValue Algorithm과 다릅니다.
7.3 Operations on Objects
7.3.1 MakeBasicObject ( internalSlotsList )
The abstract operation MakeBasicObject takes argument internalSlotsList (a List of internal slot names) and returns an Object. algorithmically 생성되는 모든 ECMAScript object의 source이며, ordinary object와 exotic object를 모두 포함합니다. 모든 object를 creating하는 데 사용되는 common step을 factored out하고 object creation을 centralize합니다. It performs the following steps when called:
Assert: caller가 obj의 [[GetPrototypeOf]]와 [[SetPrototypeOf]] essential internal method를 모두 overriding하지 않을 것이라면, internalSlotsList는 [[Prototype]]을 포함한다.
Assert: caller가 obj의 [[SetPrototypeOf]], [[IsExtensible]], [[PreventExtensions]] essential internal method를 모두 overriding하지 않을 것이라면, internalSlotsList는 [[Extensible]]을 포함한다.
이 명세 안에서 exotic object는 ArrayCreate와 BoundFunctionCreate 같은 abstract operation에서 먼저 MakeBasicObject를 호출하여 basic, foundational object를 얻은 다음, 해당 object의 internal method 일부 또는 전부를 overriding하여 생성됩니다. exotic object creation을 encapsulate하기 위해, object의 essential internal method는 이러한 operation 밖에서는 결코 modified되지 않습니다.
The abstract operation Set takes arguments obj (an Object), propertyKey (a property key), value (an ECMAScript language value), and throw (a Boolean) and returns either a normal completion containingunused or a throw completion. object의 특정 property의 value를 set하는 데 사용됩니다. value는 property의 new value입니다. It performs the following steps when called:
success를 ? obj.[[Set]](propertyKey, value, obj)로 둔다.
이 abstract operation은 ECMAScript language assignment operator가 생성하는 property에 사용되는 것과 같은 default로 attribute가 set된 property를 생성합니다. 일반적으로 property는 이미 존재하지 않습니다. 존재하지만 configurable하지 않거나 obj가 extensible하지 않으면, [[DefineOwnProperty]]는 false를 반환합니다.
7.3.6 CreateDataPropertyOrThrow ( obj, propertyKey, value )
The abstract operation CreateDataPropertyOrThrow takes arguments obj (an Object), propertyKey (a property key), and value (an ECMAScript language value) and returns either a normal completion containingunused or a throw completion. object의 new own property를 create하는 데 사용됩니다. requested property update를 수행할 수 없으면 TypeError exception을 throw합니다. It performs the following steps when called:
이 abstract operation은 ECMAScript language assignment operator가 생성하는 property에 사용되는 것과 같은 default로 attribute가 set된 property를 생성합니다. 일반적으로 property는 이미 존재하지 않습니다. 존재하지만 configurable하지 않거나 obj가 extensible하지 않으면, [[DefineOwnProperty]]는 false를 반환하여 이 operation이 TypeError exception을 throw하게 합니다.
7.3.7 CreateNonEnumerableDataPropertyOrThrow ( obj, propertyKey, value )
The abstract operation CreateNonEnumerableDataPropertyOrThrow takes arguments obj (an Object), propertyKey (a property key), and value (an ECMAScript language value) and returns unused. ordinary object의 new non-enumerable own property를 create하는 데 사용됩니다. It performs the following steps when called:
Assert: obj는 non-configurable property가 없는 ordinary, extensible object이다.
이 abstract operation은 enumerable하지 않다는 점을 제외하고 ECMAScript language assignment operator가 생성하는 property에 사용되는 것과 같은 default로 attribute가 set된 property를 생성합니다. 일반적으로 property는 이미 존재하지 않습니다. 존재하는 경우에도, DefinePropertyOrThrow는 정상적으로 complete함이 guaranteed됩니다.
The abstract operation DefinePropertyOrThrow takes arguments obj (an Object), propertyKey (a property key), and propertyDesc (a Property Descriptor) and returns either a normal completion containingunused or a throw completion. requested property update를 수행할 수 없으면 TypeError exception을 throw하는 방식으로 object의 [[DefineOwnProperty]] internal method를 call하는 데 사용됩니다. It performs the following steps when called:
success를 ? obj.[[DefineOwnProperty]](propertyKey, propertyDesc)로 둔다.
success가 false이면, TypeError exception을 throw한다.
unused를 반환한다.
7.3.9 DeletePropertyOrThrow ( obj, propertyKey )
The abstract operation DeletePropertyOrThrow takes arguments obj (an Object) and propertyKey (a property key) and returns either a normal completion containingunused or a throw completion. object의 특정 own property를 remove하는 데 사용됩니다. property가 configurable하지 않으면 exception을 throw합니다. It performs the following steps when called:
The abstract operation HasProperty takes arguments obj (an Object) and propertyKey (a property key) and returns either a normal completion containing a Boolean or a throw completion. object가 specified property key를 가진 property를 가지는지 determine하는 데 사용됩니다. property는 own 또는 inherited일 수 있습니다. It performs the following steps when called:
? obj.[[HasProperty]](propertyKey)를 반환한다.
7.3.12 HasOwnProperty ( obj, propertyKey )
The abstract operation HasOwnProperty takes arguments obj (an Object) and propertyKey (a property key) and returns either a normal completion containing a Boolean or a throw completion. object가 specified property key를 가진 own property를 가지는지 determine하는 데 사용됩니다. It performs the following steps when called:
propertyDesc를 ? obj.[[GetOwnProperty]](propertyKey)로 둔다.
The abstract operation Construct takes argument ctor (a constructor) and optional arguments argList (a List of ECMAScript language values) and newTarget (a constructor) and returns either a normal completion containing an Object or a throw completion. function object의 [[Construct]] internal method를 call하는 데 사용됩니다. argList와 newTarget은 internal method의 corresponding argument로 passed될 value입니다. argList가 present하지 않으면, 새 empty List가 그 value로 사용됩니다. newTarget이 present하지 않으면, ctor가 그 value로 사용됩니다. It performs the following steps when called:
newTarget이 present하지 않으면, newTarget을 ctor로 설정한다.
argList가 present하지 않으면, argList를 새 empty List로 설정한다.
? ctor.[[Construct]](argList, newTarget)를 반환한다.
Note
newTarget이 present하지 않으면, 이 operation은 new F(...argumentsList)와 equivalent합니다.
7.3.15 SetIntegrityLevel ( obj, level )
The abstract operation SetIntegrityLevel takes arguments obj (an Object) and level (sealed or frozen) and returns either a normal completion containing a Boolean or a throw completion. object의 own property set을 fix하는 데 사용됩니다. It performs the following steps when called:
status를 ? obj.[[PreventExtensions]]()로 둔다.
status가 false이면, false를 반환한다.
keys를 ? obj.[[OwnPropertyKeys]]()로 둔다.
level이 sealed이면, 다음을 수행한다.
keys의 각 element key에 대해, 다음을 수행한다.
? DefinePropertyOrThrow(obj, key, PropertyDescriptor { [[Configurable]]: false })를 수행한다.
The abstract operation TestIntegrityLevel takes arguments obj (an Object) and level (sealed or frozen) and returns either a normal completion containing a Boolean or a throw completion. object의 own property set이 fixed되어 있는지 determine하는 데 사용됩니다. It performs the following steps when called:
level이 frozen이고 IsDataDescriptor(currentDesc)가 true이면, 다음을 수행한다.
currentDesc.[[Writable]]이 true이면, false를 반환한다.
true를 반환한다.
7.3.17 CreateArrayFromList ( elements )
The abstract operation CreateArrayFromList takes argument elements (a List of ECMAScript language values) and returns an Array. elements가 제공하는 element를 가진 Array를 create하는 데 사용됩니다. It performs the following steps when called:
The abstract operation LengthOfArrayLike takes argument obj (an Object) and returns either a normal completion containing a non-negative integer or a throw completion. array-like object의 "length" property value를 반환합니다. It performs the following steps when called:
The abstract operation CreateListFromArrayLike takes argument obj (an ECMAScript language value) and optional argument validElementTypes (all or property-key) and returns either a normal completion containing a List of ECMAScript language values or a throw completion. obj의 indexed property가 제공하는 element를 가진 List value를 create하는 데 사용됩니다. validElementTypes는 element로 allowed되는 value의 type을 나타냅니다. It performs the following steps when called:
The abstract operation OrdinaryHasInstance takes arguments ctor (an ECMAScript language value) and instance (an ECMAScript language value) and returns either a normal completion containing a Boolean or a throw completion. instance가 ctor가 제공하는 instance object inheritance path에서 inherit하는지 determine하기 위한 default algorithm을 implements합니다. It performs the following steps when called:
여기서 passed되는 target은 항상 newly created object이며, error가 thrown되는 경우 직접 accessible하지 않습니다.
7.3.26 PrivateElementFind ( obj, privateName )
The abstract operation PrivateElementFind takes arguments obj (an Object) and privateName (a Private Name) and returns a PrivateElement or empty. It performs the following steps when called:
obj.[[PrivateElements]]가 entry.[[Key]]가 privateName인 PrivateElemententry를 contain하면, 다음을 수행한다.
entry를 반환한다.
empty를 반환한다.
7.3.27 PrivateFieldAdd ( obj, privateName, value )
The abstract operation PrivateMethodOrAccessorAdd takes arguments obj (an Object) and method (a PrivateElement) and returns either a normal completion containingunused or a throw completion. It performs the following steps when called:
Assert: method.[[Kind]]는 method 또는 accessor 중 하나이다.
The abstract operation IteratorComplete takes argument iteratorResult (an Object) and returns either a normal completion containing a Boolean or a throw completion. It performs the following steps when called:
The abstract operation IteratorStep takes argument iteratorRecord (an Iterator Record) and returns either a normal completion containing either an Object or done, or a throw completion. iteratorRecord.[[NextMethod]]를 호출하여 iteratorRecord.[[Iterator]]로부터 next value를 request하고, iterator가 끝에 도달했음을 나타내는 done 또는 next value가 available하면 IteratorResult object를 반환합니다. It performs the following steps when called:
The abstract operation IteratorClose takes arguments iteratorRecord (an Iterator Record) and completion (a Completion Record) and returns a Completion Record. iterator가 completed state에 도달했을 때 일반적으로 수행할 action을 수행해야 함을 notify하는 데 사용됩니다. It performs the following steps when called:
The abstract operation AsyncIteratorClose takes arguments iteratorRecord (an Iterator Record) and completion (a Completion Record) and returns a Completion Record. async iterator가 completed state에 도달했을 때 일반적으로 수행할 action을 수행해야 함을 notify하는 데 사용됩니다. It performs the following steps when called:
The abstract operation CreateListIteratorRecord takes argument list (a List of ECMAScript language values) and returns an Iterator Record. [[NextMethod]]가 list의 successive element를 반환하는 Iterator Record를 생성합니다. It performs the following steps when called:
closure를 parameter가 없고 list를 capture하며 called될 때 다음 step을 수행하는 새 Abstract Closure로 둔다:
DisposableResource 레코드는 폐기 가능한 객체를 해당 객체를 폐기하는 데 사용되는 메서드와 함께 캡슐화하는 데 사용되는 Record 값이다. DisposableResource 레코드는 CreateDisposableResource 추상 연산에 의해 생성된다.
The abstract operation AddDisposableResource takes arguments disposableResourceStack (DisposableResource 레코드의 List), value (ECMAScript 언어 값), and kind (sync-dispose 또는 async-dispose) and optional argument method (함수 객체) and returns unused를 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
The abstract operation CreateDisposableResource takes arguments value (ECMAScript 언어 값) and kind (sync-dispose 또는 async-dispose) and optional argument method (함수 객체) and returns DisposableResource 레코드를 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called: