diff --git a/modules/angular2/src/core/util/decorators.ts b/modules/angular2/src/core/util/decorators.ts index 54f50fa565..6e54ec84f7 100644 --- a/modules/angular2/src/core/util/decorators.ts +++ b/modules/angular2/src/core/util/decorators.ts @@ -238,9 +238,13 @@ export function Class(clsDef: ClassDefinition): ConcreteType { } var Reflect = global.Reflect; -if (!(Reflect && Reflect.getMetadata)) { - throw 'reflect-metadata shim is required when using class decorators'; -} +// Throw statement at top-level is disallowed by closure compiler in ES6 input. +// Wrap in an IIFE as a work-around. +(function checkReflect() { + if (!(Reflect && Reflect.getMetadata)) { + throw 'reflect-metadata shim is required when using class decorators'; + } +})(); export function makeDecorator( annotationCls, chainFn: (fn: Function) => void = null): (...args: any[]) => (cls: any) => any {