refactor(facade): Inline isBlank called with object-type argument (#11992)
This commit is contained in:

committed by
Chuck Jazdzewski

parent
e884f4854d
commit
0286956107
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {StringMapWrapper} from '../facade/collection';
|
||||
import {isBlank, isPresent} from '../facade/lang';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {Identifiers, resolveIdentifier} from '../identifiers';
|
||||
import * as o from '../output/output_ast';
|
||||
import {ANY_STATE, DEFAULT_STATE, EMPTY_STATE} from '../private_import_core';
|
||||
@ -323,7 +323,7 @@ class _AnimationBuilderStateMap {
|
||||
get states() { return this._states; }
|
||||
registerState(name: string, value: {[prop: string]: string | number} = null): void {
|
||||
var existingEntry = this._states[name];
|
||||
if (isBlank(existingEntry)) {
|
||||
if (!existingEntry) {
|
||||
this._states[name] = value;
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class _TreeBuilder {
|
||||
// read =
|
||||
while (this._peek.type === lex.TokenType.EXPANSION_CASE_VALUE) {
|
||||
let expCase = this._parseExpansionCase();
|
||||
if (isBlank(expCase)) return; // error
|
||||
if (!expCase) return; // error
|
||||
cases.push(expCase);
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ class _TreeBuilder {
|
||||
const start = this._advance();
|
||||
|
||||
const exp = this._collectExpansionExpTokens(start);
|
||||
if (isBlank(exp)) return null;
|
||||
if (!exp) return null;
|
||||
|
||||
const end = this._advance();
|
||||
exp.push(new lex.Token(lex.TokenType.EOF, [], end.sourceSpan));
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
|
||||
import {CompileDiDependencyMetadata, CompileIdentifierMetadata, CompileNgModuleMetadata, CompileProviderMetadata, CompileTokenMetadata} from './compile_metadata';
|
||||
import {isBlank, isPresent} from './facade/lang';
|
||||
import {isPresent} from './facade/lang';
|
||||
import {Identifiers, resolveIdentifier, resolveIdentifierToken} from './identifiers';
|
||||
import * as o from './output/output_ast';
|
||||
import {convertValueToOutputAst} from './output/value_util';
|
||||
@ -190,7 +190,7 @@ class _InjectorBuilder {
|
||||
resolvedProviderValueExpr = providerValueExpressions[0];
|
||||
type = providerValueExpressions[0].type;
|
||||
}
|
||||
if (isBlank(type)) {
|
||||
if (!type) {
|
||||
type = o.DYNAMIC_TYPE;
|
||||
}
|
||||
if (isEager) {
|
||||
@ -223,11 +223,11 @@ class _InjectorBuilder {
|
||||
resolveIdentifierToken(Identifiers.ComponentFactoryResolver).reference)) {
|
||||
result = o.THIS_EXPR;
|
||||
}
|
||||
if (isBlank(result)) {
|
||||
if (!result) {
|
||||
result = this._instances.get(dep.token.reference);
|
||||
}
|
||||
}
|
||||
if (isBlank(result)) {
|
||||
if (!result) {
|
||||
var args = [createDiTokenExpression(dep.token)];
|
||||
if (dep.isOptional) {
|
||||
args.push(o.NULL_EXPR);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
import {CompileIdentifierMetadata} from '../compile_metadata';
|
||||
import {isBlank, isPresent, isString} from '../facade/lang';
|
||||
import {isPresent, isString} from '../facade/lang';
|
||||
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ export enum TypeModifier {
|
||||
|
||||
export abstract class Type {
|
||||
constructor(public modifiers: TypeModifier[] = null) {
|
||||
if (isBlank(modifiers)) {
|
||||
if (!modifiers) {
|
||||
this.modifiers = [];
|
||||
}
|
||||
}
|
||||
@ -462,7 +462,7 @@ export enum StmtModifier {
|
||||
|
||||
export abstract class Statement {
|
||||
constructor(public modifiers: StmtModifier[] = null) {
|
||||
if (isBlank(modifiers)) {
|
||||
if (!modifiers) {
|
||||
this.modifiers = [];
|
||||
}
|
||||
}
|
||||
@ -517,7 +517,7 @@ export class ReturnStatement extends Statement {
|
||||
|
||||
export class AbstractClassPart {
|
||||
constructor(public type: Type = null, public modifiers: StmtModifier[]) {
|
||||
if (isBlank(modifiers)) {
|
||||
if (!modifiers) {
|
||||
this.modifiers = [];
|
||||
}
|
||||
}
|
||||
|
@ -136,10 +136,9 @@ export class ProviderElementContext {
|
||||
requestingProviderType: ProviderAstType, token: CompileTokenMetadata,
|
||||
eager: boolean): ProviderAst {
|
||||
var resolvedProvider = this._allProviders.get(token.reference);
|
||||
if (isBlank(resolvedProvider) ||
|
||||
((requestingProviderType === ProviderAstType.Directive ||
|
||||
requestingProviderType === ProviderAstType.PublicService) &&
|
||||
resolvedProvider.providerType === ProviderAstType.PrivateService) ||
|
||||
if (!resolvedProvider || ((requestingProviderType === ProviderAstType.Directive ||
|
||||
requestingProviderType === ProviderAstType.PublicService) &&
|
||||
resolvedProvider.providerType === ProviderAstType.PrivateService) ||
|
||||
((requestingProviderType === ProviderAstType.PrivateService ||
|
||||
requestingProviderType === ProviderAstType.PublicService) &&
|
||||
resolvedProvider.providerType === ProviderAstType.Builtin)) {
|
||||
@ -239,12 +238,12 @@ export class ProviderElementContext {
|
||||
result = this._getLocalDependency(requestingProviderType, dep, eager);
|
||||
}
|
||||
if (dep.isSelf) {
|
||||
if (isBlank(result) && dep.isOptional) {
|
||||
if (!result && dep.isOptional) {
|
||||
result = new CompileDiDependencyMetadata({isValue: true, value: null});
|
||||
}
|
||||
} else {
|
||||
// check parent elements
|
||||
while (isBlank(result) && isPresent(currElement._parent)) {
|
||||
while (!result && isPresent(currElement._parent)) {
|
||||
var prevElement = currElement;
|
||||
currElement = currElement._parent;
|
||||
if (prevElement._isViewRoot) {
|
||||
@ -253,7 +252,7 @@ export class ProviderElementContext {
|
||||
result = currElement._getLocalDependency(ProviderAstType.PublicService, dep, currEager);
|
||||
}
|
||||
// check @Host restriction
|
||||
if (isBlank(result)) {
|
||||
if (!result) {
|
||||
if (!dep.isHost || this.viewContext.component.type.isHost ||
|
||||
this.viewContext.component.type.reference === dep.token.reference ||
|
||||
isPresent(this.viewContext.viewProviders.get(dep.token.reference))) {
|
||||
@ -265,7 +264,7 @@ export class ProviderElementContext {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isBlank(result)) {
|
||||
if (!result) {
|
||||
this.viewContext.errors.push(
|
||||
new ProviderError(`No provider for ${dep.token.name}`, this._sourceSpan));
|
||||
}
|
||||
@ -311,7 +310,7 @@ export class NgModuleProviderAnalyzer {
|
||||
|
||||
private _getOrCreateLocalProvider(token: CompileTokenMetadata, eager: boolean): ProviderAst {
|
||||
var resolvedProvider = this._allProviders.get(token.reference);
|
||||
if (isBlank(resolvedProvider)) {
|
||||
if (!resolvedProvider) {
|
||||
return null;
|
||||
}
|
||||
var transformedProviderAst = this._transformedProviders.get(token.reference);
|
||||
@ -414,7 +413,7 @@ function _normalizeProviders(
|
||||
providers: Array<CompileProviderMetadata|CompileTypeMetadata|any[]>,
|
||||
sourceSpan: ParseSourceSpan, targetErrors: ParseError[],
|
||||
targetProviders: CompileProviderMetadata[] = null): CompileProviderMetadata[] {
|
||||
if (isBlank(targetProviders)) {
|
||||
if (!targetProviders) {
|
||||
targetProviders = [];
|
||||
}
|
||||
if (isPresent(providers)) {
|
||||
@ -479,7 +478,7 @@ function _resolveProviders(
|
||||
`Mixing multi and non multi provider is not possible for token ${resolvedProvider.token.name}`,
|
||||
sourceSpan));
|
||||
}
|
||||
if (isBlank(resolvedProvider)) {
|
||||
if (!resolvedProvider) {
|
||||
const lifecycleHooks =
|
||||
provider.token.identifier && provider.token.identifier instanceof CompileTypeMetadata ?
|
||||
provider.token.identifier.lifecycleHooks :
|
||||
@ -530,7 +529,7 @@ function _getContentQueries(directives: CompileDirectiveMetadata[]):
|
||||
function _addQueryToTokenMap(map: Map<any, CompileQueryMetadata[]>, query: CompileQueryMetadata) {
|
||||
query.selectors.forEach((token: CompileTokenMetadata) => {
|
||||
var entry = map.get(token.reference);
|
||||
if (isBlank(entry)) {
|
||||
if (!entry) {
|
||||
entry = [];
|
||||
map.set(token.reference, entry);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import {AnimationParser} from './animation/animation_parser';
|
||||
import {CompileDirectiveMetadata, CompileIdentifierMetadata, CompileNgModuleMetadata, CompilePipeMetadata, ProviderMeta, createHostComponentMeta} from './compile_metadata';
|
||||
import {CompilerConfig} from './config';
|
||||
import {DirectiveNormalizer} from './directive_normalizer';
|
||||
import {isBlank, stringify} from './facade/lang';
|
||||
import {stringify} from './facade/lang';
|
||||
import {CompileMetadataResolver} from './metadata_resolver';
|
||||
import {NgModuleCompiler} from './ng_module_compiler';
|
||||
import * as ir from './output/output_ast';
|
||||
@ -191,7 +191,7 @@ export class RuntimeCompiler implements Compiler {
|
||||
|
||||
private _createCompiledHostTemplate(compType: Type<any>): CompiledTemplate {
|
||||
var compiledTemplate = this._compiledHostTemplateCache.get(compType);
|
||||
if (isBlank(compiledTemplate)) {
|
||||
if (!compiledTemplate) {
|
||||
var compMeta = this._metadataResolver.getDirectiveMetadata(compType);
|
||||
assertComponent(compMeta);
|
||||
var hostMeta = createHostComponentMeta(compMeta);
|
||||
@ -206,7 +206,7 @@ export class RuntimeCompiler implements Compiler {
|
||||
private _createCompiledTemplate(
|
||||
compMeta: CompileDirectiveMetadata, ngModule: CompileNgModuleMetadata): CompiledTemplate {
|
||||
var compiledTemplate = this._compiledTemplateCache.get(compMeta.type.reference);
|
||||
if (isBlank(compiledTemplate)) {
|
||||
if (!compiledTemplate) {
|
||||
assertComponent(compMeta);
|
||||
compiledTemplate = new CompiledTemplate(
|
||||
false, compMeta.selector, compMeta.type, ngModule.transitiveModule.directives,
|
||||
|
@ -216,7 +216,7 @@ export class SelectorMatcher {
|
||||
if (isTerminal) {
|
||||
var terminalMap = matcher._attrValueMap;
|
||||
var terminalValuesMap = terminalMap.get(attrName);
|
||||
if (isBlank(terminalValuesMap)) {
|
||||
if (!terminalValuesMap) {
|
||||
terminalValuesMap = new Map<string, SelectorContext[]>();
|
||||
terminalMap.set(attrName, terminalValuesMap);
|
||||
}
|
||||
@ -224,7 +224,7 @@ export class SelectorMatcher {
|
||||
} else {
|
||||
var parttialMap = matcher._attrValuePartialMap;
|
||||
var partialValuesMap = parttialMap.get(attrName);
|
||||
if (isBlank(partialValuesMap)) {
|
||||
if (!partialValuesMap) {
|
||||
partialValuesMap = new Map<string, SelectorMatcher>();
|
||||
parttialMap.set(attrName, partialValuesMap);
|
||||
}
|
||||
@ -237,7 +237,7 @@ export class SelectorMatcher {
|
||||
private _addTerminal(
|
||||
map: Map<string, SelectorContext[]>, name: string, selectable: SelectorContext) {
|
||||
var terminalList = map.get(name);
|
||||
if (isBlank(terminalList)) {
|
||||
if (!terminalList) {
|
||||
terminalList = [];
|
||||
map.set(name, terminalList);
|
||||
}
|
||||
@ -246,7 +246,7 @@ export class SelectorMatcher {
|
||||
|
||||
private _addPartial(map: Map<string, SelectorMatcher>, name: string): SelectorMatcher {
|
||||
var matcher = map.get(name);
|
||||
if (isBlank(matcher)) {
|
||||
if (!matcher) {
|
||||
matcher = new SelectorMatcher();
|
||||
map.set(name, matcher);
|
||||
}
|
||||
@ -316,7 +316,7 @@ export class SelectorMatcher {
|
||||
_matchTerminal(
|
||||
map: Map<string, SelectorContext[]>, name: string, cssSelector: CssSelector,
|
||||
matchedCallback: (c: CssSelector, a: any) => void): boolean {
|
||||
if (isBlank(map) || isBlank(name)) {
|
||||
if (!map || isBlank(name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ export class SelectorMatcher {
|
||||
if (isPresent(starSelectables)) {
|
||||
selectables = selectables.concat(starSelectables);
|
||||
}
|
||||
if (isBlank(selectables)) {
|
||||
if (!selectables) {
|
||||
return false;
|
||||
}
|
||||
var selectable: SelectorContext;
|
||||
@ -341,11 +341,11 @@ export class SelectorMatcher {
|
||||
_matchPartial(
|
||||
map: Map<string, SelectorMatcher>, name: string, cssSelector: CssSelector,
|
||||
matchedCallback: (c: CssSelector, a: any) => void): boolean {
|
||||
if (isBlank(map) || isBlank(name)) {
|
||||
if (!map || isBlank(name)) {
|
||||
return false;
|
||||
}
|
||||
var nestedSelector = map.get(name);
|
||||
if (isBlank(nestedSelector)) {
|
||||
if (!nestedSelector) {
|
||||
return false;
|
||||
}
|
||||
// TODO(perf): get rid of recursion and measure again
|
||||
@ -374,13 +374,11 @@ export class SelectorContext {
|
||||
|
||||
finalize(cssSelector: CssSelector, callback: (c: CssSelector, a: any) => void): boolean {
|
||||
var result = true;
|
||||
if (this.notSelectors.length > 0 &&
|
||||
(isBlank(this.listContext) || !this.listContext.alreadyMatched)) {
|
||||
if (this.notSelectors.length > 0 && (!this.listContext || !this.listContext.alreadyMatched)) {
|
||||
var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors);
|
||||
result = !notMatcher.match(cssSelector, null);
|
||||
}
|
||||
if (result && isPresent(callback) &&
|
||||
(isBlank(this.listContext) || !this.listContext.alreadyMatched)) {
|
||||
if (result && isPresent(callback) && (!this.listContext || !this.listContext.alreadyMatched)) {
|
||||
if (isPresent(this.listContext)) {
|
||||
this.listContext.alreadyMatched = true;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import {CompileDirectiveMetadata, CompilePipeMetadata, CompileTemplateMetadata,
|
||||
import {AST, ASTWithSource, BindingPipe, EmptyExpr, Interpolation, ParserError, RecursiveAstVisitor, TemplateBinding} from '../expression_parser/ast';
|
||||
import {Parser} from '../expression_parser/parser';
|
||||
import {StringMapWrapper} from '../facade/collection';
|
||||
import {isBlank, isPresent, isString} from '../facade/lang';
|
||||
import {isPresent, isString} from '../facade/lang';
|
||||
import {I18NHtmlParser} from '../i18n/i18n_html_parser';
|
||||
import {Identifiers, identifierToken, resolveIdentifierToken} from '../identifiers';
|
||||
import * as html from '../ml_parser/ast';
|
||||
@ -869,7 +869,7 @@ class TemplateParseVisitor implements html.Visitor {
|
||||
const boundPropsByName = new Map<string, BoundElementOrDirectiveProperty>();
|
||||
boundProps.forEach(boundProp => {
|
||||
const prevValue = boundPropsByName.get(boundProp.name);
|
||||
if (isBlank(prevValue) || prevValue.isLiteral) {
|
||||
if (!prevValue || prevValue.isLiteral) {
|
||||
// give [a]="b" a higher precedence than a="b" on the same element
|
||||
boundPropsByName.set(boundProp.name, boundProp);
|
||||
}
|
||||
@ -900,7 +900,7 @@ class TemplateParseVisitor implements html.Visitor {
|
||||
});
|
||||
|
||||
props.forEach((prop: BoundElementOrDirectiveProperty) => {
|
||||
if (!prop.isLiteral && isBlank(boundDirectivePropsIndex.get(prop.name))) {
|
||||
if (!prop.isLiteral && !boundDirectivePropsIndex.get(prop.name)) {
|
||||
boundElementProps.push(this._createElementPropertyAst(
|
||||
elementName, prop.name, prop.expression, prop.sourceSpan));
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
import {CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileIdentifierMetadata, CompileProviderMetadata, CompileQueryMetadata, CompileTokenMetadata} from '../compile_metadata';
|
||||
import {ListWrapper, MapWrapper, StringMapWrapper} from '../facade/collection';
|
||||
import {isBlank, isPresent} from '../facade/lang';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {Identifiers, identifierToken, resolveIdentifier, resolveIdentifierToken} from '../identifiers';
|
||||
import * as o from '../output/output_ast';
|
||||
import {convertValueToOutputAst} from '../output/value_util';
|
||||
@ -27,7 +27,7 @@ export class CompileNode {
|
||||
public parent: CompileElement, public view: CompileView, public nodeIndex: number,
|
||||
public renderNode: o.Expression, public sourceAst: TemplateAst) {}
|
||||
|
||||
isNull(): boolean { return isBlank(this.renderNode); }
|
||||
isNull(): boolean { return !this.renderNode; }
|
||||
|
||||
isRootElement(): boolean { return this.view != this.parent.view; }
|
||||
}
|
||||
@ -313,12 +313,12 @@ export class CompileElement extends CompileNode {
|
||||
requestingProviderType: ProviderAstType, dep: CompileDiDependencyMetadata): o.Expression {
|
||||
var result: o.Expression = null;
|
||||
// constructor content query
|
||||
if (isBlank(result) && isPresent(dep.query)) {
|
||||
if (!result && isPresent(dep.query)) {
|
||||
result = this._addQuery(dep.query, null).queryList;
|
||||
}
|
||||
|
||||
// constructor view query
|
||||
if (isBlank(result) && isPresent(dep.viewQuery)) {
|
||||
if (!result && isPresent(dep.viewQuery)) {
|
||||
result = createQueryList(
|
||||
dep.viewQuery, null,
|
||||
`_viewQuery_${dep.viewQuery.selectors[0].name}_${this.nodeIndex}_${this._componentConstructorViewQueryLists.length}`,
|
||||
@ -328,7 +328,7 @@ export class CompileElement extends CompileNode {
|
||||
|
||||
if (isPresent(dep.token)) {
|
||||
// access builtins with special visibility
|
||||
if (isBlank(result)) {
|
||||
if (!result) {
|
||||
if (dep.token.reference ===
|
||||
resolveIdentifierToken(Identifiers.ChangeDetectorRef).reference) {
|
||||
if (requestingProviderType === ProviderAstType.Component) {
|
||||
@ -339,7 +339,7 @@ export class CompileElement extends CompileNode {
|
||||
}
|
||||
}
|
||||
// access regular providers on the element
|
||||
if (isBlank(result)) {
|
||||
if (!result) {
|
||||
let resolvedProvider = this._resolvedProviders.get(dep.token.reference);
|
||||
// don't allow directives / public services to access private services.
|
||||
// only components and private services can access private services.
|
||||
@ -361,20 +361,20 @@ export class CompileElement extends CompileNode {
|
||||
if (dep.isValue) {
|
||||
result = o.literal(dep.value);
|
||||
}
|
||||
if (isBlank(result) && !dep.isSkipSelf) {
|
||||
if (!result && !dep.isSkipSelf) {
|
||||
result = this._getLocalDependency(requestingProviderType, dep);
|
||||
}
|
||||
// check parent elements
|
||||
while (isBlank(result) && !currElement.parent.isNull()) {
|
||||
while (!result && !currElement.parent.isNull()) {
|
||||
currElement = currElement.parent;
|
||||
result = currElement._getLocalDependency(
|
||||
ProviderAstType.PublicService, new CompileDiDependencyMetadata({token: dep.token}));
|
||||
}
|
||||
|
||||
if (isBlank(result)) {
|
||||
if (!result) {
|
||||
result = injectFromViewParentInjector(dep.token, dep.isOptional);
|
||||
}
|
||||
if (isBlank(result)) {
|
||||
if (!result) {
|
||||
result = o.NULL_EXPR;
|
||||
}
|
||||
return getPropertyInView(result, this.view, currElement.view);
|
||||
@ -411,7 +411,7 @@ function createProviderProperty(
|
||||
resolvedProviderValueExpr = providerValueExpressions[0];
|
||||
type = providerValueExpressions[0].type;
|
||||
}
|
||||
if (isBlank(type)) {
|
||||
if (!type) {
|
||||
type = o.DYNAMIC_TYPE;
|
||||
}
|
||||
if (isEager) {
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
|
||||
import {CompilePipeMetadata} from '../compile_metadata';
|
||||
import {isBlank} from '../facade/lang';
|
||||
import {Identifiers, resolveIdentifier, resolveIdentifierToken} from '../identifiers';
|
||||
import * as o from '../output/output_ast';
|
||||
|
||||
@ -23,7 +22,7 @@ export class CompilePipe {
|
||||
if (meta.pure) {
|
||||
// pure pipes live on the component view
|
||||
pipe = compView.purePipes.get(name);
|
||||
if (isBlank(pipe)) {
|
||||
if (!pipe) {
|
||||
pipe = new CompilePipe(compView, meta);
|
||||
compView.purePipes.set(name, pipe);
|
||||
compView.pipes.push(pipe);
|
||||
@ -85,7 +84,7 @@ function _findPipeMeta(view: CompileView, name: string): CompilePipeMetadata {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isBlank(pipeMeta)) {
|
||||
if (!pipeMeta) {
|
||||
throw new Error(
|
||||
`Illegal state: Could not find pipe ${name} although the parser should have detected this error!`);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {CompileQueryMetadata} from '../compile_metadata';
|
||||
import {ListWrapper} from '../facade/collection';
|
||||
import {isBlank, isPresent} from '../facade/lang';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {Identifiers, resolveIdentifier} from '../identifiers';
|
||||
import * as o from '../output/output_ast';
|
||||
|
||||
@ -129,7 +129,7 @@ export function createQueryList(
|
||||
export function addQueryToTokenMap(map: Map<any, CompileQuery[]>, query: CompileQuery) {
|
||||
query.meta.selectors.forEach((selector) => {
|
||||
var entry = map.get(selector.reference);
|
||||
if (isBlank(entry)) {
|
||||
if (!entry) {
|
||||
entry = [];
|
||||
map.set(selector.reference, entry);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import {AnimationEntryCompileResult} from '../animation/animation_compiler';
|
||||
import {CompileDirectiveMetadata, CompileIdentifierMetadata, CompilePipeMetadata} from '../compile_metadata';
|
||||
import {CompilerConfig} from '../config';
|
||||
import {ListWrapper, MapWrapper} from '../facade/collection';
|
||||
import {isBlank, isPresent} from '../facade/lang';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {Identifiers, resolveIdentifier} from '../identifiers';
|
||||
import * as o from '../output/output_ast';
|
||||
import {ViewType} from '../private_import_core';
|
||||
@ -138,7 +138,7 @@ export class CompileView implements NameResolver {
|
||||
}
|
||||
var currView: CompileView = this;
|
||||
var result = currView.locals.get(name);
|
||||
while (isBlank(result) && isPresent(currView.declarationElement.view)) {
|
||||
while (!result && isPresent(currView.declarationElement.view)) {
|
||||
currView = currView.declarationElement.view;
|
||||
result = currView.locals.get(name);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {CompileDirectiveMetadata} from '../compile_metadata';
|
||||
import {StringMapWrapper} from '../facade/collection';
|
||||
import {StringWrapper, isBlank, isPresent} from '../facade/lang';
|
||||
import {StringWrapper, isPresent} from '../facade/lang';
|
||||
import {identifierToken} from '../identifiers';
|
||||
import * as o from '../output/output_ast';
|
||||
import {BoundEventAst, DirectiveAst} from '../template_parser/template_ast';
|
||||
@ -32,7 +32,7 @@ export class CompileEventListener {
|
||||
var listener = targetEventListeners.find(
|
||||
listener => listener.eventTarget == eventTarget && listener.eventName == eventName &&
|
||||
listener.eventPhase == eventPhase);
|
||||
if (isBlank(listener)) {
|
||||
if (!listener) {
|
||||
listener = new CompileEventListener(
|
||||
compileElement, eventTarget, eventName, eventPhase, targetEventListeners.length);
|
||||
targetEventListeners.push(listener);
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {SecurityContext} from '@angular/core';
|
||||
|
||||
import * as cdAst from '../expression_parser/ast';
|
||||
import {isBlank, isPresent} from '../facade/lang';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {Identifiers, resolveIdentifier} from '../identifiers';
|
||||
import * as o from '../output/output_ast';
|
||||
import {EMPTY_STATE as EMPTY_ANIMATION_STATE, LifecycleHooks, isDefaultChangeDetectionStrategy} from '../private_import_core';
|
||||
@ -37,7 +37,7 @@ function bind(
|
||||
method: CompileMethod, bindingIndex: number) {
|
||||
var checkExpression = convertCdExpressionToIr(
|
||||
view, context, parsedExpression, DetectChangesVars.valUnwrapper, bindingIndex);
|
||||
if (isBlank(checkExpression.expression)) {
|
||||
if (!checkExpression.expression) {
|
||||
// e.g. an empty expression was given
|
||||
return;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
import {CompileDirectiveMetadata, CompileTokenMetadata} from '../compile_metadata';
|
||||
import {isBlank, isPresent} from '../facade/lang';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {Identifiers, resolveIdentifier} from '../identifiers';
|
||||
import * as o from '../output/output_ast';
|
||||
import {createDiTokenExpression} from '../util';
|
||||
@ -84,7 +84,7 @@ export function createPureProxy(
|
||||
view.fields.push(new o.ClassField(pureProxyProp.name, null));
|
||||
var pureProxyId =
|
||||
argCount < Identifiers.pureProxies.length ? Identifiers.pureProxies[argCount] : null;
|
||||
if (isBlank(pureProxyId)) {
|
||||
if (!pureProxyId) {
|
||||
throw new Error(`Unsupported number of argument for pure functions: ${argCount}`);
|
||||
}
|
||||
view.createMethod.addStmt(o.THIS_EXPR.prop(pureProxyProp.name)
|
||||
|
Reference in New Issue
Block a user