From 9daccd58664e5fee530bb6380f09bb6030b92416 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 21 Dec 2016 13:54:42 -0800 Subject: [PATCH] General repository cleanup --- .gitignore | 187 +-- .npmignore | 6 + Reflect.js.map | 2 +- Reflect.ts | 88 +- docs/ecmarkup.css | 782 +++++++++ docs/ecmarkup.js | 656 ++++++++ docs/index.html | 1724 ++++++++++++++++++++ docs/spec.biblio.json | 1 + gulpfile.js | 56 + package.json | 22 +- spec.html | 419 +++++ spec/biblio.json | 6 - spec/css/elements.css | 234 --- spec/index-out.html | 662 -------- spec/index.html | 605 ------- spec/typescript-out.html | 441 ----- spec/typescript.html | 441 ----- test/harness.ts | 40 - test/reflect-decorate.ts | 210 +++ test/reflect-definemetadata.ts | 19 + test/reflect-deletemetadata.ts | 40 + test/reflect-getmetadata.ts | 53 + test/reflect-getmetadatakeys.ts | 100 ++ test/reflect-getownmetadata.ts | 53 + test/reflect-getownmetadatakeys.ts | 80 + test/reflect-hasmetadata.ts | 53 + test/reflect-hasownmetadata.ts | 53 + test/reflect-metadata.ts | 40 + test/reflect/reflect-decorate.ts | 208 --- test/reflect/reflect-definemetadata.ts | 17 - test/reflect/reflect-deletemetadata.ts | 38 - test/reflect/reflect-getmetadata.ts | 51 - test/reflect/reflect-getmetadatakeys.ts | 98 -- test/reflect/reflect-getownmetadata.ts | 51 - test/reflect/reflect-getownmetadatakeys.ts | 78 - test/reflect/reflect-hasmetadata.ts | 51 - test/reflect/reflect-hasownmetadata.ts | 51 - test/reflect/reflect-metadata.ts | 38 - test/run.ts | 5 - test/spec.ts | 10 - test/tsconfig.json | 21 +- typings/node.d.ts | 13 - 42 files changed, 4414 insertions(+), 3389 deletions(-) create mode 100644 docs/ecmarkup.css create mode 100644 docs/ecmarkup.js create mode 100644 docs/index.html create mode 100644 docs/spec.biblio.json create mode 100644 gulpfile.js create mode 100644 spec.html delete mode 100644 spec/biblio.json delete mode 100644 spec/css/elements.css delete mode 100644 spec/index-out.html delete mode 100644 spec/index.html delete mode 100644 spec/typescript-out.html delete mode 100644 spec/typescript.html delete mode 100644 test/harness.ts create mode 100644 test/reflect-decorate.ts create mode 100644 test/reflect-definemetadata.ts create mode 100644 test/reflect-deletemetadata.ts create mode 100644 test/reflect-getmetadata.ts create mode 100644 test/reflect-getmetadatakeys.ts create mode 100644 test/reflect-getownmetadata.ts create mode 100644 test/reflect-getownmetadatakeys.ts create mode 100644 test/reflect-hasmetadata.ts create mode 100644 test/reflect-hasownmetadata.ts create mode 100644 test/reflect-metadata.ts delete mode 100644 test/reflect/reflect-decorate.ts delete mode 100644 test/reflect/reflect-definemetadata.ts delete mode 100644 test/reflect/reflect-deletemetadata.ts delete mode 100644 test/reflect/reflect-getmetadata.ts delete mode 100644 test/reflect/reflect-getmetadatakeys.ts delete mode 100644 test/reflect/reflect-getownmetadata.ts delete mode 100644 test/reflect/reflect-getownmetadatakeys.ts delete mode 100644 test/reflect/reflect-hasmetadata.ts delete mode 100644 test/reflect/reflect-hasownmetadata.ts delete mode 100644 test/reflect/reflect-metadata.ts delete mode 100644 test/run.ts delete mode 100644 test/spec.ts delete mode 100644 typings/node.d.ts diff --git a/.gitignore b/.gitignore index 9f3de20..005715f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,185 +1,4 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -temp/ - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -build/ -bld/ -[Bb]in/ -[Oo]bj/ - -# Roslyn cache directories -*.ide/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -#NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf -*.cachefile - -# Visual Studio profiler -*.psess -*.vsp -*.vspx - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding addin-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -_NCrunch_* -.*crunch*.local.xml - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/packages/* -# except build/, which is used as an MSBuild target. -!**/packages/build/ -# If using the old MSBuild-Integrated Package Restore, uncomment this: -#!**/packages/repositories.config - -# Windows Azure Build Output -csx/ -*.build.csdef - -# Windows Store app package directory -AppPackages/ - -# Others -sql/ -*.Cache -ClientBin/ -[Ss]tyle[Cc]op.* -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.pfx -*.publishsettings +.vscode/ node_modules/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -*.mdf -*.ldf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings - -# Microsoft Fakes -FakesAssemblies/ +test/**/*.js +test/**/*.js.map \ No newline at end of file diff --git a/.npmignore b/.npmignore index efef072..652be7b 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,11 @@ +./.vscode ./node_modules +./out +./spec ./test ./typings +./bower.json +./gulpfile.js ./Reflect.ts +./spec.html ./tsconfig.json \ No newline at end of file diff --git a/Reflect.js.map b/Reflect.js.map index bbe4f3a..e17df06 100644 --- a/Reflect.js.map +++ b/Reflect.js.map @@ -1 +1 @@ -{"version":3,"file":"Reflect.js","sourceRoot":"","sources":["Reflect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;gFAagF;AAChF,IAAU,OAAO,CA+oDhB;AA/oDD,WAAU,OAAO;IACb,YAAY,CAAC;IAsFb,IAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;IAE/C,yCAAyC;IACzC,IAAM,cAAc,GAAG,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC;IAE3D,qCAAqC;IACrC,IAAM,aAAa,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,CAAC;IAEzD,kCAAkC;IAClC,IAAM,cAAc,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC;IACpD,IAAM,iBAAiB,GAAG,cAAc,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,WAAW,GAAG,MAAM,CAAC,WAAW,GAAG,eAAe,CAAC;IAC7H,IAAM,cAAc,GAAG,cAAc,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,GAAG,MAAM,CAAC,QAAQ,GAAG,YAAY,CAAC;IAEjH,iEAAiE;IACjE,IAAM,gBAAgB,GAClB,cAAc,GAAG,cAAS,OAAA,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAe,CAAC,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Q,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC;gBAC/B,GAAG,CAAC,CAAC,IAAM,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC;oBACtB,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;wBAC1B,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,GAAS,OAAQ,CAAC,CAAC,CAAC,CAAC;oBAC5C,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;QACD,IAAI,CAAC,CAAC;YACF,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;QAC/B,CAAC;IACL,CAAC,CAAC,CACE,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM;QAClC,OAAO,IAAI,KAAK,WAAW,GAAG,IAAI;YAC9B,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;AAC5C,CAAC,EA7oDS,OAAO,KAAP,OAAO,QA6oDhB"} \ No newline at end of file diff --git a/Reflect.ts b/Reflect.ts index 86c56d0..3cf181b 100644 --- a/Reflect.ts +++ b/Reflect.ts @@ -15,8 +15,6 @@ and limitations under the License. namespace Reflect { "use strict"; - type object = {}; // placeholder until https://github.com/Microsoft/TypeScript/pull/12501 - type HashMap = Record; interface BufferLike { @@ -135,7 +133,7 @@ namespace Reflect { const _WeakMap: typeof WeakMap = typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); // [[Metadata]] internal slot - const Metadata = new _WeakMap>>(); + const Metadata = new _WeakMap>>(); /** * Applies a set of decorators to a target object. @@ -188,7 +186,7 @@ namespace Reflect { * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); * */ - export function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: object, targetKey: string | symbol, targetDescriptor?: PropertyDescriptor | null): PropertyDescriptor | undefined; + export function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: any, targetKey: string | symbol, targetDescriptor?: PropertyDescriptor | null): PropertyDescriptor | undefined; /** * Applies a set of decorators to a property of a target object. @@ -225,7 +223,7 @@ namespace Reflect { * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); * */ - export function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: object, targetKey: string | symbol, targetDescriptor: PropertyDescriptor): PropertyDescriptor; + export function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: any, targetKey: string | symbol, targetDescriptor: PropertyDescriptor): PropertyDescriptor; /** * Applies a set of decorators to a property of a target object. @@ -266,7 +264,7 @@ namespace Reflect { * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); * */ - export function decorate(decorators: (ClassDecorator | MemberDecorator)[], target: object, targetKey?: string | symbol, targetDescriptor?: PropertyDescriptor | null): PropertyDescriptor | Function | undefined { + export function decorate(decorators: (ClassDecorator | MemberDecorator)[], target: any, targetKey?: string | symbol, targetDescriptor?: PropertyDescriptor | null): PropertyDescriptor | Function | undefined { if (!IsUndefined(targetKey)) { if (!IsArray(decorators)) throw new TypeError(); if (!IsObject(target)) throw new TypeError(); @@ -324,8 +322,8 @@ namespace Reflect { */ export function metadata(metadataKey: any, metadataValue: any) { function decorator(target: Function): void; - function decorator(target: object, targetKey: string | symbol): void; - function decorator(target: object, targetKey?: string | symbol): void { + function decorator(target: any, targetKey: string | symbol): void; + function decorator(target: any, targetKey?: string | symbol): void { if (!IsUndefined(targetKey)) { if (!IsObject(target)) throw new TypeError(); targetKey = ToPropertyKey(targetKey); @@ -358,7 +356,7 @@ namespace Reflect { * } * */ - export function defineMetadata(metadataKey: any, metadataValue: any, target: object): void; + export function defineMetadata(metadataKey: any, metadataValue: any, target: any): void; /** * Define a unique metadata entry on the target. @@ -395,7 +393,7 @@ namespace Reflect { * } * */ - export function defineMetadata(metadataKey: any, metadataValue: any, target: object, targetKey: string | symbol): void; + export function defineMetadata(metadataKey: any, metadataValue: any, target: any, targetKey: string | symbol): void; /** * Define a unique metadata entry on the target. @@ -436,7 +434,7 @@ namespace Reflect { * } * */ - export function defineMetadata(metadataKey: any, metadataValue: any, target: object, targetKey?: string | symbol): void { + export function defineMetadata(metadataKey: any, metadataValue: any, target: any, targetKey?: string | symbol): void { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(targetKey)) targetKey = ToPropertyKey(targetKey); return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); @@ -456,7 +454,7 @@ namespace Reflect { * result = Reflect.hasMetadata("custom:annotation", Example); * */ - export function hasMetadata(metadataKey: any, target: object): boolean; + export function hasMetadata(metadataKey: any, target: any): boolean; /** * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. @@ -488,7 +486,7 @@ namespace Reflect { * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); * */ - export function hasMetadata(metadataKey: any, target: object, targetKey: string | symbol): boolean; + export function hasMetadata(metadataKey: any, target: any, targetKey: string | symbol): boolean; /** * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. @@ -524,7 +522,7 @@ namespace Reflect { * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); * */ - export function hasMetadata(metadataKey: any, target: object, targetKey?: string | symbol): boolean { + export function hasMetadata(metadataKey: any, target: any, targetKey?: string | symbol): boolean { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(targetKey)) targetKey = ToPropertyKey(targetKey); return OrdinaryHasMetadata(metadataKey, target, targetKey); @@ -544,7 +542,7 @@ namespace Reflect { * result = Reflect.hasOwnMetadata("custom:annotation", Example); * */ - export function hasOwnMetadata(metadataKey: any, target: object): boolean; + export function hasOwnMetadata(metadataKey: any, target: any): boolean; /** * Gets a value indicating whether the target object has the provided metadata key defined. @@ -576,7 +574,7 @@ namespace Reflect { * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); * */ - export function hasOwnMetadata(metadataKey: any, target: object, targetKey: string | symbol): boolean; + export function hasOwnMetadata(metadataKey: any, target: any, targetKey: string | symbol): boolean; /** * Gets a value indicating whether the target object has the provided metadata key defined. @@ -612,7 +610,7 @@ namespace Reflect { * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); * */ - export function hasOwnMetadata(metadataKey: any, target: object, targetKey?: string | symbol): boolean { + export function hasOwnMetadata(metadataKey: any, target: any, targetKey?: string | symbol): boolean { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(targetKey)) targetKey = ToPropertyKey(targetKey); return OrdinaryHasOwnMetadata(metadataKey, target, targetKey); @@ -632,7 +630,7 @@ namespace Reflect { * result = Reflect.getMetadata("custom:annotation", Example); * */ - export function getMetadata(metadataKey: any, target: object): any; + export function getMetadata(metadataKey: any, target: any): any; /** * Gets the metadata value for the provided metadata key on the target object or its prototype chain. @@ -664,7 +662,7 @@ namespace Reflect { * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); * */ - export function getMetadata(metadataKey: any, target: object, targetKey: string | symbol): any; + export function getMetadata(metadataKey: any, target: any, targetKey: string | symbol): any; /** * Gets the metadata value for the provided metadata key on the target object or its prototype chain. @@ -700,7 +698,7 @@ namespace Reflect { * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); * */ - export function getMetadata(metadataKey: any, target: object, targetKey?: string | symbol): any { + export function getMetadata(metadataKey: any, target: any, targetKey?: string | symbol): any { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(targetKey)) targetKey = ToPropertyKey(targetKey); return OrdinaryGetMetadata(metadataKey, target, targetKey); @@ -720,7 +718,7 @@ namespace Reflect { * result = Reflect.getOwnMetadata("custom:annotation", Example); * */ - export function getOwnMetadata(metadataKey: any, target: object): any; + export function getOwnMetadata(metadataKey: any, target: any): any; /** * Gets the metadata value for the provided metadata key on the target object. @@ -752,7 +750,7 @@ namespace Reflect { * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); * */ - export function getOwnMetadata(metadataKey: any, target: object, targetKey: string | symbol): any; + export function getOwnMetadata(metadataKey: any, target: any, targetKey: string | symbol): any; /** * Gets the metadata value for the provided metadata key on the target object. @@ -788,7 +786,7 @@ namespace Reflect { * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); * */ - export function getOwnMetadata(metadataKey: any, target: object, targetKey?: string | symbol): any { + export function getOwnMetadata(metadataKey: any, target: any, targetKey?: string | symbol): any { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(targetKey)) targetKey = ToPropertyKey(targetKey); return OrdinaryGetOwnMetadata(metadataKey, target, targetKey); @@ -807,7 +805,7 @@ namespace Reflect { * result = Reflect.getMetadataKeys(Example); * */ - export function getMetadataKeys(target: object): any[]; + export function getMetadataKeys(target: any): any[]; /** * Gets the metadata keys defined on the target object or its prototype chain. @@ -838,7 +836,7 @@ namespace Reflect { * result = Reflect.getMetadataKeys(Example.prototype, "method"); * */ - export function getMetadataKeys(target: object, targetKey: string | symbol): any[]; + export function getMetadataKeys(target: any, targetKey: string | symbol): any[]; /** * Gets the metadata keys defined on the target object or its prototype chain. @@ -873,7 +871,7 @@ namespace Reflect { * result = Reflect.getMetadataKeys(Example.prototype, "method"); * */ - export function getMetadataKeys(target: object, targetKey?: string | symbol): any[] { + export function getMetadataKeys(target: any, targetKey?: string | symbol): any[] { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(targetKey)) targetKey = ToPropertyKey(targetKey); return OrdinaryMetadataKeys(target, targetKey); @@ -892,7 +890,7 @@ namespace Reflect { * result = Reflect.getOwnMetadataKeys(Example); * */ - export function getOwnMetadataKeys(target: object): any[]; + export function getOwnMetadataKeys(target: any): any[]; /** * Gets the unique metadata keys defined on the target object. @@ -923,7 +921,7 @@ namespace Reflect { * result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); * */ - export function getOwnMetadataKeys(target: object, targetKey: string | symbol): any[]; + export function getOwnMetadataKeys(target: any, targetKey: string | symbol): any[]; /** * Gets the unique metadata keys defined on the target object. @@ -958,7 +956,7 @@ namespace Reflect { * result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); * */ - export function getOwnMetadataKeys(target: object, targetKey?: string | symbol): any[] { + export function getOwnMetadataKeys(target: any, targetKey?: string | symbol): any[] { if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(targetKey)) targetKey = ToPropertyKey(targetKey); return OrdinaryOwnMetadataKeys(target, targetKey); @@ -978,7 +976,7 @@ namespace Reflect { * result = Reflect.deleteMetadata("custom:annotation", Example); * */ - export function deleteMetadata(metadataKey: any, target: object): boolean; + export function deleteMetadata(metadataKey: any, target: any): boolean; /** * Deletes the metadata entry from the target object with the provided key. @@ -1010,7 +1008,7 @@ namespace Reflect { * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); * */ - export function deleteMetadata(metadataKey: any, target: object, targetKey: string | symbol): boolean; + export function deleteMetadata(metadataKey: any, target: any, targetKey: string | symbol): boolean; /** * Deletes the metadata entry from the target object with the provided key. @@ -1046,7 +1044,7 @@ namespace Reflect { * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); * */ - export function deleteMetadata(metadataKey: any, target: object, targetKey?: string | symbol): boolean { + export function deleteMetadata(metadataKey: any, target: any, targetKey?: string | symbol): boolean { // https://github.com/rbuckton/ReflectDecorators/blob/master/spec/metadata.md#deletemetadata-metadatakey-p- if (!IsObject(target)) throw new TypeError(); if (!IsUndefined(targetKey)) targetKey = ToPropertyKey(targetKey); @@ -1073,7 +1071,7 @@ namespace Reflect { return target; } - function DecorateProperty(decorators: MemberDecorator[], target: object, propertyKey: string | symbol, descriptor: PropertyDescriptor | undefined): PropertyDescriptor | undefined { + function DecorateProperty(decorators: MemberDecorator[], target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor | undefined): PropertyDescriptor | undefined { for (let i = decorators.length - 1; i >= 0; --i) { const decorator = decorators[i]; const decorated = decorator(target, propertyKey, descriptor); @@ -1093,9 +1091,9 @@ namespace Reflect { // GetOrCreateMetadataMap(O, P, Create) // https://github.com/rbuckton/ReflectDecorators/blob/master/spec/metadata.md#getorcreatemetadatamap--o-p-create- - function GetOrCreateMetadataMap(O: object, P: string | symbol | undefined, Create: true): Map; - function GetOrCreateMetadataMap(O: object, P: string | symbol | undefined, Create: false): Map | undefined; - function GetOrCreateMetadataMap(O: object, P: string | symbol | undefined, Create: boolean): Map | undefined { + function GetOrCreateMetadataMap(O: any, P: string | symbol | undefined, Create: true): Map; + function GetOrCreateMetadataMap(O: any, P: string | symbol | undefined, Create: false): Map | undefined; + function GetOrCreateMetadataMap(O: any, P: string | symbol | undefined, Create: boolean): Map | undefined { let targetMetadata = Metadata.get(O); if (IsUndefined(targetMetadata)) { if (!Create) return undefined; @@ -1116,7 +1114,7 @@ namespace Reflect { // OrdinaryHasMetadata(MetadataKey, O, P) // https://github.com/rbuckton/ReflectDecorators/blob/master/spec/metadata.md#ordinaryhasmetadata--metadatakey-o-p- - function OrdinaryHasMetadata(MetadataKey: any, O: object, P: string | symbol | undefined): boolean { + function OrdinaryHasMetadata(MetadataKey: any, O: any, P: string | symbol | undefined): boolean { const hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return true; const parent = OrdinaryGetPrototypeOf(O); @@ -1126,7 +1124,7 @@ namespace Reflect { // OrdinaryHasOwnMetadata(MetadataKey, O, P) // https://github.com/rbuckton/ReflectDecorators/blob/master/spec/metadata.md#ordinaryhasownmetadata--metadatakey-o-p- - function OrdinaryHasOwnMetadata(MetadataKey: any, O: object, P: string | symbol | undefined): boolean { + function OrdinaryHasOwnMetadata(MetadataKey: any, O: any, P: string | symbol | undefined): boolean { const metadataMap = GetOrCreateMetadataMap(O, P, /*create*/ false); if (IsUndefined(metadataMap)) return false; return ToBoolean(metadataMap.has(MetadataKey)); @@ -1134,7 +1132,7 @@ namespace Reflect { // OrdinaryGetMetadata(MetadataKey, O, P) // https://github.com/rbuckton/ReflectDecorators/blob/master/spec/metadata.md#ordinarygetmetadata--metadatakey-o-p- - function OrdinaryGetMetadata(MetadataKey: any, O: object, P: string | symbol | undefined): any { + function OrdinaryGetMetadata(MetadataKey: any, O: any, P: string | symbol | undefined): any { const hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return OrdinaryGetOwnMetadata(MetadataKey, O, P); const parent = OrdinaryGetPrototypeOf(O); @@ -1144,7 +1142,7 @@ namespace Reflect { // OrdinaryGetOwnMetadata(MetadataKey, O, P) // https://github.com/rbuckton/ReflectDecorators/blob/master/spec/metadata.md#ordinarygetownmetadata--metadatakey-o-p- - function OrdinaryGetOwnMetadata(MetadataKey: any, O: object, P: string | symbol | undefined): any { + function OrdinaryGetOwnMetadata(MetadataKey: any, O: any, P: string | symbol | undefined): any { const metadataMap = GetOrCreateMetadataMap(O, P, /*create*/ false); if (IsUndefined(metadataMap)) return undefined; return metadataMap.get(MetadataKey); @@ -1152,14 +1150,14 @@ namespace Reflect { // OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) // https://github.com/rbuckton/ReflectDecorators/blob/master/spec/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p- - function OrdinaryDefineOwnMetadata(MetadataKey: any, MetadataValue: any, O: object, P: string | symbol | undefined): void { + function OrdinaryDefineOwnMetadata(MetadataKey: any, MetadataValue: any, O: any, P: string | symbol | undefined): void { const metadataMap = GetOrCreateMetadataMap(O, P, /*create*/ true); metadataMap.set(MetadataKey, MetadataValue); } // OrdinaryMetadataKeys(O, P) // https://github.com/rbuckton/ReflectDecorators/blob/master/spec/metadata.md#ordinarymetadatakeys--o-p- - function OrdinaryMetadataKeys(O: object, P: string | symbol | undefined): any[] { + function OrdinaryMetadataKeys(O: any, P: string | symbol | undefined): any[] { const ownKeys = OrdinaryOwnMetadataKeys(O, P); const parent = OrdinaryGetPrototypeOf(O); if (parent === null) return ownKeys; @@ -1187,7 +1185,7 @@ namespace Reflect { // OrdinaryOwnMetadataKeys(O, P) // https://github.com/rbuckton/ReflectDecorators/blob/master/spec/metadata.md#ordinaryownmetadatakeys--o-p- - function OrdinaryOwnMetadataKeys(O: object, P: string | symbol | undefined): any[] { + function OrdinaryOwnMetadataKeys(O: any, P: string | symbol | undefined): any[] { const metadataMap = GetOrCreateMetadataMap(O, P, /*create*/ false); const keys: any[] = []; if (IsUndefined(metadataMap)) return keys; @@ -1297,7 +1295,7 @@ namespace Reflect { // 7.1.1.1 OrdinaryToPrimitive(O, hint) // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive - function OrdinaryToPrimitive(O: object, hint: "string" | "number"): undefined | null | boolean | string | symbol | number { + function OrdinaryToPrimitive(O: any, hint: "string" | "number"): undefined | null | boolean | string | symbol | number { if (hint === "string") { const toString = O.toString; if (IsCallable(toString)) { @@ -1420,7 +1418,7 @@ namespace Reflect { // 9.1.1.1 OrdinaryGetPrototypeOf(O) // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof - function OrdinaryGetPrototypeOf(O: any): object { + function OrdinaryGetPrototypeOf(O: any): any { const proto = Object.getPrototypeOf(O); if (typeof O !== "function" || O === functionPrototype) return proto; diff --git a/docs/ecmarkup.css b/docs/ecmarkup.css new file mode 100644 index 0000000..91eb984 --- /dev/null +++ b/docs/ecmarkup.css @@ -0,0 +1,782 @@ +body { + display: flex; + font-size: 18px; + line-height: 1.5; + font-family: Cambria, Palatino Linotype, Palatino, Liberation Serif, serif; + padding: 0; + margin: 0; + color: #111; +} + +#spec-container { + padding-left: 20px; + flex-grow: 1; + flex-basis: 66%; + box-sizing: border-box; + overflow: hidden; +} + +body.oldtoc { + margin: 0 auto; +} + +a { + text-decoration: none; + color: #206ca7; +} + +a:visited { + color: #206ca7; +} + +a:hover { + text-decoration: underline; + color: #239dee; +} + + +code { + font-weight: bold; + font-family: Consolas, Monaco, monospace; + white-space: pre; +} + +pre code { + font-weight: inherit; +} + +pre code.hljs { + background-color: #fff; + margin: 0; + padding: 0; +} + +ol.toc { + list-style: none; + padding-left: 0; +} + +ol.toc ol.toc { + padding-left: 2ex; + list-style: none; +} + +var { + color: #2aa198; + transition: background-color 0.25s ease; + cursor: pointer; +} + +var.referenced { + background-color: #ffff33; +} + +emu-const { + font-family: sans-serif; +} + +emu-val { + font-weight: bold; +} +emu-alg ol, emu-alg ol ol ol ol { + list-style-type: decimal; +} + +emu-alg ol ol, emu-alg ol ol ol ol ol { + list-style-type: lower-alpha; +} + +emu-alg ol ol ol, ol ol ol ol ol ol { + list-style-type: lower-roman; +} + +emu-eqn { + display: block; + margin-left: 4em; +} + +emu-eqn.inline { + display: inline; + margin: 0; +} + +emu-eqn div:first-child { + margin-left: -2em; +} + +emu-note { + margin: 1em 0; + color: #666; + border-left: 5px solid #ccc; + display: flex; + flex-direction: row; +} + +emu-note > span.note { + flex-basis: 100px; + min-width: 100px; + flex-grow: 0; + flex-shrink: 1; + text-transform: uppercase; + padding-left: 5px; +} + +emu-note[type=editor] { + border-left-color: #faa; +} + +emu-note > div.note-contents { + flex-grow: 1; + flex-shrink: 1; +} + +emu-note > div.note-contents > p:first-child { + margin-top: 0; +} + +emu-note > div.note-contents > p:last-child { + margin-bottom: 0; +} + +emu-example { + display: block; + margin: 1em 3em; +} + +emu-example figure figcaption { + margin-top: 0.5em; + text-align: left; +} + +emu-production { + display: block; + margin-top: 1em; + margin-bottom: 1em; + margin-left: 5ex; +} + + +emu-grammar.inline, emu-production.inline, +emu-grammar.inline emu-production emu-rhs, emu-production.inline emu-rhs { + display: inline; +} + +emu-grammar[collapsed] emu-production, emu-production[collapsed] { + margin: 0; +} + +emu-grammar[collapsed] emu-production emu-rhs, emu-production[collapsed] emu-rhs { + display: inline; + padding-left: 1ex; +} + +emu-constraints { + font-size: .75em; + margin-right: 1ex; +} + +emu-gann { + margin-right: 1ex; +} + +emu-gann emu-t:last-child, +emu-gann emu-nt:last-child { + margin-right: 0; +} + +emu-geq { + margin-left: 1ex; + font-weight: bold; +} + +emu-oneof { + font-weight: bold; + margin-left: 1ex; +} + +emu-nt { + display: inline-block; + font-style: italic; + white-space: nowrap; + text-indent: 0; +} + +emu-nt a, emu-nt a:visited { + color: #333; +} + +emu-rhs emu-nt { + margin-right: 1ex; +} + +emu-t { + display: inline-block; + font-family: monospace; + font-weight: bold; + white-space: nowrap; + text-indent: 0; +} + +emu-production emu-t { + margin-right: 1ex; +} + +emu-rhs { + display: block; + padding-left: 75px; + text-indent: -25px; +} + +emu-mods { + font-size: .85em; + vertical-align: sub; + font-style: normal; + font-weight: normal; +} + +emu-production[collapsed] emu-mods { + display: none; +} + +emu-params, emu-opt { + margin-right: 1ex; + font-family: monospace; +} + +emu-params, emu-constraints { + color: #2aa198; +} + +emu-opt { + color: #b58900; +} + +emu-gprose { + font-size: 0.9em; + font-family: Helvetica, Arial, sans-serif; +} + +h1.shortname { + color: #f60; + font-size: 1.5em; + margin: 0; +} + +h1.version { + color: #f60; + font-size: 1.5em; + margin: 0; +} + +h1.title { + margin-top: 0; + color: #f60; +} + +h1.first { + margin-top: 0; +} + +h1, h2, h3, h4, h5, h6 { + position: relative; +} + +h1 .secnum { + text-decoration: none; + margin-right: 10px; +} + +h1 span.title { + order: 2; +} + + +h1 { font-size: 2.67em; margin-top: 2em; margin-bottom: 1em; line-height: 1em;} +h2 { font-size: 2em; } +h3 { font-size: 1.56em; } +h4 { font-size: 1.25em; } +h5 { font-size: 1.11em; } +h6 { font-size: 1em; } + +h1:hover span.utils { + display: block; +} + +span.utils { + font-size: 18px; + line-height: 18px; + display: none; + position: absolute; + top: 100%; + left: 0; + right: 0; + font-weight: normal; +} + +span.utils:before { + content: "⤷"; + display: inline-block; + padding: 0 5px; +} + +span.utils > * { + display: inline-block; + margin-right: 20px; +} + +h1 span.utils span.anchor a, +h2 span.utils span.anchor a, +h3 span.utils span.anchor a, +h4 span.utils span.anchor a, +h5 span.utils span.anchor a, +h6 span.utils span.anchor a { + text-decoration: none; + font-variant: small-caps; +} + +h1 span.utils span.anchor a:hover, +h2 span.utils span.anchor a:hover, +h3 span.utils span.anchor a:hover, +h4 span.utils span.anchor a:hover, +h5 span.utils span.anchor a:hover, +h6 span.utils span.anchor a:hover { + color: #333; +} + +emu-intro h1, emu-clause h1, emu-annex h1 { font-size: 2em; } +emu-intro h2, emu-clause h2, emu-annex h2 { font-size: 1.56em; } +emu-intro h3, emu-clause h3, emu-annex h3 { font-size: 1.25em; } +emu-intro h4, emu-clause h4, emu-annex h4 { font-size: 1.11em; } +emu-intro h5, emu-clause h5, emu-annex h5 { font-size: 1em; } +emu-intro h6, emu-clause h6, emu-annex h6 { font-size: 0.9em; } +emu-intro emu-intro h1, emu-clause emu-clause h1, emu-annex emu-annex h1 { font-size: 1.56em; } +emu-intro emu-intro h2, emu-clause emu-clause h2, emu-annex emu-annex h2 { font-size: 1.25em; } +emu-intro emu-intro h3, emu-clause emu-clause h3, emu-annex emu-annex h3 { font-size: 1.11em; } +emu-intro emu-intro h4, emu-clause emu-clause h4, emu-annex emu-annex h4 { font-size: 1em; } +emu-intro emu-intro h5, emu-clause emu-clause h5, emu-annex emu-annex h5 { font-size: 0.9em; } +emu-intro emu-intro emu-intro h1, emu-clause emu-clause emu-clause h1, emu-annex emu-annex emu-annex h1 { font-size: 1.25em; } +emu-intro emu-intro emu-intro h2, emu-clause emu-clause emu-clause h2, emu-annex emu-annex emu-annex h2 { font-size: 1.11em; } +emu-intro emu-intro emu-intro h3, emu-clause emu-clause emu-clause h3, emu-annex emu-annex emu-annex h3 { font-size: 1em; } +emu-intro emu-intro emu-intro h4, emu-clause emu-clause emu-clause h4, emu-annex emu-annex emu-annex h4 { font-size: 0.9em; } +emu-intro emu-intro emu-intro emu-intro h1, emu-clause emu-clause emu-clause emu-clause h1, emu-annex emu-annex emu-annex emu-annex h1 { font-size: 1.11em; } +emu-intro emu-intro emu-intro emu-intro h2, emu-clause emu-clause emu-clause emu-clause h2, emu-annex emu-annex emu-annex emu-annex h2 { font-size: 1em; } +emu-intro emu-intro emu-intro emu-intro h3, emu-clause emu-clause emu-clause emu-clause h3, emu-annex emu-annex emu-annex emu-annex h3 { font-size: 0.9em; } +emu-intro emu-intro emu-intro emu-intro emu-intro h1, emu-clause emu-clause emu-clause emu-clause emu-clause h1, emu-annex emu-annex emu-annex emu-annex emu-annex h1 { font-size: 1em; } +emu-intro emu-intro emu-intro emu-intro emu-intro h2, emu-clause emu-clause emu-clause emu-clause emu-clause h2, emu-annex emu-annex emu-annex emu-annex emu-annex h2 { font-size: 0.9em; } +emu-intro emu-intro emu-intro emu-intro emu-intro emu-intro h1, emu-clause emu-clause emu-clause emu-clause emu-clause emu-clause h1, emu-annex emu-annex emu-annex emu-annex emu-annex emu-annex h1 { font-size: 0.9em } + +emu-clause { + display: block; +} + +/* Figures and tables */ +figure { display: block; margin: 1em 0 3em 0; } +figure object { display: block; margin: 0 auto; } +figure table.real-table { margin: 0 auto; } +figure figcaption { + display: block; + color: #555555; + font-weight: bold; + text-align: center; +} + +emu-table table { + margin: 0 auto; +} + +emu-table table, table.real-table { + border-collapse: collapse; +} + +emu-table td, emu-table th, table.real-table td, table.real-table th { + border: 1px solid black; + padding: 0.4em; + vertical-align: baseline; +} +emu-table th, emu-table thead td, table.real-table th { + background-color: #eeeeee; +} + +/* Note: the left content edges of table.lightweight-table >tbody >tr >td + and div.display line up. */ +table.lightweight-table { + border-collapse: collapse; + margin: 0 0 0 1.5em; +} +table.lightweight-table td, table.lightweight-table th { + border: none; + padding: 0 0.5em; + vertical-align: baseline; +} + +/* diff styles */ +ins { + background-color: #e0f8e0; + text-decoration: none; + border-bottom: 1px solid #396; +} + +del { + background-color: #fee; +} + +ins.block, del.block, +emu-production > ins, emu-production > del, +emu-grammar > ins, emu-grammar > del { + display: block; +} + +/* Menu Styles */ +#menu-toggle { + font-size: 2em; + + position: fixed; + top: 0; + left: 0; + width: 1.5em; + height: 1.5em; + z-index: 3; + visibility: hidden; + color: #1567a2; + background-color: #fff; + + line-height: 1.5em; + text-align: center; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none;; + + cursor: pointer; +} + +#menu { + display: flex; + flex-direction: column; + width: 33%; height: 100vh; + max-width: 500px; + box-sizing: border-box; + background-color: #ddd; + overflow: hidden; + transition: opacity 0.1s linear; + padding: 0 5px; + position: fixed; + left: 0; top: 0; + + z-index: 2; +} + +#menu-spacer { + flex-basis: 33%; + max-width: 500px; + flex-grow: 0; + flex-shrink: 0; +} + +#menu a { + color: #1567a2; +} + +#menu.active { + display: flex; + opacity: 1; + z-index: 2; +} + +#menu-pins { + flex-grow: 1; + display: none; +} + +#menu-pins.active { + display: block; +} + +#menu-pins-list { + margin: 0; + padding: 0; + counter-reset: pins-counter; +} + +#menu-pins-list > li:before { + content: counter(pins-counter); + counter-increment: pins-counter; + display: inline-block; + width: 25px; + text-align: center; + border: 1px solid #bbb; + padding: 2px; + margin: 4px; + box-sizing: border-box; + line-height: 1em; + background-color: #ccc; + border-radius: 4px; +} +#menu-toc > ol { + padding: 0; + flex-grow: 1; +} + +#menu-toc > ol li { + padding: 0; +} + +#menu-toc > ol , #menu-toc > ol ol { + list-style-type: none; + margin: 0; + padding: 0; +} + +#menu-toc > ol ol { + padding-left: 0.75em; +} + +#menu-toc li { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} + +#menu-toc .item-toggle { + display: inline-block; + transform: rotate(-45deg) translate(-5px, -5px); + transition: transform 0.1s ease; + text-align: center; + width: 20px; + + color: #aab; + + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none;; + + cursor: pointer; +} + +#menu-toc .item-toggle-none { + display: inline-block; + width: 20px; +} + +#menu-toc li.active > .item-toggle { + transform: rotate(45deg) translate(-5px, -5px); +} + +#menu-toc li > ol { + display: none; +} + +#menu-toc li.active > ol { + display: block; +} + +#menu-toc li.revealed > a { + background-color: #bbb; + font-weight: bold; + /* + background-color: #222; + color: #c6d8e4; + */ +} + +#menu-toc li.revealed-leaf> a { + color: #206ca7; + /* + background-color: #222; + color: #c6d8e4; + */ +} + +#menu-toc li.revealed > .item-toggle { + transform: rotate(45deg) translate(-5px, -5px); +} + +#menu-toc li.revealed > ol { + display: block; +} + +#menu-toc li > a { + padding: 2px 5px; +} + +#menu > * { + margin-bottom: 5px; +} + +.menu-pane-header { + padding: 0 5px; + text-transform: uppercase; + background-color: #aaa; + color: #335; + font-weight: bold; + letter-spacing: 2px; + flex-grow: 0; + flex-shrink: 0; + font-size: 0.8em; +} + +#menu-toc { + display: flex; + flex-direction: column; + width: 100%; + overflow: hidden; + flex-grow: 1; +} + +#menu-toc ol.toc { + overflow-x: hidden; + overflow-y: auto; +} + +#menu-search { + position: relative; + flex-grow: 0; + flex-shrink: 0; + width: 100%; + + display: flex; + flex-direction: column; + + max-height: 300px; +} + +#menu-trace-list { + display: none; +} + +#menu-search-box { + box-sizing: border-box; + display: block; + width: 100%; + margin: 5px 0 0 0; + font-size: 1em; + padding: 2px; + background-color: #bbb; + border: 1px solid #999; +} + +#menu-search-results { + overflow-x: hidden; + overflow-y: auto; +} + +li.menu-search-result-clause:before { + content: 'clause'; + width: 40px; + display: inline-block; + text-align: right; + padding-right: 1ex; + color: #666; + font-size: 75%; +} +li.menu-search-result-op:before { + content: 'op'; + width: 40px; + display: inline-block; + text-align: right; + padding-right: 1ex; + color: #666; + font-size: 75%; +} + +li.menu-search-result-prod:before { + content: 'prod'; + width: 40px; + display: inline-block; + text-align: right; + padding-right: 1ex; + color: #666; + font-size: 75% +} + + +li.menu-search-result-term:before { + content: 'term'; + width: 40px; + display: inline-block; + text-align: right; + padding-right: 1ex; + color: #666; + font-size: 75% +} + +#menu-search-results ul { + padding: 0 5px; + margin: 0; +} + +#menu-search-results li { + white-space: nowrap; + text-overflow: ellipsis; +} + + +#menu-trace-list { + counter-reset: item; + margin: 0 0 0 20px; + padding: 0; +} +#menu-trace-list li { + display: block; + white-space: nowrap; +} + +#menu-trace-list li .secnum:after { + content: " "; +} +#menu-trace-list li:before { + content: counter(item) " "; + background-color: #222; + counter-increment: item; + color: #999; + width: 20px; + height: 20px; + line-height: 20px; + display: inline-block; + text-align: center; + margin: 2px 4px 2px 0; +} + +@media (max-width: 1000px) { + body { + margin: 0; + display: block; + } + + #menu { + display: none; + padding-top: 3em; + width: 450px; + } + + #menu.active { + position: fixed; + height: 100%; + left: 0; + top: 0; + right: 300px; + } + + #menu-toggle { + visibility: visible; + } + + #spec-container { + padding: 0 5px; + } +} + +@media only screen and (max-width: 800px) { + #menu { + width: 100%; + } + + h1 .secnum:empty { + margin: 0; padding: 0; + } +} diff --git a/docs/ecmarkup.js b/docs/ecmarkup.js new file mode 100644 index 0000000..7d42b28 --- /dev/null +++ b/docs/ecmarkup.js @@ -0,0 +1,656 @@ +"use strict"; + +function Search(menu) { + this.menu = menu; + this.$search = document.getElementById('menu-search'); + this.$searchBox = document.getElementById('menu-search-box'); + this.$searchResults = document.getElementById('menu-search-results'); + + this.loadBiblio(); + + document.addEventListener('keydown', this.documentKeydown.bind(this)); + + this.$searchBox.addEventListener('keydown', debounce(this.searchBoxKeydown.bind(this), { stopPropagation: true })); + this.$searchBox.addEventListener('keyup', debounce(this.searchBoxKeyup.bind(this), { stopPropagation: true })); +} + +Search.prototype.loadBiblio = function () { + var $biblio = document.getElementById('menu-search-biblio'); + if (!$biblio) { + this.biblio = {}; + } else { + this.biblio = JSON.parse($biblio.textContent); + this.biblio.clauses = this.biblio.filter(function (e) { return e.type === 'clause' }); + this.biblio.clausesById = this.biblio.clauses.reduce(function (map, entry) { + map[entry.id] = entry; + return map; + }, {}); + } +} + +Search.prototype.documentKeydown = function (e) { + if (e.keyCode === 191) { + e.preventDefault(); + e.stopPropagation(); + this.triggerSearch(); + } +} + +Search.prototype.searchBoxKeydown = function (e) { + e.stopPropagation(); + e.preventDefault(); + if (e.keyCode === 191 && e.target.value.length === 0) { + e.preventDefault(); + } else if (e.keyCode === 13) { + e.preventDefault(); + this.selectResult(); + } +} + +Search.prototype.searchBoxKeyup = function (e) { + if (e.keyCode === 13 || e.keyCode === 9) { + return; + } + + this.search(e.target.value); +} + + +Search.prototype.triggerSearch = function (e) { + if (this.menu.isVisible()) { + this._closeAfterSearch = false; + } else { + this._closeAfterSearch = true; + this.menu.show(); + } + + this.$searchBox.focus(); + this.$searchBox.select(); +} +// bit 12 - Set if the result starts with searchString +// bits 8-11: 8 - number of chunks multiplied by 2 if cases match, otherwise 1. +// bits 1-7: 127 - length of the entry +// General scheme: prefer case sensitive matches with fewer chunks, and otherwise +// prefer shorter matches. +function relevance(result, searchString) { + var relevance = 0; + + relevance = Math.max(0, 8 - result.match.chunks) << 7; + + if (result.match.caseMatch) { + relevance *= 2; + } + + if (result.match.prefix) { + relevance += 2048 + } + + relevance += Math.max(0, 255 - result.entry.key.length); + + return relevance; +} + +Search.prototype.search = function (searchString) { + var s = Date.now(); + + if (searchString === '') { + this.displayResults([]); + this.hideSearch(); + return; + } else { + this.showSearch(); + } + + if (searchString.length === 1) { + this.displayResults([]); + return; + } + + var results; + + if (/^[\d\.]*$/.test(searchString)) { + results = this.biblio.clauses.filter(function (clause) { + return clause.number.substring(0, searchString.length) === searchString; + }).map(function (clause) { + return { entry: clause }; + }); + } else { + results = []; + + for (var i = 0; i < this.biblio.length; i++) { + var entry = this.biblio[i]; + + var match = fuzzysearch(searchString, entry.key); + if (match) { + results.push({ entry: entry, match: match }); + } + } + + results.forEach(function (result) { + result.relevance = relevance(result, searchString); + }); + + results = results.sort(function (a, b) { return b.relevance - a.relevance }); + + } + + if (results.length > 50) { + results = results.slice(0, 50); + } + + this.displayResults(results); +} +Search.prototype.hideSearch = function () { + this.$search.classList.remove('active'); +} + +Search.prototype.showSearch = function () { + this.$search.classList.add('active'); +} + +Search.prototype.selectResult = function () { + var $first = this.$searchResults.querySelector('li:first-child a'); + + if ($first) { + document.location = $first.getAttribute('href'); + } + + this.$searchBox.value = ''; + this.$searchBox.blur(); + this.displayResults([]); + this.hideSearch(); + + if (this._closeAfterSearch) { + this.menu.hide(); + } +} + +Search.prototype.displayResults = function (results) { + if (results.length > 0) { + this.$searchResults.classList.remove('no-results'); + + var html = '
    '; + + results.forEach(function (result) { + var entry = result.entry; + var id = entry.id; + var cssClass = ''; + var text = ''; + + if (entry.type === 'clause') { + var number = entry.number ? entry.number + ' ' : ''; + text = number + entry.key; + cssClass = 'clause'; + id = entry.id; + } else if (entry.type === 'production') { + text = entry.key; + cssClass = 'prod'; + id = entry.id; + } else if (entry.type === 'op') { + text = entry.key; + cssClass = 'op'; + id = entry.refId; + } else if (entry.type === 'term') { + text = entry.key; + cssClass = 'term'; + id = entry.id || entry.refId; + } + + if (text) { + html += '' + } + }); + + html += '
' + + this.$searchResults.innerHTML = html; + } else { + this.$searchResults.innerHTML = ''; + this.$searchResults.classList.add('no-results'); + } +} + + +function Menu() { + this.$toggle = document.getElementById('menu-toggle'); + this.$menu = document.getElementById('menu'); + this.$toc = document.querySelector('menu-toc > ol'); + this.$pins = document.querySelector('#menu-pins'); + this.$pinList = document.getElementById('menu-pins-list'); + this.$toc = document.querySelector('#menu-toc > ol'); + this.$specContainer = document.getElementById('spec-container'); + this.search = new Search(this); + + this._pinnedIds = {}; + this.loadPinEntries(); + + // toggle menu + this.$toggle.addEventListener('click', this.toggle.bind(this)); + + // keydown events for pinned clauses + document.addEventListener('keydown', this.documentKeydown.bind(this)); + + // toc expansion + var tocItems = this.$menu.querySelectorAll('#menu-toc li'); + for (var i = 0; i < tocItems.length; i++) { + var $item = tocItems[i]; + $item.addEventListener('click', function($item, event) { + $item.classList.toggle('active'); + event.stopPropagation(); + }.bind(null, $item)); + } + + // close toc on toc item selection + var tocLinks = this.$menu.querySelectorAll('#menu-toc li > a'); + for (var i = 0; i < tocLinks.length; i++) { + var $link = tocLinks[i]; + $link.addEventListener('click', function(event) { + this.toggle(); + event.stopPropagation(); + }.bind(this)); + } + + // update active clause on scroll + window.addEventListener('scroll', debounce(this.updateActiveClause.bind(this))); + this.updateActiveClause(); + + // prevent menu scrolling from scrolling the body + this.$toc.addEventListener('wheel', function (e) { + var target = e.currentTarget; + var offTop = e.deltaY < 0 && target.scrollTop === 0; + if (offTop) { + e.preventDefault(); + } + var offBottom = e.deltaY > 0 + && target.offsetHeight + target.scrollTop >= target.scrollHeight; + + if (offBottom) { + event.preventDefault(); + } + }) + + // handle pinning clauses via the pin link + document.addEventListener('click', function (e) { + if (e.target.classList.contains('utils-pin')) { + var id = e.target.parentNode.parentNode.parentNode.parentNode.id; + this.togglePinEntry(id); + } + }.bind(this)) +} + +Menu.prototype.documentKeydown = function (e) { + e.stopPropagation(); + if (e.keyCode === 80) { + this.togglePinEntry(); + } else if (e.keyCode > 48 && e.keyCode < 58) { + this.selectPin(e.keyCode - 49); + } +} + +Menu.prototype.updateActiveClause = function () { + this.setActiveClause(findActiveClause(this.$specContainer)) +} + +Menu.prototype.setActiveClause = function (clause) { + this.$activeClause = clause; + this.revealInToc(this.$activeClause); +} + +Menu.prototype.revealInToc = function (path) { + var current = this.$toc.querySelectorAll('li.revealed'); + for (var i = 0; i < current.length; i++) { + current[i].classList.remove('revealed'); + current[i].classList.remove('revealed-leaf'); + } + + var current = this.$toc; + var index = 0; + while (index < path.length) { + var children = current.children; + for (var i = 0; i < children.length; i++) { + if ('#' + path[index].id === children[i].children[1].getAttribute('href') ) { + children[i].classList.add('revealed'); + if (index === path.length - 1) { + children[i].classList.add('revealed-leaf'); + var rect = children[i].getBoundingClientRect(); + this.$toc.getBoundingClientRect().top + var tocRect = this.$toc.getBoundingClientRect(); + if (rect.top + 10 > tocRect.bottom) { + this.$toc.scrollTop = this.$toc.scrollTop + (rect.top - tocRect.bottom) + (rect.bottom - rect.top); + } else if (rect.top < tocRect.top) { + this.$toc.scrollTop = this.$toc.scrollTop - (tocRect.top - rect.top); + } + } + current = children[i].querySelector('ol'); + index++; + break; + } + } + + } +} + +function findActiveClause(root, path) { + var clauses = new ClauseWalker(root); + var $clause; + var found = false; + var path = path || []; + + while ($clause = clauses.nextNode()) { + var rect = $clause.getBoundingClientRect(); + var $header = $clause.children[0]; + var marginTop = parseInt(getComputedStyle($header)["margin-top"]); + + if ((rect.top - marginTop) <= 0 && rect.bottom > 0) { + found = true; + return findActiveClause($clause, path.concat($clause)) || path; + } + } + + return path; +} + +function ClauseWalker(root) { + var previous; + var treeWalker = document.createTreeWalker( + root, + NodeFilter.SHOW_ELEMENT, + { + acceptNode: function (node) { + if (previous === node.parentNode) { + return NodeFilter.FILTER_REJECT; + } else { + previous = node; + } + if (node.nodeName === 'EMU-CLAUSE' || node.nodeName === 'EMU-INTRO' || node.nodeName === 'EMU-ANNEX') { + return NodeFilter.FILTER_ACCEPT; + } else { + return NodeFilter.FILTER_SKIP; + } + } + }, + false + ); + + return treeWalker; +} + +Menu.prototype.toggle = function () { + this.$menu.classList.toggle('active'); +} + +Menu.prototype.show = function () { + this.$menu.classList.add('active'); +} + +Menu.prototype.hide = function () { + this.$menu.classList.remove('active'); +} + +Menu.prototype.isVisible = function() { + return this.$menu.classList.contains('active'); +} + +Menu.prototype.showPins = function () { + this.$pins.classList.add('active'); +} + +Menu.prototype.hidePins = function () { + this.$pins.classList.remove('active'); +} + +Menu.prototype.addPinEntry = function (id) { + var entry = this.search.biblio.clausesById[id]; + var prefix; + if (entry.number) { + prefix = entry.number + ' '; + } else { + prefix = ''; + } + this.$pinList.innerHTML += '
  • ' + prefix + entry.titleHTML + '
  • '; + if (Object.keys(this._pinnedIds).length === 0) { + this.showPins(); + } + this._pinnedIds[id] = true; + this.persistPinEntries(); +} + +Menu.prototype.removePinEntry = function (id) { + var item = this.$pinList.querySelector('a[href="#' + id + '"]').parentNode; + this.$pinList.removeChild(item); + delete this._pinnedIds[id]; + if (Object.keys(this._pinnedIds).length === 0) { + this.hidePins(); + } + + this.persistPinEntries(); +} + +Menu.prototype.persistPinEntries = function () { + try { + if (!window.localStorage) return; + } catch (e) { + return; + } + + localStorage.pinEntries = JSON.stringify(Object.keys(this._pinnedIds)); +} + +Menu.prototype.loadPinEntries = function () { + try { + if (!window.localStorage) return; + } catch (e) { + return; + } + + var pinsString = window.localStorage.pinEntries; + if (!pinsString) return; + var pins = JSON.parse(pinsString); + for(var i = 0; i < pins.length; i++) { + this.addPinEntry(pins[i]); + } +} + +Menu.prototype.togglePinEntry = function (id) { + if (!id) { + id = this.$activeClause[this.$activeClause.length - 1].id; + } + + if (this._pinnedIds[id]) { + this.removePinEntry(id); + } else { + this.addPinEntry(id); + } +} + +Menu.prototype.selectPin = function (num) { + document.location = this.$pinList.children[num].children[0].href; +} + +function init() { + var menu = new Menu(); +} + +document.addEventListener('DOMContentLoaded', init); + +function debounce(fn, opts) { + opts = opts || {}; + var timeout; + return function(e) { + if (opts.stopPropagation) { + e.stopPropagation(); + } + var args = arguments; + if (timeout) { + clearTimeout(timeout); + } + timeout = setTimeout(function() { + timeout = null; + fn.apply(this, args); + }.bind(this), 150); + } +} + + + + +var CLAUSE_NODES = ['EMU-CLAUSE', 'EMU-INTRO', 'EMU-ANNEX']; +function findLocalReferences ($elem) { + var name = $elem.innerHTML; + var references = []; + + var parentClause = $elem.parentNode; + while (parentClause && CLAUSE_NODES.indexOf(parentClause.nodeName) === -1) { + parentClause = parentClause.parentNode; + } + + if(!parentClause) return; + + var vars = parentClause.querySelectorAll('var'); + + for (var i = 0; i < vars.length; i++) { + var $var = vars[i]; + + if ($var.innerHTML === name) { + references.push($var); + } + } + + return references; +} + +function toggleFindLocalReferences($elem) { + var references = findLocalReferences($elem); + if ($elem.classList.contains('referenced')) { + references.forEach(function ($reference) { + $reference.classList.remove('referenced'); + }); + } else { + references.forEach(function ($reference) { + $reference.classList.add('referenced'); + }); + } +} + +function installFindLocalReferences () { + document.addEventListener('click', function (e) { + if (e.target.nodeName === 'VAR') { + toggleFindLocalReferences(e.target); + } + }); +} + +document.addEventListener('DOMContentLoaded', installFindLocalReferences); + + + + +// The following license applies to the fuzzysearch function +// The MIT License (MIT) +// Copyright © 2015 Nicolas Bevacqua +// Copyright © 2016 Brian Terlson +// Permission is hereby granted, free of charge, to any person obtaining a copy of +// this software and associated documentation files (the "Software"), to deal in +// the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +function fuzzysearch (searchString, haystack, caseInsensitive) { + var tlen = haystack.length; + var qlen = searchString.length; + var chunks = 1; + var finding = false; + var prefix = true; + + if (qlen > tlen) { + return false; + } + + if (qlen === tlen) { + if (searchString === haystack) { + return { caseMatch: true, chunks: 1, prefix: true }; + } else if (searchString.toLowerCase() === haystack.toLowerCase()) { + return { caseMatch: false, chunks: 1, prefix: true }; + } else { + return false; + } + } + + outer: for (var i = 0, j = 0; i < qlen; i++) { + var nch = searchString[i]; + while (j < tlen) { + var targetChar = haystack[j++]; + if (targetChar === nch) { + finding = true; + continue outer; + } + if (finding) { + chunks++; + finding = false; + } + } + + if (caseInsensitive) { return false } + + return fuzzysearch(searchString.toLowerCase(), haystack.toLowerCase(), true); + } + + return { caseMatch: !caseInsensitive, chunks: chunks, prefix: j <= qlen }; +} +var CLAUSE_NODES = ['EMU-CLAUSE', 'EMU-INTRO', 'EMU-ANNEX']; +function findLocalReferences ($elem) { + var name = $elem.innerHTML; + var references = []; + + var parentClause = $elem.parentNode; + while (parentClause && CLAUSE_NODES.indexOf(parentClause.nodeName) === -1) { + parentClause = parentClause.parentNode; + } + + if(!parentClause) return; + + var vars = parentClause.querySelectorAll('var'); + + for (var i = 0; i < vars.length; i++) { + var $var = vars[i]; + + if ($var.innerHTML === name) { + references.push($var); + } + } + + return references; +} + +function toggleFindLocalReferences($elem) { + var references = findLocalReferences($elem); + if ($elem.classList.contains('referenced')) { + references.forEach(function ($reference) { + $reference.classList.remove('referenced'); + }); + } else { + references.forEach(function ($reference) { + $reference.classList.add('referenced'); + }); + } +} + +function installFindLocalReferences () { + document.addEventListener('click', function (e) { + if (e.target.nodeName === 'VAR') { + toggleFindLocalReferences(e.target); + } + }); +} + +document.addEventListener('DOMContentLoaded', installFindLocalReferences); diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..b29794a --- /dev/null +++ b/docs/index.html @@ -0,0 +1,1724 @@ + + +Metadata + + + + +
    + + +

    Metadata Proposal - ECMAScriptlinkpin

    +

    Proposal to add Metadata to ECMAScript.

    +
    + + +

    1Syntaxlinkpin

    + Note
    This section is non-normative.
    +
    // define metadata on an object or property
    +Reflect.defineMetadata(metadataKey, metadataValue, target);
    +Reflect.defineMetadata(metadataKey, metadataValue, target, propertyKey);
    +
    +// check for presence of a metadata key on the prototype chain of an object or property
    +let result = Reflect.hasMetadata(metadataKey, target);
    +let result = Reflect.hasMetadata(metadataKey, target, propertyKey);
    +
    +// check for presence of an own metadata key of an object or property
    +let result = Reflect.hasOwnMetadata(metadataKey, target);
    +let result = Reflect.hasOwnMetadata(metadataKey, target, propertyKey);
    +
    +// get metadata value of a metadata key on the prototype chain of an object or property
    +let result = Reflect.getMetadata(metadataKey, target);
    +let result = Reflect.getMetadata(metadataKey, target, propertyKey);
    +
    +// get metadata value of an own metadata key of an object or property
    +let result = Reflect.getOwnMetadata(metadataKey, target);
    +let result = Reflect.getOwnMetadata(metadataKey, target, propertyKey);
    +
    +// get all metadata keys on the prototype chain of an object or property
    +let result = Reflect.getMetadataKeys(target);
    +let result = Reflect.getMetadataKeys(target, propertyKey);
    +
    +// get all own metadata keys of an object or property
    +let result = Reflect.getOwnMetadataKeys(target);
    +let result = Reflect.getOwnMetadataKeys(target, propertyKey);
    +
    +// delete metadata from an object or property
    +let result = Reflect.deleteMetadata(metadataKey, target);
    +let result = Reflect.deleteMetadata(metadataKey, target, propertyKey);
    +
    +// apply metadata via a decorator to a constructor
    +@Reflect.metadata(metadataKey, metadataValue)
    +class C {
    +  // apply metadata via a decorator to a method (property)
    +  @Reflect.metadata(metadataKey, metadataValue)
    +  method() {
    +  }
    +}
    +
    +// Design-time type annotations
    +function Type(type) { return Reflect.metadata("design:type", type); }
    +function ParamTypes(...types) { return Reflect.metadata("design:paramtypes", types); }
    +function ReturnType(type) { return Reflect.metadata("design:returntype", type); }
    +
    +// Decorator application
    +@ParamTypes(String, Number)
    +class C {
    +  constructor(text, i) {
    +  }
    +
    +  @Type(String)
    +  get name() { return "text"; }
    +
    +  @Type(Function)
    +  @ParamTypes(Number, Number)
    +  @ReturnType(Number)
    +  add(x, y) {
    +    return x + y;
    +  }
    +}
    +
    +// Metadata introspection
    +let obj = new C("a", 1);
    +let paramTypes = Reflect.getMetadata("design:paramtypes", inst, "add"); // [Number, Number]
    +
    + + +

    2Abstract Operationslinkpin

    + +

    2.1Operations on Objectslinkpin

    + +

    2.1.1GetOrCreateMetadataMap ( O, P, Create )linkpin

    +

    When the abstract operation GetOrCreateMetadataMap is called with Object O, property key P, and Boolean Create the following steps are taken:

    +
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. Let targetMetadata be the value of O's [[Metadata]] internal slot.
    3. If targetMetadata is undefined, then
      1. If Create is false, return undefined.
      2. Set targetMetadata to be a newly created Map object.
      3. Set the [[Metadata]] internal slot of O to targetMetadata.
    4. Let metadataMap be ? Invoke(targetMetadata, "get", P).
    5. If metadataMap is undefined, then
      1. If Create is false, return undefined.
      2. Set metadataMap to be a newly created Map object.
      3. Perform ? Invoke(targetMetadata, "set", P, metadataMap).
    6. Return metadataMap. +
    +
    +
    +
    + + +

    3Ordinary and Exotic Objects Behaviorslinkpin

    + + +

    3.1Ordinary Object Internal Methods and Internal Slotslinkpin

    +

    All ordinary objects have an internal slot called [[Metadata]]. The value of this internal slot is either null or a Map object and is used for storing metadata for an object.

    + +

    3.1.1[[HasMetadata]] ( MetadataKey, P )linkpin

    +

    When the [[HasMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:

    +
    1. Return ? OrdinaryHasMetadata(MetadataKey, O, P). +
    + +

    3.1.1.1OrdinaryHasMetadata ( MetadataKey, O, P )linkpin

    +

    When the abstract operation OrdinaryHasMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:

    +
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. Let hasOwn be ? OrdinaryHasOwnMetadata(MetadataKey, O, P).
    3. If hasOwn is true, return true.
    4. Let parent be ? O.[[GetPrototypeOf]]().
    5. If parent is not null, then
      1. Return ? parent.[[HasMetadata]](MetadataKey, P).
    6. Return false. +
    +
    +
    + + +

    3.1.2[[HasOwnMetadata]] ( MetadataKey, P )linkpin

    +

    When the [[HasOwnMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:

    +
    1. Return ? OrdinaryHasOwnMetadata(MetadataKey, O, P). +
    + +

    3.1.2.1OrdinaryHasOwnMetadata ( MetadataKey, O, P )linkpin

    +

    When the abstract operation OrdinaryHasOwnMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:

    +
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. Let metadataMap be ? GetOrCreateMetadataMap(O, P, false).
    3. If metadataMap is undefined, return false.
    4. Return ? Invoke(metadataMap, "has", MetadataKey). +
    +
    +
    + + +

    3.1.3[[GetMetadata]] ( MetadataKey, P )linkpin

    +

    When the [[GetMatadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:

    +
    1. Return ? OrdinaryGetMetadata(MetadataKey, O, P). +
    + +

    3.1.3.1OrdinaryGetMetadata ( MetadataKey, O, P )linkpin

    +

    When the abstract operation OrdinaryGetMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:

    +
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. Let hasOwn be ? OrdinaryHasOwnMetadata(MetadataKey, O, P).
    3. If hasOwn is true, then
      1. Return ? OrdinaryGetOwnMetadata(MetadataKey, O, P).
    4. Let parent be ? O.[[GetPrototypeOf]]().
    5. If parent is not null, then
      1. return ? parent.[[GetMetadata]](MetadataKey, P).
    6. Return undefined. +
    +
    +
    + + +

    3.1.4[[GetOwnMetadata]] ( MetadataKey, P, ParamIndex )linkpin

    +

    When the [[GetOwnMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:

    +
    1. Return ? OrdinaryGetOwnMetadata(MetadataKey, O, P). +
    + +

    3.1.4.1OrdinaryGetOwnMetadata ( MetadataKey, O, P )linkpin

    +

    When the abstract operation OrdinaryGetOwnMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:

    +
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. Let metadataMap be ? GetOrCreateMetadataMap(O, P, false).
    3. If metadataMap is undefined, return undefined.
    4. Return ? Invoke(metadataMap, "get", MetadataKey). +
    +
    +
    + + +

    3.1.5[[DefineOwnMetadata]] ( MetadataKey, MetadataValue, P )linkpin

    +

    When the [[DefineOwnMetadata]] internal method of O is called with ECMAScript language value MetadataKey, ECMAScript language value MetadataValue, and property key P, the following steps are taken:

    +
    1. Return ? OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) +
    + +

    3.1.5.1OrdinaryDefineOwnMetadata ( MetadataKey, MetadataValue, O, P )linkpin

    +

    When the abstract operation OrdinaryDefineOwnProperty is called with ECMAScript language value MetadataKey, ECMAScript language value MetadataValue, Object O, and property key P, the following steps are taken:

    +
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. Let metadataMap be ? GetOrCreateMetadataMap(O, P, true).
    3. Return ? Invoke(metadataMap, "set", MetadataKey, MetadataValue). +
    +
    +
    + + +

    3.1.6[[MetadataKeys]] ( P )linkpin

    +

    When the [[MetadataKeys]] internal method of O is called with property key P the following steps are taken:

    +
    1. Return ? OrdinaryMetadataKeys(O, P). +
    + +

    3.1.6.1OrdinaryMetadataKeys ( O, P )linkpin

    +

    When the abstract operation OrdinaryMetadataKeys is called with Object O and property key P the following steps are taken:

    +
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. Let ownKeys be ? OrdinaryOwnMetadataKeys(O, P).
    3. Let parent be ? O.[[GetPrototypeOf]]().
    4. If parent is null, then return ownKeys.
    5. Let parentKeys be ? O.[[OrdinaryMetadataKeys]](P).
    6. Let ownKeysLen = ? Get(ownKeys, "length").
    7. If ownKeysLen is 0, return parentKeys.
    8. Let parentKeysLen = ? Get(parentKeys, "length").
    9. If parentKeysLen is 0, return ownKeys.
    10. Let set be a newly created Set object.
    11. Let keys be ? ArrayCreate(0).
    12. Let k be 0.
    13. For each element key of ownKeys
      1. Let hasKey be ? Invoke(set, "has", key).
      2. If hasKey is false, then
        1. Let Pk be ! ToString(k).
        2. Perform ? Invoke(set, "add", key).
        3. Let defineStatus be CreateDataProperty(keys, Pk, key).
        4. Assert: defineStatus is true.
        5. Increase k by 1.
    14. For each element key of parentKeys
      1. Let hasKey be ? Invoke(set, "has", key).
      2. If hasKey is false, then
        1. Let Pk be ! ToString(k).
        2. Perform ? Invoke(set, "add", key).
        3. Let defineStatus be CreateDataProperty(keys, Pk, key).
        4. Assert: defineStatus is true.
        5. Increase k by 1.
    15. Perform ? Set(keys, "length", k).
    16. return keys. +
    +
    +
    + + +

    3.1.7[[OwnMetadataKeys]] ( P )linkpin

    +

    When the [[OwnMetadataKeys]] internal method of O is called with property key P the following steps are taken:

    +
    1. Return OrdinaryOwnMetadataKeys(O, P). +
    + +

    3.1.7.1OrdinaryOwnMetadataKeys ( O, P )linkpin

    +

    When the abstract operation OrdinaryOwnMetadataKeys is called with Object O and property key P the following steps are taken:

    +
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. Let keys be ? ArrayCreate(0).
    3. Let metadataMap be ? GetOrCreateMetadataMap(O, P, false).
    4. If metadataMap is undefined, return keys.
    5. Let keysObj be ? Invoke(metadataMap, "keys").
    6. Let iterator be ? GetIterator(keysObj).
    7. Let k be 0.
    8. Repeat
      1. Let Pk be ! ToString(k).
      2. Let next be ? IteratorStep(iterator).
      3. If next is false, then
        1. Let setStatus be ? Set(keys, "length", k, true).
        2. Assert: setStatus is true.
        3. Return keys.
      4. Let nextValue be ? IteratorValue(next).
      5. Let defineStatus be CreateDataPropertyOrThrow(keys, Pk, nextValue).
      6. If defineStatus is an abrupt completion, return ? IteratorClose(iterator, defineStatus).
      7. Increase k by 1. +
    +
    +
    + + +

    3.1.8[[DeleteMetadata]]( MetadataKey, P )linkpin

    +

    When the [[DeleteMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P the following steps are taken:

    +
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. Let metadataMap be ? GetOrCreateMetadataMap(O, P, false).
    3. If metadataMap is undefined, return false.
    4. Return ? Invoke(metadataMap, "delete", MetadataKey). +
    +
    +
    +
    + + +

    4Reflectionlinkpin

    + +

    4.1The Reflect Objectlinkpin

    +

    This section contains amendments to the Reflect object.

    + Note
    A shim for this API can be found here: https://github.com/rbuckton/ReflectDecorators
    + +

    4.1.1Metadata Decorator Functionslinkpin

    +

    A metadata decorator function is an anonymous built-in function that has [[MetadataKey]] and [[MetadataValue]] internal slots.

    +

    When a metadata decorator function F is called with arguments target and key, the following steps are taken:

    +
    1. Assert: F has a [[MetadataKey]] internal slot whose value is an ECMAScript language value, or undefined.
    2. Assert: F has a [[MetadataValue]] internal slot whose value is an ECMAScript language value, or undefined.
    3. If Type(target) is not Object, throw a TypeError exception.
    4. If key is not undefined and IsPropertyKey(key) is false, throw a TypeError exception.
    5. Let metadataKey be the value of F's [[MetadataKey]] internal slot.
    6. Let metadataValue be the value of F's [[MetadataValue]] internal slot.
    7. Perform ? target.[[DefineMetadata]](metadataKey, metadataValue, target, key).
    8. Return undefined. +
    +
    + + +

    4.1.2Reflect.metadata ( metadataKey, metadataValue )linkpin

    +

    When the metadata function is called with arguments metadataKey and metadataValue, the following steps are taken:

    +
    1. Let decorator be a new built-in function object as defined in Metadata Decorator Functions.
    2. Set the [[MetadataKey]] internal slot of decorator to metadataKey.
    3. Set the [[MetadataValue]] internal slot of decorator to metadataValue.
    4. Return decorator. +
    +
    + + +

    4.1.3Reflect.defineMetadata ( metadataKey, metadataValue, target, propertyKey )linkpin

    +

    When the defineMetadata function is called with arguments metadataKey, metadataValue, target, and propertyKey, the following steps are taken:

    +
    1. If Type(target) is not Object, throw a TypeError exception.
    2. Return ? target.[[DefineMetadata]](metadataKey, metadataValue, propertyKey). +
    +
    + + +

    4.1.4Reflect.hasMetadata ( metadataKey, target, propertyKey )linkpin

    +

    When the hasMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    +
    1. If Type(target) is not Object, throw a TypeError exception.
    2. Return ? target.[[HasMetadata]](metadataKey, propertyKey). +
    +
    + + +

    4.1.5Reflect.hasOwnMetadata ( metadataKey, target, propertyKey )linkpin

    +

    When the hasOwnMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    +
    1. If Type(target) is not Object, throw a TypeError exception.
    2. Return ? target.[[HasOwn]](metadataKey, propertyKey). +
    +
    + + +

    4.1.6Reflect.getMetadata ( metadataKey, target, propertyKey )linkpin

    +

    When the getMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    +
    1. If Type(target) is not Object, throw a TypeError exception.
    2. Return ? target.[[GetMetadata]](metadataKey, propertyKey). +
    +
    + + +

    4.1.7Reflect.getOwnMetadata ( metadataKey, target, propertyKey )linkpin

    +

    When the getOwnMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    +
    1. If Type(target) is not Object, throw a TypeError exception.
    2. Return ? target.[[GetOwnMetadata]](metadataKey, propertyKey). +
    +
    + + +

    4.1.8Reflect.getMetadataKeys ( target, propertyKey )linkpin

    +

    When the getMetadataKeys function is called with arguments target and propertyKey, the following steps are taken:

    +
    1. If Type(target) is not Object, throw a TypeError exception.
    2. Return ? target.[[GetMetadataKeys]](propertyKey). +
    +
    + + +

    4.1.9Reflect.getOwnMetadataKeys ( target, propertyKey )linkpin

    +

    When the getOwnMetadataKeys function is called with arguments target and propertyKey, the following steps are taken:

    +
    1. If Type(target) is not Object, throw a TypeError exception.
    2. Return ? target.[[GetOwnMetadataKeys]](propertyKey). +
    +
    + + +

    4.1.10Reflect.deleteMetadata ( metadataKey, target, propertyKey )linkpin

    +

    When the deleteMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    +
    1. If Type(target) is not Object, throw a TypeError exception.
    2. Return ? target.[[DeleteMetadata]](metadataKey, propertyKey). +
    +
    +
    +
    \ No newline at end of file diff --git a/docs/spec.biblio.json b/docs/spec.biblio.json new file mode 100644 index 0000000..7397632 --- /dev/null +++ b/docs/spec.biblio.json @@ -0,0 +1 @@ +{"https://rbuckton.github.io/ReflectDecorators":[{"type":"clause","id":"introduction","aoid":null,"title":"Metadata Proposal - ECMAScript","titleHTML":"Metadata Proposal - ECMAScript","number":"","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Metadata Proposal - ECMAScript"},{"type":"clause","id":"syntax","aoid":null,"title":"Syntax","titleHTML":"Syntax","number":"1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Syntax"},{"type":"op","aoid":"GetOrCreateMetadataMap","refId":"getorcreatemetadatamap","location":"","key":"GetOrCreateMetadataMap"},{"type":"clause","id":"getorcreatemetadatamap","aoid":"GetOrCreateMetadataMap","title":"GetOrCreateMetadataMap ( O, P, Create )","titleHTML":"GetOrCreateMetadataMap ( O, P, Create )","number":"2.1.1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"GetOrCreateMetadataMap ( O, P, Create )"},{"type":"clause","id":"operations-on-objects","aoid":null,"title":"Operations on Objects","titleHTML":"Operations on Objects","number":"2.1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Operations on Objects"},{"type":"clause","id":"abstract-operations","aoid":null,"title":"Abstract Operations","titleHTML":"Abstract Operations","number":"2","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Abstract Operations"},{"type":"op","aoid":"OrdinaryHasMetadata","refId":"ordinaryhasmetadata","location":"","key":"OrdinaryHasMetadata"},{"type":"clause","id":"ordinaryhasmetadata","aoid":"OrdinaryHasMetadata","title":"OrdinaryHasMetadata ( MetadataKey, O, P )","titleHTML":"OrdinaryHasMetadata ( MetadataKey, O, P )","number":"3.1.1.1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"OrdinaryHasMetadata ( MetadataKey, O, P )"},{"type":"clause","id":"ordinary-object-internal-methods-and-internal-slots-hasmetadata","aoid":null,"title":"[[HasMetadata]] ( MetadataKey, P )","titleHTML":"[[HasMetadata]] ( MetadataKey, P )","number":"3.1.1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"[[HasMetadata]] ( MetadataKey, P )"},{"type":"op","aoid":"OrdinaryHasOwnMetadata","refId":"ordinaryhasownmetadata","location":"","key":"OrdinaryHasOwnMetadata"},{"type":"clause","id":"ordinaryhasownmetadata","aoid":"OrdinaryHasOwnMetadata","title":"OrdinaryHasOwnMetadata ( MetadataKey, O, P )","titleHTML":"OrdinaryHasOwnMetadata ( MetadataKey, O, P )","number":"3.1.2.1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"OrdinaryHasOwnMetadata ( MetadataKey, O, P )"},{"type":"clause","id":"ordinary-object-internal-methods-and-internal-slots-hasownmetadata","aoid":null,"title":"[[HasOwnMetadata]] ( MetadataKey, P )","titleHTML":"[[HasOwnMetadata]] ( MetadataKey, P )","number":"3.1.2","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"[[HasOwnMetadata]] ( MetadataKey, P )"},{"type":"op","aoid":"OrdinaryGetMetadata","refId":"ordinarygetmetadata","location":"","key":"OrdinaryGetMetadata"},{"type":"clause","id":"ordinarygetmetadata","aoid":"OrdinaryGetMetadata","title":"OrdinaryGetMetadata ( MetadataKey, O, P )","titleHTML":"OrdinaryGetMetadata ( MetadataKey, O, P )","number":"3.1.3.1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"OrdinaryGetMetadata ( MetadataKey, O, P )"},{"type":"clause","id":"ordinary-object-internal-methods-and-internal-slots-getmetadata","aoid":null,"title":"[[GetMetadata]] ( MetadataKey, P )","titleHTML":"[[GetMetadata]] ( MetadataKey, P )","number":"3.1.3","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"[[GetMetadata]] ( MetadataKey, P )"},{"type":"op","aoid":"OrdinaryGetOwnMetadata","refId":"ordinarygetownmetadata","location":"","key":"OrdinaryGetOwnMetadata"},{"type":"clause","id":"ordinarygetownmetadata","aoid":"OrdinaryGetOwnMetadata","title":"OrdinaryGetOwnMetadata ( MetadataKey, O, P )","titleHTML":"OrdinaryGetOwnMetadata ( MetadataKey, O, P )","number":"3.1.4.1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"OrdinaryGetOwnMetadata ( MetadataKey, O, P )"},{"type":"clause","id":"ordinary-object-internal-methods-and-internal-slots-getownmetadata","aoid":null,"title":"[[GetOwnMetadata]] ( MetadataKey, P, ParamIndex )","titleHTML":"[[GetOwnMetadata]] ( MetadataKey, P, ParamIndex )","number":"3.1.4","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"[[GetOwnMetadata]] ( MetadataKey, P, ParamIndex )"},{"type":"op","aoid":"OrdinaryDefineOwnMetadata","refId":"ordinarydefineownmetadata","location":"","key":"OrdinaryDefineOwnMetadata"},{"type":"clause","id":"ordinarydefineownmetadata","aoid":"OrdinaryDefineOwnMetadata","title":"OrdinaryDefineOwnMetadata ( MetadataKey, MetadataValue, O, P )","titleHTML":"OrdinaryDefineOwnMetadata ( MetadataKey, MetadataValue, O, P )","number":"3.1.5.1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"OrdinaryDefineOwnMetadata ( MetadataKey, MetadataValue, O, P )"},{"type":"clause","id":"ordinary-object-internal-methods-and-internal-slots-defineownmetadata","aoid":null,"title":"[[DefineOwnMetadata]] ( MetadataKey, MetadataValue, P )","titleHTML":"[[DefineOwnMetadata]] ( MetadataKey, MetadataValue, P )","number":"3.1.5","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"[[DefineOwnMetadata]] ( MetadataKey, MetadataValue, P )"},{"type":"op","aoid":"OrdinaryMetadataKeys","refId":"ordinarymetadatakeys","location":"","key":"OrdinaryMetadataKeys"},{"type":"clause","id":"ordinarymetadatakeys","aoid":"OrdinaryMetadataKeys","title":"OrdinaryMetadataKeys ( O, P )","titleHTML":"OrdinaryMetadataKeys ( O, P )","number":"3.1.6.1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"OrdinaryMetadataKeys ( O, P )"},{"type":"clause","id":"ordinary-object-internal-methods-and-internal-slots-metadatakeys","aoid":null,"title":"[[MetadataKeys]] ( P )","titleHTML":"[[MetadataKeys]] ( P )","number":"3.1.6","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"[[MetadataKeys]] ( P )"},{"type":"op","aoid":"OrdinaryOwnMetadataKeys","refId":"ordinaryownmetadatakeys","location":"","key":"OrdinaryOwnMetadataKeys"},{"type":"clause","id":"ordinaryownmetadatakeys","aoid":"OrdinaryOwnMetadataKeys","title":"OrdinaryOwnMetadataKeys ( O, P )","titleHTML":"OrdinaryOwnMetadataKeys ( O, P )","number":"3.1.7.1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"OrdinaryOwnMetadataKeys ( O, P )"},{"type":"clause","id":"ordinary-object-internal-methods-and-internal-slots-ownmetadatakeys","aoid":null,"title":"[[OwnMetadataKeys]] ( P )","titleHTML":"[[OwnMetadataKeys]] ( P )","number":"3.1.7","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"[[OwnMetadataKeys]] ( P )"},{"type":"clause","id":"ordinary-object-internal-methods-and-internal-slots-deletemetadata","aoid":null,"title":"[[DeleteMetadata]]( MetadataKey, P )","titleHTML":"[[DeleteMetadata]]( MetadataKey, P )","number":"3.1.8","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"[[DeleteMetadata]]( MetadataKey, P )"},{"type":"clause","id":"ordinary-object-internal-methods-and-internal-slots","aoid":null,"title":"Ordinary Object Internal Methods and Internal Slots","titleHTML":"Ordinary Object Internal Methods and Internal Slots","number":"3.1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Ordinary Object Internal Methods and Internal Slots"},{"type":"clause","id":"ordinary-and-exotic-objects-behaviors","aoid":null,"title":"Ordinary and Exotic Objects Behaviors","titleHTML":"Ordinary and Exotic Objects Behaviors","number":"3","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Ordinary and Exotic Objects Behaviors"},{"type":"clause","id":"reflect-metadatadecoratorfunctions","aoid":null,"title":"Metadata Decorator Functions","titleHTML":"Metadata Decorator Functions","number":"4.1.1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Metadata Decorator Functions"},{"type":"clause","id":"reflect.metadata","aoid":null,"title":"Reflect.metadata ( metadataKey, metadataValue )","titleHTML":"Reflect.metadata ( metadataKey, metadataValue )","number":"4.1.2","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Reflect.metadata ( metadataKey, metadataValue )"},{"type":"clause","id":"reflect.definemetadata","aoid":null,"title":"Reflect.defineMetadata ( metadataKey, metadataValue, target, propertyKey )","titleHTML":"Reflect.defineMetadata ( metadataKey, metadataValue, target, propertyKey )","number":"4.1.3","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Reflect.defineMetadata ( metadataKey, metadataValue, target, propertyKey )"},{"type":"clause","id":"reflect.hasmetadata","aoid":null,"title":"Reflect.hasMetadata ( metadataKey, target, propertyKey )","titleHTML":"Reflect.hasMetadata ( metadataKey, target, propertyKey )","number":"4.1.4","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Reflect.hasMetadata ( metadataKey, target, propertyKey )"},{"type":"clause","id":"reflect-hasownmetadata","aoid":null,"title":"Reflect.hasOwnMetadata ( metadataKey, target, propertyKey )","titleHTML":"Reflect.hasOwnMetadata ( metadataKey, target, propertyKey )","number":"4.1.5","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Reflect.hasOwnMetadata ( metadataKey, target, propertyKey )"},{"type":"clause","id":"reflect-getmetadata","aoid":null,"title":"Reflect.getMetadata ( metadataKey, target, propertyKey )","titleHTML":"Reflect.getMetadata ( metadataKey, target, propertyKey )","number":"4.1.6","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Reflect.getMetadata ( metadataKey, target, propertyKey )"},{"type":"clause","id":"reflect-getownmetadata","aoid":null,"title":"Reflect.getOwnMetadata ( metadataKey, target, propertyKey )","titleHTML":"Reflect.getOwnMetadata ( metadataKey, target, propertyKey )","number":"4.1.7","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Reflect.getOwnMetadata ( metadataKey, target, propertyKey )"},{"type":"clause","id":"reflect-getmetadatakeys","aoid":null,"title":"Reflect.getMetadataKeys ( target, propertyKey )","titleHTML":"Reflect.getMetadataKeys ( target, propertyKey )","number":"4.1.8","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Reflect.getMetadataKeys ( target, propertyKey )"},{"type":"clause","id":"reflect-getownmetadata","aoid":null,"title":"Reflect.getOwnMetadataKeys ( target, propertyKey )","titleHTML":"Reflect.getOwnMetadataKeys ( target, propertyKey )","number":"4.1.9","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Reflect.getOwnMetadataKeys ( target, propertyKey )"},{"type":"clause","id":"reflect-deletemetadata","aoid":null,"title":"Reflect.deleteMetadata ( metadataKey, target, propertyKey )","titleHTML":"Reflect.deleteMetadata ( metadataKey, target, propertyKey )","number":"4.1.10","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Reflect.deleteMetadata ( metadataKey, target, propertyKey )"},{"type":"clause","id":"reflect","aoid":null,"title":"The Reflect Object","titleHTML":"The Reflect Object","number":"4.1","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"The Reflect Object"},{"type":"clause","id":"reflection","aoid":null,"title":"Reflection","titleHTML":"Reflection","number":"4","namespace":"https://rbuckton.github.io/ReflectDecorators","location":"","key":"Reflection"}]} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..7ab7d61 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,56 @@ +const gulp = require("gulp"); +const sequence = require("gulp-sequence"); +const del = require("del"); +const tsb = require("gulp-tsb"); +const mocha = require("gulp-mocha"); +const emu = require("gulp-emu"); +const rename = require("gulp-rename"); +const gls = require("gulp-live-server"); +const spawn = require("child_process").spawn; + +const project = tsb.create("tsconfig.json"); +const tests = tsb.create("test/tsconfig.json"); + +gulp.task("clean", () => del(["test/**/*.js", "test/**/*.js.map"])); + +gulp.task("build:reflect", () => gulp + .src(["Reflect.ts"]) + .pipe(project()) + .pipe(gulp.dest("."))); + +gulp.task("build:tests", () => gulp + .src(["test/**/*.ts"]) + .pipe(tests()) + .pipe(gulp.dest("test"))); + +gulp.task("build:spec", () => gulp + .src(["spec.html"]) + .pipe(emu({ js: "ecmarkup.js", css: "ecmarkup.css", biblio: true })) + .pipe(rename(path => { + if (path.basename === "spec" && path.extname === ".html") { + path.basename = "index"; + } + })) + .pipe(gulp.dest("docs"))); + +gulp.task("build", ["build:reflect", "build:tests", "build:spec"]); + +gulp.task("test", ["build:tests"], () => gulp + .src(["test/**/*.js"], { read: false }) + .pipe(mocha())); + +gulp.task("watch:reflect", ["test"], () => gulp.watch(["Reflect.ts", "test/**/*"], ["test"])); +gulp.task("watch:spec", ["build:spec"], () => gulp.watch(["spec.html"], ["build:spec"])); +gulp.task("watch", ["test", "watch:reflect", "watch:spec"], () => { + const server = gls.static("docs", 8080); + const promise = server.start(); + gulp.watch(["docs/**/*"], file => server.notify(file)); + return promise; +}); + +gulp.task("prepublish", sequence("clean", "test")); +gulp.task("reflect", ["build:reflect"]); +gulp.task("tests", ["build:tests"]); +gulp.task("spec", ["build:spec"]); +gulp.task("start", ["watch"]); +gulp.task("default", ["build", "test"]); diff --git a/package.json b/package.json index 81095cf..2a73eb9 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,10 @@ "definition": "Reflect.d.ts" }, "scripts": { - "prepublish": "npm run test", - "build": "tsc", - "build-test": "tsc --project ./test/", - "test": "npm run build & npm run build-test & node ./temp/test/run.js" + "prepublish": "gulp prepublish", + "build": "gulp build", + "test": "gulp test", + "start": "gulp start" }, "repository": { "type": "git", @@ -41,6 +41,20 @@ "homepage": "http://rbuckton.github.io/ReflectDecorators", "dependencies": {}, "devDependencies": { + "@types/chai": "^3.4.34", + "@types/mocha": "^2.2.34", + "@types/node": "^6.0.52", + "chai": "^3.5.0", + "del": "^2.2.2", + "ecmarkup": "^3.9.3", + "gulp": "^3.9.1", + "gulp-emu": "^1.1.0", + "gulp-live-server": "0.0.30", + "gulp-mocha": "^3.0.1", + "gulp-rename": "^1.2.2", + "gulp-sequence": "^0.4.6", + "gulp-tsb": "^2.0.3", + "mocha": "^3.2.0", "typescript": "^2.1.4" } } diff --git a/spec.html b/spec.html new file mode 100644 index 0000000..a1ca641 --- /dev/null +++ b/spec.html @@ -0,0 +1,419 @@ + + +Metadata + + + + + + + +

    Metadata Proposal - ECMAScript

    +

    Proposal to add Metadata to ECMAScript.

    +
    + + +

    Syntax

    + This section is non-normative. +
    
    +    // define metadata on an object or property
    +    Reflect.defineMetadata(metadataKey, metadataValue, target);
    +    Reflect.defineMetadata(metadataKey, metadataValue, target, propertyKey);
    +
    +    // check for presence of a metadata key on the prototype chain of an object or property
    +    let result = Reflect.hasMetadata(metadataKey, target);
    +    let result = Reflect.hasMetadata(metadataKey, target, propertyKey);
    +
    +    // check for presence of an own metadata key of an object or property
    +    let result = Reflect.hasOwnMetadata(metadataKey, target);
    +    let result = Reflect.hasOwnMetadata(metadataKey, target, propertyKey);
    +
    +    // get metadata value of a metadata key on the prototype chain of an object or property
    +    let result = Reflect.getMetadata(metadataKey, target);
    +    let result = Reflect.getMetadata(metadataKey, target, propertyKey);
    +
    +    // get metadata value of an own metadata key of an object or property
    +    let result = Reflect.getOwnMetadata(metadataKey, target);
    +    let result = Reflect.getOwnMetadata(metadataKey, target, propertyKey);
    +
    +    // get all metadata keys on the prototype chain of an object or property
    +    let result = Reflect.getMetadataKeys(target);
    +    let result = Reflect.getMetadataKeys(target, propertyKey);
    +
    +    // get all own metadata keys of an object or property
    +    let result = Reflect.getOwnMetadataKeys(target);
    +    let result = Reflect.getOwnMetadataKeys(target, propertyKey);
    +
    +    // delete metadata from an object or property
    +    let result = Reflect.deleteMetadata(metadataKey, target);
    +    let result = Reflect.deleteMetadata(metadataKey, target, propertyKey);
    +
    +    // apply metadata via a decorator to a constructor
    +    @Reflect.metadata(metadataKey, metadataValue)
    +    class C {
    +      // apply metadata via a decorator to a method (property)
    +      @Reflect.metadata(metadataKey, metadataValue)
    +      method() {
    +      }
    +    }
    +
    +    // Design-time type annotations
    +    function Type(type) { return Reflect.metadata("design:type", type); }
    +    function ParamTypes(...types) { return Reflect.metadata("design:paramtypes", types); }
    +    function ReturnType(type) { return Reflect.metadata("design:returntype", type); }
    +
    +    // Decorator application
    +    @ParamTypes(String, Number)
    +    class C {
    +      constructor(text, i) {
    +      }
    +
    +      @Type(String)
    +      get name() { return "text"; }
    +
    +      @Type(Function)
    +      @ParamTypes(Number, Number)
    +      @ReturnType(Number)
    +      add(x, y) {
    +        return x + y;
    +      }
    +    }
    +
    +    // Metadata introspection
    +    let obj = new C("a", 1);
    +    let paramTypes = Reflect.getMetadata("design:paramtypes", inst, "add"); // [Number, Number]
    +  
    +
    + + +

    Abstract Operations

    + +

    Operations on Objects

    + +

    GetOrCreateMetadataMap ( O, P, Create )

    +

    When the abstract operation GetOrCreateMetadataMap is called with Object _O_, property key _P_, and Boolean _Create_ the following steps are taken:

    + + 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. + 2. Let _targetMetadata_ be the value of _O_'s [[Metadata]] internal slot. + 3. If _targetMetadata_ is *undefined*, then + 1. If _Create_ is *false*, return *undefined*. + 2. Set _targetMetadata_ to be a newly created *Map* object. + 3. Set the [[Metadata]] internal slot of _O_ to _targetMetadata_. + 4. Let _metadataMap_ be ? Invoke(_targetMetadata_, `"get"`, _P_). + 5. If _metadataMap_ is *undefined*, then + 1. If _Create_ is *false*, return *undefined*. + 2. Set _metadataMap_ to be a newly created *Map* object. + 3. Perform ? Invoke(_targetMetadata_, `"set"`, _P_, _metadataMap_). + 6. Return _metadataMap_. + +
    +
    +
    + + +

    Ordinary and Exotic Objects Behaviors

    + + +

    Ordinary Object Internal Methods and Internal Slots

    +

    All ordinary objects have an internal slot called [[Metadata]]. The value of this internal slot is either *null* or a *Map* object and is used for storing metadata for an object.

    + +

    [[HasMetadata]] ( MetadataKey, P )

    +

    When the [[HasMetadata]] internal method of _O_ is called with ECMAScript language value _MetadataKey_ and property key _P_, the following steps are taken:

    + + 1. Return ? OrdinaryHasMetadata(_MetadataKey_, _O_, _P_). + + +

    OrdinaryHasMetadata ( MetadataKey, O, P )

    +

    When the abstract operation OrdinaryHasMetadata is called with ECMAScript language value _MetadataKey_, Object _O_, and property key _P_, the following steps are taken:

    + + 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. + 2. Let _hasOwn_ be ? OrdinaryHasOwnMetadata(_MetadataKey_, _O_, _P_). + 3. If _hasOwn_ is *true*, return *true*. + 4. Let _parent_ be ? _O_.[[GetPrototypeOf]](). + 5. If _parent_ is not *null*, then + 1. Return ? _parent_.[[HasMetadata]](_MetadataKey_, _P_). + 6. Return *false*. + +
    +
    + + +

    [[HasOwnMetadata]] ( MetadataKey, P )

    +

    When the [[HasOwnMetadata]] internal method of _O_ is called with ECMAScript language value _MetadataKey_ and property key _P_, the following steps are taken:

    + + 1. Return ? OrdinaryHasOwnMetadata(_MetadataKey_, _O_, _P_). + + +

    OrdinaryHasOwnMetadata ( MetadataKey, O, P )

    +

    When the abstract operation OrdinaryHasOwnMetadata is called with ECMAScript language value _MetadataKey_, Object _O_, and property key _P_, the following steps are taken:

    + + 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. + 2. Let _metadataMap_ be ? GetOrCreateMetadataMap(_O_, _P_, *false*). + 3. If _metadataMap_ is *undefined*, return *false*. + 4. Return ? Invoke(_metadataMap_, `"has"`, _MetadataKey_). + +
    +
    + + +

    [[GetMetadata]] ( MetadataKey, P )

    +

    When the [[GetMatadata]] internal method of _O_ is called with ECMAScript language value _MetadataKey_ and property key _P_, the following steps are taken:

    + + 1. Return ? OrdinaryGetMetadata(_MetadataKey_, _O_, _P_). + + +

    OrdinaryGetMetadata ( MetadataKey, O, P )

    +

    When the abstract operation OrdinaryGetMetadata is called with ECMAScript language value _MetadataKey_, Object _O_, and property key _P_, the following steps are taken:

    + + 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. + 2. Let _hasOwn_ be ? OrdinaryHasOwnMetadata(_MetadataKey_, _O_, _P_). + 3. If _hasOwn_ is *true*, then + 1. Return ? OrdinaryGetOwnMetadata(_MetadataKey_, _O_, _P_). + 4. Let _parent_ be ? _O_.[[GetPrototypeOf]](). + 5. If _parent_ is not *null*, then + 1. return ? _parent_.[[GetMetadata]](_MetadataKey_, _P_). + 6. Return *undefined*. + +
    +
    + + +

    [[GetOwnMetadata]] ( MetadataKey, P, ParamIndex )

    +

    When the [[GetOwnMetadata]] internal method of _O_ is called with ECMAScript language value _MetadataKey_ and property key _P_, the following steps are taken:

    + + 1. Return ? OrdinaryGetOwnMetadata(_MetadataKey_, _O_, _P_). + + +

    OrdinaryGetOwnMetadata ( MetadataKey, O, P )

    +

    When the abstract operation OrdinaryGetOwnMetadata is called with ECMAScript language value _MetadataKey_, Object _O_, and property key _P_, the following steps are taken:

    + + 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. + 2. Let _metadataMap_ be ? GetOrCreateMetadataMap(_O_, _P_, *false*). + 3. If _metadataMap_ is *undefined*, return *undefined*. + 4. Return ? Invoke(_metadataMap_, `"get"`, _MetadataKey_). + +
    +
    + + +

    [[DefineOwnMetadata]] ( MetadataKey, MetadataValue, P )

    +

    When the [[DefineOwnMetadata]] internal method of _O_ is called with ECMAScript language value _MetadataKey_, ECMAScript language value _MetadataValue_, and property key _P_, the following steps are taken:

    + + 1. Return ? OrdinaryDefineOwnMetadata(_MetadataKey_, _MetadataValue_, _O_, _P_) + + +

    OrdinaryDefineOwnMetadata ( MetadataKey, MetadataValue, O, P )

    +

    When the abstract operation OrdinaryDefineOwnProperty is called with ECMAScript language value _MetadataKey_, ECMAScript language value _MetadataValue_, Object _O_, and property key _P_, the following steps are taken:

    + + 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. + 2. Let _metadataMap_ be ? GetOrCreateMetadataMap(_O_, _P_, *true*). + 3. Return ? Invoke(_metadataMap_, `"set"`, _MetadataKey_, _MetadataValue_). + +
    +
    + + +

    [[MetadataKeys]] ( P )

    +

    When the [[MetadataKeys]] internal method of _O_ is called with property key _P_ the following steps are taken:

    + + 1. Return ? OrdinaryMetadataKeys(_O_, _P_). + + +

    OrdinaryMetadataKeys ( O, P )

    +

    When the abstract operation OrdinaryMetadataKeys is called with Object _O_ and property key _P_ the following steps are taken:

    + + 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. + 2. Let _ownKeys_ be ? OrdinaryOwnMetadataKeys(_O_, _P_). + 3. Let _parent_ be ? _O_.[[GetPrototypeOf]](). + 4. If _parent_ is *null*, then return _ownKeys_. + 5. Let _parentKeys_ be ? _O_.[[OrdinaryMetadataKeys]](_P_). + 6. Let _ownKeysLen_ = ? Get(_ownKeys_, "length"). + 7. If _ownKeysLen_ is *0*, return _parentKeys_. + 8. Let _parentKeysLen_ = ? Get(_parentKeys_, "length"). + 9. If _parentKeysLen_ is *0*, return _ownKeys_. + 10. Let _set_ be a newly created *Set* object. + 11. Let _keys_ be ? ArrayCreate(0). + 12. Let _k_ be *0*. + 13. For each element _key_ of _ownKeys_ + 1. Let _hasKey_ be ? Invoke(_set_, `"has"`, _key_). + 2. If _hasKey_ is *false*, then + 1. Let _Pk_ be ! ToString(_k_). + 2. Perform ? Invoke(_set_, "add", _key_). + 3. Let _defineStatus_ be CreateDataProperty(_keys_, _Pk_, _key_). + 4. Assert: _defineStatus_ is *true*. + 5. Increase _k_ by *1*. + 14. For each element _key_ of _parentKeys_ + 1. Let _hasKey_ be ? Invoke(_set_, `"has"`, _key_). + 2. If _hasKey_ is *false*, then + 1. Let _Pk_ be ! ToString(_k_). + 2. Perform ? Invoke(_set_, `"add"`, _key_). + 3. Let _defineStatus_ be CreateDataProperty(_keys_, _Pk_, _key_). + 4. Assert: _defineStatus_ is *true*. + 5. Increase _k_ by *1*. + 15. Perform ? Set(_keys_, `"length"`, _k_). + 16. return _keys_. + +
    +
    + + +

    [[OwnMetadataKeys]] ( P )

    +

    When the [[OwnMetadataKeys]] internal method of _O_ is called with property key _P_ the following steps are taken:

    + + 1. Return OrdinaryOwnMetadataKeys(_O_, _P_). + + +

    OrdinaryOwnMetadataKeys ( O, P )

    +

    When the abstract operation OrdinaryOwnMetadataKeys is called with Object _O_ and property key _P_ the following steps are taken:

    + + 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. + 2. Let _keys_ be ? ArrayCreate(0). + 3. Let _metadataMap_ be ? GetOrCreateMetadataMap(_O_, _P_, *false*). + 4. If _metadataMap_ is *undefined*, return _keys_. + 5. Let _keysObj_ be ? Invoke(_metadataMap_, `"keys"`). + 6. Let _iterator_ be ? GetIterator(_keysObj_). + 7. Let _k_ be *0*. + 8. Repeat + 1. Let _Pk_ be ! ToString(_k_). + 2. Let _next_ be ? IteratorStep(_iterator_). + 3. If _next_ is *false*, then + 1. Let _setStatus_ be ? Set(_keys_, `"length"`, _k_, _true_). + 2. Assert: _setStatus_ is *true*. + 3. Return _keys_. + 4. Let _nextValue_ be ? IteratorValue(_next_). + 5. Let _defineStatus_ be CreateDataPropertyOrThrow(_keys_, _Pk_, _nextValue_). + 6. If _defineStatus_ is an abrupt completion, return ? IteratorClose(_iterator_, _defineStatus_). + 7. Increase _k_ by *1*. + +
    +
    + + +

    [[DeleteMetadata]]( MetadataKey, P )

    +

    When the [[DeleteMetadata]] internal method of _O_ is called with ECMAScript language value _MetadataKey_ and property key _P_ the following steps are taken:

    + + 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. + 2. Let _metadataMap_ be ? GetOrCreateMetadataMap(_O_, _P_, *false*). + 4. If _metadataMap_ is *undefined*, return *false*. + 5. Return ? Invoke(_metadataMap_, `"delete"`, _MetadataKey_). + +
    +
    +
    + + +

    Reflection

    + +

    The Reflect Object

    +

    This section contains amendments to the Reflect object.

    + A shim for this API can be found here: https://github.com/rbuckton/ReflectDecorators + +

    Metadata Decorator Functions

    +

    A metadata decorator function is an anonymous built-in function that has [[MetadataKey]] and [[MetadataValue]] internal slots.

    +

    When a metadata decorator function _F_ is called with arguments _target_ and _key_, the following steps are taken:

    + + 1. Assert: _F_ has a [[MetadataKey]] internal slot whose value is an ECMAScript language value, or *undefined*. + 2. Assert: _F_ has a [[MetadataValue]] internal slot whose value is an ECMAScript language value, or *undefined*. + 3. If Type(_target_) is not Object, throw a *TypeError* exception. + 4. If _key_ is not *undefined* and IsPropertyKey(_key_) is *false*, throw a *TypeError* exception. + 5. Let _metadataKey_ be the value of _F_'s [[MetadataKey]] internal slot. + 6. Let _metadataValue_ be the value of _F_'s [[MetadataValue]] internal slot. + 7. Perform ? _target_.[[DefineMetadata]](_metadataKey_, _metadataValue_, _target_, _key_). + 8. Return *undefined*. + +
    + + +

    Reflect.metadata ( metadataKey, metadataValue )

    +

    When the `metadata` function is called with arguments _metadataKey_ and _metadataValue_, the following steps are taken:

    + + 1. Let _decorator_ be a new built-in function object as defined in Metadata Decorator Functions. + 2. Set the [[MetadataKey]] internal slot of _decorator_ to _metadataKey_. + 3. Set the [[MetadataValue]] internal slot of _decorator_ to _metadataValue_. + 4. Return _decorator_. + +
    + + +

    Reflect.defineMetadata ( metadataKey, metadataValue, target, propertyKey )

    +

    When the `defineMetadata` function is called with arguments _metadataKey_, _metadataValue_, _target_, and _propertyKey_, the following steps are taken:

    + + 1. If Type(_target_) is not Object, throw a *TypeError* exception. + 2. Return ? _target_.[[DefineMetadata]](_metadataKey_, _metadataValue_, _propertyKey_). + +
    + + +

    Reflect.hasMetadata ( metadataKey, target, propertyKey )

    +

    When the `hasMetadata` function is called with arguments _metadataKey_, _target_, and _propertyKey_, the following steps are taken:

    + + 1. If Type(_target_) is not Object, throw a *TypeError* exception. + 2. Return ? _target_.[[HasMetadata]](_metadataKey_, _propertyKey_). + +
    + + +

    Reflect.hasOwnMetadata ( metadataKey, target, propertyKey )

    +

    When the `hasOwnMetadata` function is called with arguments _metadataKey_, _target_, and _propertyKey_, the following steps are taken:

    + + 1. If Type(_target_) is not Object, throw a *TypeError* exception. + 2. Return ? _target_.[[HasOwn]](_metadataKey_, _propertyKey_). + +
    + + +

    Reflect.getMetadata ( metadataKey, target, propertyKey )

    +

    When the `getMetadata` function is called with arguments _metadataKey_, _target_, and _propertyKey_, the following steps are taken:

    + + 1. If Type(_target_) is not Object, throw a *TypeError* exception. + 2. Return ? _target_.[[GetMetadata]](_metadataKey_, _propertyKey_). + +
    + + +

    Reflect.getOwnMetadata ( metadataKey, target, propertyKey )

    +

    When the `getOwnMetadata` function is called with arguments _metadataKey_, _target_, and _propertyKey_, the following steps are taken:

    + + 1. If Type(_target_) is not Object, throw a *TypeError* exception. + 2. Return ? _target_.[[GetOwnMetadata]](_metadataKey_, _propertyKey_). + +
    + + +

    Reflect.getMetadataKeys ( target, propertyKey )

    +

    When the `getMetadataKeys` function is called with arguments _target_ and _propertyKey_, the following steps are taken:

    + + 1. If Type(_target_) is not Object, throw a *TypeError* exception. + 2. Return ? _target_.[[GetMetadataKeys]](_propertyKey_). + +
    + + +

    Reflect.getOwnMetadataKeys ( target, propertyKey )

    +

    When the `getOwnMetadataKeys` function is called with arguments _target_ and _propertyKey_, the following steps are taken:

    + + 1. If Type(_target_) is not Object, throw a *TypeError* exception. + 2. Return ? _target_.[[GetOwnMetadataKeys]](_propertyKey_). + +
    + + +

    Reflect.deleteMetadata ( metadataKey, target, propertyKey )

    +

    When the `deleteMetadata` function is called with arguments _metadataKey_, _target_, and _propertyKey_, the following steps are taken:

    + + 1. If Type(_target_) is not Object, throw a *TypeError* exception. + 2. Return ? _target_.[[DeleteMetadata]](_metadataKey_, _propertyKey_). + +
    +
    +
    \ No newline at end of file diff --git a/spec/biblio.json b/spec/biblio.json deleted file mode 100644 index 66d43e8..0000000 --- a/spec/biblio.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "http://people.mozilla.org/~jorendorff/es6-draft.html": { - "abstract operations": { - } - } -} \ No newline at end of file diff --git a/spec/css/elements.css b/spec/css/elements.css deleted file mode 100644 index 7790735..0000000 --- a/spec/css/elements.css +++ /dev/null @@ -1,234 +0,0 @@ -body { - font-size: 18px; - line-height: 1.5; - font-family: Cambria, Palatino Linotype, Palatino, Liberation Serif, serif; - margin: 0 20%; - color: #333; -} - -a:link { - text-decoration: none; - color: #3333bb; -} - -a:hover { - text-decoration: underline; - color: blue; -} - -a:visited { - color: inherit; -} - -code { - font-weight: bold; - font-family: Consolas, Monaco, monospace; - white-space: pre; -} - -pre code { - font-weight: inherit; -} - -pre code.hljs { - background-color: #fff; -} - -ol.toc { - list-style: none; - padding-left: 0; -} - -ol.toc ol.toc { - padding-left: 2ex; - list-style: none; -} - -emu-val { - font-weight: bold; -} -emu-alg ol, emu-alg ol ol ol ol { - list-style-type: decimal; -} - -emu-alg ol ol, emu-alg ol ol ol ol ol { - list-style-type: lower-alpha; -} - -emu-alg ol ol ol, ol ol ol ol ol ol { - list-style-type: lower-roman; -} - -emu-note { - display: block; - margin-left: 5em; - color: #666; -} - -emu-note span.note { - text-transform: uppercase; - margin-left: -5em; - display: block; - float: left; -} - -emu-production { - display: block; - margin-top: 1em; - margin-bottom: 1em; - margin-left: 5ex; -} - -emu-production.inline { - display: inline; - margin: 0; -} - -emu-production.inline emu-rhs { - display: inline; - padding-left: 1ex; -} -emu-constraints { - font-size: .75em; - margin-right: 1ex; -} - -emu-gann { - margin-right: 1ex; -} - -emu-gann emu-t:last-child, -emu-gann emu-nt:last-child { - margin-right: 0; -} - -emu-geq { - margin-left: 1ex; - font-weight: bold; -} - -emu-oneof { - font-weight: bold; - margin-left: 1ex; -} - -emu-nt { - font-style: italic; -} - -emu-rhs emu-nt { - margin-right: 1ex; -} - -emu-t { - font-family: monospace; - font-weight: bold; - margin-right: 1ex; -} - -emu-rhs { - display: block; - padding-left: 50px; -} - -emu-mods { - font-size: .75em; - vertical-align: sub; - font-style: normal; -} - -emu-gprose { - font-size: 0.9em; - font-family: Helvetica, Arial, sans-serif; -} - -h1, h2, h3, h4, h5, h6 { - position: relative; -} -h1 .secnum { - position: absolute; - text-align: right; - right: 100%; - margin-right: 1ex; - white-space: nowrap; -} - -h1 { font-size: 2.67em; } -h2 { font-size: 2em; } -h3 { font-size: 1.56em; } -h4 { font-size: 1.25em; } -h5 { font-size: 1.11em; } -h6 { font-size: 1em; } - -emu-intro h1, emu-clause h1, emu-annex h1 { font-size: 2em; } -emu-intro h2, emu-clause h2, emu-annex h2 { font-size: 1.56em; } -emu-intro h3, emu-clause h3, emu-annex h3 { font-size: 1.25em; } -emu-intro h4, emu-clause h4, emu-annex h4 { font-size: 1.11em; } -emu-intro h5, emu-clause h5, emu-annex h5 { font-size: 1em; } -emu-intro h6, emu-clause h6, emu-annex h6 { font-size: 0.9em; } -emu-intro emu-intro h1, emu-clause emu-clause h1, emu-annex emu-annex h1 { font-size: 1.56em; } -emu-intro emu-intro h2, emu-clause emu-clause h2, emu-annex emu-annex h2 { font-size: 1.25em; } -emu-intro emu-intro h3, emu-clause emu-clause h3, emu-annex emu-annex h3 { font-size: 1.11em; } -emu-intro emu-intro h4, emu-clause emu-clause h4, emu-annex emu-annex h4 { font-size: 1em; } -emu-intro emu-intro h5, emu-clause emu-clause h5, emu-annex emu-annex h5 { font-size: 0.9em; } -emu-intro emu-intro emu-intro h1, emu-clause emu-clause emu-clause h1, emu-annex emu-annex emu-annex h1 { font-size: 1.25em; } -emu-intro emu-intro emu-intro h2, emu-clause emu-clause emu-clause h2, emu-annex emu-annex emu-annex h2 { font-size: 1.11em; } -emu-intro emu-intro emu-intro h3, emu-clause emu-clause emu-clause h3, emu-annex emu-annex emu-annex h3 { font-size: 1em; } -emu-intro emu-intro emu-intro h4, emu-clause emu-clause emu-clause h4, emu-annex emu-annex emu-annex h4 { font-size: 0.9em; } -emu-intro emu-intro emu-intro emu-intro h1, emu-clause emu-clause emu-clause emu-clause h1, emu-annex emu-annex emu-annex emu-annex h1 { font-size: 1.11em; } -emu-intro emu-intro emu-intro emu-intro h2, emu-clause emu-clause emu-clause emu-clause h2, emu-annex emu-annex emu-annex emu-annex h2 { font-size: 1em; } -emu-intro emu-intro emu-intro emu-intro h3, emu-clause emu-clause emu-clause emu-clause h3, emu-annex emu-annex emu-annex emu-annex h3 { font-size: 0.9em; } -emu-intro emu-intro emu-intro emu-intro emu-intro h1, emu-clause emu-clause emu-clause emu-clause emu-clause h1, emu-annex emu-annex emu-annex emu-annex emu-annex h1 { font-size: 1em; } -emu-intro emu-intro emu-intro emu-intro emu-intro h2, emu-clause emu-clause emu-clause emu-clause emu-clause h2, emu-annex emu-annex emu-annex emu-annex emu-annex h2 { font-size: 0.9em; } -emu-intro emu-intro emu-intro emu-intro emu-intro emu-intro h1, emu-clause emu-clause emu-clause emu-clause emu-clause emu-clause h1, emu-annex emu-annex emu-annex emu-annex emu-annex emu-annex h1 { font-size: 0.9em } - -emu-clause { - display: block; -} - -/* Figures and tables */ -figure { display: block; margin: 1em 0 3em 0; } -figure object { display: block; margin: 0 auto; } -figure table.real-table { margin: 0 auto; } -figure figcaption { - display: block; - color: #555555; - font-weight: bold; - text-align: center; -} - -table.real-table { - border-collapse: collapse; -} -table.real-table td, table.real-table th { - border: 1px solid black; - padding: 0.4em; - vertical-align: baseline; -} -table.real-table th { - background-color: #eeeeee; -} - -/* Note: the left content edges of table.lightweight-table >tbody >tr >td - and div.display line up. */ -table.lightweight-table { - border-collapse: collapse; - margin: 0 0 0 1.5em; -} -table.lightweight-table td, table.lightweight-table th { - border: none; - padding: 0 0.5em; - vertical-align: baseline; -} - -/* diff styles */ -ins { - background-color: #e0f8e0; - text-decoration: none; - border-bottom: 1px solid #396; -} - -del { - background-color: #fee; -} - diff --git a/spec/index-out.html b/spec/index-out.html deleted file mode 100644 index c355e3a..0000000 --- a/spec/index-out.html +++ /dev/null @@ -1,662 +0,0 @@ - - -Decorators - - - - -

    Decorators Proposal - ECMAScript

    -

    Table of Contents

    1. Introduction
    2. 1 Terms
      1. 1.1 Decorator
      2. 1.2 Class Decorator Function
      3. 1.3 Property/Method Decorator Function
      4. 1.4 Decorator Factory
    3. 2 Decorator Targets
    4. 3 Decorator Evaluation and Application Order
    5. 4 Abstract Operations
      1. 4.1 Decorator Operations
        1. 4.1.1 Decorate ( Decorators, O, P, desc )
        2. 4.1.2 DecorateConstructor ( Decorators, F )
        3. 4.1.3 DecorateProperty ( Decorators, O, P, desc )
      2. 4.2 Operations on Objects
        1. 4.2.1 CreateListFromIterator ( iterator [, elementTypes] )
        2. 4.2.2 GetOrCreateMetadataMap ( O, P, Create )
        3. 4.2.3 [[HasMetadata]] ( MetadataKey, P )
        4. 4.2.4 OrdinaryHasMetadata ( MetadataKey, O, P )
        5. 4.2.5 [[HasOwnMetadata]] ( MetadataKey, P )
        6. 4.2.6 OrdinaryHasOwnMetadata ( MetadataKey, O, P )
        7. 4.2.7 [[GetMetadata]] ( MetadataKey, P )
        8. 4.2.8 OrdinaryGetMetadata ( MetadataKey, O, P )
        9. 4.2.9 [[GetOwnMetadata]] ( MetadataKey, P, ParamIndex )
        10. 4.2.10 OrdinaryGetOwnMetadata ( MetadataKey, O, P )
        11. 4.2.11 [[DefineOwnMetadata]] ( MetadataKey, MetadataValue, P )
        12. 4.2.12 OrdinaryDefineOwnMetadata ( MetadataKey, MetadataValue, O, P )
        13. 4.2.13 [[MetadataKeys]] ( P )
        14. 4.2.14 OrdinaryMetadataKeys ( O, P )
        15. 4.2.15 [[OwnMetadataKeys]] ( P )
        16. 4.2.16 OrdinaryOwnMetadataKeys ( O, P )
        17. 4.2.17 [[DeleteMetadata]]( MetadataKey, P )
    6. 5 Reflection
      1. 5.1 The Reflect Object
        1. 5.1.1 Metadata Decorator Functions
        2. 5.1.2 Reflect.decorate ( decorators, target, propertyKey, attributes )
        3. 5.1.3 Reflect.metadata ( metadataKey, metadataValue )
        4. 5.1.4 Reflect.defineMetadata ( metadataKey, metadataValue, target, propertyKey )
        5. 5.1.5 Reflect.hasMetadata ( metadataKey, target, propertyKey )
        6. 5.1.6 Reflect.hasOwnMetadata ( metadataKey, target, propertyKey )
        7. 5.1.7 Reflect.getMetadata ( metadataKey, target, propertyKey )
        8. 5.1.8 Reflect.getOwnMetadata ( metadataKey, target, propertyKey )
        9. 5.1.9 Reflect.getMetadataKeys ( target, propertyKey )
        10. 5.1.10 Reflect.getOwnMetadataKeys ( target, propertyKey )
        11. 5.1.11 Reflect.deleteMetadata ( metadataKey, target, propertyKey )
    7. A Grammar
      1. A.1 Expressions
      2. A.2 Functions and Classes
      3. A.3 Scripts and Modules
    -

    Introduction

    -

    Proposal to add Decorators to ECMAScript.

    -

    For the TypeScript specific proposal, see http://rbuckton.github.io/reflectdecorators/typescript.html

    -
    - - -

    1Terms

    - -

    1.1Decorator

    - NoteThis section is non-normative. -

    A decorator is an expression that is evaluated after a class has been defined, that can be used to annotate or modify the class in some fashion. This expression must evaluate to a function, which is executed by the runtime to apply the decoration.

    -
    @decoratorExpression
    -class C {
    -}
    -
    -
    - -

    1.2Class Decorator Function

    - NoteThis section is non-normative. -

    A class decorator function is a function that accepts a constructor function as its argument, and returns either undefined, the provided constructor function, or a new constructor function. Returning undefined is equivalent to returning the provided constructor function.

    -
    // A class decorator function
    -function dec(target) {  
    - // modify, annotate, or replace target...
    -}
    -
    -
    - -

    1.3Property/Method Decorator Function

    - NoteThis section is non-normative. -

    A property decorator function is a function that accepts three arguments: The object that owns the property, the key for the property (a string or a symbol), and optionally the property descriptor of the property. The function must return either undefined, the provided property descriptor, or a new property descriptor. Returning undefined is equivalent to returning the provided property descriptor.

    -
    // A property (or method/accessor) decorator function
    -function dec(target, key, descriptor) {
    -  // annotate the target and key; or modify or replace the descriptor...
    -}
    -    
    -
    - -

    1.4Decorator Factory

    - NoteThis section is non-normative. -

    A decorator factory is a function that can accept any number of arguments, and must return one of the above types of decorator function.

    -
    // a class decorator factory function
    -function dec(x, y) {
    -  // the class decorator function
    -  return function (target) {
    -      // modify, annotate, or replace target...
    -  }
    -}
    -
    -
    -
    - -

    2Decorator Targets

    - NoteThis section is non-normative. -

    A decorator can be legally applied to any of the following:

    -
      -
    • A class declaration
    • -
    • A class property initializer (static or prototype)
    • -
    • A class method declaration (static or prototype)
    • -
    • A class get or set accessor declaration (static or prototype)
    • -
    -

    Please note that a decorator currently cannot be legally applied to any of the following:

    -
      -
    • A class constructor - This is to reduce ambiguity between where you can apply a decorator (on the class or on its constructor) and which of the above decorator function forms is called.
    • -
    • A function declaration - Decorators on a function declaration would introduce a TDZ (Temporal Dead Zone), which would make the function unreachable until its declaration is executed. This could cause confusion as an undecorated function declaration is hoisted and can be used in a statement preceeding the declaration.
    • -
    • A function expression - This is to reduce confusion and maintain parity with disallowing decorators on a function declaration.
    • -
    • An arrow function - This is to reduce confusion and maintain parity with disallowing decorators on a function expression.
    • -
    -

    This list may change in the future.

    -
    - -

    3Decorator Evaluation and Application Order

    - NoteThis section is non-normative. -

    Decorators are evaluated in the order they appear preceeding their target declaration, to preserve side-effects due to evaluation order. Decorators are applied to their target declaration in reverse order, starting with the decorator closest to the declaration. This behavior is specified to preserve the expected behavior of decorators without a declarative syntax.

    -
    @F
    -@G
    -class C {   
    -}
    -
    -

    For example, the above listing could be approximately written without decorators in the following fashion:

    -
    C = F(G(C))
    -

    In the above example, the expression F is evaluated first, followed by the expression G. G is then called with the constructor function as its argument, followed by calling F with the result. The actual process of applying decorators is more complex than the above example however, though you may still imperatively apply decorators with a reflection API.

    -

    If a class declaration has decorators on both the class and any of its members or parameters, the decorators are applied using the following pseudocode:

    -
    for each member M of class C
    -  if M is an accessor then
    -      let accessor = first accessor (get or set, in declaration order) of M
    -      let memberDecorators = decorators of accessor
    -      for each parameter of accessor
    -          let paramDecorators = decorators of parameter           
    -          let paramIndex = ordinal index of parameter
    -          Reflect.decorate(paramDecorators, accessor, paramIndex)
    -      next parameter
    -
    -      let accessor = second accessor (get or set, in declaration order) of M
    -      if accessor then
    -          let memberDecorators = memberDecorators + decorators of accessor
    -          for each parameter of accessor
    -              let paramDecorators = decorators of parameter           
    -              let paramIndex = ordinal index of parameter
    -              Reflect.decorate(paramDecorators, accessor, paramIndex)
    -          next parameter
    -      end if
    -  else if M is a method
    -      let memberDecorators = decorators of M
    -      for each parameter of M
    -          let paramDecorators = decorators of parameter           
    -          let paramIndex = ordinal index of parameter
    -          Reflect.decorate(paramDecorators, M, paramIndex)
    -      next parameter
    -  else
    -      let memberDecorators = decorators of M
    -  end if
    -
    -  let name = name of M
    -  let target = C.prototype if M is on the prototype; otherwise, C if M is static  
    -  Reflect.decorate(memberDecorators, C, name)
    -next member
    -
    -for each parameter of C
    -  let paramDecorators = decorators of parameter
    -  let paramIndex = ordinal index of parameter
    -  Reflect.decorate(paramDecorators, C, paramIndex)
    -next parameter
    -
    -let classDecorators = decorators of C
    -let C = Reflect.decorate(classDecorators, C)
    -  
    -
    - - -

    4Abstract Operations

    - -

    4.1Decorator Operations

    - -

    4.1.1Decorate ( Decorators, O, P, desc )

    -

    When the abstract operation Decorate is called with ECMAScript language value Decorators, Object O, property key P, and property descriptor desc, the following steps are taken:

    -
      -
    1. If P is undefined and desc is undefined, then -
        -
      1. If IsCallable(O) is not true, throw a TypeError exception.
      2. -
      3. Return DecorateConstructor(Decorators, O).
      4. -
      -
    2. -
    3. Else -
        -
      1. Return DecorateProperty(Decorators, O, P, desc).
      2. -
      -
    4. -
    -
    - -

    4.1.2DecorateConstructor ( Decorators, F )

    -

    When the abstract operation DecorateConstructor is called with ECMAScript language value Decorators and Object F, the following steps are taken:

    -
      -
    1. Let result be F.
    2. -
    3. Let iterator be GetIterator(Decorators).
    4. -
    5. Let list be CreateListFromIterator(iterator, «Object»).
    6. -
    7. For each decorator in list in reverse order -
        -
      1. Let decorated be Call(decorator, null, result).
      2. -
      3. ReturnIfAbrupt(decorated).
      4. -
      5. If IsCallable(decorated), then -
          -
        1. Set result to be decorated.
        2. -
        -
      6. -
      7. Else if decorated is not undefined, throw a TypeError exception.
      8. -
      -
    8. -
    -
    - -

    4.1.3DecorateProperty ( Decorators, O, P, desc )

    -

    When the abstract operation DecorateProperty is called with ECMAScript language value Decorators, Object O, property key P, and property descriptor desc, the following steps are taken:

    -
      -
    1. Let result be desc.
    2. -
    3. Let key be ToPropertyKey(P).
    4. -
    5. Let iterator be GetIterator(Decorators).
    6. -
    7. Let list be CreateListFromIterator(iterator, «Object»).
    8. -
    9. For each decorator in list in reverse order -
        -
      1. Let decorated be Call(decorator, null, O, key, result).
      2. -
      3. ReturnIfAbrupt(decorated).
      4. -
      5. If Type(decorated) is Object, then -
          -
        1. Set result to be decorated.
        2. -
        -
      6. -
      7. Else if decorated is not undefined, throw a TypeError exception.
      8. -
      -
    10. -
    -
    -
    - -

    4.2Operations on Objects

    - -

    4.2.1CreateListFromIterator ( iterator [, elementTypes] )

    -

    When the abstract operation CreateListFromIterator is called with ECMAScript language value iterator, the following steps are taken:

    -
      -
    1. ReturnIfAbrupt(iterator).
    2. -
    3. If elementTypes was not passed, let elementTypes be (Undefined, Null, Boolean, String, Symbol, Number, Object).
    4. -
    5. Let list be an empty List.
    6. -
    7. Repeat -
        -
      1. Let next be IteratorStep(iterator).
      2. -
      3. ReturnIfAbrupt(next).
      4. -
      5. If next is false, return list.
      6. -
      7. Let nextValue be IteratorValue(next).
      8. -
      9. ReturnIfAbrupt(nextValue).
      10. -
      11. If Type(nextValue) is not an element of elementTypes, then -
          -
        1. Return IteratorClose(iterator, Completion{[[type]]: throw, [[value]]: a newly created TypeError object, [[target]: empty}).
        2. -
        -
      12. -
      13. Append nextValue as the last element of list.
      14. -
      -
    8. -
    -
    - -

    4.2.2GetOrCreateMetadataMap ( O, P, Create )

    -

    When the abstract operation GetOrCreateMetadataMap is called with Object O, property key P, and Boolean Create the following steps are taken:

    -
      -
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. -
    3. Let metadataMap be undefined.
    4. -
    5. Let succeeded be true.
    6. -
    7. Let targetMetadata be the value of O's [[Metadata]] internal slot.
    8. -
    9. If targetMetadata is undefined, then -
        -
      1. If Create is false, return undefined.
      2. -
      3. Set targetMetadata to be a newly created Map object.
      4. -
      5. Set the [[Metadata]] internal slot of O to targetMetadata.
      6. -
      -
    10. -
    11. Let metadataMap be Invoke(targetMetadata, "get", P).
    12. -
    13. ReturnIfAbrupt(metadataMap).
    14. -
    15. If metadataMap is undefined, then -
        -
      1. If Create is false, return undefined.
      2. -
      3. Set metadataMap to be a newly created Map object.
      4. -
      5. Let setStatus be Invoke(targetMetadata, "set", P, metadataMap).
      6. -
      7. ReturnIfAbrupt(setStatus).
      8. -
      -
    16. -
    17. Return metadataMap.
    18. -
    -
    - -

    4.2.3[[HasMetadata]] ( MetadataKey, P )

    -

    When the [[HasMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:

    -
      -
    1. Return OrdinaryHasMetadata(MetadataKey, O, P).
    2. -
    -
    - -

    4.2.4OrdinaryHasMetadata ( MetadataKey, O, P )

    -

    When the abstract operation OrdinaryHasMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:

    -
      -
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. -
    3. Let hasOwn be OrdinaryHasOwnMetadata(MetadataKey, O, P).
    4. -
    5. If hasOwn is true, return true.
    6. -
    7. Let parent be O.[[GetPrototypeOf]]().
    8. -
    9. ReturnIfAbrupt(parent).
    10. -
    11. If parent is not null, then -
        -
      1. return parent.[[HasMetadata]](MetadataKey, P).
      2. -
      -
    12. -
    13. Return false.
    14. -
    -
    - -

    4.2.5[[HasOwnMetadata]] ( MetadataKey, P )

    -

    When the [[HasOwnMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:

    -
      -
    1. Return OrdinaryHasOwnMetadata(MetadataKey, O, P).
    2. -
    -
    - -

    4.2.6OrdinaryHasOwnMetadata ( MetadataKey, O, P )

    -

    When the abstract operation OrdinaryHasOwnMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:

    -
      -
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. -
    3. Let metadataMap be GetOrCreateMetadataMap(O, P, false).
    4. -
    5. ReturnIfAbrupt(metadataMap).
    6. -
    7. If metadataMap is undefined, return false.
    8. -
    9. Return Invoke(metadataMap, "has", MetadataKey).
    10. -
    -
    - -

    4.2.7[[GetMetadata]] ( MetadataKey, P )

    -

    When the [[GetMatadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:

    -
      -
    1. Return OrdinaryGetMetadata(MetadataKey, O, P).
    2. -
    -
    - -

    4.2.8OrdinaryGetMetadata ( MetadataKey, O, P )

    -

    When the abstract operation OrdinaryGetMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:

    -
      -
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. -
    3. Let hasOwn be OrdinaryHasOwnMetadata(MetadataKey, O, P).
    4. -
    5. If hasOwn is true, then -
        -
      1. return OrdinaryGetOwnMetadata(MetadataKey, O, P).
      2. -
      -
    6. -
    7. Let parent be O.[[GetPrototypeOf]]().
    8. -
    9. ReturnIfAbrupt(parent).
    10. -
    11. If parent is not null, then -
        -
      1. return parent.[[GetMetadata]](MetadataKey, P).
      2. -
      -
    12. -
    13. Return undefined.
    14. -
    -
    - -

    4.2.9[[GetOwnMetadata]] ( MetadataKey, P, ParamIndex )

    -

    When the [[GetOwnMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:

    -
      -
    1. Return OrdinaryGetOwnMetadata(MetadataKey, O, P).
    2. -
    -
    - -

    4.2.10OrdinaryGetOwnMetadata ( MetadataKey, O, P )

    -

    When the abstract operation OrdinaryGetOwnMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:

    -
      -
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. -
    3. Let metadataMap be GetOrCreateMetadataMap(O, P, false).
    4. -
    5. ReturnIfAbrupt(metadataMap).
    6. -
    7. If metadataMap is undefined, return undefined.
    8. -
    9. Return Invoke(metadataMap, "get", MetadataKey).
    10. -
    -
    - -

    4.2.11[[DefineOwnMetadata]] ( MetadataKey, MetadataValue, P )

    -

    When the [[DefineOwnMetadata]] internal method of O is called with ECMAScript language value MetadataKey, ECMAScript language value MetadataValue, and property key P, the following steps are taken:

    -
      -
    1. Return OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P)
    2. -
    -
    - -

    4.2.12OrdinaryDefineOwnMetadata ( MetadataKey, MetadataValue, O, P )

    -

    When the abstract operation OrdinaryDefineOwnProperty is called with ECMAScript language value MetadataKey, ECMAScript language value MetadataValue, Object O, and property key P, the following steps are taken:

    -
      -
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. -
    3. Let metadataMap be GetOrCreateMetadataMap(O, P, true).
    4. -
    5. ReturnIfAbrupt(metadataMap).
    6. -
    7. Return Invoke(metadataMap, "set", MetadataKey, MetadataValue).
    8. -
    -
    - -

    4.2.13[[MetadataKeys]] ( P )

    -

    When the [[MetadataKeys]] internal method of O is called with property key P the following steps are taken:

    -
      -
    1. Return OrdinaryMetadataKeys(O, P).
    2. -
    -
    - -

    4.2.14OrdinaryMetadataKeys ( O, P )

    -

    When the abstract operation OrdinaryMetadataKeys is called with Object O and property key P the following steps are taken:

    -
      -
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. -
    3. Let ownKeys be OrdinaryOwnMetadataKeys(O, P).
    4. -
    5. Let parent = O.[[GetPrototypeOf]]().
    6. -
    7. ReturnIfAbrupt(parent).
    8. -
    9. If parent is null, then return ownKeys.
    10. -
    11. Let parentKeys be O.[[OrdinaryMetadataKeys]](P).
    12. -
    13. ReturnIfAbrupt(parentKeys).
    14. -
    15. Let ownKeysLen = Get(ownKeys, "length").
    16. -
    17. ReturnIfAbrupt(ownKeysLen).
    18. -
    19. If ownKeysLen is 0, return parentKeys.
    20. -
    21. Let parentKeysLen = Get(parentKeys, "length").
    22. -
    23. ReturnIfAbrupt(parentKeysLen).
    24. -
    25. If parentKeysLen is 0, return ownKeys.
    26. -
    27. Let set be a newly created Set object.
    28. -
    29. Let keys be ArrayCreate(0).
    30. -
    31. Let k be 0.
    32. -
    33. For each element key of ownKeys -
        -
      1. Let hasKey be Invoke(set, "has", key).
      2. -
      3. ReturnIfAbrupt(hasKey).
      4. -
      5. If hasKey is false, then -
          -
        1. Let Pk be ToString(k).
        2. -
        3. Let addStatus be Invoke(set, "add", key).
        4. -
        5. ReturnIfAbrupt(addStatus).
        6. -
        7. Let defineStatus be CreateDataPropertyOrThrow(keys, Pk, key).
        8. -
        9. ReturnIfAbrupt(defineStatus).
        10. -
        11. Increase k by 1.
        12. -
        -
      6. -
      -
    34. -
    35. For each element key of parentKeys -
        -
      1. Let hasKey be Invoke(set, "has", key).
      2. -
      3. ReturnIfAbrupt(hasKey).
      4. -
      5. If hasKey is false, then -
          -
        1. Let Pk be ToString(k).
        2. -
        3. Let addStatus be Invoke(set, "add", key).
        4. -
        5. ReturnIfAbrupt(addStatus).
        6. -
        7. Let defineStatus be CreateDataPropertyOrThrow(keys, Pk, key).
        8. -
        9. ReturnIfAbrupt(defineStatus).
        10. -
        11. Increase k by 1.
        12. -
        -
      6. -
      -
    36. -
    37. Let setStatus be Set(keys, "length", k).
    38. -
    39. ReturnIfAbrupt(setStatus).
    40. -
    41. return keys.
    42. -
    -
    - -

    4.2.15[[OwnMetadataKeys]] ( P )

    -

    When the [[OwnMetadataKeys]] internal method of O is called with property key P the following steps are taken:

    -
      -
    1. Return OrdinaryOwnMetadataKeys(O, P).
    2. -
    -
    - -

    4.2.16OrdinaryOwnMetadataKeys ( O, P )

    -

    When the abstract operation OrdinaryOwnMetadataKeys is called with Object O and property key P the following steps are taken:

    -
      -
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. -
    3. Let keys be ArrayCreate(0).
    4. -
    5. Let metadataMap be GetOrCreateMetadataMap(O, P, false).
    6. -
    7. ReturnIfAbrupt(metadataMap).
    8. -
    9. If metadataMap is undefined, return keys.
    10. -
    11. Let keysObj be Invoke(metadataMap, "keys").
    12. -
    13. ReturnIfAbrupt(keysObj).
    14. -
    15. Let iterator be GetIterator(keysObj).
    16. -
    17. ReturnIfAbrupt(iterator).
    18. -
    19. Let k be 0.
    20. -
    21. Repeat -
        -
      1. Let Pk be ToString(k).
      2. -
      3. Let next be IteratorStep(iterator).
      4. -
      5. ReturnIfAbrupt(next).
      6. -
      7. If next is false, then -
          -
        1. Let setStatus be Set(keys, "length", k, true).
        2. -
        3. ReturnIfAbrupt(setStatus).
        4. -
        5. Return keys.
        6. -
        -
      8. -
      9. Let nextValue be IteratorValue(next).
      10. -
      11. ReturnIfAbrupt(nextValue).
      12. -
      13. Let defineStatus be CreateDataPropertyOrThrow(keys, Pk, nextValue).
      14. -
      15. If defineStatus is an abrupt completion, return IteratorClose(iterator, defineStatus).
      16. -
      17. Increase k by 1.
      18. -
      -
    22. -
    -
    - -

    4.2.17[[DeleteMetadata]]( MetadataKey, P )

    -

    When the [[DeleteMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P the following steps are taken:

    -
      -
    1. Assert: P is undefined or IsPropertyKey(P) is true.
    2. -
    3. Let metadataMap be GetOrCreateMetadataMap(O, P, false).
    4. -
    5. ReturnIfAbrupt(metadataMap).
    6. -
    7. If metadataMap is undefined, return false.
    8. -
    9. Return Invoke(metadataMap, "delete", MetadataKey).
    10. -
    -
    -
    -
    - - -

    5Reflection

    - -

    5.1The Reflect Object

    -

    This section contains amendments to the Reflect object.

    - NoteA shim for this API can be found here: https://github.com/rbuckton/ReflectDecorators - -

    5.1.1Metadata Decorator Functions

    -

    A metadata decorator function is an anonymous built-in function that has [[MetadataKey]] and [[MetadataValue]] internal slots.

    -

    When a metadata decorator function F is called with arguments target and key, the following steps are taken:

    -
      -
    1. Assert: F has a [[MetadataKey]] internal slot whose value is an ECMAScript language value, or undefined.
    2. -
    3. Assert: F has a [[MetadataValue]] internal slot whose value is an ECMAScript language value, or undefined.
    4. -
    5. If Type(target) is not Object, throw a TypeError exception.
    6. -
    7. If key is not undefined and IsPropertyKey(key) is false, throw a TypeError exception.
    8. -
    9. Let metadataKey be the value of F's [[MetadataKey]] internal slot.
    10. -
    11. Let metadataValue be the value of F's [[MetadataValue]] internal slot.
    12. -
    13. Return target.[[DefineMetadata]](metadataKey, metadataValue, target, key).
    14. -
    -
    - -

    5.1.2Reflect.decorate ( decorators, target, propertyKey, attributes )

    -

    When the decorator function is called with arguments decorators, target, propertyKey, and attributes, the following steps are taken:

    -
      -
    1. If Type(decorators) is not Object, throw a TypeError exception.
    2. -
    3. If Type(target) is not Object, throw a TypeError exception.
    4. -
    5. Let key be ToPropertyKey(propertyKey).
    6. -
    7. ReturnIfAbrupt(propertyKey).
    8. -
    9. Let desc be ToPropertyDescriptor(attributes).
    10. -
    11. ReturnIfAbrupt(desc).
    12. -
    13. Return Decorate(decorators, target, propertyKey, desc).
    14. -
    -
    - -

    5.1.3Reflect.metadata ( metadataKey, metadataValue )

    -

    When the metadata function is called with arguments metadataKey and metadataValue, the following steps are taken:

    -
      -
    1. Let decorator be a new built-in function object as defined in Metadata Decorator Functions.
    2. -
    3. Set the [[MetadataKey]] internal slot of decorator to metadataKey.
    4. -
    5. Set the [[MetadataValue]] internal slot of decorator to metadataValue.
    6. -
    7. return decorator.
    8. -
    -
    - -

    5.1.4Reflect.defineMetadata ( metadataKey, metadataValue, target, propertyKey )

    -

    When the defineMetadata function is called with arguments metadataKey, metadataValue, target, and propertyKey, the following steps are taken:

    -
      -
    1. If Type(target) is not Object, throw a TypeError exception.
    2. -
    3. return target.[[DefineMetadata]](metadataKey, metadataValue, propertyKey).
    4. -
    -
    - -

    5.1.5Reflect.hasMetadata ( metadataKey, target, propertyKey )

    -

    When the hasMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    -
      -
    1. If Type(target) is not Object, throw a TypeError exception.
    2. -
    3. return target.[[HasMetadata]](metadataKey, propertyKey).
    4. -
    -
    - -

    5.1.6Reflect.hasOwnMetadata ( metadataKey, target, propertyKey )

    -

    When the hasOwnMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    -
      -
    1. If Type(target) is not Object, throw a TypeError exception.
    2. -
    3. return target.[[HasOwn]](metadataKey, propertyKey).
    4. -
    -
    - -

    5.1.7Reflect.getMetadata ( metadataKey, target, propertyKey )

    -

    When the getMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    -
      -
    1. If Type(target) is not Object, throw a TypeError exception.
    2. -
    3. return target.[[GetMetadata]](metadataKey, propertyKey).
    4. -
    -
    - -

    5.1.8Reflect.getOwnMetadata ( metadataKey, target, propertyKey )

    -

    When the getOwnMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    -
      -
    1. If Type(target) is not Object, throw a TypeError exception.
    2. -
    3. return target.[[GetOwnMetadata]](metadataKey, propertyKey).
    4. -
    -
    - -

    5.1.9Reflect.getMetadataKeys ( target, propertyKey )

    -

    When the getMetadataKeys function is called with arguments target and propertyKey, the following steps are taken:

    -
      -
    1. If Type(target) is not Object, throw a TypeError exception.
    2. -
    3. return target.[[GetMetadataKeys]](propertyKey).
    4. -
    -
    - -

    5.1.10Reflect.getOwnMetadataKeys ( target, propertyKey )

    -

    When the getOwnMetadataKeys function is called with arguments target and propertyKey, the following steps are taken:

    -
      -
    1. If Type(target) is not Object, throw a TypeError exception.
    2. -
    3. return target.[[GetOwnMetadataKeys]](propertyKey).
    4. -
    -
    - -

    5.1.11Reflect.deleteMetadata ( metadataKey, target, propertyKey )

    -

    When the deleteMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    -
      -
    1. If Type(target) is not Object, throw a TypeError exception.
    2. -
    3. return target.[[DeleteMetadata]](metadataKey, propertyKey).
    4. -
    -
    -
    -
    - -

    AGrammar

    - -

    A.1Expressions

    - - MemberExpression [Yield, Decorator]:PrimaryExpression [?Yield] - [~Decorator]MemberExpression [?Yield, ?Decorator][Expression [In, ?Yield]] - MemberExpression [?Yield, ?Decorator].IdentifierName - MemberExpression [?Yield, ?Decorator]TemplateLiteral [?Yield] - SuperProperty [?Yield, ?Decorator] - MetaProperty - newMemberExpression [?Yield, ?Decorator]Arguments [?Yield] - - - SuperProperty [Yield, Decorator]:[~Decorator]super[Expression [In, ?Yield]] - - - NewExpression [Yield, Decorator]:MemberExpression [?Yield, ?Decorator] - newNewExpression [?Yield, ?Decorator] - - - CallExpression [Yield, Decorator]:MemberExpression [?Yield, ?Decorator]Arguments [?Yield] - SuperCall [?Yield] - CallExpression [?Yield, ?Decorator]Arguments [?Yield] - [~Decorator]CallExpression [?Yield][Expression [In, ?Yield]] - CallExpression [?Yield, ?Decorator].IdentifierName - CallExpression [?Yield, ?Decorator]TemplateLiteral [?Yield] - - - LeftHandSideExpression [Yield, Decorator]:NewExpression [?Yield, ?Decorator] - CallExpression [?Yield, ?Decorator] - -
    - - -

    A.2Functions and Classes

    - - ClassDeclaration [Yield, Default]:DecoratorList [?Yield] optclassBindingIdentifier [?Yield]ClassTail [?Yield] - [+Default]DecoratorList [?Yield] optclassClassTail [?Yield] - - - ClassExpression [Yield, GeneratorParameter]:DecoratorList [?Yield] optclassBindingIdentifier [?Yield] optClassTail [?Yield, ?GeneratorParameter] - - - ClassElement [Yield]:DecoratorList [?Yield] optMethodDefinition [?Yield] - DecoratorList [?Yield] optstaticMethodDefinition [?Yield] - ; - - - DecoratorList [Yield]:DecoratorList [?Yield] optDecorator [?Yield] - - - Decorator [Yield]:@LeftHandSideExpression [Decorator, ?Yield] - -
    - - -

    A.3Scripts and Modules

    - - ExportDeclaration:export*FromClause; - exportExportClauseFromClause; - exportExportClause; - exportVariableStatement - export[lookahead ≠ @]Declaration - exportdefaultHoistableDeclaration [Default] - exportdefault[lookahead ≠ @]ClassDeclaration [Default] - exportdefault[lookahead ∉ { function, class, @ }]AssignmentExpression - DecoratorListexport[lookahead ≠ @]ClassDeclaration - DecoratorListexportdefault[lookahead ≠ @]ClassDeclaration [Default] - -
    -
    \ No newline at end of file diff --git a/spec/index.html b/spec/index.html deleted file mode 100644 index 7a4897c..0000000 --- a/spec/index.html +++ /dev/null @@ -1,605 +0,0 @@ - -Decorators - - - - -

    Decorators Proposal - ECMAScript

    - -

    Introduction

    -

    Proposal to add Decorators to ECMAScript.

    -

    For the TypeScript specific proposal, see http://rbuckton.github.io/reflectdecorators/typescript.html

    -
    - - -

    Terms

    - -

    Decorator

    - This section is non-normative. -

    A decorator is an expression that is evaluated after a class has been defined, that can be used to annotate or modify the class in some fashion. This expression must evaluate to a function, which is executed by the runtime to apply the decoration.

    -
    @decoratorExpression
    -class C {
    -}
    -
    -
    - -

    Class Decorator Function

    - This section is non-normative. -

    A class decorator function is a function that accepts a constructor function as its argument, and returns either undefined, the provided constructor function, or a new constructor function. Returning undefined is equivalent to returning the provided constructor function.

    -
    // A class decorator function
    -function dec(target) {  
    - // modify, annotate, or replace target...
    -}
    -
    -
    - -

    Property/Method Decorator Function

    - This section is non-normative. -

    A property decorator function is a function that accepts three arguments: The object that owns the property, the key for the property (a string or a symbol), and optionally the property descriptor of the property. The function must return either undefined, the provided property descriptor, or a new property descriptor. Returning undefined is equivalent to returning the provided property descriptor.

    -
    // A property (or method/accessor) decorator function
    -function dec(target, key, descriptor) {
    -  // annotate the target and key; or modify or replace the descriptor...
    -}
    -    
    -
    - -

    Decorator Factory

    - This section is non-normative. -

    A decorator factory is a function that can accept any number of arguments, and must return one of the above types of decorator function.

    -
    // a class decorator factory function
    -function dec(x, y) {
    -  // the class decorator function
    -  return function (target) {
    -      // modify, annotate, or replace target...
    -  }
    -}
    -
    -
    -
    - -

    Decorator Targets

    - This section is non-normative. -

    A decorator can be legally applied to any of the following:

    -
      -
    • A class declaration
    • -
    • A class property initializer (static or prototype)
    • -
    • A class method declaration (static or prototype)
    • -
    • A class get or set accessor declaration (static or prototype)
    • -
    -

    Please note that a decorator currently cannot be legally applied to any of the following:

    -
      -
    • A class constructor - This is to reduce ambiguity between where you can apply a decorator (on the class or on its constructor) and which of the above decorator function forms is called.
    • -
    • A function declaration - Decorators on a function declaration would introduce a TDZ (Temporal Dead Zone), which would make the function unreachable until its declaration is executed. This could cause confusion as an undecorated function declaration is hoisted and can be used in a statement preceeding the declaration.
    • -
    • A function expression - This is to reduce confusion and maintain parity with disallowing decorators on a function declaration.
    • -
    • An arrow function - This is to reduce confusion and maintain parity with disallowing decorators on a function expression.
    • -
    -

    This list may change in the future.

    -
    - -

    Decorator Evaluation and Application Order

    - This section is non-normative. -

    Decorators are evaluated in the order they appear preceeding their target declaration, to preserve side-effects due to evaluation order. Decorators are applied to their target declaration in reverse order, starting with the decorator closest to the declaration. This behavior is specified to preserve the expected behavior of decorators without a declarative syntax.

    -
    @F
    -@G
    -class C {   
    -}
    -
    -

    For example, the above listing could be approximately written without decorators in the following fashion:

    -
    C = F(G(C))
    -

    In the above example, the expression F is evaluated first, followed by the expression G. G is then called with the constructor function as its argument, followed by calling F with the result. The actual process of applying decorators is more complex than the above example however, though you may still imperatively apply decorators with a reflection API.

    -

    If a class declaration has decorators on both the class and any of its members or parameters, the decorators are applied using the following pseudocode:

    -
    -for each member M of class C
    -  if M is an accessor then
    -      let accessor = first accessor (get or set, in declaration order) of M
    -      let memberDecorators = decorators of accessor
    -      for each parameter of accessor
    -          let paramDecorators = decorators of parameter           
    -          let paramIndex = ordinal index of parameter
    -          Reflect.decorate(paramDecorators, accessor, paramIndex)
    -      next parameter
    -
    -      let accessor = second accessor (get or set, in declaration order) of M
    -      if accessor then
    -          let memberDecorators = memberDecorators + decorators of accessor
    -          for each parameter of accessor
    -              let paramDecorators = decorators of parameter           
    -              let paramIndex = ordinal index of parameter
    -              Reflect.decorate(paramDecorators, accessor, paramIndex)
    -          next parameter
    -      end if
    -  else if M is a method
    -      let memberDecorators = decorators of M
    -      for each parameter of M
    -          let paramDecorators = decorators of parameter           
    -          let paramIndex = ordinal index of parameter
    -          Reflect.decorate(paramDecorators, M, paramIndex)
    -      next parameter
    -  else
    -      let memberDecorators = decorators of M
    -  end if
    -
    -  let name = name of M
    -  let target = C.prototype if M is on the prototype; otherwise, C if M is static  
    -  Reflect.decorate(memberDecorators, C, name)
    -next member
    -
    -for each parameter of C
    -  let paramDecorators = decorators of parameter
    -  let paramIndex = ordinal index of parameter
    -  Reflect.decorate(paramDecorators, C, paramIndex)
    -next parameter
    -
    -let classDecorators = decorators of C
    -let C = Reflect.decorate(classDecorators, C)
    -  
    -
    - - -

    Abstract Operations

    - -

    Decorator Operations

    - -

    Decorate ( Decorators, O, P, desc )

    -

    When the abstract operation Decorate is called with ECMAScript language value Decorators, Object O, property key P, and property descriptor desc, the following steps are taken:

    - - 1. If _P_ is *undefined* and _desc_ is *undefined*, then - 1. If IsCallable(_O_) is not *true*, throw a *TypeError* exception. - 2. Return DecorateConstructor(_Decorators_, _O_). - 2. Else - 1. Return DecorateProperty(_Decorators_, _O_, _P_, _desc_). - -
    - -

    DecorateConstructor ( Decorators, F )

    -

    When the abstract operation DecorateConstructor is called with ECMAScript language value Decorators and Object F, the following steps are taken:

    - - 1. Let _result_ be _F_. - 2. Let _iterator_ be GetIterator(_Decorators_). - 3. Let _list_ be CreateListFromIterator(_iterator_, «Object»). - 4. For each _decorator_ in _list_ in reverse order - 1. Let _decorated_ be Call(_decorator_, *null*, _result_). - 2. ReturnIfAbrupt(_decorated_). - 3. If IsCallable(_decorated_), then - 1. Set _result_ to be _decorated_. - 4. Else if _decorated_ is not *undefined*, throw a *TypeError* exception. - -
    - -

    DecorateProperty ( Decorators, O, P, desc )

    -

    When the abstract operation DecorateProperty is called with ECMAScript language value Decorators, Object O, property key P, and property descriptor desc, the following steps are taken:

    - - 1. Let _result_ be _desc_. - 2. Let _key_ be ToPropertyKey(_P_). - 3. Let _iterator_ be GetIterator(_Decorators_). - 4. Let _list_ be CreateListFromIterator(_iterator_, «Object»). - 5. For each _decorator_ in _list_ in reverse order - 6. Let _decorated_ be Call(_decorator_, *null*, _O_, _key_, _result_). - 7. ReturnIfAbrupt(_decorated_). - 8. If Type(_decorated_) is Object, then - 1. Set _result_ to be _decorated_. - 9. Else if _decorated_ is not *undefined*, throw a *TypeError* exception. - -
    -
    - -

    Operations on Objects

    - -

    CreateListFromIterator ( iterator [, elementTypes] )

    -

    When the abstract operation CreateListFromIterator is called with ECMAScript language value iterator, the following steps are taken:

    - - 1. ReturnIfAbrupt(_iterator_). - 2. If _elementTypes_ was not passed, let _elementTypes_ be (Undefined, Null, Boolean, String, Symbol, Number, Object). - 3. Let _list_ be an empty List. - 4. Repeat - 1. Let _next_ be IteratorStep(_iterator_). - 2. ReturnIfAbrupt(_next_). - 3. If _next_ is *false*, return _list_. - 4. Let _nextValue_ be IteratorValue(_next_). - 5. ReturnIfAbrupt(_nextValue_). - 6. If Type(_nextValue_) is not an element of _elementTypes_, then - 1. Return IteratorClose(_iterator_, Completion{[[type]]: throw, [[value]]: a newly created *TypeError* object, [[target]: empty}). - 7. Append _nextValue_ as the last element of _list_. - -
    - -

    GetOrCreateMetadataMap ( O, P, Create )

    -

    When the abstract operation GetOrCreateMetadataMap is called with Object O, property key P, and Boolean Create the following steps are taken:

    - - 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. - 2. Let _metadataMap_ be *undefined*. - 3. Let _succeeded_ be *true*. - 4. Let _targetMetadata_ be the value of _O_'s [[Metadata]] internal slot. - 5. If _targetMetadata_ is *undefined*, then - 1. If _Create_ is *false*, return *undefined*. - 2. Set _targetMetadata_ to be a newly created *Map* object. - 3. Set the [[Metadata]] internal slot of _O_ to _targetMetadata_. - 6. Let _metadataMap_ be Invoke(_targetMetadata_, "get", _P_). - 7. ReturnIfAbrupt(_metadataMap_). - 8. If _metadataMap_ is *undefined*, then - 1. If _Create_ is *false*, return *undefined*. - 2. Set _metadataMap_ to be a newly created *Map* object. - 3. Let _setStatus_ be Invoke(_targetMetadata_, "set", _P_, _metadataMap_). - 4. ReturnIfAbrupt(_setStatus_). - 9. Return _metadataMap_. - -
    - -

    [[HasMetadata]] ( MetadataKey, P )

    -

    When the [[HasMetadata]] internal method of _O_ is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:

    - - 1. Return OrdinaryHasMetadata(_MetadataKey_, _O_, _P_). - -
    - -

    OrdinaryHasMetadata ( MetadataKey, O, P )

    -

    When the abstract operation OrdinaryHasMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:

    - - 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. - 2. Let _hasOwn_ be OrdinaryHasOwnMetadata(_MetadataKey_, _O_, _P_). - 3. If _hasOwn_ is *true*, return *true*. - 4. Let _parent_ be _O_.[[GetPrototypeOf]](). - 5. ReturnIfAbrupt(_parent_). - 6. If _parent_ is not *null*, then - 1. return parent.[[HasMetadata]](_MetadataKey_, _P_). - 7. Return *false*. - -
    - -

    [[HasOwnMetadata]] ( MetadataKey, P )

    -

    When the [[HasOwnMetadata]] internal method of _O_ is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:

    - - 1. Return OrdinaryHasOwnMetadata(_MetadataKey_, _O_, _P_). - -
    - -

    OrdinaryHasOwnMetadata ( MetadataKey, O, P )

    -

    When the abstract operation OrdinaryHasOwnMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:

    - - 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. - 2. Let _metadataMap_ be GetOrCreateMetadataMap(_O_, _P_, *false*). - 3. ReturnIfAbrupt(_metadataMap_). - 4. If _metadataMap_ is *undefined*, return *false*. - 5. Return Invoke(_metadataMap_, "has", _MetadataKey_). - -
    - -

    [[GetMetadata]] ( MetadataKey, P )

    -

    When the [[GetMatadata]] internal method of _O_ is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:

    - - 1. Return OrdinaryGetMetadata(_MetadataKey_, _O_, _P_). - -
    - -

    OrdinaryGetMetadata ( MetadataKey, O, P )

    -

    When the abstract operation OrdinaryGetMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:

    - - 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. - 2. Let _hasOwn_ be OrdinaryHasOwnMetadata(_MetadataKey_, _O_, _P_). - 3. If _hasOwn_ is *true*, then - 1. return OrdinaryGetOwnMetadata(_MetadataKey_, _O_, _P_). - 4. Let _parent_ be _O_.[[GetPrototypeOf]](). - 5. ReturnIfAbrupt(_parent_). - 6. If _parent_ is not *null*, then - 1. return parent.[[GetMetadata]](_MetadataKey_, _P_). - 7. Return *undefined*. - -
    - -

    [[GetOwnMetadata]] ( MetadataKey, P, ParamIndex )

    -

    When the [[GetOwnMetadata]] internal method of _O_ is called with ECMAScript language value MetadataKey and property key P, the following steps are taken:

    - - 1. Return OrdinaryGetOwnMetadata(_MetadataKey_, _O_, _P_). - -
    - -

    OrdinaryGetOwnMetadata ( MetadataKey, O, P )

    -

    When the abstract operation OrdinaryGetOwnMetadata is called with ECMAScript language value MetadataKey, Object O, and property key P, the following steps are taken:

    - - 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. - 2. Let _metadataMap_ be GetOrCreateMetadataMap(_O_, _P_, *false*). - 3. ReturnIfAbrupt(_metadataMap_). - 4. If _metadataMap_ is *undefined*, return *undefined*. - 5. Return Invoke(_metadataMap_, "get", _MetadataKey_). - -
    - -

    [[DefineOwnMetadata]] ( MetadataKey, MetadataValue, P )

    -

    When the [[DefineOwnMetadata]] internal method of _O_ is called with ECMAScript language value MetadataKey, ECMAScript language value MetadataValue, and property key P, the following steps are taken:

    - - 1. Return OrdinaryDefineOwnMetadata(_MetadataKey_, _MetadataValue_, _O_, _P_) - -
    - -

    OrdinaryDefineOwnMetadata ( MetadataKey, MetadataValue, O, P )

    -

    When the abstract operation OrdinaryDefineOwnProperty is called with ECMAScript language value MetadataKey, ECMAScript language value MetadataValue, Object O, and property key P, the following steps are taken:

    - - 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. - 2. Let _metadataMap_ be GetOrCreateMetadataMap(_O_, _P_, *true*). - 3. ReturnIfAbrupt(_metadataMap_). - 4. Return Invoke(_metadataMap_, "set", _MetadataKey_, _MetadataValue_). - -
    - -

    [[MetadataKeys]] ( P )

    -

    When the [[MetadataKeys]] internal method of O is called with property key P the following steps are taken:

    - - 1. Return OrdinaryMetadataKeys(_O_, _P_). - -
    - -

    OrdinaryMetadataKeys ( O, P )

    -

    When the abstract operation OrdinaryMetadataKeys is called with Object O and property key P the following steps are taken:

    - - 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. - 2. Let _ownKeys_ be OrdinaryOwnMetadataKeys(_O_, _P_). - 3. Let _parent_ = _O_.[[GetPrototypeOf]](). - 4. ReturnIfAbrupt(_parent_). - 5. If _parent_ is *null*, then return _ownKeys_. - 6. Let _parentKeys_ be O.[[OrdinaryMetadataKeys]](_P_). - 7. ReturnIfAbrupt(_parentKeys_). - 8. Let _ownKeysLen_ = Get(_ownKeys_, "length"). - 9. ReturnIfAbrupt(_ownKeysLen_). - 10. If _ownKeysLen_ is 0, return _parentKeys_. - 11. Let _parentKeysLen_ = Get(_parentKeys_, "length"). - 12. ReturnIfAbrupt(_parentKeysLen_). - 13. If _parentKeysLen_ is 0, return _ownKeys_. - 14. Let _set_ be a newly created *Set* object. - 15. Let _keys_ be ArrayCreate(0). - 16. Let _k_ be 0. - 17. For each element _key_ of _ownKeys_ - 1. Let _hasKey_ be Invoke(_set_, "has", _key_). - 2. ReturnIfAbrupt(_hasKey_). - 3. If _hasKey_ is *false*, then - 1. Let _Pk_ be ToString(_k_). - 2. Let _addStatus_ be Invoke(_set_, "add", _key_). - 3. ReturnIfAbrupt(_addStatus_). - 4. Let _defineStatus_ be CreateDataPropertyOrThrow(_keys_, _Pk_, _key_). - 5. ReturnIfAbrupt(_defineStatus_). - 6. Increase _k_ by 1. - 18. For each element _key_ of _parentKeys_ - 1. Let _hasKey_ be Invoke(_set_, "has", _key_). - 2. ReturnIfAbrupt(_hasKey_). - 3. If _hasKey_ is *false*, then - 1. Let _Pk_ be ToString(_k_). - 2. Let _addStatus_ be Invoke(_set_, "add", _key_). - 3. ReturnIfAbrupt(_addStatus_). - 4. Let _defineStatus_ be CreateDataPropertyOrThrow(_keys_, _Pk_, _key_). - 5. ReturnIfAbrupt(_defineStatus_). - 6. Increase _k_ by 1. - 19. Let _setStatus_ be Set(_keys_, "length", _k_). - 20. ReturnIfAbrupt(_setStatus_). - 21. return _keys_. - -
    - -

    [[OwnMetadataKeys]] ( P )

    -

    When the [[OwnMetadataKeys]] internal method of O is called with property key P the following steps are taken:

    - - 1. Return OrdinaryOwnMetadataKeys(_O_, _P_). - -
    - -

    OrdinaryOwnMetadataKeys ( O, P )

    -

    When the abstract operation OrdinaryOwnMetadataKeys is called with Object O and property key P the following steps are taken:

    - - 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. - 2. Let _keys_ be ArrayCreate(0). - 3. Let _metadataMap_ be GetOrCreateMetadataMap(_O_, _P_, *false*). - 4. ReturnIfAbrupt(_metadataMap_). - 5. If _metadataMap_ is *undefined*, return _keys_. - 6. Let _keysObj_ be Invoke(_metadataMap_, "keys"). - 7. ReturnIfAbrupt(_keysObj_). - 8. Let _iterator_ be GetIterator(_keysObj_). - 9. ReturnIfAbrupt(_iterator_). - 10. Let _k_ be 0. - 11. Repeat - 1. Let _Pk_ be ToString(k). - 2. Let _next_ be IteratorStep(_iterator_). - 3. ReturnIfAbrupt(_next_). - 4. If _next_ is *false*, then - 1. Let _setStatus_ be Set(_keys_, "length", _k_, _true_). - 2. ReturnIfAbrupt(_setStatus_). - 3. Return _keys_. - 5. Let _nextValue_ be IteratorValue(_next_). - 6. ReturnIfAbrupt(_nextValue_). - 7. Let _defineStatus_ be CreateDataPropertyOrThrow(_keys_, _Pk_, _nextValue_). - 8. If _defineStatus_ is an abrupt completion, return IteratorClose(_iterator_, _defineStatus_). - 9. Increase _k_ by 1. - -
    - -

    [[DeleteMetadata]]( MetadataKey, P )

    -

    When the [[DeleteMetadata]] internal method of O is called with ECMAScript language value MetadataKey and property key P the following steps are taken:

    - - 1. Assert: _P_ is *undefined* or IsPropertyKey(_P_) is *true*. - 2. Let _metadataMap_ be GetOrCreateMetadataMap(_O_, _P_, *false*). - 3. ReturnIfAbrupt(_metadataMap_). - 4. If _metadataMap_ is *undefined*, return *false*. - 5. Return Invoke(_metadataMap_, "delete", _MetadataKey_). - -
    -
    -
    - - -

    Reflection

    - -

    The Reflect Object

    -

    This section contains amendments to the Reflect object.

    - A shim for this API can be found here: https://github.com/rbuckton/ReflectDecorators - -

    Metadata Decorator Functions

    -

    A metadata decorator function is an anonymous built-in function that has [[MetadataKey]] and [[MetadataValue]] internal slots.

    -

    When a metadata decorator function F is called with arguments target and key, the following steps are taken:

    - - 1. Assert: _F_ has a [[MetadataKey]] internal slot whose value is an ECMAScript language value, or *undefined*. - 2. Assert: _F_ has a [[MetadataValue]] internal slot whose value is an ECMAScript language value, or *undefined*. - 3. If Type(_target_) is not Object, throw a *TypeError* exception. - 4. If _key_ is not *undefined* and IsPropertyKey(_key_) is *false*, throw a *TypeError* exception. - 5. Let _metadataKey_ be the value of _F_'s [[MetadataKey]] internal slot. - 6. Let _metadataValue_ be the value of _F_'s [[MetadataValue]] internal slot. - 7. Return target.[[DefineMetadata]](_metadataKey_, _metadataValue_, _target_, _key_). - -
    - -

    Reflect.decorate ( decorators, target, propertyKey, attributes )

    -

    When the decorator function is called with arguments decorators, target, propertyKey, and attributes, the following steps are taken:

    - - 1. If Type(_decorators_) is not Object, throw a *TypeError* exception. - 2. If Type(_target_) is not Object, throw a *TypeError* exception. - 3. Let _key_ be ToPropertyKey(_propertyKey_). - 4. ReturnIfAbrupt(_propertyKey_). - 5. Let _desc_ be ToPropertyDescriptor(_attributes_). - 6. ReturnIfAbrupt(_desc_). - 7. Return Decorate(_decorators_, _target_, _propertyKey_, _desc_). - -
    - -

    Reflect.metadata ( metadataKey, metadataValue )

    -

    When the metadata function is called with arguments metadataKey and metadataValue, the following steps are taken:

    - - 1. Let _decorator_ be a new built-in function object as defined in Metadata Decorator Functions. - 2. Set the [[MetadataKey]] internal slot of _decorator_ to _metadataKey_. - 3. Set the [[MetadataValue]] internal slot of _decorator_ to _metadataValue_. - 4. return _decorator_. - -
    - -

    Reflect.defineMetadata ( metadataKey, metadataValue, target, propertyKey )

    -

    When the defineMetadata function is called with arguments metadataKey, metadataValue, target, and propertyKey, the following steps are taken:

    - - 1. If Type(_target_) is not Object, throw a *TypeError* exception. - 2. return target.[[DefineMetadata]](_metadataKey_, _metadataValue_, _propertyKey_). - -
    - -

    Reflect.hasMetadata ( metadataKey, target, propertyKey )

    -

    When the hasMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    - - 1. If Type(_target_) is not Object, throw a *TypeError* exception. - 2. return target.[[HasMetadata]](_metadataKey_, _propertyKey_). - -
    - -

    Reflect.hasOwnMetadata ( metadataKey, target, propertyKey )

    -

    When the hasOwnMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    - - 1. If Type(_target_) is not Object, throw a *TypeError* exception. - 2. return target.[[HasOwn]](_metadataKey_, _propertyKey_). - -
    - -

    Reflect.getMetadata ( metadataKey, target, propertyKey )

    -

    When the getMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    - - 1. If Type(_target_) is not Object, throw a *TypeError* exception. - 2. return target.[[GetMetadata]](_metadataKey_, _propertyKey_). - -
    - -

    Reflect.getOwnMetadata ( metadataKey, target, propertyKey )

    -

    When the getOwnMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    - - 1. If Type(_target_) is not Object, throw a *TypeError* exception. - 2. return target.[[GetOwnMetadata]](_metadataKey_, _propertyKey_). - -
    - -

    Reflect.getMetadataKeys ( target, propertyKey )

    -

    When the getMetadataKeys function is called with arguments target and propertyKey, the following steps are taken:

    - - 1. If Type(_target_) is not Object, throw a *TypeError* exception. - 2. return target.[[GetMetadataKeys]](_propertyKey_). - -
    - -

    Reflect.getOwnMetadataKeys ( target, propertyKey )

    -

    When the getOwnMetadataKeys function is called with arguments target and propertyKey, the following steps are taken:

    - - 1. If Type(_target_) is not Object, throw a *TypeError* exception. - 2. return target.[[GetOwnMetadataKeys]](_propertyKey_). - -
    - -

    Reflect.deleteMetadata ( metadataKey, target, propertyKey )

    -

    When the deleteMetadata function is called with arguments metadataKey, target, and propertyKey, the following steps are taken:

    - - 1. If Type(_target_) is not Object, throw a *TypeError* exception. - 2. return target.[[DeleteMetadata]](_metadataKey_, _propertyKey_). - -
    -
    -
    - -

    Grammar

    - -

    Expressions

    - - PrimaryExpression - MemberExpression[Expression] - MemberExpression.IdentifierName - MemberExpressionTemplateLiteral - SuperProperty - MetaProperty - newMemberExpressionArguments - - - super[Expression] - - - MemberExpression - newNewExpression - - - MemberExpression Arguments - SuperCall - CallExpression Arguments - CallExpression [ Expression ] - CallExpression . IdentifierName - CallExpression TemplateLiteral - - - NewExpression - CallExpression - -
    - - -

    Functions and Classes

    - - DecoratorList class BindingIdentifier ClassTail - DecoratorList class ClassTail - - - DecoratorList class BindingIdentifier ClassTail - - - DecoratorList MethodDefinition - DecoratorList static MethodDefinition - ; - - - DecoratorList Decorator - - - @ LeftHandSideExpression - -
    - - -

    Scripts and Modules

    - - export * FromClause ; - export ExportClause FromClause ; - export ExportClause ; - export VariableStatement - export lookahead ≠ @ Declaration - export default HoistableDeclaration - export default lookahead ≠ @ ClassDeclaration - export default lookahead ∉ { function, class, @ } AssignmentExpression - DecoratorList export lookahead ≠ @ ClassDeclaration - DecoratorList export default lookahead ≠ @ ClassDeclaration - -
    -
    \ No newline at end of file diff --git a/spec/typescript-out.html b/spec/typescript-out.html deleted file mode 100644 index 7c7cc0c..0000000 --- a/spec/typescript-out.html +++ /dev/null @@ -1,441 +0,0 @@ - - -Decorators - - - - -

    Decorators Proposal - TypeScript

    - -

    Introduction

    -

    Proposal to add Decorators to TypeScript.

    -

    For the ECMAScript specific proposal, see http://rbuckton.github.io/reflectdecorators/index.html

    -
    - - -

    1Terms

    - -

    1.1Decorator

    - NoteThis section is non-normative. -

    A decorator is an expression that is evaluated after a class has been defined, that can be used to annotate or modify the class in some fashion. This expression must evaluate to a function, which is executed by the runtime to apply the decoration.

    -
    @decoratorExpression
    -class C {
    -}
    -
    -
    - -

    1.2Class Decorator Function

    - NoteThis section is non-normative. -

    A class decorator function is a function that accepts a constructor function as its argument, and returns either undefined, the provided constructor function, or a new constructor function. Returning undefined is equivalent to returning the provided constructor function.

    -
    // A class decorator function
    -function dec(target) {  
    - // modify, annotate, or replace target...
    -}
    -
    -
    - -

    1.3Property/Method Decorator Function

    - NoteThis section is non-normative. -

    A property decorator function is a function that accepts three arguments: The object that owns the property, the key for the property (a string or a symbol), and optionally the property descriptor of the property. The function must return either undefined, the provided property descriptor, or a new property descriptor. Returning undefined is equivalent to returning the provided property descriptor.

    -
    // A property (or method/accessor) decorator function
    -function dec(target, key, descriptor) {
    -  // annotate the target and key; or modify or replace the descriptor...
    -}
    -    
    -
    - -

    1.4Parameter Decorator Function

    - NoteThis section is non-normative. -

    A parameter decorator function is a function that accepts three arguments: The function that contains the decorated parameter, the property key of the member (or undefined for a parameter of the constructor), and the ordinal index of the parameter. The return value of this decorator is ignored.

    -
    
    -// A parameter decorator
    -function dec(target, paramIndex) {
    -    // annotate the target and index
    -}
    -
    -
    - -

    1.5Decorator Factory

    - NoteThis section is non-normative. -

    A decorator factory is a function that can accept any number of arguments, and must return one of the above types of decorator function.

    -
    // a class decorator factory function
    -function dec(x, y) {
    -  // the class decorator function
    -  return function (target) {
    -      // modify, annotate, or replace target...
    -  }
    -}
    -
    -
    -
    - -

    2Decorator Targets

    - NoteThis section is non-normative. -

    A decorator can be legally applied to any of the following:

    -
      -
    • A class declaration
    • -
    • A class property initializer (static or prototype)
    • -
    • A class method declaration (static or prototype)
    • -
    • A class get or set accessor declaration (static or prototype)
    • -
    • A parameter of a class constructor
    • -
    • A parameter of a class method (static or prototype)
    • -
    • A parameter of a class get or set accessor (static or prototype)
    • -
    -

    Please note that a decorator currently cannot be legally applied to any of the following:

    -
      -
    • A class constructor - This is to reduce ambiguity between where you can apply a decorator (on the class or on its constructor) and which of the above decorator function forms is called.
    • -
    • A function declaration - Decorators on a function declaration would introduce a TDZ (Temporal Dead Zone), which would make the function unreachable until its declaration is executed. This could cause confusion as an undecorated function declaration is hoisted and can be used in a statement preceeding the declaration.
    • -
    • A function expression - This is to reduce confusion and maintain parity with disallowing decorators on a function declaration.
    • -
    • An arrow function - This is to reduce confusion and maintain parity with disallowing decorators on a function expression.
    • -
    -

    This list may change in the future.

    -
    - -

    3Decorator Evaluation and Application Order

    - NoteThis section is non-normative. -

    Decorators are evaluated in the order they appear preceeding their target declaration, to preserve side-effects due to evaluation order. Decorators are applied to their target declaration in reverse order, starting with the decorator closest to the declaration. This behavior is specified to preserve the expected behavior of decorators without a declarative syntax.

    -
    @F
    -@G
    -class C {   
    -}
    -
    -

    For example, the above listing could be approximately written without decorators in the following fashion:

    -
    C = F(G(C))
    -

    In the above example, the expression F is evaluated first, followed by the expression G. G is then called with the constructor function as its argument, followed by calling F with the result. The actual process of applying decorators is more complex than the above example however, though you may still imperatively apply decorators with a reflection API.

    -

    If a class declaration has decorators on both the class and any of its members or parameters, the decorators are applied using the following pseudocode:

    -
    for each member M of class C
    -  if M is an accessor then
    -      let accessor = first accessor (get or set, in declaration order) of M
    -      let memberDecorators = decorators of accessor
    -      for each parameter of accessor
    -          let paramDecorators = decorators of parameter           
    -          let paramIndex = ordinal index of parameter
    -          Reflect.decorate(paramDecorators, accessor, paramIndex)
    -      next parameter
    -
    -      let accessor = second accessor (get or set, in declaration order) of M
    -      if accessor then
    -          let memberDecorators = memberDecorators + decorators of accessor
    -          for each parameter of accessor
    -              let paramDecorators = decorators of parameter           
    -              let paramIndex = ordinal index of parameter
    -              Reflect.decorate(paramDecorators, accessor, paramIndex)
    -          next parameter
    -      end if
    -  else if M is a method
    -      let memberDecorators = decorators of M
    -      for each parameter of M
    -          let paramDecorators = decorators of parameter           
    -          let paramIndex = ordinal index of parameter
    -          Reflect.decorate(paramDecorators, M, paramIndex)
    -      next parameter
    -  else
    -      let memberDecorators = decorators of M
    -  end if
    -
    -  let name = name of M
    -  let target = C.prototype if M is on the prototype; otherwise, C if M is static  
    -  Reflect.decorate(memberDecorators, C, name)
    -next member
    -
    -for each parameter of C
    -  let paramDecorators = decorators of parameter
    -  let paramIndex = ordinal index of parameter
    -  Reflect.decorate(paramDecorators, C, paramIndex)
    -next parameter
    -
    -let classDecorators = decorators of C
    -let C = Reflect.decorate(classDecorators, C)
    -  
    -
    - - -

    4Reflect API

    - NoteThis section is non-normative. -

    In addition to a declarative approach to defining decorators, it is necessary to also include an imperative API capable of applying decorators, as well as defining, reflecting over, and removing decorator metadata from an object, property, or parameter.

    -

    A shim for this API can be found here: https://github.com/rbuckton/ReflectDecorators

    -
    Reflect.decorate(decorators, target, propertyKey?, descriptor?)
    -
    - - -

    5Transformation

    -

    The following are examples of how decorators can be desugared to ES6 (through a transpiler such as TypeScript). These examples levarage an imperative reflection API.

    - -

    5.1Class Declaration

    -

    Syntax

    -
    @F("color")
    -@G
    -class C {  
    -}
    -    
    -

    ES6 Transformation

    -
    let C = class {
    -}
    -Object.defineProperty(C, "name", { value: "C", configurable: true });
    -C = __decorate([F("color"), G], C);
    -    
    -
    - - -

    5.2Class Declaration (Exported)

    -

    Syntax

    -
    @F("color")
    -@G
    -export class C {
    -}
    -    
    -

    ES6 Transformation

    -
    export let C = class {
    -}
    -Object.defineProperty(C, "name", { value: "C", configurable: true });
    -C = __decorate([F("color"), G], C);
    -    
    -
    - - -

    5.3Class Declaration (Default, Exported)

    -

    Syntax

    -
    @F("color")
    -@G
    -export default class C {
    -}
    -    
    -

    ES6 Transformation

    -
    let C = class {
    -}
    -Object.defineProperty(C, "name", { value: "C", configurable: true });
    -C = __decorate([F("color"), G], C);
    -export default C;
    -    
    -
    - - -

    5.4Class Method Declaration

    -

    Syntax

    -
    class C {
    -    @F("color")
    -    @G
    -    method() { }
    -}
    -    
    -

    ES6 Transformation

    -
    class C {
    -    method() { }
    -}
    -Object.defineProperty(C.prototype, "method", 
    -    __decorate([F("color"), G], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
    -    
    -
    - - -

    5.5Class Accessor Declaration

    -

    Syntax

    -
    class C {
    -    @F("color")
    -    @G
    -    get accessor() { }
    -    set accessor(value) { }
    -}
    -    
    -

    ES6 Transformation

    -
    class C {
    -    get accessor() { }
    -    set accessor(value) { }
    -}
    -Object.defineProperty(C.prototype, "accessor", 
    -    __decorate([F("color"), G], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
    -    
    -
    - - -

    5.6Class Property Declaration

    -

    Syntax

    -
    class C {
    -    @F("color")
    -    @G
    -    property = 1;
    -}
    -    
    -

    ES6 Transformation

    -
    class C {
    -    constructor() {
    -        this.property = 1;
    -    }
    -}
    -__decorate([F("color"), G], C.prototype, "property");
    -    
    -
    - - -

    5.7Class Constructor Parameter Declaration

    -

    Syntax

    -
    class C {
    -    constructor(@F("color") @G p) { }
    -}
    -    
    -

    ES6 Transformation

    -
    class C {
    -    constructor(p) { }
    -}
    -__decorate([F("color"), G], C, void 0, 0);
    -    
    -
    - - -

    5.8Class Method Parameter Declaration

    -

    Syntax

    -
    class C {
    -    method(@F("color") @G p) { }
    -}
    -    
    -

    ES6 Transformation

    -
    class C {
    -    method(p) { }
    -}
    -__decorate([F("color"), G], C.prototype, "method", 0);
    -    
    -
    - - -

    5.9Class Set Accessor Parameter Declaration

    -

    Syntax

    -
    class C {
    -    set accessor(@F("color") @G p) { }
    -}
    -    
    -

    ES6 Transformation

    -
    class C {
    -    set accessor(p) { }
    -}
    -__decorate([F("color"), G], C.prototype, "accessor", 0);
    -    
    -
    - -
    - - -

    AGrammar

    - -

    A.1Expressions

    - - MemberExpression [Yield, Decorator]:PrimaryExpression [?Yield] - [~Decorator]MemberExpression [?Yield, ?Decorator][Expression [In, ?Yield]] - MemberExpression [?Yield, ?Decorator].IdentifierName - MemberExpression [?Yield, ?Decorator]TemplateLiteral [?Yield] - SuperProperty [?Yield, ?Decorator] - MetaProperty - newMemberExpression [?Yield, ?Decorator]Arguments [?Yield] - - - SuperProperty [Yield, Decorator]:[~Decorator]super[Expression [In, ?Yield]] - - - NewExpression [Yield, Decorator]:MemberExpression [?Yield, ?Decorator] - newNewExpression [?Yield, ?Decorator] - - - CallExpression [Yield, Decorator]:MemberExpression [?Yield, ?Decorator]Arguments [?Yield] - SuperCall [?Yield] - CallExpression [?Yield, ?Decorator]Arguments [?Yield] - [~Decorator]CallExpression [?Yield][Expression [In, ?Yield]] - CallExpression [?Yield, ?Decorator].IdentifierName - CallExpression [?Yield, ?Decorator]TemplateLiteral [?Yield] - - - LeftHandSideExpression [Yield, Decorator]:NewExpression [?Yield, ?Decorator] - CallExpression [?Yield, ?Decorator] - -
    - - -

    A.2Functions and Classes

    - - StrictFormalParameters [Yield, GeneratorParameter, ClassParameter]:FormalParameters [?Yield, ?GeneratorParameter, ?ClassParameter] - - - FormalParameters [Yield, GeneratorParameter, ClassParameter]:[empty] - FormalParameterList [?Yield, ?GeneratorParameter, ?ClassParameter] - - - FormalParameterList [Yield, GeneratorParameter, ClassParameter]:FunctionRestParameter [?Yield, ?ClassParameter] - FormalsList [?Yield, ?GeneratorParameter, ?ClassParameter] - FormalsList [?Yield, ?GeneratorParameter, ?ClassParameter],FunctionRestParameter [?Yield, ?ClassParameter] - - - FormalsList [Yield, GeneratorParameter, ClassParameter]:FormalParameter [?Yield, ?GeneratorParameter, ?ClassParameter] - FormalsList [?Yield, ?GeneratorParameter, ?ClassParameter],FormalParameter [?Yield, ?GeneratorParameter, ?ClassParameter] - - - FunctionRestParameter [Yield, ClassParameter]:BindingRestElement [?Yield] - [+ClassParameter]DecoratorListBindingRestElement [?Yield] - - - FormalParameter [Yield, GeneratorParameter, ClassParameter]:BindingElement [?Yield, ?GeneratorParameter] - [+ClassParameter]DecoratorListBindingElement [?Yield, ?GeneratorParameter] - - - MethodDefinition [Yield, ClassParameter]:PropertyName [?Yield](StrictFormalParameters [?ClassParameter]){FunctionBody} - GeneratorMethod [?Yield, ?ClassParameter] - getPropertyName [?Yield](){FunctionBody} - setPropertyName [?Yield](PropertySetParameterList [?ClassParameter]){FunctionBody} - - - GeneratorMethod [Yield, ClassParameter]:*PropertyName [?Yield](StrictFormalParameters [Yield, GeneratorParameter, ?ClassParameter]){GeneratorBody} - - - ClassDeclaration [Yield, Default]:DecoratorList [?Yield] optclassBindingIdentifier [?Yield]ClassTail [?Yield] - [+Default]DecoratorList [?Yield] optclassClassTail [?Yield] - - - ClassExpression [Yield, GeneratorParameter]:DecoratorList [?Yield] optclassBindingIdentifier [?Yield] optClassTail [?Yield, ?GeneratorParameter] - - - ClassElement [Yield]:DecoratorList [?Yield] optMethodDefinition [ClassParameter, ?Yield] - DecoratorList [?Yield] optstaticMethodDefinition [ClassParameter, ?Yield] - DecoratorList [?Yield] optstaticPropertyNameInitializer [In, ?Yield] opt; - ; - - - DecoratorList [Yield]:DecoratorList [?Yield] optDecorator [?Yield] - - - Decorator [Yield]:@LeftHandSideExpression [Decorator, ?Yield] - -
    - - -

    A.3Scripts and Modules

    - - ExportDeclaration:export*FromClause; - exportExportClauseFromClause; - exportExportClause; - exportVariableStatement - export[lookahead ≠ @]Declaration - exportdefaultHoistableDeclaration [Default] - exportdefault[lookahead ≠ @]ClassDeclaration [Default] - exportdefault[lookahead ∉ { function, class, @ }]AssignmentExpression - DecoratorListexport[lookahead ≠ @]ClassDeclaration - DecoratorListexportdefault[lookahead ≠ @]ClassDeclaration [Default] - -
    -
    - -

    BTypeScript

    - -

    B.1TypeScript Definitions

    -
    interface TypedPropertyDescriptor<T> {  
    -    enumerable?: boolean;  
    -    configurable?: boolean;  
    -    writable?: boolean;  
    -    value?: T;  
    -    get?: () => T;  
    -    set?: (value: T) => void;  
    -}  
    -
    -type ClassDecorator = <TFunction extends Function>(target: TFunction): TFunction | void;
    -type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
    -type PropertyDecorator = (target: Object, propertyKey: string | symbol): void;
    -type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number): void;
    -
    -
    -
    \ No newline at end of file diff --git a/spec/typescript.html b/spec/typescript.html deleted file mode 100644 index c24eeef..0000000 --- a/spec/typescript.html +++ /dev/null @@ -1,441 +0,0 @@ - -Decorators - - - - -

    Decorators Proposal - TypeScript

    - -

    Introduction

    -

    Proposal to add Decorators to TypeScript.

    -

    For the ECMAScript specific proposal, see http://rbuckton.github.io/reflectdecorators/index.html

    -
    - - -

    Terms

    - -

    Decorator

    - This section is non-normative. -

    A decorator is an expression that is evaluated after a class has been defined, that can be used to annotate or modify the class in some fashion. This expression must evaluate to a function, which is executed by the runtime to apply the decoration.

    -
    @decoratorExpression
    -class C {
    -}
    -
    -
    - -

    Class Decorator Function

    - This section is non-normative. -

    A class decorator function is a function that accepts a constructor function as its argument, and returns either undefined, the provided constructor function, or a new constructor function. Returning undefined is equivalent to returning the provided constructor function.

    -
    // A class decorator function
    -function dec(target) {  
    - // modify, annotate, or replace target...
    -}
    -
    -
    - -

    Property/Method Decorator Function

    - This section is non-normative. -

    A property decorator function is a function that accepts three arguments: The object that owns the property, the key for the property (a string or a symbol), and optionally the property descriptor of the property. The function must return either undefined, the provided property descriptor, or a new property descriptor. Returning undefined is equivalent to returning the provided property descriptor.

    -
    // A property (or method/accessor) decorator function
    -function dec(target, key, descriptor) {
    -  // annotate the target and key; or modify or replace the descriptor...
    -}
    -    
    -
    - -

    Parameter Decorator Function

    - This section is non-normative. -

    A parameter decorator function is a function that accepts three arguments: The function that contains the decorated parameter, the property key of the member (or undefined for a parameter of the constructor), and the ordinal index of the parameter. The return value of this decorator is ignored.

    -
    
    -// A parameter decorator
    -function dec(target, paramIndex) {
    -    // annotate the target and index
    -}
    -
    -
    - -

    Decorator Factory

    - This section is non-normative. -

    A decorator factory is a function that can accept any number of arguments, and must return one of the above types of decorator function.

    -
    // a class decorator factory function
    -function dec(x, y) {
    -  // the class decorator function
    -  return function (target) {
    -      // modify, annotate, or replace target...
    -  }
    -}
    -
    -
    -
    - -

    Decorator Targets

    - This section is non-normative. -

    A decorator can be legally applied to any of the following:

    -
      -
    • A class declaration
    • -
    • A class property initializer (static or prototype)
    • -
    • A class method declaration (static or prototype)
    • -
    • A class get or set accessor declaration (static or prototype)
    • -
    • A parameter of a class constructor
    • -
    • A parameter of a class method (static or prototype)
    • -
    • A parameter of a class get or set accessor (static or prototype)
    • -
    -

    Please note that a decorator currently cannot be legally applied to any of the following:

    -
      -
    • A class constructor - This is to reduce ambiguity between where you can apply a decorator (on the class or on its constructor) and which of the above decorator function forms is called.
    • -
    • A function declaration - Decorators on a function declaration would introduce a TDZ (Temporal Dead Zone), which would make the function unreachable until its declaration is executed. This could cause confusion as an undecorated function declaration is hoisted and can be used in a statement preceeding the declaration.
    • -
    • A function expression - This is to reduce confusion and maintain parity with disallowing decorators on a function declaration.
    • -
    • An arrow function - This is to reduce confusion and maintain parity with disallowing decorators on a function expression.
    • -
    -

    This list may change in the future.

    -
    - -

    Decorator Evaluation and Application Order

    - This section is non-normative. -

    Decorators are evaluated in the order they appear preceeding their target declaration, to preserve side-effects due to evaluation order. Decorators are applied to their target declaration in reverse order, starting with the decorator closest to the declaration. This behavior is specified to preserve the expected behavior of decorators without a declarative syntax.

    -
    @F
    -@G
    -class C {   
    -}
    -
    -

    For example, the above listing could be approximately written without decorators in the following fashion:

    -
    C = F(G(C))
    -

    In the above example, the expression F is evaluated first, followed by the expression G. G is then called with the constructor function as its argument, followed by calling F with the result. The actual process of applying decorators is more complex than the above example however, though you may still imperatively apply decorators with a reflection API.

    -

    If a class declaration has decorators on both the class and any of its members or parameters, the decorators are applied using the following pseudocode:

    -
    -for each member M of class C
    -  if M is an accessor then
    -      let accessor = first accessor (get or set, in declaration order) of M
    -      let memberDecorators = decorators of accessor
    -      for each parameter of accessor
    -          let paramDecorators = decorators of parameter           
    -          let paramIndex = ordinal index of parameter
    -          Reflect.decorate(paramDecorators, accessor, paramIndex)
    -      next parameter
    -
    -      let accessor = second accessor (get or set, in declaration order) of M
    -      if accessor then
    -          let memberDecorators = memberDecorators + decorators of accessor
    -          for each parameter of accessor
    -              let paramDecorators = decorators of parameter           
    -              let paramIndex = ordinal index of parameter
    -              Reflect.decorate(paramDecorators, accessor, paramIndex)
    -          next parameter
    -      end if
    -  else if M is a method
    -      let memberDecorators = decorators of M
    -      for each parameter of M
    -          let paramDecorators = decorators of parameter           
    -          let paramIndex = ordinal index of parameter
    -          Reflect.decorate(paramDecorators, M, paramIndex)
    -      next parameter
    -  else
    -      let memberDecorators = decorators of M
    -  end if
    -
    -  let name = name of M
    -  let target = C.prototype if M is on the prototype; otherwise, C if M is static  
    -  Reflect.decorate(memberDecorators, C, name)
    -next member
    -
    -for each parameter of C
    -  let paramDecorators = decorators of parameter
    -  let paramIndex = ordinal index of parameter
    -  Reflect.decorate(paramDecorators, C, paramIndex)
    -next parameter
    -
    -let classDecorators = decorators of C
    -let C = Reflect.decorate(classDecorators, C)
    -  
    -
    - - -

    Reflect API

    - This section is non-normative. -

    In addition to a declarative approach to defining decorators, it is necessary to also include an imperative API capable of applying decorators, as well as defining, reflecting over, and removing decorator metadata from an object, property, or parameter.

    -

    A shim for this API can be found here: https://github.com/rbuckton/ReflectDecorators

    -
    Reflect.decorate(decorators, target, propertyKey?, descriptor?)
    -
    - - -

    Transformation

    -

    The following are examples of how decorators can be desugared to ES6 (through a transpiler such as TypeScript). These examples levarage an imperative reflection API.

    - -

    Class Declaration

    -

    Syntax

    -
    @F("color")
    -@G
    -class C {  
    -}
    -    
    -

    ES6 Transformation

    -
    let C = class {
    -}
    -Object.defineProperty(C, "name", { value: "C", configurable: true });
    -C = __decorate([F("color"), G], C);
    -    
    -
    - - -

    Class Declaration (Exported)

    -

    Syntax

    -
    @F("color")
    -@G
    -export class C {
    -}
    -    
    -

    ES6 Transformation

    -
    export let C = class {
    -}
    -Object.defineProperty(C, "name", { value: "C", configurable: true });
    -C = __decorate([F("color"), G], C);
    -    
    -
    - - -

    Class Declaration (Default, Exported)

    -

    Syntax

    -
    @F("color")
    -@G
    -export default class C {
    -}
    -    
    -

    ES6 Transformation

    -
    let C = class {
    -}
    -Object.defineProperty(C, "name", { value: "C", configurable: true });
    -C = __decorate([F("color"), G], C);
    -export default C;
    -    
    -
    - - -

    Class Method Declaration

    -

    Syntax

    -
    class C {
    -    @F("color")
    -    @G
    -    method() { }
    -}
    -    
    -

    ES6 Transformation

    -
    class C {
    -    method() { }
    -}
    -Object.defineProperty(C.prototype, "method", 
    -    __decorate([F("color"), G], C.prototype, "method", Object.getOwnPropertyDescriptor(C.prototype, "method")));
    -    
    -
    - - -

    Class Accessor Declaration

    -

    Syntax

    -
    class C {
    -    @F("color")
    -    @G
    -    get accessor() { }
    -    set accessor(value) { }
    -}
    -    
    -

    ES6 Transformation

    -
    class C {
    -    get accessor() { }
    -    set accessor(value) { }
    -}
    -Object.defineProperty(C.prototype, "accessor", 
    -    __decorate([F("color"), G], C.prototype, "accessor", Object.getOwnPropertyDescriptor(C.prototype, "accessor")));
    -    
    -
    - - -

    Class Property Declaration

    -

    Syntax

    -
    class C {
    -    @F("color")
    -    @G
    -    property = 1;
    -}
    -    
    -

    ES6 Transformation

    -
    class C {
    -    constructor() {
    -        this.property = 1;
    -    }
    -}
    -__decorate([F("color"), G], C.prototype, "property");
    -    
    -
    - - -

    Class Constructor Parameter Declaration

    -

    Syntax

    -
    class C {
    -    constructor(@F("color") @G p) { }
    -}
    -    
    -

    ES6 Transformation

    -
    class C {
    -    constructor(p) { }
    -}
    -__decorate([F("color"), G], C, void 0, 0);
    -    
    -
    - - -

    Class Method Parameter Declaration

    -

    Syntax

    -
    class C {
    -    method(@F("color") @G p) { }
    -}
    -    
    -

    ES6 Transformation

    -
    class C {
    -    method(p) { }
    -}
    -__decorate([F("color"), G], C.prototype, "method", 0);
    -    
    -
    - - -

    Class Set Accessor Parameter Declaration

    -

    Syntax

    -
    class C {
    -    set accessor(@F("color") @G p) { }
    -}
    -    
    -

    ES6 Transformation

    -
    class C {
    -    set accessor(p) { }
    -}
    -__decorate([F("color"), G], C.prototype, "accessor", 0);
    -    
    -
    - -
    - - -

    Grammar

    - -

    Expressions

    - - PrimaryExpression - MemberExpression[Expression] - MemberExpression.IdentifierName - MemberExpressionTemplateLiteral - SuperProperty - MetaProperty - newMemberExpressionArguments - - - super[Expression] - - - MemberExpression - newNewExpression - - - MemberExpression Arguments - SuperCall - CallExpression Arguments - CallExpression [ Expression ] - CallExpression . IdentifierName - CallExpression TemplateLiteral - - - NewExpression - CallExpression - -
    - - -

    Functions and Classes

    - - FormalParameters - - - [empty] - FormalParameterList - - - FunctionRestParameter - FormalsList - FormalsList,FunctionRestParameter - - - FormalParameter - FormalsList,FormalParameter - - - BindingRestElement - DecoratorListBindingRestElement - - - BindingElement - DecoratorListBindingElement - - - PropertyName ( StrictFormalParameters ) { FunctionBody } - GeneratorMethod - getPropertyName ( ) { FunctionBody } - setPropertyName ( PropertySetParameterList ) { FunctionBody } - - - *PropertyName ( StrictFormalParameters ) { GeneratorBody } - - - DecoratorList class BindingIdentifier ClassTail - DecoratorList class ClassTail - - - DecoratorList class BindingIdentifier ClassTail - - - DecoratorList MethodDefinition - DecoratorList static MethodDefinition - DecoratorList static PropertyName Initializer ; - ; - - - DecoratorList Decorator - - - @ LeftHandSideExpression - -
    - - -

    Scripts and Modules

    - - export * FromClause ; - export ExportClause FromClause ; - export ExportClause ; - export VariableStatement - export lookahead ≠ @ Declaration - export default HoistableDeclaration - export default lookahead ≠ @ ClassDeclaration - export default lookahead ∉ { function, class, @ } AssignmentExpression - DecoratorList export lookahead ≠ @ ClassDeclaration - DecoratorList export default lookahead ≠ @ ClassDeclaration - -
    -
    - -

    TypeScript

    - -

    TypeScript Definitions

    -
    interface TypedPropertyDescriptor<T> {  
    -    enumerable?: boolean;  
    -    configurable?: boolean;  
    -    writable?: boolean;  
    -    value?: T;  
    -    get?: () => T;  
    -    set?: (value: T) => void;  
    -}  
    -
    -type ClassDecorator = <TFunction extends Function>(target: TFunction): TFunction | void;
    -type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
    -type PropertyDecorator = (target: Object, propertyKey: string | symbol): void;
    -type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number): void;
    -
    -
    -
    \ No newline at end of file diff --git a/test/harness.ts b/test/harness.ts deleted file mode 100644 index 89ed159..0000000 --- a/test/harness.ts +++ /dev/null @@ -1,40 +0,0 @@ -export interface TestResults { - passed: string[]; - failed: [string, any][]; -} - -export function runTests(fixture: any): TestResults { - let results: TestResults = { passed: [], failed: [] }; - for (let testName in fixture) { - let test = fixture[testName]; - if (typeof test === "function") { - try { - test(); - results.passed.push(testName); - } - catch (e) { - results.failed.push([testName, e]); - } - } - } - return results; -} - -export function printResults(results: TestResults): void { - for (let [testName, error] of results.failed) { - let message = "stack" in error ? error.stack : String(error); - console.error(`${testName} failed.\n${message}`); - } - - let passedCount = results.passed.length; - let failedCount = results.failed.length; - let totalCount = passedCount + failedCount; - - let message = `Run ${failedCount > 0 ? "failed" : "succeeded" }: passed: ${passedCount}, failed: ${failedCount}, total: ${totalCount}.`; - if (results.failed.length) { - console.error(message); - } - else { - console.log(message); - } -} \ No newline at end of file diff --git a/test/reflect-decorate.ts b/test/reflect-decorate.ts new file mode 100644 index 0000000..4189e43 --- /dev/null +++ b/test/reflect-decorate.ts @@ -0,0 +1,210 @@ +// Reflect.decorate ( decorators, target [, propertyKey [, descriptor] ] ) + +import "../Reflect"; +import { assert } from "chai"; + +describe("Reflect.decorate", () => { + it("ThrowsIfDecoratorsArgumentNotArrayForFunctionOverload", () => { + let target = function() { }; + assert.throws(() => Reflect.decorate(undefined, target, undefined, undefined), TypeError); + }); + + it("ThrowsIfTargetArgumentNotFunctionForFunctionOverload", () => { + let decorators: (ClassDecorator | MethodDecorator | PropertyDecorator)[] = []; + let target = {}; + assert.throws(() => Reflect.decorate(decorators, target, undefined, undefined), TypeError); + }); + + it("ThrowsIfDecoratorsArgumentNotArrayForPropertyOverload", () => { + let target = {}; + let name = "name"; + assert.throws(() => Reflect.decorate(undefined, target, name, undefined), TypeError); + }); + + it("ThrowsIfTargetArgumentNotObjectForPropertyOverload", () => { + let decorators: (ClassDecorator | MethodDecorator | PropertyDecorator)[] = []; + let target = 1; + let name = "name"; + assert.throws(() => Reflect.decorate(decorators, target, name, undefined), TypeError); + }); + + it("ThrowsIfDecoratorsArgumentNotArrayForPropertyDescriptorOverload", () => { + let target = {}; + let name = "name"; + let descriptor = {}; + assert.throws(() => Reflect.decorate(undefined, target, name, descriptor), TypeError); + }); + + it("ThrowsIfTargetArgumentNotObjectForPropertyDescriptorOverload", () => { + let decorators: (ClassDecorator | MethodDecorator | PropertyDecorator)[] = []; + let target = 1; + let name = "name"; + let descriptor = {}; + assert.throws(() => Reflect.decorate(decorators, target, name, descriptor), TypeError); + }); + + it("ExecutesDecoratorsInReverseOrderForFunctionOverload", () => { + let order: number[] = []; + let decorators = [ + (target: Function): void => { order.push(0); }, + (target: Function): void => { order.push(1); } + ]; + let target = function() { }; + Reflect.decorate(decorators, target); + assert.deepEqual(order, [1, 0]); + }); + + it("ExecutesDecoratorsInReverseOrderForPropertyOverload", () => { + let order: number[] = []; + let decorators = [ + (target: Object, name: string | symbol): void => { order.push(0); }, + (target: Object, name: string | symbol): void => { order.push(1); } + ]; + let target = {}; + let name = "name"; + Reflect.decorate(decorators, target, name, undefined); + assert.deepEqual(order, [1, 0]); + }); + + it("ExecutesDecoratorsInReverseOrderForPropertyDescriptorOverload", () => { + let order: number[] = []; + let decorators = [ + (target: Object, name: string | symbol): void => { order.push(0); }, + (target: Object, name: string | symbol): void => { order.push(1); } + ]; + let target = {}; + let name = "name"; + let descriptor = {}; + Reflect.decorate(decorators, target, name, descriptor); + assert.deepEqual(order, [1, 0]); + }); + + it("DecoratorPipelineForFunctionOverload", () => { + let A = function A(): void { }; + let B = function B(): void { }; + let decorators = [ + (target: Function): any => { return undefined; }, + (target: Function): any => { return A; }, + (target: Function): any => { return B; } + ]; + let target = function (): void { }; + let result = Reflect.decorate(decorators, target); + assert.strictEqual(result, A); + }); + + it("DecoratorPipelineForPropertyOverload", () => { + let A = {}; + let B = {}; + let decorators = [ + (target: Object, name: string | symbol): any => { return undefined; }, + (target: Object, name: string | symbol): any => { return A; }, + (target: Object, name: string | symbol): any => { return B; } + ]; + let target = {}; + let result = Reflect.decorate(decorators, target, "name", undefined); + assert.strictEqual(result, A); + }); + + it("DecoratorPipelineForPropertyDescriptorOverload", () => { + let A = {}; + let B = {}; + let C = {}; + let decorators = [ + (target: Object, name: string | symbol): any => { return undefined; }, + (target: Object, name: string | symbol): any => { return A; }, + (target: Object, name: string | symbol): any => { return B; } + ]; + let target = {}; + let result = Reflect.decorate(decorators, target, "name", C); + assert.strictEqual(result, A); + }); + + it("DecoratorCorrectTargetInPipelineForFunctionOverload", () => { + let sent: Function[] = []; + let A = function A(): void { }; + let B = function B(): void { }; + let decorators = [ + (target: Function): any => { sent.push(target); return undefined; }, + (target: Function): any => { sent.push(target); return undefined; }, + (target: Function): any => { sent.push(target); return A; }, + (target: Function): any => { sent.push(target); return B; } + ]; + let target = function (): void { }; + Reflect.decorate(decorators, target); + assert.deepEqual(sent, [target, B, A, A]); + }); + + it("DecoratorCorrectTargetInPipelineForPropertyOverload", () => { + let sent: Object[] = []; + let decorators = [ + (target: Object, name: string | symbol): any => { sent.push(target); }, + (target: Object, name: string | symbol): any => { sent.push(target); }, + (target: Object, name: string | symbol): any => { sent.push(target); }, + (target: Object, name: string | symbol): any => { sent.push(target); } + ]; + let target = { }; + Reflect.decorate(decorators, target, "name"); + assert.deepEqual(sent, [target, target, target, target]); + }); + + it("DecoratorCorrectNameInPipelineForPropertyOverload", () => { + let sent: (symbol | string)[] = []; + let decorators = [ + (target: Object, name: string | symbol): any => { sent.push(name); }, + (target: Object, name: string | symbol): any => { sent.push(name); }, + (target: Object, name: string | symbol): any => { sent.push(name); }, + (target: Object, name: string | symbol): any => { sent.push(name); } + ]; + let target = { }; + Reflect.decorate(decorators, target, "name"); + assert.deepEqual(sent, ["name", "name", "name", "name"]); + }); + + it("DecoratorCorrectTargetInPipelineForPropertyDescriptorOverload", () => { + let sent: Object[] = []; + let A = { }; + let B = { }; + let C = { }; + let decorators = [ + (target: Object, name: string | symbol): any => { sent.push(target); return undefined; }, + (target: Object, name: string | symbol): any => { sent.push(target); return undefined; }, + (target: Object, name: string | symbol): any => { sent.push(target); return A; }, + (target: Object, name: string | symbol): any => { sent.push(target); return B; } + ]; + let target = { }; + Reflect.decorate(decorators, target, "name", C); + assert.deepEqual(sent, [target, target, target, target]); + }); + + it("DecoratorCorrectNameInPipelineForPropertyDescriptorOverload", () => { + let sent: (symbol | string)[] = []; + let A = { }; + let B = { }; + let C = { }; + let decorators = [ + (target: Object, name: string | symbol): any => { sent.push(name); return undefined; }, + (target: Object, name: string | symbol): any => { sent.push(name); return undefined; }, + (target: Object, name: string | symbol): any => { sent.push(name); return A; }, + (target: Object, name: string | symbol): any => { sent.push(name); return B; } + ]; + let target = { }; + Reflect.decorate(decorators, target, "name", C); + assert.deepEqual(sent, ["name", "name", "name", "name"]); + }); + + it("DecoratorCorrectDescriptorInPipelineForPropertyDescriptorOverload", () => { + let sent: PropertyDescriptor[] = []; + let A = { }; + let B = { }; + let C = { }; + let decorators = [ + (target: Object, name: string | symbol, descriptor: PropertyDescriptor): any => { sent.push(descriptor); return undefined; }, + (target: Object, name: string | symbol, descriptor: PropertyDescriptor): any => { sent.push(descriptor); return undefined; }, + (target: Object, name: string | symbol, descriptor: PropertyDescriptor): any => { sent.push(descriptor); return A; }, + (target: Object, name: string | symbol, descriptor: PropertyDescriptor): any => { sent.push(descriptor); return B; } + ]; + let target = { }; + Reflect.decorate(decorators, target, "name", C); + assert.deepEqual(sent, [C, B, A, A]); + }); +}); diff --git a/test/reflect-definemetadata.ts b/test/reflect-definemetadata.ts new file mode 100644 index 0000000..721bb79 --- /dev/null +++ b/test/reflect-definemetadata.ts @@ -0,0 +1,19 @@ +// Reflect.defineMetadata ( metadataKey, metadataValue, target, propertyKey ) +// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectdefinemetadata--metadatakey-metadatavalue-target-propertykey- + +import "../Reflect"; +import { assert } from "chai"; + +describe("Reflect.defineMetadata", () => { + it("InvalidTarget", () => { + assert.throws(() => Reflect.defineMetadata("key", "value", undefined, undefined), TypeError); + }); + + it("ValidTargetWithoutTargetKey", () => { + assert.doesNotThrow(() => Reflect.defineMetadata("key", "value", { }, undefined)); + }); + + it("ValidTargetWithTargetKey", () => { + assert.doesNotThrow(() => Reflect.defineMetadata("key", "value", { }, "name")); + }); +}); \ No newline at end of file diff --git a/test/reflect-deletemetadata.ts b/test/reflect-deletemetadata.ts new file mode 100644 index 0000000..1b9be04 --- /dev/null +++ b/test/reflect-deletemetadata.ts @@ -0,0 +1,40 @@ +// Reflect.deleteMetadata ( metadataKey, target [, propertyKey] ) +// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectdeletemetadata--metadatakey-target--propertykey- + +import "../Reflect"; +import { assert } from "chai"; + +describe("Reflect.deleteMetadata", () => { + it("InvalidTarget", () => { + assert.throws(() => Reflect.deleteMetadata("key", undefined, undefined), TypeError); + }); + + it("WhenNotDefinedWithoutTargetKey", () => { + let obj = {}; + let result = Reflect.deleteMetadata("key", obj, undefined); + assert.equal(result, false); + }); + + it("WhenDefinedWithoutTargetKey", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, undefined); + let result = Reflect.deleteMetadata("key", obj, undefined); + assert.equal(result, true); + }); + + it("WhenDefinedOnPrototypeWithoutTargetKey", () => { + let prototype = {}; + Reflect.defineMetadata("key", "value", prototype, undefined); + let obj = Object.create(prototype); + let result = Reflect.deleteMetadata("key", obj, undefined); + assert.equal(result, false); + }); + + it("AfterDeleteMetadata", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, undefined); + Reflect.deleteMetadata("key", obj, undefined); + let result = Reflect.hasOwnMetadata("key", obj, undefined); + assert.equal(result, false); + }); +}); \ No newline at end of file diff --git a/test/reflect-getmetadata.ts b/test/reflect-getmetadata.ts new file mode 100644 index 0000000..13bac98 --- /dev/null +++ b/test/reflect-getmetadata.ts @@ -0,0 +1,53 @@ +// Reflect.getMetadata ( metadataKey, target [, propertyKey] ) +// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectgetmetadata--metadatakey-target--propertykey- + +import "../Reflect"; +import { assert } from "chai"; + +describe("Reflect.getMetadata", () => { + it("InvalidTarget", () => { + assert.throws(() => Reflect.getMetadata("key", undefined, undefined), TypeError); + }); + + it("WithoutTargetKeyWhenNotDefined", () => { + let obj = {}; + let result = Reflect.getMetadata("key", obj, undefined); + assert.equal(result, undefined); + }); + + it("WithoutTargetKeyWhenDefined", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, undefined); + let result = Reflect.getMetadata("key", obj, undefined); + assert.equal(result, "value"); + }); + + it("WithoutTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + let obj = Object.create(prototype); + Reflect.defineMetadata("key", "value", prototype, undefined); + let result = Reflect.getMetadata("key", obj, undefined); + assert.equal(result, "value"); + }); + + it("WithTargetKeyWhenNotDefined", () => { + let obj = {}; + let result = Reflect.getMetadata("key", obj, "name"); + assert.equal(result, undefined); + }); + + it("WithTargetKeyWhenDefined", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, "name"); + let result = Reflect.getMetadata("key", obj, "name"); + assert.equal(result, "value"); + }); + + it("WithTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + let obj = Object.create(prototype); + Reflect.defineMetadata("key", "value", prototype, "name"); + let result = Reflect.getMetadata("key", obj, "name"); + assert.equal(result, "value"); + }); +}); \ No newline at end of file diff --git a/test/reflect-getmetadatakeys.ts b/test/reflect-getmetadatakeys.ts new file mode 100644 index 0000000..9074a5e --- /dev/null +++ b/test/reflect-getmetadatakeys.ts @@ -0,0 +1,100 @@ +// Reflect.getMetadataKeys ( target [, propertyKey] ) +// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectgetmetadatakeys--target--propertykey- + +import "../Reflect"; +import { assert } from "chai"; + +describe("Reflect.getMetadataKeys", () => { + it("KeysInvalidTarget", () => { + // 1. If Type(target) is not Object, throw a TypeError exception. + assert.throws(() => Reflect.getMetadataKeys(undefined, undefined), TypeError); + }); + + it("KeysWithoutTargetKeyWhenNotDefined", () => { + let obj = {}; + let result = Reflect.getMetadataKeys(obj, undefined); + assert.deepEqual(result, []); + }); + + it("KeysWithoutTargetKeyWhenDefined", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, undefined); + let result = Reflect.getMetadataKeys(obj, undefined); + assert.deepEqual(result, ["key"]); + }); + + it("KeysWithoutTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + let obj = Object.create(prototype); + Reflect.defineMetadata("key", "value", prototype, undefined); + let result = Reflect.getMetadataKeys(obj, undefined); + assert.deepEqual(result, ["key"]); + }); + + it("KeysOrderWithoutTargetKey", () => { + let obj = {}; + Reflect.defineMetadata("key1", "value", obj, undefined); + Reflect.defineMetadata("key0", "value", obj, undefined); + let result = Reflect.getMetadataKeys(obj, undefined); + assert.deepEqual(result, ["key1", "key0"]); + }); + + it("KeysOrderAfterRedefineWithoutTargetKey", () => { + let obj = {}; + Reflect.defineMetadata("key1", "value", obj, undefined); + Reflect.defineMetadata("key0", "value", obj, undefined); + Reflect.defineMetadata("key1", "value", obj, undefined); + let result = Reflect.getMetadataKeys(obj, undefined); + assert.deepEqual(result, ["key1", "key0"]); + }); + + it("KeysOrderWithoutTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + Reflect.defineMetadata("key2", "value", prototype, undefined); + let obj = Object.create(prototype); + Reflect.defineMetadata("key1", "value", obj, undefined); + Reflect.defineMetadata("key0", "value", obj, undefined); + let result = Reflect.getMetadataKeys(obj, undefined); + assert.deepEqual(result, ["key1", "key0", "key2"]); + }); + + it("KeysWithTargetKeyWhenNotDefined", () => { + let obj = {}; + let result = Reflect.getMetadataKeys(obj, "name"); + assert.deepEqual(result, []); + }); + + it("KeysWithTargetKeyWhenDefined", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, "name"); + let result = Reflect.getMetadataKeys(obj, "name"); + assert.deepEqual(result, ["key"]); + }); + + it("KeysWithTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + let obj = Object.create(prototype); + Reflect.defineMetadata("key", "value", prototype, "name"); + let result = Reflect.getMetadataKeys(obj, "name"); + assert.deepEqual(result, ["key"]); + }); + + it("KeysOrderAfterRedefineWithTargetKey", () => { + let obj = {}; + Reflect.defineMetadata("key1", "value", obj, "name"); + Reflect.defineMetadata("key0", "value", obj, "name"); + Reflect.defineMetadata("key1", "value", obj, "name"); + let result = Reflect.getMetadataKeys(obj, "name"); + assert.deepEqual(result, ["key1", "key0"]); + }); + + it("KeysOrderWithTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + Reflect.defineMetadata("key2", "value", prototype, "name"); + let obj = Object.create(prototype); + Reflect.defineMetadata("key1", "value", obj, "name"); + Reflect.defineMetadata("key0", "value", obj, "name"); + let result = Reflect.getMetadataKeys(obj, "name"); + assert.deepEqual(result, ["key1", "key0", "key2"]); + }); +}); \ No newline at end of file diff --git a/test/reflect-getownmetadata.ts b/test/reflect-getownmetadata.ts new file mode 100644 index 0000000..8d97f75 --- /dev/null +++ b/test/reflect-getownmetadata.ts @@ -0,0 +1,53 @@ +// Reflect.getOwnMetadata ( metadataKey, target [, propertyKey] ) +// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectgetownmetadata--metadatakey-target--propertykey- + +import "../Reflect"; +import { assert } from "chai"; + +describe("Reflect.getOwnMetadata", () => { + it("InvalidTarget", () => { + assert.throws(() => Reflect.getOwnMetadata("key", undefined, undefined), TypeError); + }); + + it("WithoutTargetKeyWhenNotDefined", () => { + let obj = {}; + let result = Reflect.getOwnMetadata("key", obj, undefined); + assert.equal(result, undefined); + }); + + it("WithoutTargetKeyWhenDefined", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, undefined); + let result = Reflect.getOwnMetadata("key", obj, undefined); + assert.equal(result, "value"); + }); + + it("WithoutTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + let obj = Object.create(prototype); + Reflect.defineMetadata("key", "value", prototype, undefined); + let result = Reflect.getOwnMetadata("key", obj, undefined); + assert.equal(result, undefined); + }); + + it("WithTargetKeyWhenNotDefined", () => { + let obj = {}; + let result = Reflect.getOwnMetadata("key", obj, "name"); + assert.equal(result, undefined); + }); + + it("WithTargetKeyWhenDefined", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, "name"); + let result = Reflect.getOwnMetadata("key", obj, "name"); + assert.equal(result, "value"); + }); + + it("WithTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + let obj = Object.create(prototype); + Reflect.defineMetadata("key", "value", prototype, "name"); + let result = Reflect.getOwnMetadata("key", obj, "name"); + assert.equal(result, undefined); + }); +}); \ No newline at end of file diff --git a/test/reflect-getownmetadatakeys.ts b/test/reflect-getownmetadatakeys.ts new file mode 100644 index 0000000..816aa44 --- /dev/null +++ b/test/reflect-getownmetadatakeys.ts @@ -0,0 +1,80 @@ +// Reflect.getOwnMetadataKeysKeys ( target [, propertyKey] ) +// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectgetownmetadatakeyskeys--target--propertykey- + +import "../Reflect"; +import { assert } from "chai"; + +describe("Reflect.deleteMetadata", () => { + it("KeysKeysInvalidTarget", () => { + // 1. If Type(target) is not Object, throw a TypeError exception. + assert.throws(() => Reflect.getOwnMetadataKeys(undefined, undefined), TypeError); + }); + + it("KeysWithoutTargetKeyWhenNotDefined", () => { + let obj = {}; + let result = Reflect.getOwnMetadataKeys(obj, undefined); + assert.deepEqual(result, []); + }); + + it("KeysWithoutTargetKeyWhenDefined", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, undefined); + let result = Reflect.getOwnMetadataKeys(obj, undefined); + assert.deepEqual(result, ["key"]); + }); + + it("KeysWithoutTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + let obj = Object.create(prototype); + Reflect.defineMetadata("key", "value", prototype, undefined); + let result = Reflect.getOwnMetadataKeys(obj, undefined); + assert.deepEqual(result, []); + }); + + it("KeysOrderWithoutTargetKey", () => { + let obj = {}; + Reflect.defineMetadata("key1", "value", obj, undefined); + Reflect.defineMetadata("key0", "value", obj, undefined); + let result = Reflect.getOwnMetadataKeys(obj, undefined); + assert.deepEqual(result, ["key1", "key0"]); + }); + + it("KeysOrderAfterRedefineWithoutTargetKey", () => { + let obj = {}; + Reflect.defineMetadata("key1", "value", obj, undefined); + Reflect.defineMetadata("key0", "value", obj, undefined); + Reflect.defineMetadata("key1", "value", obj, undefined); + let result = Reflect.getOwnMetadataKeys(obj, undefined); + assert.deepEqual(result, ["key1", "key0"]); + }); + + it("KeysWithTargetKeyWhenNotDefined", () => { + let obj = {}; + let result = Reflect.getOwnMetadataKeys(obj, "name"); + assert.deepEqual(result, []); + }); + + it("KeysWithTargetKeyWhenDefined", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, "name"); + let result = Reflect.getOwnMetadataKeys(obj, "name"); + assert.deepEqual(result, ["key"]); + }); + + it("KeysWithTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + let obj = Object.create(prototype); + Reflect.defineMetadata("key", "value", prototype, "name"); + let result = Reflect.getOwnMetadataKeys(obj, "name"); + assert.deepEqual(result, []); + }); + + it("KeysOrderAfterRedefineWithTargetKey", () => { + let obj = {}; + Reflect.defineMetadata("key1", "value", obj, "name"); + Reflect.defineMetadata("key0", "value", obj, "name"); + Reflect.defineMetadata("key1", "value", obj, "name"); + let result = Reflect.getOwnMetadataKeys(obj, "name"); + assert.deepEqual(result, ["key1", "key0"]); + }); +}); \ No newline at end of file diff --git a/test/reflect-hasmetadata.ts b/test/reflect-hasmetadata.ts new file mode 100644 index 0000000..587fafd --- /dev/null +++ b/test/reflect-hasmetadata.ts @@ -0,0 +1,53 @@ +// Reflect.hasMetadata ( metadataKey, target [, propertyKey] ) +// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflecthasmetadata--metadatakey-target--propertykey- + +import "../Reflect"; +import { assert } from "chai"; + +describe("Reflect.hasMetadata", () => { + it("InvalidTarget", () => { + assert.throws(() => Reflect.hasMetadata("key", undefined, undefined), TypeError); + }); + + it("WithoutTargetKeyWhenNotDefined", () => { + let obj = {}; + let result = Reflect.hasMetadata("key", obj, undefined); + assert.equal(result, false); + }); + + it("WithoutTargetKeyWhenDefined", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, undefined); + let result = Reflect.hasMetadata("key", obj, undefined); + assert.equal(result, true); + }); + + it("WithoutTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + let obj = Object.create(prototype); + Reflect.defineMetadata("key", "value", prototype, undefined); + let result = Reflect.hasMetadata("key", obj, undefined); + assert.equal(result, true); + }); + + it("WithTargetKeyWhenNotDefined", () => { + let obj = {}; + let result = Reflect.hasMetadata("key", obj, "name"); + assert.equal(result, false); + }); + + it("WithTargetKeyWhenDefined", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, "name"); + let result = Reflect.hasMetadata("key", obj, "name"); + assert.equal(result, true); + }); + + it("WithTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + let obj = Object.create(prototype); + Reflect.defineMetadata("key", "value", prototype, "name"); + let result = Reflect.hasMetadata("key", obj, "name"); + assert.equal(result, true); + }); +}); \ No newline at end of file diff --git a/test/reflect-hasownmetadata.ts b/test/reflect-hasownmetadata.ts new file mode 100644 index 0000000..ac4baf9 --- /dev/null +++ b/test/reflect-hasownmetadata.ts @@ -0,0 +1,53 @@ +// Reflect.hasOwnMetadata ( metadataKey, target [, propertyKey] ) +// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflecthasownmetadata--metadatakey-target--propertykey- + +import "../Reflect"; +import { assert } from "chai"; + +describe("Reflect.hasOwnMetadata", () => { + it("InvalidTarget", () => { + assert.throws(() => Reflect.hasOwnMetadata("key", undefined, undefined), TypeError); + }); + + it("WithoutTargetKeyWhenNotDefined", () => { + let obj = {}; + let result = Reflect.hasOwnMetadata("key", obj, undefined); + assert.equal(result, false); + }); + + it("WithoutTargetKeyWhenDefined", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, undefined); + let result = Reflect.hasOwnMetadata("key", obj, undefined); + assert.equal(result, true); + }); + + it("WithoutTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + let obj = Object.create(prototype); + Reflect.defineMetadata("key", "value", prototype, undefined); + let result = Reflect.hasOwnMetadata("key", obj, undefined); + assert.equal(result, false); + }); + + it("WithTargetKeyWhenNotDefined", () => { + let obj = {}; + let result = Reflect.hasOwnMetadata("key", obj, "name"); + assert.equal(result, false); + }); + + it("WithTargetKeyWhenDefined", () => { + let obj = {}; + Reflect.defineMetadata("key", "value", obj, "name"); + let result = Reflect.hasOwnMetadata("key", obj, "name"); + assert.equal(result, true); + }); + + it("WithTargetKeyWhenDefinedOnPrototype", () => { + let prototype = {}; + let obj = Object.create(prototype); + Reflect.defineMetadata("key", "value", prototype, "name"); + let result = Reflect.hasOwnMetadata("key", obj, "name"); + assert.equal(result, false); + }); +}); \ No newline at end of file diff --git a/test/reflect-metadata.ts b/test/reflect-metadata.ts new file mode 100644 index 0000000..eaf45bc --- /dev/null +++ b/test/reflect-metadata.ts @@ -0,0 +1,40 @@ +// Reflect.metadata ( metadataKey, metadataValue ) +// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectmetadata--metadatakey-metadatavalue- + +import "../Reflect"; +import { assert } from "chai"; + +describe("Reflect.metadata", () => { + it("ReturnsDecoratorFunction", () => { + let result = Reflect.metadata("key", "value"); + assert.equal(typeof result, "function"); + }); + + it("DecoratorThrowsWithInvalidTargetWithTargetKey", () => { + let decorator = Reflect.metadata("key", "value"); + assert.throws(() => decorator(undefined, "name"), TypeError); + }); + + it("DecoratorThrowsWithInvalidTargetWithoutTargetKey", () => { + let decorator = Reflect.metadata("key", "value"); + assert.throws(() => decorator({}, undefined), TypeError); + }); + + it("OnTargetWithoutTargetKey", () => { + let decorator = Reflect.metadata("key", "value"); + let target = function () {} + decorator(target); + + let result = Reflect.hasOwnMetadata("key", target, undefined); + assert.equal(result, true); + }); + + it("OnTargetWithTargetKey", () => { + let decorator = Reflect.metadata("key", "value"); + let target = {} + decorator(target, "name"); + + let result = Reflect.hasOwnMetadata("key", target, "name"); + assert.equal(result, true); + }); +}); \ No newline at end of file diff --git a/test/reflect/reflect-decorate.ts b/test/reflect/reflect-decorate.ts deleted file mode 100644 index 0d1bbf6..0000000 --- a/test/reflect/reflect-decorate.ts +++ /dev/null @@ -1,208 +0,0 @@ -// Reflect.decorate ( decorators, target [, propertyKey [, descriptor] ] ) - -import "../../Reflect"; -import * as assert from "assert"; - -export function ReflectDecorateThrowsIfDecoratorsArgumentNotArrayForFunctionOverload() { - let target = function() { }; - assert.throws(() => Reflect.decorate(undefined, target, undefined, undefined), TypeError); -} - -export function ReflectDecorateThrowsIfTargetArgumentNotFunctionForFunctionOverload() { - let decorators: (ClassDecorator | MethodDecorator | PropertyDecorator)[] = []; - let target = {}; - assert.throws(() => Reflect.decorate(decorators, target, undefined, undefined), TypeError); -} - -export function ReflectDecorateThrowsIfDecoratorsArgumentNotArrayForPropertyOverload() { - let target = {}; - let name = "name"; - assert.throws(() => Reflect.decorate(undefined, target, name, undefined), TypeError); -} - -export function ReflectDecorateThrowsIfTargetArgumentNotObjectForPropertyOverload() { - let decorators: (ClassDecorator | MethodDecorator | PropertyDecorator)[] = []; - let target = 1; - let name = "name"; - assert.throws(() => Reflect.decorate(decorators, target, name, undefined), TypeError); -} - -export function ReflectDecorateThrowsIfDecoratorsArgumentNotArrayForPropertyDescriptorOverload() { - let target = {}; - let name = "name"; - let descriptor = {}; - assert.throws(() => Reflect.decorate(undefined, target, name, descriptor), TypeError); -} - -export function ReflectDecorateThrowsIfTargetArgumentNotObjectForPropertyDescriptorOverload() { - let decorators: (ClassDecorator | MethodDecorator | PropertyDecorator)[] = []; - let target = 1; - let name = "name"; - let descriptor = {}; - assert.throws(() => Reflect.decorate(decorators, target, name, descriptor), TypeError); -} - -export function ReflectDecorateExecutesDecoratorsInReverseOrderForFunctionOverload() { - let order: number[] = []; - let decorators = [ - (target: Function): void => { order.push(0); }, - (target: Function): void => { order.push(1); } - ]; - let target = function() { }; - Reflect.decorate(decorators, target); - assert.deepEqual(order, [1, 0]); -} - -export function ReflectDecorateExecutesDecoratorsInReverseOrderForPropertyOverload() { - let order: number[] = []; - let decorators = [ - (target: Object, name: string | symbol): void => { order.push(0); }, - (target: Object, name: string | symbol): void => { order.push(1); } - ]; - let target = {}; - let name = "name"; - Reflect.decorate(decorators, target, name, undefined); - assert.deepEqual(order, [1, 0]); -} - -export function ReflectDecorateExecutesDecoratorsInReverseOrderForPropertyDescriptorOverload() { - let order: number[] = []; - let decorators = [ - (target: Object, name: string | symbol): void => { order.push(0); }, - (target: Object, name: string | symbol): void => { order.push(1); } - ]; - let target = {}; - let name = "name"; - let descriptor = {}; - Reflect.decorate(decorators, target, name, descriptor); - assert.deepEqual(order, [1, 0]); -} - -export function ReflectDecoratorPipelineForFunctionOverload() { - let A = function A(): void { }; - let B = function B(): void { }; - let decorators = [ - (target: Function): any => { return undefined; }, - (target: Function): any => { return A; }, - (target: Function): any => { return B; } - ]; - let target = function (): void { }; - let result = Reflect.decorate(decorators, target); - assert.strictEqual(result, A); -} - -export function ReflectDecoratorPipelineForPropertyOverload() { - let A = {}; - let B = {}; - let decorators = [ - (target: Object, name: string | symbol): any => { return undefined; }, - (target: Object, name: string | symbol): any => { return A; }, - (target: Object, name: string | symbol): any => { return B; } - ]; - let target = {}; - let result = Reflect.decorate(decorators, target, "name", undefined); - assert.strictEqual(result, A); -} - -export function ReflectDecoratorPipelineForPropertyDescriptorOverload() { - let A = {}; - let B = {}; - let C = {}; - let decorators = [ - (target: Object, name: string | symbol): any => { return undefined; }, - (target: Object, name: string | symbol): any => { return A; }, - (target: Object, name: string | symbol): any => { return B; } - ]; - let target = {}; - let result = Reflect.decorate(decorators, target, "name", C); - assert.strictEqual(result, A); -} - -export function ReflectDecoratorCorrectTargetInPipelineForFunctionOverload() { - let sent: Function[] = []; - let A = function A(): void { }; - let B = function B(): void { }; - let decorators = [ - (target: Function): any => { sent.push(target); return undefined; }, - (target: Function): any => { sent.push(target); return undefined; }, - (target: Function): any => { sent.push(target); return A; }, - (target: Function): any => { sent.push(target); return B; } - ]; - let target = function (): void { }; - Reflect.decorate(decorators, target); - assert.deepEqual(sent, [target, B, A, A]); -} - -export function ReflectDecoratorCorrectTargetInPipelineForPropertyOverload() { - let sent: Object[] = []; - let decorators = [ - (target: Object, name: string | symbol): any => { sent.push(target); }, - (target: Object, name: string | symbol): any => { sent.push(target); }, - (target: Object, name: string | symbol): any => { sent.push(target); }, - (target: Object, name: string | symbol): any => { sent.push(target); } - ]; - let target = { }; - Reflect.decorate(decorators, target, "name"); - assert.deepEqual(sent, [target, target, target, target]); -} - -export function ReflectDecoratorCorrectNameInPipelineForPropertyOverload() { - let sent: (symbol | string)[] = []; - let decorators = [ - (target: Object, name: string | symbol): any => { sent.push(name); }, - (target: Object, name: string | symbol): any => { sent.push(name); }, - (target: Object, name: string | symbol): any => { sent.push(name); }, - (target: Object, name: string | symbol): any => { sent.push(name); } - ]; - let target = { }; - Reflect.decorate(decorators, target, "name"); - assert.deepEqual(sent, ["name", "name", "name", "name"]); -} - -export function ReflectDecoratorCorrectTargetInPipelineForPropertyDescriptorOverload() { - let sent: Object[] = []; - let A = { }; - let B = { }; - let C = { }; - let decorators = [ - (target: Object, name: string | symbol): any => { sent.push(target); return undefined; }, - (target: Object, name: string | symbol): any => { sent.push(target); return undefined; }, - (target: Object, name: string | symbol): any => { sent.push(target); return A; }, - (target: Object, name: string | symbol): any => { sent.push(target); return B; } - ]; - let target = { }; - Reflect.decorate(decorators, target, "name", C); - assert.deepEqual(sent, [target, target, target, target]); -} - -export function ReflectDecoratorCorrectNameInPipelineForPropertyDescriptorOverload() { - let sent: (symbol | string)[] = []; - let A = { }; - let B = { }; - let C = { }; - let decorators = [ - (target: Object, name: string | symbol): any => { sent.push(name); return undefined; }, - (target: Object, name: string | symbol): any => { sent.push(name); return undefined; }, - (target: Object, name: string | symbol): any => { sent.push(name); return A; }, - (target: Object, name: string | symbol): any => { sent.push(name); return B; } - ]; - let target = { }; - Reflect.decorate(decorators, target, "name", C); - assert.deepEqual(sent, ["name", "name", "name", "name"]); -} - -export function ReflectDecoratorCorrectDescriptorInPipelineForPropertyDescriptorOverload() { - let sent: PropertyDescriptor[] = []; - let A = { }; - let B = { }; - let C = { }; - let decorators = [ - (target: Object, name: string | symbol, descriptor: PropertyDescriptor): any => { sent.push(descriptor); return undefined; }, - (target: Object, name: string | symbol, descriptor: PropertyDescriptor): any => { sent.push(descriptor); return undefined; }, - (target: Object, name: string | symbol, descriptor: PropertyDescriptor): any => { sent.push(descriptor); return A; }, - (target: Object, name: string | symbol, descriptor: PropertyDescriptor): any => { sent.push(descriptor); return B; } - ]; - let target = { }; - Reflect.decorate(decorators, target, "name", C); - assert.deepEqual(sent, [C, B, A, A]); -} \ No newline at end of file diff --git a/test/reflect/reflect-definemetadata.ts b/test/reflect/reflect-definemetadata.ts deleted file mode 100644 index c2bf910..0000000 --- a/test/reflect/reflect-definemetadata.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Reflect.defineMetadata ( metadataKey, metadataValue, target, propertyKey ) -// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectdefinemetadata--metadatakey-metadatavalue-target-propertykey- - -import "../../Reflect"; -import * as assert from "assert"; - -export function ReflectDefineMetadataInvalidTarget() { - assert.throws(() => Reflect.defineMetadata("key", "value", undefined, undefined), TypeError); -} - -export function ReflectDefineMetadataValidTargetWithoutTargetKey() { - assert.doesNotThrow(() => Reflect.defineMetadata("key", "value", { }, undefined)); -} - -export function ReflectDefineMetadataValidTargetWithTargetKey() { - assert.doesNotThrow(() => Reflect.defineMetadata("key", "value", { }, "name")); -} \ No newline at end of file diff --git a/test/reflect/reflect-deletemetadata.ts b/test/reflect/reflect-deletemetadata.ts deleted file mode 100644 index 0418a8b..0000000 --- a/test/reflect/reflect-deletemetadata.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Reflect.deleteMetadata ( metadataKey, target [, propertyKey] ) -// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectdeletemetadata--metadatakey-target--propertykey- - -import "../../Reflect"; -import * as assert from "assert"; - -export function ReflectDeleteMetadataInvalidTarget() { - assert.throws(() => Reflect.deleteMetadata("key", undefined, undefined), TypeError); -} - -export function ReflectDeleteMetadataWhenNotDefinedWithoutTargetKey() { - let obj = {}; - let result = Reflect.deleteMetadata("key", obj, undefined); - assert.equal(result, false); -} - -export function ReflectDeleteMetadataWhenDefinedWithoutTargetKey() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, undefined); - let result = Reflect.deleteMetadata("key", obj, undefined); - assert.equal(result, true); -} - -export function ReflectDeleteMetadataWhenDefinedOnPrototypeWithoutTargetKey() { - let prototype = {}; - Reflect.defineMetadata("key", "value", prototype, undefined); - let obj = Object.create(prototype); - let result = Reflect.deleteMetadata("key", obj, undefined); - assert.equal(result, false); -} - -export function ReflectHasOwnMetadataAfterDeleteMetadata() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, undefined); - Reflect.deleteMetadata("key", obj, undefined); - let result = Reflect.hasOwnMetadata("key", obj, undefined); - assert.equal(result, false); -} \ No newline at end of file diff --git a/test/reflect/reflect-getmetadata.ts b/test/reflect/reflect-getmetadata.ts deleted file mode 100644 index eca04ed..0000000 --- a/test/reflect/reflect-getmetadata.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Reflect.getMetadata ( metadataKey, target [, propertyKey] ) -// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectgetmetadata--metadatakey-target--propertykey- - -import "../../Reflect"; -import * as assert from "assert"; - -export function ReflectGetMetadataInvalidTarget() { - assert.throws(() => Reflect.getMetadata("key", undefined, undefined), TypeError); -} - -export function ReflectGetMetadataWithoutTargetKeyWhenNotDefined() { - let obj = {}; - let result = Reflect.getMetadata("key", obj, undefined); - assert.equal(result, undefined); -} - -export function ReflectGetMetadataWithoutTargetKeyWhenDefined() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, undefined); - let result = Reflect.getMetadata("key", obj, undefined); - assert.equal(result, "value"); -} - -export function ReflectGetMetadataWithoutTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - let obj = Object.create(prototype); - Reflect.defineMetadata("key", "value", prototype, undefined); - let result = Reflect.getMetadata("key", obj, undefined); - assert.equal(result, "value"); -} - -export function ReflectGetMetadataWithTargetKeyWhenNotDefined() { - let obj = {}; - let result = Reflect.getMetadata("key", obj, "name"); - assert.equal(result, undefined); -} - -export function ReflectGetMetadataWithTargetKeyWhenDefined() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, "name"); - let result = Reflect.getMetadata("key", obj, "name"); - assert.equal(result, "value"); -} - -export function ReflectGetMetadataWithTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - let obj = Object.create(prototype); - Reflect.defineMetadata("key", "value", prototype, "name"); - let result = Reflect.getMetadata("key", obj, "name"); - assert.equal(result, "value"); -} diff --git a/test/reflect/reflect-getmetadatakeys.ts b/test/reflect/reflect-getmetadatakeys.ts deleted file mode 100644 index aab0ee5..0000000 --- a/test/reflect/reflect-getmetadatakeys.ts +++ /dev/null @@ -1,98 +0,0 @@ -// Reflect.getMetadataKeys ( target [, propertyKey] ) -// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectgetmetadatakeys--target--propertykey- - -import "../../Reflect"; -import * as assert from "assert"; - -export function ReflectGetMetadataKeysInvalidTarget() { - // 1. If Type(target) is not Object, throw a TypeError exception. - assert.throws(() => Reflect.getMetadataKeys(undefined, undefined), TypeError); -} - -export function ReflectGetMetadataKeysWithoutTargetKeyWhenNotDefined() { - let obj = {}; - let result = Reflect.getMetadataKeys(obj, undefined); - assert.deepEqual(result, []); -} - -export function ReflectGetMetadataKeysWithoutTargetKeyWhenDefined() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, undefined); - let result = Reflect.getMetadataKeys(obj, undefined); - assert.deepEqual(result, ["key"]); -} - -export function ReflectGetMetadataKeysWithoutTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - let obj = Object.create(prototype); - Reflect.defineMetadata("key", "value", prototype, undefined); - let result = Reflect.getMetadataKeys(obj, undefined); - assert.deepEqual(result, ["key"]); -} - -export function ReflectGetMetadataKeysOrderWithoutTargetKey() { - let obj = {}; - Reflect.defineMetadata("key1", "value", obj, undefined); - Reflect.defineMetadata("key0", "value", obj, undefined); - let result = Reflect.getMetadataKeys(obj, undefined); - assert.deepEqual(result, ["key1", "key0"]); -} - -export function ReflectGetMetadataKeysOrderAfterRedefineWithoutTargetKey() { - let obj = {}; - Reflect.defineMetadata("key1", "value", obj, undefined); - Reflect.defineMetadata("key0", "value", obj, undefined); - Reflect.defineMetadata("key1", "value", obj, undefined); - let result = Reflect.getMetadataKeys(obj, undefined); - assert.deepEqual(result, ["key1", "key0"]); -} - -export function ReflectGetMetadataKeysOrderWithoutTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - Reflect.defineMetadata("key2", "value", prototype, undefined); - let obj = Object.create(prototype); - Reflect.defineMetadata("key1", "value", obj, undefined); - Reflect.defineMetadata("key0", "value", obj, undefined); - let result = Reflect.getMetadataKeys(obj, undefined); - assert.deepEqual(result, ["key1", "key0", "key2"]); -} - -export function ReflectGetMetadataKeysWithTargetKeyWhenNotDefined() { - let obj = {}; - let result = Reflect.getMetadataKeys(obj, "name"); - assert.deepEqual(result, []); -} - -export function ReflectGetMetadataKeysWithTargetKeyWhenDefined() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, "name"); - let result = Reflect.getMetadataKeys(obj, "name"); - assert.deepEqual(result, ["key"]); -} - -export function ReflectGetMetadataKeysWithTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - let obj = Object.create(prototype); - Reflect.defineMetadata("key", "value", prototype, "name"); - let result = Reflect.getMetadataKeys(obj, "name"); - assert.deepEqual(result, ["key"]); -} - -export function ReflectGetMetadataKeysOrderAfterRedefineWithTargetKey() { - let obj = {}; - Reflect.defineMetadata("key1", "value", obj, "name"); - Reflect.defineMetadata("key0", "value", obj, "name"); - Reflect.defineMetadata("key1", "value", obj, "name"); - let result = Reflect.getMetadataKeys(obj, "name"); - assert.deepEqual(result, ["key1", "key0"]); -} - -export function ReflectGetMetadataKeysOrderWithTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - Reflect.defineMetadata("key2", "value", prototype, "name"); - let obj = Object.create(prototype); - Reflect.defineMetadata("key1", "value", obj, "name"); - Reflect.defineMetadata("key0", "value", obj, "name"); - let result = Reflect.getMetadataKeys(obj, "name"); - assert.deepEqual(result, ["key1", "key0", "key2"]); -} \ No newline at end of file diff --git a/test/reflect/reflect-getownmetadata.ts b/test/reflect/reflect-getownmetadata.ts deleted file mode 100644 index a0e18bc..0000000 --- a/test/reflect/reflect-getownmetadata.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Reflect.getOwnMetadata ( metadataKey, target [, propertyKey] ) -// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectgetownmetadata--metadatakey-target--propertykey- - -import "../../Reflect"; -import * as assert from "assert"; - -export function ReflectGetOwnMetadataInvalidTarget() { - assert.throws(() => Reflect.getOwnMetadata("key", undefined, undefined), TypeError); -} - -export function ReflectGetOwnMetadataWithoutTargetKeyWhenNotDefined() { - let obj = {}; - let result = Reflect.getOwnMetadata("key", obj, undefined); - assert.equal(result, undefined); -} - -export function ReflectGetOwnMetadataWithoutTargetKeyWhenDefined() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, undefined); - let result = Reflect.getOwnMetadata("key", obj, undefined); - assert.equal(result, "value"); -} - -export function ReflectGetOwnMetadataWithoutTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - let obj = Object.create(prototype); - Reflect.defineMetadata("key", "value", prototype, undefined); - let result = Reflect.getOwnMetadata("key", obj, undefined); - assert.equal(result, undefined); -} - -export function ReflectGetOwnMetadataWithTargetKeyWhenNotDefined() { - let obj = {}; - let result = Reflect.getOwnMetadata("key", obj, "name"); - assert.equal(result, undefined); -} - -export function ReflectGetOwnMetadataWithTargetKeyWhenDefined() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, "name"); - let result = Reflect.getOwnMetadata("key", obj, "name"); - assert.equal(result, "value"); -} - -export function ReflectGetOwnMetadataWithTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - let obj = Object.create(prototype); - Reflect.defineMetadata("key", "value", prototype, "name"); - let result = Reflect.getOwnMetadata("key", obj, "name"); - assert.equal(result, undefined); -} diff --git a/test/reflect/reflect-getownmetadatakeys.ts b/test/reflect/reflect-getownmetadatakeys.ts deleted file mode 100644 index 530ff60..0000000 --- a/test/reflect/reflect-getownmetadatakeys.ts +++ /dev/null @@ -1,78 +0,0 @@ -// Reflect.getOwnMetadataKeysKeys ( target [, propertyKey] ) -// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectgetownmetadatakeyskeys--target--propertykey- - -import "../../Reflect"; -import * as assert from "assert"; - -export function ReflectGetOwnMetadataKeysKeysInvalidTarget() { - // 1. If Type(target) is not Object, throw a TypeError exception. - assert.throws(() => Reflect.getOwnMetadataKeys(undefined, undefined), TypeError); -} - -export function ReflectGetOwnMetadataKeysWithoutTargetKeyWhenNotDefined() { - let obj = {}; - let result = Reflect.getOwnMetadataKeys(obj, undefined); - assert.deepEqual(result, []); -} - -export function ReflectGetOwnMetadataKeysWithoutTargetKeyWhenDefined() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, undefined); - let result = Reflect.getOwnMetadataKeys(obj, undefined); - assert.deepEqual(result, ["key"]); -} - -export function ReflectGetOwnMetadataKeysWithoutTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - let obj = Object.create(prototype); - Reflect.defineMetadata("key", "value", prototype, undefined); - let result = Reflect.getOwnMetadataKeys(obj, undefined); - assert.deepEqual(result, []); -} - -export function ReflectGetOwnMetadataKeysOrderWithoutTargetKey() { - let obj = {}; - Reflect.defineMetadata("key1", "value", obj, undefined); - Reflect.defineMetadata("key0", "value", obj, undefined); - let result = Reflect.getOwnMetadataKeys(obj, undefined); - assert.deepEqual(result, ["key1", "key0"]); -} - -export function ReflectGetOwnMetadataKeysOrderAfterRedefineWithoutTargetKey() { - let obj = {}; - Reflect.defineMetadata("key1", "value", obj, undefined); - Reflect.defineMetadata("key0", "value", obj, undefined); - Reflect.defineMetadata("key1", "value", obj, undefined); - let result = Reflect.getOwnMetadataKeys(obj, undefined); - assert.deepEqual(result, ["key1", "key0"]); -} - -export function ReflectGetOwnMetadataKeysWithTargetKeyWhenNotDefined() { - let obj = {}; - let result = Reflect.getOwnMetadataKeys(obj, "name"); - assert.deepEqual(result, []); -} - -export function ReflectGetOwnMetadataKeysWithTargetKeyWhenDefined() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, "name"); - let result = Reflect.getOwnMetadataKeys(obj, "name"); - assert.deepEqual(result, ["key"]); -} - -export function ReflectGetOwnMetadataKeysWithTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - let obj = Object.create(prototype); - Reflect.defineMetadata("key", "value", prototype, "name"); - let result = Reflect.getOwnMetadataKeys(obj, "name"); - assert.deepEqual(result, []); -} - -export function ReflectGetOwnMetadataKeysOrderAfterRedefineWithTargetKey() { - let obj = {}; - Reflect.defineMetadata("key1", "value", obj, "name"); - Reflect.defineMetadata("key0", "value", obj, "name"); - Reflect.defineMetadata("key1", "value", obj, "name"); - let result = Reflect.getOwnMetadataKeys(obj, "name"); - assert.deepEqual(result, ["key1", "key0"]); -} \ No newline at end of file diff --git a/test/reflect/reflect-hasmetadata.ts b/test/reflect/reflect-hasmetadata.ts deleted file mode 100644 index 291233b..0000000 --- a/test/reflect/reflect-hasmetadata.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Reflect.hasMetadata ( metadataKey, target [, propertyKey] ) -// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflecthasmetadata--metadatakey-target--propertykey- - -import "../../Reflect"; -import * as assert from "assert"; - -export function ReflectHasMetadataInvalidTarget() { - assert.throws(() => Reflect.hasMetadata("key", undefined, undefined), TypeError); -} - -export function ReflectHasMetadataWithoutTargetKeyWhenNotDefined() { - let obj = {}; - let result = Reflect.hasMetadata("key", obj, undefined); - assert.equal(result, false); -} - -export function ReflectHasMetadataWithoutTargetKeyWhenDefined() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, undefined); - let result = Reflect.hasMetadata("key", obj, undefined); - assert.equal(result, true); -} - -export function ReflectHasMetadataWithoutTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - let obj = Object.create(prototype); - Reflect.defineMetadata("key", "value", prototype, undefined); - let result = Reflect.hasMetadata("key", obj, undefined); - assert.equal(result, true); -} - -export function ReflectHasMetadataWithTargetKeyWhenNotDefined() { - let obj = {}; - let result = Reflect.hasMetadata("key", obj, "name"); - assert.equal(result, false); -} - -export function ReflectHasMetadataWithTargetKeyWhenDefined() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, "name"); - let result = Reflect.hasMetadata("key", obj, "name"); - assert.equal(result, true); -} - -export function ReflectHasMetadataWithTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - let obj = Object.create(prototype); - Reflect.defineMetadata("key", "value", prototype, "name"); - let result = Reflect.hasMetadata("key", obj, "name"); - assert.equal(result, true); -} \ No newline at end of file diff --git a/test/reflect/reflect-hasownmetadata.ts b/test/reflect/reflect-hasownmetadata.ts deleted file mode 100644 index 6727f02..0000000 --- a/test/reflect/reflect-hasownmetadata.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Reflect.hasOwnMetadata ( metadataKey, target [, propertyKey] ) -// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflecthasownmetadata--metadatakey-target--propertykey- - -import "../../Reflect"; -import * as assert from "assert"; - -export function ReflectHasOwnMetadataInvalidTarget() { - assert.throws(() => Reflect.hasOwnMetadata("key", undefined, undefined), TypeError); -} - -export function ReflectHasOwnMetadataWithoutTargetKeyWhenNotDefined() { - let obj = {}; - let result = Reflect.hasOwnMetadata("key", obj, undefined); - assert.equal(result, false); -} - -export function ReflectHasOwnMetadataWithoutTargetKeyWhenDefined() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, undefined); - let result = Reflect.hasOwnMetadata("key", obj, undefined); - assert.equal(result, true); -} - -export function ReflectHasOwnMetadataWithoutTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - let obj = Object.create(prototype); - Reflect.defineMetadata("key", "value", prototype, undefined); - let result = Reflect.hasOwnMetadata("key", obj, undefined); - assert.equal(result, false); -} - -export function ReflectHasOwnMetadataWithTargetKeyWhenNotDefined() { - let obj = {}; - let result = Reflect.hasOwnMetadata("key", obj, "name"); - assert.equal(result, false); -} - -export function ReflectHasOwnMetadataWithTargetKeyWhenDefined() { - let obj = {}; - Reflect.defineMetadata("key", "value", obj, "name"); - let result = Reflect.hasOwnMetadata("key", obj, "name"); - assert.equal(result, true); -} - -export function ReflectHasOwnMetadataWithTargetKeyWhenDefinedOnPrototype() { - let prototype = {}; - let obj = Object.create(prototype); - Reflect.defineMetadata("key", "value", prototype, "name"); - let result = Reflect.hasOwnMetadata("key", obj, "name"); - assert.equal(result, false); -} diff --git a/test/reflect/reflect-metadata.ts b/test/reflect/reflect-metadata.ts deleted file mode 100644 index ed42476..0000000 --- a/test/reflect/reflect-metadata.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Reflect.metadata ( metadataKey, metadataValue ) -// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectmetadata--metadatakey-metadatavalue- - -import "../../Reflect"; -import * as assert from "assert"; - -export function ReflectMetadataReturnsDecoratorFunction() { - let result = Reflect.metadata("key", "value"); - assert.equal(typeof result, "function"); -} - -export function ReflectMetadataDecoratorThrowsWithInvalidTargetWithTargetKey() { - let decorator = Reflect.metadata("key", "value"); - assert.throws(() => decorator(undefined, "name"), TypeError); -} - -export function ReflectMetadataDecoratorThrowsWithInvalidTargetWithoutTargetKey() { - let decorator = Reflect.metadata("key", "value"); - assert.throws(() => decorator({}, undefined), TypeError); -} - -export function ReflectMetadataDecoratorSetsMetadataOnTargetWithoutTargetKey() { - let decorator = Reflect.metadata("key", "value"); - let target = function () {} - decorator(target); - - let result = Reflect.hasOwnMetadata("key", target, undefined); - assert.equal(result, true); -} - -export function ReflectMetadataDecoratorSetsMetadataOnTargetWithTargetKey() { - let decorator = Reflect.metadata("key", "value"); - let target = {} - decorator(target, "name"); - - let result = Reflect.hasOwnMetadata("key", target, "name"); - assert.equal(result, true); -} \ No newline at end of file diff --git a/test/run.ts b/test/run.ts deleted file mode 100644 index ced5b7a..0000000 --- a/test/run.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { runTests, printResults } from './harness'; -import * as spec from "./spec"; - -let results = runTests(spec); -printResults(results); diff --git a/test/spec.ts b/test/spec.ts deleted file mode 100644 index 5285279..0000000 --- a/test/spec.ts +++ /dev/null @@ -1,10 +0,0 @@ -export * from "./reflect/reflect-decorate"; -export * from "./reflect/reflect-metadata"; -export * from "./reflect/reflect-definemetadata"; -export * from "./reflect/reflect-hasownmetadata"; -export * from "./reflect/reflect-hasmetadata"; -export * from "./reflect/reflect-getownmetadata"; -export * from "./reflect/reflect-getmetadata"; -export * from "./reflect/reflect-getownmetadatakeys"; -export * from "./reflect/reflect-getmetadatakeys"; -export * from "./reflect/reflect-deletemetadata"; \ No newline at end of file diff --git a/test/tsconfig.json b/test/tsconfig.json index 5a65ffc..a7503fb 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -4,23 +4,10 @@ "noImplicitAny": true, "sourceMap": true, "module": "commonjs", - "outDir": "../temp/" + "types": ["node", "mocha"], + "typeRoots": ["../../node_modules/@types"] }, - "files": [ - "../Reflect.ts", - "../typings/node.d.ts", - "reflect/reflect-decorate.ts", - "reflect/reflect-metadata.ts", - "reflect/reflect-definemetadata.ts", - "reflect/reflect-hasownmetadata.ts", - "reflect/reflect-hasmetadata.ts", - "reflect/reflect-getownmetadata.ts", - "reflect/reflect-getmetadata.ts", - "reflect/reflect-getownmetadatakeys.ts", - "reflect/reflect-getmetadatakeys.ts", - "reflect/reflect-deletemetadata.ts", - "harness.ts", - "spec.ts", - "run.ts" + "include": [ + "**/*.ts" ] } \ No newline at end of file diff --git a/typings/node.d.ts b/typings/node.d.ts deleted file mode 100644 index 7ecc748..0000000 --- a/typings/node.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -declare module "assert" { - function ok(test: any, message?: string): void; - function fail(message?: string): void; - function equal(actual: any, expected: any, message?: string): void; - function notEqual(actual: any, expected: any, message?: string): void; - function deepEqual(actual: any, expected: any, message?: string): void; - function notDeepEqual(actual: any, expected: any, message?: string): void; - function strictEqual(actual: any, expected: any, message?: string): void; - function notStrictEqual(actual: any, expected: any, message?: string): void; - function throws(block: () => void, error?: ErrorConstructor | RegExp | ((err: any) => boolean), message?: string): void; - function doesNotThrow(block: () => void, message?: string): void; - function ifError(value: any): boolean; -} \ No newline at end of file