diff --git a/modules/@angular/compiler/src/aot/compiler.ts b/modules/@angular/compiler/src/aot/compiler.ts index 6e017cce8c..57398b5eec 100644 --- a/modules/@angular/compiler/src/aot/compiler.ts +++ b/modules/@angular/compiler/src/aot/compiler.ts @@ -6,8 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {SchemaMetadata} from '@angular/core'; - import {AnimationCompiler} from '../animation/animation_compiler'; import {AnimationParser} from '../animation/animation_parser'; import {CompileDirectiveMetadata, CompileIdentifierMetadata, CompileNgModuleMetadata, CompilePipeMetadata, CompileProviderMetadata, CompileTypeSummary, createHostComponentMeta, identifierModuleUrl, identifierName} from '../compile_metadata'; diff --git a/modules/@angular/compiler/src/aot/static_reflector.ts b/modules/@angular/compiler/src/aot/static_reflector.ts index 9e7e537a2b..97ab385d6c 100644 --- a/modules/@angular/compiler/src/aot/static_reflector.ts +++ b/modules/@angular/compiler/src/aot/static_reflector.ts @@ -10,8 +10,8 @@ import {Attribute, Component, ContentChild, ContentChildren, Directive, Host, Ho import {ReflectorReader} from '../private_import_core'; -import {StaticSymbol, StaticSymbolCache} from './static_symbol'; -import {ResolvedStaticSymbol, StaticSymbolResolver} from './static_symbol_resolver'; +import {StaticSymbol} from './static_symbol'; +import {StaticSymbolResolver} from './static_symbol_resolver'; const ANGULAR_IMPORT_LOCATIONS = { coreDecorators: '@angular/core/src/metadata', @@ -652,10 +652,6 @@ class PopulatedScope extends BindingScope { } } -function sameSymbol(a: StaticSymbol, b: StaticSymbol): boolean { - return a === b; -} - function shouldIgnore(value: any): boolean { return value && value.__symbolic == 'ignore'; } diff --git a/modules/@angular/compiler/src/aot/summary_resolver.ts b/modules/@angular/compiler/src/aot/summary_resolver.ts index 91731e7f3c..0f5154ad5d 100644 --- a/modules/@angular/compiler/src/aot/summary_resolver.ts +++ b/modules/@angular/compiler/src/aot/summary_resolver.ts @@ -5,7 +5,7 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import {CompileSummaryKind, CompileTypeSummary} from '../compile_metadata'; + import {Summary, SummaryResolver} from '../summary_resolver'; import {StaticSymbol, StaticSymbolCache} from './static_symbol'; diff --git a/modules/@angular/compiler/src/aot/summary_serializer.ts b/modules/@angular/compiler/src/aot/summary_serializer.ts index b8d38db56d..faaed3d667 100644 --- a/modules/@angular/compiler/src/aot/summary_serializer.ts +++ b/modules/@angular/compiler/src/aot/summary_serializer.ts @@ -5,16 +5,16 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import {CompileDirectiveSummary, CompileIdentifierMetadata, CompileNgModuleSummary, CompilePipeSummary, CompileSummaryKind, CompileTypeMetadata, CompileTypeSummary, identifierModuleUrl, identifierName} from '../compile_metadata'; +import {CompileNgModuleSummary, CompileSummaryKind, CompileTypeSummary} from '../compile_metadata'; import {Summary, SummaryResolver} from '../summary_resolver'; import {ValueTransformer, visitValue} from '../util'; -import {GeneratedFile} from './generated_file'; import {StaticSymbol, StaticSymbolCache} from './static_symbol'; import {ResolvedStaticSymbol, StaticSymbolResolver} from './static_symbol_resolver'; const STRIP_SRC_FILE_SUFFIXES = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/; + export interface AotSummarySerializerHost { /** * Returns the output file path of a source file. @@ -180,4 +180,4 @@ class Deserializer extends ValueTransformer { return super.visitStringMap(map, context); } } -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/src/compiler_util/binding_util.ts b/modules/@angular/compiler/src/compiler_util/binding_util.ts index 7a332bdec9..05b9523c50 100644 --- a/modules/@angular/compiler/src/compiler_util/binding_util.ts +++ b/modules/@angular/compiler/src/compiler_util/binding_util.ts @@ -5,7 +5,6 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ - import {Identifiers, createIdentifier} from '../identifiers'; import {ClassBuilder} from '../output/class_builder'; import * as o from '../output/output_ast'; diff --git a/modules/@angular/compiler/src/compiler_util/expression_converter.ts b/modules/@angular/compiler/src/compiler_util/expression_converter.ts index d5e0f7becd..b4b937e684 100644 --- a/modules/@angular/compiler/src/compiler_util/expression_converter.ts +++ b/modules/@angular/compiler/src/compiler_util/expression_converter.ts @@ -8,7 +8,7 @@ import * as cdAst from '../expression_parser/ast'; -import {isBlank, isPresent} from '../facade/lang'; +import {isBlank} from '../facade/lang'; import {Identifiers, createIdentifier} from '../identifiers'; import {ClassBuilder} from '../output/class_builder'; import * as o from '../output/output_ast'; @@ -338,7 +338,7 @@ class _AstToIrVisitor implements cdAst.AstVisitor { const receiver = this.visit(ast.receiver, _Mode.Expression); if (receiver === this._implicitReceiver) { const varExpr = this._getLocal(ast.name); - if (isPresent(varExpr)) { + if (varExpr) { result = varExpr.callFn(args); } } @@ -374,7 +374,7 @@ class _AstToIrVisitor implements cdAst.AstVisitor { const receiver: o.Expression = this.visit(ast.receiver, _Mode.Expression); if (receiver === this._implicitReceiver) { const varExpr = this._getLocal(ast.name); - if (isPresent(varExpr)) { + if (varExpr) { throw new Error('Cannot assign to a reference or variable!'); } } diff --git a/modules/@angular/compiler/src/directive_normalizer.ts b/modules/@angular/compiler/src/directive_normalizer.ts index 1bcee76dd1..bfa704b026 100644 --- a/modules/@angular/compiler/src/directive_normalizer.ts +++ b/modules/@angular/compiler/src/directive_normalizer.ts @@ -8,7 +8,7 @@ import {Component, ViewEncapsulation} from '@angular/core'; -import {CompileAnimationEntryMetadata, CompileDirectiveMetadata, CompileStylesheetMetadata, CompileTemplateMetadata, CompileTypeMetadata} from './compile_metadata'; +import {CompileAnimationEntryMetadata, CompileDirectiveMetadata, CompileStylesheetMetadata, CompileTemplateMetadata} from './compile_metadata'; import {CompilerConfig} from './config'; import {isBlank, isPresent, stringify} from './facade/lang'; import {CompilerInjectable} from './injectable'; diff --git a/modules/@angular/compiler/src/directive_resolver.ts b/modules/@angular/compiler/src/directive_resolver.ts index 2eacc7103f..8b874a5762 100644 --- a/modules/@angular/compiler/src/directive_resolver.ts +++ b/modules/@angular/compiler/src/directive_resolver.ts @@ -14,8 +14,6 @@ import {CompilerInjectable} from './injectable'; import {ReflectorReader, reflector} from './private_import_core'; import {splitAtColon} from './util'; - - /* * Resolve a `Type` for {@link Directive}. * diff --git a/modules/@angular/compiler/src/directive_wrapper_compiler.ts b/modules/@angular/compiler/src/directive_wrapper_compiler.ts index 40d19f29d7..2baa6a3fcb 100644 --- a/modules/@angular/compiler/src/directive_wrapper_compiler.ts +++ b/modules/@angular/compiler/src/directive_wrapper_compiler.ts @@ -128,7 +128,6 @@ class DirectiveWrapperBuilder implements ClassBuilder { new o.ClassMethod('ngOnDestroy', [], this.destroyStmts), ]; - const fields: o.ClassField[] = [ new o.ClassField(EVENT_HANDLER_FIELD_NAME, o.FUNCTION_TYPE, [o.StmtModifier.Private]), new o.ClassField(CONTEXT_FIELD_NAME, o.importType(this.dirMeta.type)), diff --git a/modules/@angular/compiler/src/expression_parser/lexer.ts b/modules/@angular/compiler/src/expression_parser/lexer.ts index 1430869f87..952aa37214 100644 --- a/modules/@angular/compiler/src/expression_parser/lexer.ts +++ b/modules/@angular/compiler/src/expression_parser/lexer.ts @@ -7,7 +7,7 @@ */ import * as chars from '../chars'; -import {NumberWrapper, isPresent} from '../facade/lang'; +import {NumberWrapper} from '../facade/lang'; import {CompilerInjectable} from '../injectable'; export enum TokenType { @@ -241,7 +241,7 @@ class _Scanner { this.advance(); str += two; } - if (isPresent(threeCode) && this.peek == threeCode) { + if (threeCode != null && this.peek == threeCode) { this.advance(); str += three; } diff --git a/modules/@angular/compiler/src/identifiers.ts b/modules/@angular/compiler/src/identifiers.ts index 2d0d80cb5b..7a03bc8cb7 100644 --- a/modules/@angular/compiler/src/identifiers.ts +++ b/modules/@angular/compiler/src/identifiers.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {ANALYZE_FOR_ENTRY_COMPONENTS, AnimationTransitionEvent, ChangeDetectionStrategy, ChangeDetectorRef, ComponentFactory, ComponentFactoryResolver, ComponentRef, ElementRef, Injector, LOCALE_ID, NgModuleFactory, QueryList, RenderComponentType, Renderer, SecurityContext, SimpleChange, TRANSLATIONS_FORMAT, TemplateRef, ViewContainerRef, ViewEncapsulation} from '@angular/core'; +import {ANALYZE_FOR_ENTRY_COMPONENTS, ChangeDetectionStrategy, ChangeDetectorRef, ComponentFactory, ComponentFactoryResolver, ComponentRef, ElementRef, Injector, LOCALE_ID, NgModuleFactory, QueryList, RenderComponentType, Renderer, SecurityContext, SimpleChange, TRANSLATIONS_FORMAT, TemplateRef, ViewContainerRef, ViewEncapsulation} from '@angular/core'; import {StaticSymbol} from './aot/static_symbol'; import {CompileIdentifierMetadata, CompileTokenMetadata, identifierModuleUrl, identifierName} from './compile_metadata'; diff --git a/modules/@angular/compiler/src/ml_parser/parser.ts b/modules/@angular/compiler/src/ml_parser/parser.ts index 0658ca35ef..2c1473daff 100644 --- a/modules/@angular/compiler/src/ml_parser/parser.ts +++ b/modules/@angular/compiler/src/ml_parser/parser.ts @@ -283,7 +283,7 @@ class _TreeBuilder { const tagDef = this.getTagDefinition(el.name); const {parent, container} = this._getParentElementSkippingContainers(); - if (isPresent(parent) && tagDef.requireExtraParent(parent.name)) { + if (parent && tagDef.requireExtraParent(parent.name)) { const newParent = new html.Element( tagDef.parentToAdd, [], [], el.sourceSpan, el.startSourceSpan, el.endSourceSpan); this._insertBeforeContainer(parent, container, newParent); diff --git a/modules/@angular/compiler/src/ng_module_compiler.ts b/modules/@angular/compiler/src/ng_module_compiler.ts index aa210ede5f..448ac53329 100644 --- a/modules/@angular/compiler/src/ng_module_compiler.ts +++ b/modules/@angular/compiler/src/ng_module_compiler.ts @@ -9,7 +9,7 @@ import {CompileDiDependencyMetadata, CompileIdentifierMetadata, CompileNgModuleMetadata, CompileProviderMetadata, CompileTokenMetadata, identifierModuleUrl, identifierName, tokenName, tokenReference} from './compile_metadata'; import {createDiTokenExpression} from './compiler_util/identifier_util'; import {isPresent} from './facade/lang'; -import {Identifiers, createIdentifier, createIdentifierToken, resolveIdentifier} from './identifiers'; +import {Identifiers, createIdentifier, resolveIdentifier} from './identifiers'; import {CompilerInjectable} from './injectable'; import {ClassBuilder, createClassStmt} from './output/class_builder'; import * as o from './output/output_ast'; diff --git a/modules/@angular/compiler/src/ng_module_resolver.ts b/modules/@angular/compiler/src/ng_module_resolver.ts index e29eb78f85..581b4110ad 100644 --- a/modules/@angular/compiler/src/ng_module_resolver.ts +++ b/modules/@angular/compiler/src/ng_module_resolver.ts @@ -9,7 +9,7 @@ import {NgModule, Type} from '@angular/core'; import {ListWrapper} from './facade/collection'; -import {isPresent, stringify} from './facade/lang'; +import {stringify} from './facade/lang'; import {CompilerInjectable} from './injectable'; import {ReflectorReader, reflector} from './private_import_core'; @@ -30,7 +30,7 @@ export class NgModuleResolver { const ngModuleMeta: NgModule = ListWrapper.findLast(this._reflector.annotations(type), _isNgModuleMetadata); - if (isPresent(ngModuleMeta)) { + if (ngModuleMeta) { return ngModuleMeta; } else { if (throwIfNotFound) { diff --git a/modules/@angular/compiler/src/output/value_util.ts b/modules/@angular/compiler/src/output/value_util.ts index 6862eb1d0f..c60677aac2 100644 --- a/modules/@angular/compiler/src/output/value_util.ts +++ b/modules/@angular/compiler/src/output/value_util.ts @@ -7,7 +7,6 @@ */ -import {CompileIdentifierMetadata} from '../compile_metadata'; import {ValueTransformer, visitValue} from '../util'; import * as o from './output_ast'; diff --git a/modules/@angular/compiler/src/pipe_resolver.ts b/modules/@angular/compiler/src/pipe_resolver.ts index 94de46ee54..2a8cb7e6ee 100644 --- a/modules/@angular/compiler/src/pipe_resolver.ts +++ b/modules/@angular/compiler/src/pipe_resolver.ts @@ -9,7 +9,7 @@ import {Pipe, Type, resolveForwardRef} from '@angular/core'; import {ListWrapper} from './facade/collection'; -import {isPresent, stringify} from './facade/lang'; +import {stringify} from './facade/lang'; import {CompilerInjectable} from './injectable'; import {ReflectorReader, reflector} from './private_import_core'; @@ -38,9 +38,9 @@ export class PipeResolver { */ resolve(type: Type, throwIfNotFound = true): Pipe { const metas = this._reflector.annotations(resolveForwardRef(type)); - if (isPresent(metas)) { + if (metas) { const annotation = ListWrapper.findLast(metas, _isPipeMetadata); - if (isPresent(annotation)) { + if (annotation) { return annotation; } } diff --git a/modules/@angular/compiler/src/provider_analyzer.ts b/modules/@angular/compiler/src/provider_analyzer.ts index d754f86a22..df3248956b 100644 --- a/modules/@angular/compiler/src/provider_analyzer.ts +++ b/modules/@angular/compiler/src/provider_analyzer.ts @@ -9,7 +9,7 @@ import {CompileDiDependencyMetadata, CompileDirectiveMetadata, CompileDirectiveSummary, CompileNgModuleMetadata, CompileProviderMetadata, CompileQueryMetadata, CompileTokenMetadata, CompileTypeMetadata, tokenName, tokenReference} from './compile_metadata'; import {isBlank, isPresent} from './facade/lang'; -import {Identifiers, createIdentifierToken, resolveIdentifier} from './identifiers'; +import {Identifiers, resolveIdentifier} from './identifiers'; import {ParseError, ParseSourceSpan} from './parse_util'; import {AttrAst, DirectiveAst, ProviderAst, ProviderAstType, ReferenceAst} from './template_parser/template_ast'; @@ -114,7 +114,7 @@ export class ProviderElementContext { let queries: CompileQueryMetadata[]; while (currentEl !== null) { queries = currentEl._contentQueries.get(tokenReference(token)); - if (isPresent(queries)) { + if (queries) { result.push(...queries.filter((query) => query.descendants || distance <= 1)); } if (currentEl._directiveAsts.length > 0) { @@ -123,7 +123,7 @@ export class ProviderElementContext { currentEl = currentEl._parent; } queries = this.viewContext.viewQueries.get(tokenReference(token)); - if (isPresent(queries)) { + if (queries) { result.push(...queries); } return result; @@ -143,7 +143,7 @@ export class ProviderElementContext { return null; } let transformedProviderAst = this._transformedProviders.get(tokenReference(token)); - if (isPresent(transformedProviderAst)) { + if (transformedProviderAst) { return transformedProviderAst; } if (isPresent(this._seenProviders.get(tokenReference(token)))) { @@ -165,11 +165,11 @@ export class ProviderElementContext { transformedUseExisting = null; transformedUseValue = existingDiDep.value; } - } else if (isPresent(provider.useFactory)) { + } else if (provider.useFactory) { const deps = provider.deps || provider.useFactory.diDeps; transformedDeps = deps.map((dep) => this._getDependency(resolvedProvider.providerType, dep, eager)); - } else if (isPresent(provider.useClass)) { + } else if (provider.useClass) { const deps = provider.deps || provider.useClass.diDeps; transformedDeps = deps.map((dep) => this._getDependency(resolvedProvider.providerType, dep, eager)); @@ -235,7 +235,7 @@ export class ProviderElementContext { } } else { // check parent elements - while (!result && isPresent(currElement._parent)) { + while (!result && currElement._parent) { const prevElement = currElement; currElement = currElement._parent; if (prevElement._isViewRoot) { @@ -301,7 +301,7 @@ export class NgModuleProviderAnalyzer { return null; } let transformedProviderAst = this._transformedProviders.get(tokenReference(token)); - if (isPresent(transformedProviderAst)) { + if (transformedProviderAst) { return transformedProviderAst; } if (isPresent(this._seenProviders.get(tokenReference(token)))) { @@ -324,11 +324,11 @@ export class NgModuleProviderAnalyzer { transformedUseExisting = null; transformedUseValue = existingDiDep.value; } - } else if (isPresent(provider.useFactory)) { + } else if (provider.useFactory) { const deps = provider.deps || provider.useFactory.diDeps; transformedDeps = deps.map((dep) => this._getDependency(dep, eager, resolvedProvider.sourceSpan)); - } else if (isPresent(provider.useClass)) { + } else if (provider.useClass) { const deps = provider.deps || provider.useClass.diDeps; transformedDeps = deps.map((dep) => this._getDependency(dep, eager, resolvedProvider.sourceSpan)); @@ -454,7 +454,7 @@ function _resolveProviders( function _getViewQueries(component: CompileDirectiveMetadata): Map { const viewQueries = new Map(); - if (isPresent(component.viewQueries)) { + if (component.viewQueries) { component.viewQueries.forEach((query) => _addQueryToTokenMap(viewQueries, query)); } return viewQueries; @@ -464,7 +464,7 @@ function _getContentQueries(directives: CompileDirectiveSummary[]): Map { const contentQueries = new Map(); directives.forEach(directive => { - if (isPresent(directive.queries)) { + if (directive.queries) { directive.queries.forEach((query) => _addQueryToTokenMap(contentQueries, query)); } }); diff --git a/modules/@angular/compiler/src/template_parser/binding_parser.ts b/modules/@angular/compiler/src/template_parser/binding_parser.ts index 7b51ac387f..9756c19ccb 100644 --- a/modules/@angular/compiler/src/template_parser/binding_parser.ts +++ b/modules/@angular/compiler/src/template_parser/binding_parser.ts @@ -11,7 +11,6 @@ import {SecurityContext} from '@angular/core'; import {CompileDirectiveSummary, CompilePipeSummary} from '../compile_metadata'; import {ASTWithSource, BindingPipe, EmptyExpr, ParserError, RecursiveAstVisitor, TemplateBinding} from '../expression_parser/ast'; import {Parser} from '../expression_parser/parser'; -import {isPresent} from '../facade/lang'; import {InterpolationConfig} from '../ml_parser/interpolation_config'; import {mergeNsAndName} from '../ml_parser/tags'; import {ParseError, ParseErrorLevel, ParseSourceSpan} from '../parse_util'; @@ -111,14 +110,14 @@ export class BindingParser { } parseInlineTemplateBinding( - name: string, prefixToken: string, value: string, sourceSpan: ParseSourceSpan, + prefixToken: string, value: string, sourceSpan: ParseSourceSpan, targetMatchableAttrs: string[][], targetProps: BoundProperty[], targetVars: VariableAst[]) { const bindings = this._parseTemplateBindings(prefixToken, value, sourceSpan); for (let i = 0; i < bindings.length; i++) { const binding = bindings[i]; if (binding.keyIsVar) { targetVars.push(new VariableAst(binding.key, binding.name, sourceSpan)); - } else if (isPresent(binding.expression)) { + } else if (binding.expression) { this._parsePropertyAst( binding.key, binding.expression, sourceSpan, targetMatchableAttrs, targetProps); } else { @@ -136,7 +135,7 @@ export class BindingParser { const bindingsResult = this._exprParser.parseTemplateBindings(prefixToken, value, sourceInfo); this._reportExpressionParserErrors(bindingsResult.errors, sourceSpan); bindingsResult.templateBindings.forEach((binding) => { - if (isPresent(binding.expression)) { + if (binding.expression) { this._checkPipes(binding.expression, sourceSpan); } }); @@ -193,7 +192,7 @@ export class BindingParser { name: string, value: string, sourceSpan: ParseSourceSpan, targetMatchableAttrs: string[][], targetProps: BoundProperty[]): boolean { const expr = this.parseInterpolation(value, sourceSpan); - if (isPresent(expr)) { + if (expr) { this._parsePropertyAst(name, expr, sourceSpan, targetMatchableAttrs, targetProps); return true; } @@ -374,7 +373,7 @@ export class BindingParser { } private _checkPipes(ast: ASTWithSource, sourceSpan: ParseSourceSpan) { - if (isPresent(ast)) { + if (ast) { const collector = new PipeCollector(); ast.visit(collector); collector.pipes.forEach((ast, pipeName) => { diff --git a/modules/@angular/compiler/src/template_parser/template_parser.ts b/modules/@angular/compiler/src/template_parser/template_parser.ts index 78e8f3f1f2..493b371bd6 100644 --- a/modules/@angular/compiler/src/template_parser/template_parser.ts +++ b/modules/@angular/compiler/src/template_parser/template_parser.ts @@ -288,7 +288,7 @@ class TemplateParseVisitor implements html.Visitor { } hasInlineTemplates = true; this._bindingParser.parseInlineTemplateBinding( - attr.name, prefixToken, templateBindingsSource, attr.sourceSpan, templateMatchableAttrs, + prefixToken, templateBindingsSource, attr.sourceSpan, templateMatchableAttrs, templateElementOrDirectiveProps, templateElementVars); } @@ -309,9 +309,11 @@ class TemplateParseVisitor implements html.Visitor { const elementProps: BoundElementPropertyAst[] = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, directiveAsts); const isViewRoot = parent.isTemplateElement || hasInlineTemplates; + const providerContext = new ProviderElementContext( this.providerViewContext, parent.providerContext, isViewRoot, directiveAsts, attrs, references, element.sourceSpan); + const children = html.visitAll( preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, ElementContext.create( diff --git a/modules/@angular/compiler/src/view_compiler/compile_element.ts b/modules/@angular/compiler/src/view_compiler/compile_element.ts index 6c8675290e..c91ff274d7 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_element.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_element.ts @@ -19,7 +19,7 @@ import {ProviderAst, ProviderAstType, ReferenceAst, TemplateAst} from '../templa import {CompileMethod} from './compile_method'; import {CompileQuery, addQueryToTokenMap, createQueryList} from './compile_query'; import {CompileView, CompileViewRootNode} from './compile_view'; -import {InjectMethodVars, ViewProperties} from './constants'; +import {InjectMethodVars} from './constants'; import {ComponentFactoryDependency, DirectiveWrapperDependency} from './deps'; import {getPropertyInView, injectFromViewParentInjector} from './util'; @@ -195,7 +195,7 @@ export class CompileElement extends CompileNode { const propName = `_${tokenName(resolvedProvider.token)}_${this.nodeIndex}_${this.instances.size}`; const instance = createProviderProperty( - propName, resolvedProvider, providerValueExpressions, resolvedProvider.multiProvider, + propName, providerValueExpressions, resolvedProvider.multiProvider, resolvedProvider.eager, this); if (isDirectiveWrapper) { this.directiveWrapperInstance.set(tokenReference(resolvedProvider.token), instance); @@ -289,7 +289,7 @@ export class CompileElement extends CompileNode { CompileQuery { const propName = `_query_${tokenName(queryMeta.selectors[0])}_${this.nodeIndex}_${this._queryCount++}`; - const queryList = createQueryList(queryMeta, directiveInstance, propName, this.view); + const queryList = createQueryList(propName, this.view); const query = new CompileQuery(queryMeta, queryList, directiveInstance, this.view); addQueryToTokenMap(this._queries, query); return query; @@ -369,8 +369,8 @@ function createInjectInternalCondition( } function createProviderProperty( - propName: string, provider: ProviderAst, providerValueExpressions: o.Expression[], - isMulti: boolean, isEager: boolean, compileElement: CompileElement): o.Expression { + propName: string, providerValueExpressions: o.Expression[], isMulti: boolean, isEager: boolean, + compileElement: CompileElement): o.Expression { const view = compileElement.view; let resolvedProviderValueExpr: o.Expression; let type: o.Type; diff --git a/modules/@angular/compiler/src/view_compiler/compile_method.ts b/modules/@angular/compiler/src/view_compiler/compile_method.ts index cafb869e77..a6cdf3bf8f 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_method.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_method.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.io/license */ -import {isPresent} from '../facade/lang'; import * as o from '../output/output_ast'; import {TemplateAst} from '../template_parser/template_ast'; @@ -34,7 +33,7 @@ export class CompileMethod { if (this._newState.nodeIndex !== this._currState.nodeIndex || this._newState.sourceAst !== this._currState.sourceAst) { const expr = this._updateDebugContext(this._newState); - if (isPresent(expr)) { + if (expr) { this._bodyStatements.push(expr.toStmt()); } } @@ -43,13 +42,12 @@ export class CompileMethod { private _updateDebugContext(newState: _DebugState): o.Expression { this._currState = this._newState = newState; if (this._debugEnabled) { - const sourceLocation = - isPresent(newState.sourceAst) ? newState.sourceAst.sourceSpan.start : null; + const sourceLocation = newState.sourceAst ? newState.sourceAst.sourceSpan.start : null; return o.THIS_EXPR.callMethod('debug', [ o.literal(newState.nodeIndex), - isPresent(sourceLocation) ? o.literal(sourceLocation.line) : o.NULL_EXPR, - isPresent(sourceLocation) ? o.literal(sourceLocation.col) : o.NULL_EXPR + sourceLocation ? o.literal(sourceLocation.line) : o.NULL_EXPR, + sourceLocation ? o.literal(sourceLocation.col) : o.NULL_EXPR ]); } else { return null; diff --git a/modules/@angular/compiler/src/view_compiler/compile_query.ts b/modules/@angular/compiler/src/view_compiler/compile_query.ts index db53a53355..21b9708a58 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_query.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_query.ts @@ -8,7 +8,6 @@ import {CompileQueryMetadata, tokenReference} from '../compile_metadata'; import {ListWrapper} from '../facade/collection'; -import {isPresent} from '../facade/lang'; import {Identifiers, createIdentifier} from '../identifiers'; import * as o from '../output/output_ast'; @@ -33,7 +32,7 @@ export class CompileQuery { addValue(value: o.Expression, view: CompileView) { let currentView = view; const elPath: CompileElement[] = []; - while (isPresent(currentView) && currentView !== this.view) { + while (currentView && currentView !== this.view) { const parentEl = currentView.declarationElement; elPath.unshift(parentEl); currentView = parentEl.view; @@ -67,7 +66,7 @@ export class CompileQuery { generateStatements(targetStaticMethod: CompileMethod, targetDynamicMethod: CompileMethod) { const values = createQueryValues(this._values); const updateStmts = [this.queryList.callMethod('reset', [o.literalArr(values)]).toStmt()]; - if (isPresent(this.ownerDirectiveExpression)) { + if (this.ownerDirectiveExpression) { const valueExpr = this.meta.first ? this.queryList.prop('first') : this.queryList; updateStmts.push( this.ownerDirectiveExpression.prop(this.meta.propertyName).set(valueExpr).toStmt()); @@ -110,9 +109,7 @@ function mapNestedViews( ]); } -export function createQueryList( - query: CompileQueryMetadata, directiveInstance: o.Expression, propertyName: string, - compileView: CompileView): o.Expression { +export function createQueryList(propertyName: string, compileView: CompileView): o.Expression { compileView.fields.push(new o.ClassField( propertyName, o.importType(createIdentifier(Identifiers.QueryList), [o.DYNAMIC_TYPE]))); const expr = o.THIS_EXPR.prop(propertyName); diff --git a/modules/@angular/compiler/src/view_compiler/compile_view.ts b/modules/@angular/compiler/src/view_compiler/compile_view.ts index e7a6f5159e..fd0f1c6315 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_view.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_view.ts @@ -12,7 +12,6 @@ import {EventHandlerVars, NameResolver} from '../compiler_util/expression_conver import {createPureProxy} from '../compiler_util/identifier_util'; import {CompilerConfig} from '../config'; import {isPresent} from '../facade/lang'; -import {Identifiers, createIdentifier} from '../identifiers'; import * as o from '../output/output_ast'; import {ViewType} from '../private_import_core'; @@ -119,7 +118,7 @@ export class CompileView implements NameResolver { const directiveInstance = o.THIS_EXPR.prop('context'); this.component.viewQueries.forEach((queryMeta, queryIndex) => { const propName = `_viewQuery_${tokenName(queryMeta.selectors[0])}_${queryIndex}`; - const queryList = createQueryList(queryMeta, directiveInstance, propName, this); + const queryList = createQueryList(propName, this); const query = new CompileQuery(queryMeta, queryList, directiveInstance, this); addQueryToTokenMap(viewQueries, query); }); diff --git a/modules/@angular/compiler/src/view_compiler/constants.ts b/modules/@angular/compiler/src/view_compiler/constants.ts index e6a3b02d93..43a2974697 100644 --- a/modules/@angular/compiler/src/view_compiler/constants.ts +++ b/modules/@angular/compiler/src/view_compiler/constants.ts @@ -11,7 +11,7 @@ import {ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; import {createEnumExpression} from '../compiler_util/identifier_util'; import {Identifiers} from '../identifiers'; import * as o from '../output/output_ast'; -import {ChangeDetectorStatus, ViewType} from '../private_import_core'; +import {ViewType} from '../private_import_core'; export class ViewTypeEnum { static fromValue(value: ViewType): o.Expression { @@ -25,12 +25,6 @@ export class ViewEncapsulationEnum { } } -export class ChangeDetectionStrategyEnum { - static fromValue(value: ChangeDetectionStrategy): o.Expression { - return createEnumExpression(Identifiers.ChangeDetectionStrategy, value); - } -} - export class ChangeDetectorStatusEnum { static fromValue(value: ChangeDetectorStatusEnum): o.Expression { return createEnumExpression(Identifiers.ChangeDetectorStatus, value); diff --git a/modules/@angular/compiler/src/view_compiler/event_binder.ts b/modules/@angular/compiler/src/view_compiler/event_binder.ts index 459f64c831..57ffd9584d 100644 --- a/modules/@angular/compiler/src/view_compiler/event_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/event_binder.ts @@ -15,7 +15,6 @@ import {BoundEventAst, DirectiveAst} from '../template_parser/template_ast'; import {CompileElement} from './compile_element'; import {CompileMethod} from './compile_method'; -import {ViewProperties} from './constants'; import {getHandleEventMethodName} from './util'; export function bindOutputs( diff --git a/modules/@angular/compiler/src/view_compiler/query_binder.ts b/modules/@angular/compiler/src/view_compiler/query_binder.ts index 9f2ddb31fb..6d2e64008b 100644 --- a/modules/@angular/compiler/src/view_compiler/query_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/query_binder.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {CompileQueryMetadata, CompileTokenMetadata, tokenReference} from '../compile_metadata'; +import {CompileTokenMetadata, tokenReference} from '../compile_metadata'; import * as o from '../output/output_ast'; import {CompileElement} from './compile_element'; @@ -17,16 +17,18 @@ import {CompileQuery} from './compile_query'; // as we create embedded views before the