fix(perf): support prod mode again

After splitting the facades into multiple modules,
enabling prod mode for code had no effect for the compiler.

Also in a change between RC1 and RC2 we created the `CompilerConfig`
via a provider with `useValue` and not via a `useFactory`, which reads
the prod mode too early.

Closes #9318
Closes #8508
Closes #9318
This commit is contained in:
Tobias Bosch
2016-06-17 14:09:19 -07:00
parent 5c8d3154d7
commit c0f2a22a08
21 changed files with 110 additions and 112 deletions

View File

@ -1,8 +1,10 @@
import {isDevMode} from '@angular/core';
import {BaseException} from '../src/facade/exceptions';
import {assertionsEnabled, isArray, isBlank, isString} from '../src/facade/lang';
import {isArray, isBlank, isString} from '../src/facade/lang';
export function assertArrayOfStrings(identifier: string, value: any) {
if (!assertionsEnabled() || isBlank(value)) {
if (!isDevMode() || isBlank(value)) {
return;
}
if (!isArray(value)) {

View File

@ -1,7 +1,6 @@
import {ViewEncapsulation} from '@angular/core';
import {ViewEncapsulation, isDevMode} from '@angular/core';
import {unimplemented} from '../src/facade/exceptions';
import {assertionsEnabled} from '../src/facade/lang';
import {CompileIdentifierMetadata} from './compile_metadata';
import {Identifiers} from './identifiers';
@ -9,16 +8,16 @@ import {Identifiers} from './identifiers';
export class CompilerConfig {
public renderTypes: RenderTypes;
public defaultEncapsulation: ViewEncapsulation;
public genDebugInfo: boolean;
public logBindingUpdate: boolean;
private _genDebugInfo: boolean;
private _logBindingUpdate: boolean;
public useJit: boolean;
public platformDirectives: any[];
public platformPipes: any[];
constructor(
{renderTypes = new DefaultRenderTypes(), defaultEncapsulation = ViewEncapsulation.Emulated,
genDebugInfo = assertionsEnabled(), logBindingUpdate = assertionsEnabled(), useJit = true,
platformDirectives = [], platformPipes = []}: {
genDebugInfo, logBindingUpdate, useJit = true, platformDirectives = [],
platformPipes = []}: {
renderTypes?: RenderTypes,
defaultEncapsulation?: ViewEncapsulation,
genDebugInfo?: boolean,
@ -29,12 +28,19 @@ export class CompilerConfig {
} = {}) {
this.renderTypes = renderTypes;
this.defaultEncapsulation = defaultEncapsulation;
this.genDebugInfo = genDebugInfo;
this.logBindingUpdate = logBindingUpdate;
this._genDebugInfo = genDebugInfo;
this._logBindingUpdate = logBindingUpdate;
this.useJit = useJit;
this.platformDirectives = platformDirectives;
this.platformPipes = platformPipes;
}
get genDebugInfo(): boolean {
return this._genDebugInfo === void 0 ? isDevMode() : this._genDebugInfo;
}
get logBindingUpdate(): boolean {
return this._logBindingUpdate === void 0 ? isDevMode() : this._logBindingUpdate;
}
}
/**