You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@angular/compiler

Package Overview
Dependencies
Maintainers
1
Versions
822
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.1 to 2.1.2

src/compiler_util/binding_util.d.ts

7

bundles/compiler-testing.umd.js
/**
* @license Angular v2.1.1
* @license Angular v2.1.2
* (c) 2010-2016 Google, Inc. https://angular.io/

@@ -28,3 +28,4 @@ * License: MIT

};
MockSchemaRegistry.prototype.securityContext = function (tagName, property) {
MockSchemaRegistry.prototype.allKnownElementNames = function () { return Object.keys(this.existingElements); };
MockSchemaRegistry.prototype.securityContext = function (selector, property, isAttribute) {
return _angular_core.SecurityContext.NONE;

@@ -57,3 +58,3 @@ };

function isPresent(obj) {
return obj !== undefined && obj !== null;
return obj != null;
}

@@ -60,0 +61,0 @@ function stringify(token) {

@@ -36,5 +36,4 @@ /**

export { DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig } from './src/ml_parser/interpolation_config';
export { ElementSchemaRegistry } from './src/schema/element_schema_registry';
export * from './src/schema/element_schema_registry';
export * from './src/i18n/index';
export * from './src/template_parser/template_ast';
export * from './src/directive_normalizer';

@@ -41,0 +40,0 @@ export * from './src/expression_parser/lexer';

@@ -36,5 +36,4 @@ /**

export { DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig } from './src/ml_parser/interpolation_config';
export { ElementSchemaRegistry } from './src/schema/element_schema_registry';
export * from './src/schema/element_schema_registry';
export * from './src/i18n/index';
export * from './src/template_parser/template_ast';
export * from './src/directive_normalizer';

@@ -41,0 +40,0 @@ export * from './src/expression_parser/lexer';

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./src/template_parser/template_ast"},{"from":"./src/template_parser/template_parser","export":["TEMPLATE_TRANSFORMS"]},{"from":"./src/config","export":["CompilerConfig","RenderTypes"]},{"from":"./src/compile_metadata"},{"from":"./src/offline_compiler"},{"from":"./src/runtime_compiler","export":["RuntimeCompiler"]},{"from":"./src/url_resolver"},{"from":"./src/resource_loader"},{"from":"./src/compiler"},{"from":"./src/directive_resolver","export":["DirectiveResolver"]},{"from":"./src/pipe_resolver","export":["PipeResolver"]},{"from":"./src/ng_module_resolver","export":["NgModuleResolver"]},{"from":"./src/ml_parser/interpolation_config","export":["DEFAULT_INTERPOLATION_CONFIG","InterpolationConfig"]},{"from":"./src/schema/element_schema_registry","export":["ElementSchemaRegistry"]},{"from":"./src/i18n/index"},{"from":"./src/template_parser/template_ast"},{"from":"./src/directive_normalizer"},{"from":"./src/expression_parser/lexer"},{"from":"./src/expression_parser/parser"},{"from":"./src/metadata_resolver"},{"from":"./src/ml_parser/html_parser"},{"from":"./src/ml_parser/interpolation_config"},{"from":"./src/ng_module_compiler","export":["NgModuleCompiler"]},{"from":"./src/directive_wrapper_compiler","export":["DirectiveWrapperCompiler"]},{"from":"./src/output/path_util"},{"from":"./src/output/ts_emitter"},{"from":"./src/parse_util"},{"from":"./src/schema/dom_element_schema_registry"},{"from":"./src/selector"},{"from":"./src/style_compiler"},{"from":"./src/template_parser/template_parser"},{"from":"./src/view_compiler/view_compiler","export":["ViewCompiler"]}]}
{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./src/template_parser/template_ast"},{"from":"./src/template_parser/template_parser","export":["TEMPLATE_TRANSFORMS"]},{"from":"./src/config","export":["CompilerConfig","RenderTypes"]},{"from":"./src/compile_metadata"},{"from":"./src/offline_compiler"},{"from":"./src/runtime_compiler","export":["RuntimeCompiler"]},{"from":"./src/url_resolver"},{"from":"./src/resource_loader"},{"from":"./src/compiler"},{"from":"./src/directive_resolver","export":["DirectiveResolver"]},{"from":"./src/pipe_resolver","export":["PipeResolver"]},{"from":"./src/ng_module_resolver","export":["NgModuleResolver"]},{"from":"./src/ml_parser/interpolation_config","export":["DEFAULT_INTERPOLATION_CONFIG","InterpolationConfig"]},{"from":"./src/schema/element_schema_registry"},{"from":"./src/i18n/index"},{"from":"./src/directive_normalizer"},{"from":"./src/expression_parser/lexer"},{"from":"./src/expression_parser/parser"},{"from":"./src/metadata_resolver"},{"from":"./src/ml_parser/html_parser"},{"from":"./src/ml_parser/interpolation_config"},{"from":"./src/ng_module_compiler","export":["NgModuleCompiler"]},{"from":"./src/directive_wrapper_compiler","export":["DirectiveWrapperCompiler"]},{"from":"./src/output/path_util"},{"from":"./src/output/ts_emitter"},{"from":"./src/parse_util"},{"from":"./src/schema/dom_element_schema_registry"},{"from":"./src/selector"},{"from":"./src/style_compiler"},{"from":"./src/template_parser/template_parser"},{"from":"./src/view_compiler/view_compiler","export":["ViewCompiler"]}]}
{
"name": "@angular/compiler",
"version": "2.1.1",
"version": "2.1.2",
"description": "Angular - the compiler library",

@@ -11,3 +11,3 @@ "main": "bundles/compiler.umd.js",

"peerDependencies": {
"@angular/core": "2.1.1"
"@angular/core": "2.1.2"
},

@@ -14,0 +14,0 @@ "repository": {

@@ -14,3 +14,3 @@ /**

import { CompileAnimationAnimateMetadata, CompileAnimationGroupMetadata, CompileAnimationKeyframesSequenceMetadata, CompileAnimationSequenceMetadata, CompileAnimationStateDeclarationMetadata, CompileAnimationStyleMetadata, CompileAnimationWithStepsMetadata } from '../compile_metadata';
import { ListWrapper, StringMapWrapper } from '../facade/collection';
import { StringMapWrapper } from '../facade/collection';
import { isBlank, isPresent } from '../facade/lang';

@@ -161,3 +161,3 @@ import { ParseError } from '../parse_util';

if (typeof styleEntry === 'string') {
ListWrapper.addAll(normalizedStyles, _resolveStylesFromState(styleEntry, stateStyles, errors));
normalizedStyles.push.apply(normalizedStyles, _resolveStylesFromState(styleEntry, stateStyles, errors));
}

@@ -309,7 +309,7 @@ else {

if (doSortKeyframes) {
ListWrapper.sort(rawKeyframes, function (a, b) { return a[0] <= b[0] ? -1 : 1; });
rawKeyframes.sort(function (a, b) { return a[0] <= b[0] ? -1 : 1; });
}
var firstKeyframe = rawKeyframes[0];
if (firstKeyframe[0] != _INITIAL_KEYFRAME) {
ListWrapper.insert(rawKeyframes, 0, firstKeyframe = [_INITIAL_KEYFRAME, {}]);
rawKeyframes.splice(0, 0, firstKeyframe = [_INITIAL_KEYFRAME, {}]);
}

@@ -376,3 +376,3 @@ var firstKeyframeStyles = firstKeyframe[1];

var innerStep = innerAst;
ListWrapper.addAll(innerStep.startingStyles.styles, previousStyles);
(_a = innerStep.startingStyles.styles).push.apply(_a, previousStyles);
}

@@ -386,2 +386,3 @@ previousStyles = null;

steps.push(innerAst);
var _a;
});

@@ -388,0 +389,0 @@ if (isPresent(previousStyles)) {

@@ -8,3 +8,2 @@ /**

*/
import { ListWrapper } from '../facade/collection';
import { isPresent } from '../facade/lang';

@@ -40,3 +39,3 @@ export var StylesCollectionEntry = (function () {

}
ListWrapper.insert(entries, insertionIndex, tuple);
entries.splice(insertionIndex, 0, tuple);
};

@@ -43,0 +42,0 @@ StylesCollection.prototype.getByIndex = function (property, index) {

@@ -308,3 +308,3 @@ /**

/**
* Metadata regarding compilation of a directive.
* Metadata regarding compilation of a module.
*/

@@ -311,0 +311,0 @@ export declare class CompileNgModuleMetadata implements CompileMetadataWithIdentifier {

@@ -15,3 +15,3 @@ /**

import { ListWrapper, MapWrapper } from './facade/collection';
import { isPresent, normalizeBlank, normalizeBool } from './facade/lang';
import { isPresent } from './facade/lang';
import { CssSelector } from './selector';

@@ -27,3 +27,2 @@ import { sanitizeIdentifier, splitAtColon } from './util';

var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
var UNDEFINED = new Object();
export var CompileMetadataWithIdentifier = (function () {

@@ -150,8 +149,8 @@ function CompileMetadataWithIdentifier() {

var _b = _a === void 0 ? {} : _a, isAttribute = _b.isAttribute, isSelf = _b.isSelf, isHost = _b.isHost, isSkipSelf = _b.isSkipSelf, isOptional = _b.isOptional, isValue = _b.isValue, query = _b.query, viewQuery = _b.viewQuery, token = _b.token, value = _b.value;
this.isAttribute = normalizeBool(isAttribute);
this.isSelf = normalizeBool(isSelf);
this.isHost = normalizeBool(isHost);
this.isSkipSelf = normalizeBool(isSkipSelf);
this.isOptional = normalizeBool(isOptional);
this.isValue = normalizeBool(isValue);
this.isAttribute = !!isAttribute;
this.isSelf = !!isSelf;
this.isHost = !!isHost;
this.isSkipSelf = !!isSkipSelf;
this.isOptional = !!isOptional;
this.isValue = !!isValue;
this.query = query;

@@ -172,4 +171,4 @@ this.viewQuery = viewQuery;

this.useFactory = useFactory;
this.deps = normalizeBlank(deps);
this.multi = normalizeBool(multi);
this.deps = deps || null;
this.multi = !!multi;
}

@@ -192,3 +191,3 @@ return CompileProviderMetadata;

this.identifier = identifier;
this.identifierIsInstance = normalizeBool(identifierIsInstance);
this.identifierIsInstance = !!identifierIsInstance;
}

@@ -224,3 +223,3 @@ Object.defineProperty(CompileTokenMetadata.prototype, "reference", {

_super.call(this, { reference: reference, name: name, moduleUrl: moduleUrl, prefix: prefix, value: value });
this.isHost = normalizeBool(isHost);
this.isHost = !!isHost;
this.diDeps = _normalizeArray(diDeps);

@@ -235,4 +234,4 @@ this.lifecycleHooks = _normalizeArray(lifecycleHooks);

this.selectors = selectors;
this.descendants = normalizeBool(descendants);
this.first = normalizeBool(first);
this.descendants = !!descendants;
this.first = !!first;
this.propertyName = propertyName;

@@ -267,5 +266,5 @@ this.read = read;

this.externalStylesheets = _normalizeArray(externalStylesheets);
this.animations = isPresent(animations) ? ListWrapper.flatten(animations) : [];
this.animations = animations ? ListWrapper.flatten(animations) : [];
this.ngContentSelectors = ngContentSelectors || [];
if (isPresent(interpolation) && interpolation.length != 2) {
if (interpolation && interpolation.length != 2) {
throw new Error("'interpolation' should have a start and an end symbol.");

@@ -340,3 +339,3 @@ }

type: type,
isComponent: normalizeBool(isComponent), selector: selector, exportAs: exportAs, changeDetection: changeDetection,
isComponent: !!isComponent, selector: selector, exportAs: exportAs, changeDetection: changeDetection,
inputs: inputsMap,

@@ -400,3 +399,3 @@ outputs: outputsMap,

this.name = name;
this.pure = normalizeBool(pure);
this.pure = !!pure;
}

@@ -411,3 +410,3 @@ Object.defineProperty(CompilePipeMetadata.prototype, "identifier", {

/**
* Metadata regarding compilation of a directive.
* Metadata regarding compilation of a module.
*/

@@ -414,0 +413,0 @@ export var CompileNgModuleMetadata = (function () {

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"isStaticSymbol":{"__symbolic":"function","parameters":["value"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":596,"character":9},"right":"object"},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"value"},"right":null}},"right":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"value"},"index":"name"}},"right":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"value"},"index":"filePath"}}}}}
{"__symbolic":"module","version":1,"metadata":{"isStaticSymbol":{"__symbolic":"function","parameters":["value"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":598,"character":9},"right":"object"},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"value"},"right":null}},"right":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"value"},"index":"name"}},"right":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"value"},"index":"filePath"}}}}}
import { CompileDirectiveMetadata, CompileIdentifierMetadata } from './compile_metadata';
import { CompilerConfig } from './config';
import { Parser } from './expression_parser/parser';
import * as o from './output/output_ast';
import { Console } from './private_import_core';
import { ElementSchemaRegistry } from './schema/element_schema_registry';
export declare class DirectiveWrapperCompileResult {

@@ -19,5 +22,8 @@ statements: o.Statement[];

private compilerConfig;
private _exprParser;
private _schemaRegistry;
private _console;
static dirWrapperClassName(id: CompileIdentifierMetadata): string;
constructor(compilerConfig: CompilerConfig);
constructor(compilerConfig: CompilerConfig, _exprParser: Parser, _schemaRegistry: ElementSchemaRegistry, _console: Console);
compile(dirMeta: CompileDirectiveMetadata): DirectiveWrapperCompileResult;
}

@@ -9,6 +9,15 @@ /**

import { Injectable } from '@angular/core';
import { createCheckBindingField, createCheckBindingStmt } from './compiler_util/binding_util';
import { convertPropertyBinding } from './compiler_util/expression_converter';
import { writeToRenderer } from './compiler_util/render_util';
import { CompilerConfig } from './config';
import { Parser } from './expression_parser/parser';
import { Identifiers, resolveIdentifier } from './identifiers';
import { DEFAULT_INTERPOLATION_CONFIG } from './ml_parser/interpolation_config';
import { createClassStmt } from './output/class_builder';
import * as o from './output/output_ast';
import { LifecycleHooks } from './private_import_core';
import { ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan } from './parse_util';
import { Console, LifecycleHooks } from './private_import_core';
import { ElementSchemaRegistry } from './schema/element_schema_registry';
import { BindingParser } from './template_parser/binding_parser';
export var DirectiveWrapperCompileResult = (function () {

@@ -39,58 +48,80 @@ function DirectiveWrapperCompileResult(statements, dirWrapperClassVar) {

export var DirectiveWrapperCompiler = (function () {
function DirectiveWrapperCompiler(compilerConfig) {
function DirectiveWrapperCompiler(compilerConfig, _exprParser, _schemaRegistry, _console) {
this.compilerConfig = compilerConfig;
this._exprParser = _exprParser;
this._schemaRegistry = _schemaRegistry;
this._console = _console;
}
DirectiveWrapperCompiler.dirWrapperClassName = function (id) { return "Wrapper_" + id.name; };
DirectiveWrapperCompiler.prototype.compile = function (dirMeta) {
var builder = new DirectiveWrapperBuilder(this.compilerConfig, dirMeta);
Object.keys(dirMeta.inputs).forEach(function (inputFieldName) {
addCheckInputMethod(inputFieldName, builder);
});
addDetectChangesInInputPropsMethod(builder);
var hostParseResult = parseHostBindings(dirMeta, this._exprParser, this._schemaRegistry);
reportParseErrors(hostParseResult.errors, this._console);
// host properties are change detected by the DirectiveWrappers,
// except for the animation properties as they need close integration with animation events
// and DirectiveWrappers don't support
// event listeners right now.
addDetectChangesInHostPropsMethod(hostParseResult.hostProps.filter(function (hostProp) { return !hostProp.isAnimation; }), builder);
// TODO(tbosch): implement hostListeners via DirectiveWrapper as well!
var classStmt = builder.build();
return new DirectiveWrapperCompileResult([classStmt], classStmt.name);
};
DirectiveWrapperCompiler.decorators = [
{ type: Injectable },
];
/** @nocollapse */
DirectiveWrapperCompiler.ctorParameters = [
{ type: CompilerConfig, },
{ type: Parser, },
{ type: ElementSchemaRegistry, },
{ type: Console, },
];
return DirectiveWrapperCompiler;
}());
var DirectiveWrapperBuilder = (function () {
function DirectiveWrapperBuilder(compilerConfig, dirMeta) {
this.compilerConfig = compilerConfig;
this.dirMeta = dirMeta;
this.fields = [];
this.getters = [];
this.methods = [];
this.ctorStmts = [];
var dirLifecycleHooks = dirMeta.type.lifecycleHooks;
this.genChanges = dirLifecycleHooks.indexOf(LifecycleHooks.OnChanges) !== -1 ||
this.compilerConfig.logBindingUpdate;
this.ngOnChanges = dirLifecycleHooks.indexOf(LifecycleHooks.OnChanges) !== -1;
this.ngOnInit = dirLifecycleHooks.indexOf(LifecycleHooks.OnInit) !== -1;
this.ngDoCheck = dirLifecycleHooks.indexOf(LifecycleHooks.DoCheck) !== -1;
}
DirectiveWrapperBuilder.prototype.build = function () {
var dirDepParamNames = [];
for (var i = 0; i < dirMeta.type.diDeps.length; i++) {
for (var i = 0; i < this.dirMeta.type.diDeps.length; i++) {
dirDepParamNames.push("p" + i);
}
var dirLifecycleHooks = dirMeta.type.lifecycleHooks;
var lifecycleHooks = {
genChanges: dirLifecycleHooks.indexOf(LifecycleHooks.OnChanges) !== -1 ||
this.compilerConfig.logBindingUpdate,
ngOnChanges: dirLifecycleHooks.indexOf(LifecycleHooks.OnChanges) !== -1,
ngOnInit: dirLifecycleHooks.indexOf(LifecycleHooks.OnInit) !== -1,
ngDoCheck: dirLifecycleHooks.indexOf(LifecycleHooks.DoCheck) !== -1
};
var fields = [
new o.ClassField(CONTEXT_FIELD_NAME, o.importType(dirMeta.type)),
new o.ClassField(CONTEXT_FIELD_NAME, o.importType(this.dirMeta.type)),
new o.ClassField(CHANGED_FIELD_NAME, o.BOOL_TYPE),
];
var ctorStmts = [o.THIS_EXPR.prop(CHANGED_FIELD_NAME).set(o.literal(false)).toStmt()];
if (lifecycleHooks.genChanges) {
if (this.genChanges) {
fields.push(new o.ClassField(CHANGES_FIELD_NAME, new o.MapType(o.DYNAMIC_TYPE)));
ctorStmts.push(RESET_CHANGES_STMT);
}
var methods = [];
Object.keys(dirMeta.inputs).forEach(function (inputFieldName, idx) {
var fieldName = "_" + inputFieldName;
// private is fine here as no child view will reference the cached value...
fields.push(new o.ClassField(fieldName, null, [o.StmtModifier.Private]));
ctorStmts.push(o.THIS_EXPR.prop(fieldName)
.set(o.importExpr(resolveIdentifier(Identifiers.UNINITIALIZED)))
.toStmt());
methods.push(checkInputMethod(inputFieldName, o.THIS_EXPR.prop(fieldName), lifecycleHooks));
});
methods.push(detectChangesInternalMethod(lifecycleHooks, this.compilerConfig.genDebugInfo));
ctorStmts.push(o.THIS_EXPR.prop(CONTEXT_FIELD_NAME)
.set(o.importExpr(dirMeta.type)
.set(o.importExpr(this.dirMeta.type)
.instantiate(dirDepParamNames.map(function (paramName) { return o.variable(paramName); })))
.toStmt());
var ctor = new o.ClassMethod(null, dirDepParamNames.map(function (paramName) { return new o.FnParam(paramName, o.DYNAMIC_TYPE); }), ctorStmts);
var wrapperClassName = DirectiveWrapperCompiler.dirWrapperClassName(dirMeta.type);
var classStmt = new o.ClassStmt(wrapperClassName, null, fields, [], ctor, methods);
return new DirectiveWrapperCompileResult([classStmt], wrapperClassName);
return createClassStmt({
name: DirectiveWrapperCompiler.dirWrapperClassName(this.dirMeta.type),
ctorParams: dirDepParamNames.map(function (paramName) { return new o.FnParam(paramName, o.DYNAMIC_TYPE); }),
builders: [{ fields: fields, ctorStmts: ctorStmts }, this]
});
};
DirectiveWrapperCompiler.decorators = [
{ type: Injectable },
];
/** @nocollapse */
DirectiveWrapperCompiler.ctorParameters = [
{ type: CompilerConfig, },
];
return DirectiveWrapperCompiler;
return DirectiveWrapperBuilder;
}());
function detectChangesInternalMethod(lifecycleHooks, logBindingUpdate) {
function addDetectChangesInInputPropsMethod(builder) {
var changedVar = o.variable('changed');

@@ -102,5 +133,5 @@ var stmts = [

var lifecycleStmts = [];
if (lifecycleHooks.genChanges) {
if (builder.genChanges) {
var onChangesStmts = [];
if (lifecycleHooks.ngOnChanges) {
if (builder.ngOnChanges) {
onChangesStmts.push(o.THIS_EXPR.prop(CONTEXT_FIELD_NAME)

@@ -110,3 +141,3 @@ .callMethod('ngOnChanges', [o.THIS_EXPR.prop(CHANGES_FIELD_NAME)])

}
if (logBindingUpdate) {
if (builder.compilerConfig.logBindingUpdate) {
onChangesStmts.push(o.importExpr(resolveIdentifier(Identifiers.setBindingDebugInfoForChanges))

@@ -119,6 +150,6 @@ .callFn([VIEW_VAR.prop('renderer'), RENDER_EL_VAR, o.THIS_EXPR.prop(CHANGES_FIELD_NAME)])

}
if (lifecycleHooks.ngOnInit) {
if (builder.ngOnInit) {
lifecycleStmts.push(new o.IfStmt(VIEW_VAR.prop('numberOfChecks').identical(new o.LiteralExpr(0)), [o.THIS_EXPR.prop(CONTEXT_FIELD_NAME).callMethod('ngOnInit', []).toStmt()]));
}
if (lifecycleHooks.ngDoCheck) {
if (builder.ngDoCheck) {
lifecycleStmts.push(o.THIS_EXPR.prop(CONTEXT_FIELD_NAME).callMethod('ngDoCheck', []).toStmt());

@@ -130,9 +161,10 @@ }

stmts.push(new o.ReturnStatement(changedVar));
return new o.ClassMethod('detectChangesInternal', [
builder.methods.push(new o.ClassMethod('detectChangesInInputProps', [
new o.FnParam(VIEW_VAR.name, o.importType(resolveIdentifier(Identifiers.AppView), [o.DYNAMIC_TYPE])),
new o.FnParam(RENDER_EL_VAR.name, o.DYNAMIC_TYPE),
new o.FnParam(THROW_ON_CHANGE_VAR.name, o.BOOL_TYPE),
], stmts, o.BOOL_TYPE);
], stmts, o.BOOL_TYPE));
}
function checkInputMethod(input, fieldExpr, lifecycleHooks) {
function addCheckInputMethod(input, builder) {
var field = createCheckBindingField(builder);
var onChangeStatements = [

@@ -142,20 +174,68 @@ o.THIS_EXPR.prop(CHANGED_FIELD_NAME).set(o.literal(true)).toStmt(),

];
if (lifecycleHooks.genChanges) {
if (builder.genChanges) {
onChangeStatements.push(o.THIS_EXPR.prop(CHANGES_FIELD_NAME)
.key(o.literal(input))
.set(o.importExpr(resolveIdentifier(Identifiers.SimpleChange))
.instantiate([fieldExpr, CURR_VALUE_VAR]))
.instantiate([field.expression, CURR_VALUE_VAR]))
.toStmt());
}
onChangeStatements.push(fieldExpr.set(CURR_VALUE_VAR).toStmt());
var methodBody = [
new o.IfStmt(FORCE_UPDATE_VAR.or(o.importExpr(resolveIdentifier(Identifiers.checkBinding))
.callFn([THROW_ON_CHANGE_VAR, fieldExpr, CURR_VALUE_VAR])), onChangeStatements),
];
return new o.ClassMethod("check_" + input, [
var methodBody = createCheckBindingStmt({ currValExpr: CURR_VALUE_VAR, forceUpdate: FORCE_UPDATE_VAR, stmts: [] }, field.expression, THROW_ON_CHANGE_VAR, onChangeStatements);
builder.methods.push(new o.ClassMethod("check_" + input, [
new o.FnParam(CURR_VALUE_VAR.name, o.DYNAMIC_TYPE),
new o.FnParam(THROW_ON_CHANGE_VAR.name, o.BOOL_TYPE),
new o.FnParam(FORCE_UPDATE_VAR.name, o.BOOL_TYPE),
], methodBody);
], methodBody));
}
function addDetectChangesInHostPropsMethod(hostProps, builder) {
var stmts = [];
var methodParams = [
new o.FnParam(VIEW_VAR.name, o.importType(resolveIdentifier(Identifiers.AppView), [o.DYNAMIC_TYPE])),
new o.FnParam(RENDER_EL_VAR.name, o.DYNAMIC_TYPE),
new o.FnParam(THROW_ON_CHANGE_VAR.name, o.BOOL_TYPE),
];
hostProps.forEach(function (hostProp) {
var field = createCheckBindingField(builder);
var evalResult = convertPropertyBinding(builder, null, o.THIS_EXPR.prop(CONTEXT_FIELD_NAME), hostProp.value, field.bindingId);
if (!evalResult) {
return;
}
var securityContextExpr;
if (hostProp.needsRuntimeSecurityContext) {
securityContextExpr = o.variable("secCtx_" + methodParams.length);
methodParams.push(new o.FnParam(securityContextExpr.name, o.importType(resolveIdentifier(Identifiers.SecurityContext))));
}
stmts.push.apply(stmts, createCheckBindingStmt(evalResult, field.expression, THROW_ON_CHANGE_VAR, writeToRenderer(VIEW_VAR, hostProp, RENDER_EL_VAR, evalResult.currValExpr, builder.compilerConfig.logBindingUpdate, securityContextExpr)));
});
builder.methods.push(new o.ClassMethod('detectChangesInHostProps', methodParams, stmts));
}
var ParseResult = (function () {
function ParseResult(hostProps, hostListeners, errors) {
this.hostProps = hostProps;
this.hostListeners = hostListeners;
this.errors = errors;
}
return ParseResult;
}());
function parseHostBindings(dirMeta, exprParser, schemaRegistry) {
var errors = [];
var parser = new BindingParser(exprParser, DEFAULT_INTERPOLATION_CONFIG, schemaRegistry, [], errors);
var sourceFileName = dirMeta.type.moduleUrl ?
"in Directive " + dirMeta.type.name + " in " + dirMeta.type.moduleUrl :
"in Directive " + dirMeta.type.name;
var sourceFile = new ParseSourceFile('', sourceFileName);
var sourceSpan = new ParseSourceSpan(new ParseLocation(sourceFile, null, null, null), new ParseLocation(sourceFile, null, null, null));
var parsedHostProps = parser.createDirectiveHostPropertyAsts(dirMeta, sourceSpan);
var parsedHostListeners = parser.createDirectiveHostEventAsts(dirMeta, sourceSpan);
return new ParseResult(parsedHostProps, parsedHostListeners, errors);
}
function reportParseErrors(parseErrors, console) {
var warnings = parseErrors.filter(function (error) { return error.level === ParseErrorLevel.WARNING; });
var errors = parseErrors.filter(function (error) { return error.level === ParseErrorLevel.FATAL; });
if (warnings.length > 0) {
this._console.warn("Directive parse warnings:\n" + warnings.join('\n'));
}
if (errors.length > 0) {
throw new Error("Directive parse errors:\n" + errors.join('\n'));
}
}
//# sourceMappingURL=directive_wrapper_compiler.js.map

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"DirectiveWrapperCompiler":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./config","name":"CompilerConfig"}]}],"compile":[{"__symbolic":"method"}]},"statics":{"dirWrapperClassName":{"__symbolic":"function","parameters":["id"],"value":{"__symbolic":"error","message":"Expression form not supported","line":42,"character":69}}}}}}
{"__symbolic":"module","version":1,"metadata":{"DirectiveWrapperCompiler":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./config","name":"CompilerConfig"},{"__symbolic":"reference","module":"./expression_parser/parser","name":"Parser"},{"__symbolic":"reference","module":"./schema/element_schema_registry","name":"ElementSchemaRegistry"},{"__symbolic":"reference","module":"./private_import_core","name":"Console"}]}],"compile":[{"__symbolic":"method"}]},"statics":{"dirWrapperClassName":{"__symbolic":"function","parameters":["id"],"value":{"__symbolic":"error","message":"Expression form not supported","line":52,"character":69}}}}}}

@@ -56,4 +56,5 @@ /**

var ast = this._parseBindingAst(input, location, interpolationConfig);
if (!SimpleExpressionChecker.check(ast)) {
this._reportError('Host binding expression can only contain field access and constants', input, location);
var errors = SimpleExpressionChecker.check(ast);
if (errors.length > 0) {
this._reportError("Host binding expression cannot contain " + errors.join(' '), input, location);
}

@@ -710,3 +711,3 @@ return new ASTWithSource(ast, input, location, this.errors);

function SimpleExpressionChecker() {
this.simple = true;
this.errors = [];
}

@@ -716,21 +717,21 @@ SimpleExpressionChecker.check = function (ast) {

ast.visit(s);
return s.simple;
return s.errors;
};
SimpleExpressionChecker.prototype.visitImplicitReceiver = function (ast, context) { };
SimpleExpressionChecker.prototype.visitInterpolation = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitInterpolation = function (ast, context) { };
SimpleExpressionChecker.prototype.visitLiteralPrimitive = function (ast, context) { };
SimpleExpressionChecker.prototype.visitPropertyRead = function (ast, context) { };
SimpleExpressionChecker.prototype.visitPropertyWrite = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitSafePropertyRead = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitMethodCall = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitSafeMethodCall = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitFunctionCall = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitPropertyWrite = function (ast, context) { };
SimpleExpressionChecker.prototype.visitSafePropertyRead = function (ast, context) { };
SimpleExpressionChecker.prototype.visitMethodCall = function (ast, context) { };
SimpleExpressionChecker.prototype.visitSafeMethodCall = function (ast, context) { };
SimpleExpressionChecker.prototype.visitFunctionCall = function (ast, context) { };
SimpleExpressionChecker.prototype.visitLiteralArray = function (ast, context) { this.visitAll(ast.expressions); };
SimpleExpressionChecker.prototype.visitLiteralMap = function (ast, context) { this.visitAll(ast.values); };
SimpleExpressionChecker.prototype.visitBinary = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitPrefixNot = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitConditional = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitPipe = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitKeyedRead = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitKeyedWrite = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitBinary = function (ast, context) { };
SimpleExpressionChecker.prototype.visitPrefixNot = function (ast, context) { };
SimpleExpressionChecker.prototype.visitConditional = function (ast, context) { };
SimpleExpressionChecker.prototype.visitPipe = function (ast, context) { this.errors.push('pipes'); };
SimpleExpressionChecker.prototype.visitKeyedRead = function (ast, context) { };
SimpleExpressionChecker.prototype.visitKeyedWrite = function (ast, context) { };
SimpleExpressionChecker.prototype.visitAll = function (asts) {

@@ -740,6 +741,6 @@ var _this = this;

};
SimpleExpressionChecker.prototype.visitChain = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitQuote = function (ast, context) { this.simple = false; };
SimpleExpressionChecker.prototype.visitChain = function (ast, context) { };
SimpleExpressionChecker.prototype.visitQuote = function (ast, context) { };
return SimpleExpressionChecker;
}());
//# sourceMappingURL=parser.js.map

@@ -33,28 +33,7 @@ export declare class MapWrapper {

export declare class ListWrapper {
static createFixedSize(size: number): any[];
static createGrowableSize(size: number): any[];
static clone<T>(array: T[]): T[];
static forEachWithIndex<T>(array: T[], fn: (t: T, n: number) => void): void;
static first<T>(array: T[]): T;
static last<T>(array: T[]): T;
static indexOf<T>(array: T[], value: T, startIndex?: number): number;
static contains<T>(list: T[], el: T): boolean;
static reversed<T>(array: T[]): T[];
static concat(a: any[], b: any[]): any[];
static insert<T>(list: T[], index: number, value: T): void;
static removeAt<T>(list: T[], index: number): T;
static removeAll<T>(list: T[], items: T[]): void;
static remove<T>(list: T[], el: T): boolean;
static clear(list: any[]): void;
static isEmpty(list: any[]): boolean;
static fill(list: any[], value: any, start?: number, end?: number): void;
static equals(a: any[], b: any[]): boolean;
static slice<T>(l: T[], from?: number, to?: number): T[];
static splice<T>(l: T[], from: number, length: number): T[];
static sort<T>(l: T[], compareFn?: (a: T, b: T) => number): void;
static toString<T>(l: T[]): string;
static toJSON<T>(l: T[]): string;
static maximum<T>(list: T[], predicate: (t: T) => number): T;
static flatten<T>(list: Array<T | T[]>): T[];
static addAll<T>(list: Array<T>, source: Array<T>): void;
}

@@ -61,0 +40,0 @@ export declare function isListLikeIterable(obj: any): boolean;

@@ -8,3 +8,3 @@ /**

*/
import { getSymbolIterator, isBlank, isJsObject, isPresent } from './lang';
import { getSymbolIterator, isJsObject, isPresent } from './lang';
// Safari doesn't implement MapIterator.next(), which is used is Traceur's polyfill of Array.from

@@ -82,38 +82,2 @@ // TODO(mlaval): remove the work around once we have a working polyfill of Array.from

}
// JS has no way to express a statically fixed size list, but dart does so we
// keep both methods.
ListWrapper.createFixedSize = function (size) { return new Array(size); };
ListWrapper.createGrowableSize = function (size) { return new Array(size); };
ListWrapper.clone = function (array) { return array.slice(0); };
ListWrapper.forEachWithIndex = function (array, fn) {
for (var i = 0; i < array.length; i++) {
fn(array[i], i);
}
};
ListWrapper.first = function (array) {
if (!array)
return null;
return array[0];
};
ListWrapper.last = function (array) {
if (!array || array.length == 0)
return null;
return array[array.length - 1];
};
ListWrapper.indexOf = function (array, value, startIndex) {
if (startIndex === void 0) { startIndex = 0; }
return array.indexOf(value, startIndex);
};
ListWrapper.contains = function (list, el) { return list.indexOf(el) !== -1; };
ListWrapper.reversed = function (array) {
var a = ListWrapper.clone(array);
return a.reverse();
};
ListWrapper.concat = function (a, b) { return a.concat(b); };
ListWrapper.insert = function (list, index, value) { list.splice(index, 0, value); };
ListWrapper.removeAt = function (list, index) {
var res = list[index];
list.splice(index, 1);
return res;
};
ListWrapper.removeAll = function (list, items) {

@@ -133,9 +97,2 @@ for (var i = 0; i < items.length; ++i) {

};
ListWrapper.clear = function (list) { list.length = 0; };
ListWrapper.isEmpty = function (list) { return list.length == 0; };
ListWrapper.fill = function (list, value, start, end) {
if (start === void 0) { start = 0; }
if (end === void 0) { end = null; }
list.fill(value, start, end === null ? list.length : end);
};
ListWrapper.equals = function (a, b) {

@@ -150,18 +107,2 @@ if (a.length != b.length)

};
ListWrapper.slice = function (l, from, to) {
if (from === void 0) { from = 0; }
if (to === void 0) { to = null; }
return l.slice(from, to === null ? undefined : to);
};
ListWrapper.splice = function (l, from, length) { return l.splice(from, length); };
ListWrapper.sort = function (l, compareFn) {
if (isPresent(compareFn)) {
l.sort(compareFn);
}
else {
l.sort();
}
};
ListWrapper.toString = function (l) { return l.toString(); };
ListWrapper.toJSON = function (l) { return JSON.stringify(l); };
ListWrapper.maximum = function (list, predicate) {

@@ -175,3 +116,3 @@ if (list.length == 0) {

var candidate = list[index];
if (isBlank(candidate)) {
if (candidate == null) {
continue;

@@ -192,7 +133,2 @@ }

};
ListWrapper.addAll = function (list, source) {
for (var i = 0; i < source.length; i++) {
list.push(source[i]);
}
};
return ListWrapper;

@@ -199,0 +135,0 @@ }());

@@ -31,3 +31,3 @@

export declare function scheduleMicroTask(fn: Function): void;
declare var _global: BrowserNodeGlobal;
declare const _global: BrowserNodeGlobal;
export { _global as global };

@@ -39,3 +39,2 @@ export declare function getTypeNameForDebugging(type: any): string;

export declare function isDate(obj: any): obj is Date;
export declare function noop(): void;
export declare function stringify(token: any): string;

@@ -48,4 +47,2 @@ export declare class NumberWrapper {

export declare function looseIdentical(a: any, b: any): boolean;
export declare function normalizeBlank(obj: Object): any;
export declare function normalizeBool(obj: boolean): boolean;
export declare function isJsObject(o: any): boolean;

@@ -52,0 +49,0 @@ export declare function print(obj: Error | Object): void;

@@ -38,6 +38,6 @@ /**

export function isPresent(obj) {
return obj !== undefined && obj !== null;
return obj != null;
}
export function isBlank(obj) {
return obj === undefined || obj === null;
return obj == null;
}

@@ -51,3 +51,2 @@ var STRING_MAP_PROTO = Object.getPrototypeOf({});

}
export function noop() { }
export function stringify(token) {

@@ -106,8 +105,2 @@ if (typeof token === 'string') {

}
export function normalizeBlank(obj) {
return isBlank(obj) ? null : obj;
}
export function normalizeBool(obj) {
return isBlank(obj) ? false : obj;
}
export function isJsObject(o) {

@@ -141,4 +134,4 @@ return o !== null && (typeof o === 'function' || typeof o === 'object');

export function getSymbolIterator() {
if (isBlank(_symbolIterator)) {
if (isPresent(globalScope.Symbol) && isPresent(Symbol.iterator)) {
if (!_symbolIterator) {
if (globalScope.Symbol && Symbol.iterator) {
_symbolIterator = Symbol.iterator;

@@ -145,0 +138,0 @@ }

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"getTypeNameForDebugging":{"__symbolic":"function","parameters":["type"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"type"},"index":"name"},"right":{"__symbolic":"error","message":"Expression form not supported","line":61,"character":25}}},"isPresent":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isStrictStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":81,"character":9},"right":"object"},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{}]}}}},"isDate":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"Date"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"valueOf"}}]}}}},"looseIdentical":{"__symbolic":"function","parameters":["a","b"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"a"},"right":{"__symbolic":"reference","name":"b"}},"right":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":143,"character":20},"right":"number"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":143,"character":45},"right":"number"}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"a"}]}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"b"}]}}}},"normalizeBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isBlank"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"thenExpression":null,"elseExpression":{"__symbolic":"reference","name":"obj"}}},"normalizeBool":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isBlank"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"thenExpression":false,"elseExpression":{"__symbolic":"reference","name":"obj"}}},"isJsObject":{"__symbolic":"function","parameters":["o"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"o"},"right":null},"right":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":155,"character":24},"right":"function"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":155,"character":51},"right":"object"}}}},"isPrimitive":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isJsObject"},"arguments":[{"__symbolic":"reference","name":"obj"}]}}},"escapeRegExp":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Expression form not supported","line":210,"character":19}}}}
{"__symbolic":"module","version":1,"metadata":{"getTypeNameForDebugging":{"__symbolic":"function","parameters":["type"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"type"},"index":"name"},"right":{"__symbolic":"error","message":"Expression form not supported","line":60,"character":25}}},"isPresent":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"!=","left":{"__symbolic":"reference","name":"obj"},"right":null}},"isBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"==","left":{"__symbolic":"reference","name":"obj"},"right":null}},"isStrictStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":80,"character":9},"right":"object"},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{}]}}}},"isDate":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"Date"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"valueOf"}}]}}}},"looseIdentical":{"__symbolic":"function","parameters":["a","b"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"a"},"right":{"__symbolic":"reference","name":"b"}},"right":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":140,"character":20},"right":"number"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":140,"character":45},"right":"number"}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"a"}]}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"b"}]}}}},"isJsObject":{"__symbolic":"function","parameters":["o"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"o"},"right":null},"right":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":144,"character":24},"right":"function"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":144,"character":51},"right":"object"}}}},"isPrimitive":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isJsObject"},"arguments":[{"__symbolic":"reference","name":"obj"}]}}},"escapeRegExp":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Expression form not supported","line":199,"character":19}}}}

@@ -44,7 +44,5 @@ import { CompileIdentifierMetadata, CompileTokenMetadata } from './compile_metadata';

static EMPTY_MAP: IdentifierSpec;
static pureProxies: {
name: string;
moduleUrl: string;
runtime: <P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, R>(fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9) => R) => (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9) => R;
}[];
static createRenderElement: IdentifierSpec;
static selectOrCreateRenderHostElement: IdentifierSpec;
static pureProxies: IdentifierSpec[];
static SecurityContext: IdentifierSpec;

@@ -66,3 +64,8 @@ static AnimationKeyframe: IdentifierSpec;

static AnimationTransition: IdentifierSpec;
static InlineArray: IdentifierSpec;
static inlineArrays: IdentifierSpec[];
static EMPTY_INLINE_ARRAY: IdentifierSpec;
static InlineArrayDynamic: IdentifierSpec;
}
export declare function assetUrl(pkg: string, path?: string, type?: string): string;
export declare function resolveIdentifier(identifier: IdentifierSpec): CompileIdentifierMetadata;

@@ -69,0 +72,0 @@ export declare function identifierToken(identifier: CompileIdentifierMetadata): CompileTokenMetadata;

@@ -11,3 +11,2 @@ /**

import { AnimationGroupPlayer, AnimationKeyframe, AnimationSequencePlayer, AnimationStyles, AnimationTransition, AppElement, AppView, ChangeDetectorStatus, CodegenComponentFactoryResolver, DebugAppView, DebugContext, NgModuleInjector, NoOpAnimationPlayer, StaticNodeDebugInfo, TemplateRef_, UNINITIALIZED, ValueUnwrapper, ViewType, balanceAnimationKeyframes, clearStyles, collectAndResolveStyles, devModeEqual, prepareFinalAnimationStyles, reflector, registerModuleFactory, renderStyles, view_utils } from './private_import_core';
import { assetUrl } from './util';
var APP_VIEW_MODULE_URL = assetUrl('core', 'linker/view');

@@ -180,2 +179,12 @@ var VIEW_UTILS_MODULE_URL = assetUrl('core', 'linker/view_utils');

};
Identifiers.createRenderElement = {
name: 'createRenderElement',
moduleUrl: VIEW_UTILS_MODULE_URL,
runtime: view_utils.createRenderElement
};
Identifiers.selectOrCreateRenderHostElement = {
name: 'selectOrCreateRenderHostElement',
moduleUrl: VIEW_UTILS_MODULE_URL,
runtime: view_utils.selectOrCreateRenderHostElement
};
Identifiers.pureProxies = [

@@ -274,4 +283,33 @@ null,

};
// This is just the interface!
Identifiers.InlineArray = { name: 'InlineArray', moduleUrl: VIEW_UTILS_MODULE_URL, runtime: null };
Identifiers.inlineArrays = [
{ name: 'InlineArray2', moduleUrl: VIEW_UTILS_MODULE_URL, runtime: view_utils.InlineArray2 },
{ name: 'InlineArray2', moduleUrl: VIEW_UTILS_MODULE_URL, runtime: view_utils.InlineArray2 },
{ name: 'InlineArray4', moduleUrl: VIEW_UTILS_MODULE_URL, runtime: view_utils.InlineArray4 },
{ name: 'InlineArray8', moduleUrl: VIEW_UTILS_MODULE_URL, runtime: view_utils.InlineArray8 },
{ name: 'InlineArray16', moduleUrl: VIEW_UTILS_MODULE_URL, runtime: view_utils.InlineArray16 },
];
Identifiers.EMPTY_INLINE_ARRAY = {
name: 'EMPTY_INLINE_ARRAY',
moduleUrl: VIEW_UTILS_MODULE_URL,
runtime: view_utils.EMPTY_INLINE_ARRAY
};
Identifiers.InlineArrayDynamic = {
name: 'InlineArrayDynamic',
moduleUrl: VIEW_UTILS_MODULE_URL,
runtime: view_utils.InlineArrayDynamic
};
return Identifiers;
}());
export function assetUrl(pkg, path, type) {
if (path === void 0) { path = null; }
if (type === void 0) { type = 'src'; }
if (path == null) {
return "asset:@angular/lib/" + pkg + "/index";
}
else {
return "asset:@angular/lib/" + pkg + "/src/" + path;
}
}
export function resolveIdentifier(identifier) {

@@ -278,0 +316,0 @@ return new CompileIdentifierMetadata({

@@ -338,9 +338,9 @@ /**

CompileMetadataResolver.prototype._getTypeDescriptor = function (type) {
if (this._directiveResolver.resolve(type, false) !== null) {
if (this._directiveResolver.resolve(type, false)) {
return 'directive';
}
if (this._pipeResolver.resolve(type, false) !== null) {
if (this._pipeResolver.resolve(type, false)) {
return 'pipe';
}
if (this._ngModuleResolver.resolve(type, false) !== null) {
if (this._ngModuleResolver.resolve(type, false)) {
return 'module';

@@ -347,0 +347,0 @@ }

@@ -13,3 +13,2 @@ /**

};
import { ListWrapper } from '../facade/collection';
import { isBlank, isPresent } from '../facade/lang';

@@ -212,3 +211,3 @@ import { ParseError, ParseSourceSpan } from '../parse_util';

if (this._elementStack.length > 0) {
var el = ListWrapper.last(this._elementStack);
var el = this._elementStack[this._elementStack.length - 1];
if (this.getTagDefinition(el.name).isVoid) {

@@ -253,3 +252,3 @@ this._elementStack.pop();

if (this._elementStack.length > 0) {
var parentEl = ListWrapper.last(this._elementStack);
var parentEl = this._elementStack[this._elementStack.length - 1];
if (this.getTagDefinition(parentEl.name).isClosedByChild(el.name)) {

@@ -284,3 +283,3 @@ this._elementStack.pop();

if (el.name == fullName) {
ListWrapper.splice(this._elementStack, stackIndex, this._elementStack.length - stackIndex);
this._elementStack.splice(stackIndex, this._elementStack.length - stackIndex);
return true;

@@ -308,3 +307,3 @@ }

_TreeBuilder.prototype._getParentElement = function () {
return this._elementStack.length > 0 ? ListWrapper.last(this._elementStack) : null;
return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null;
};

@@ -324,3 +323,3 @@ /**

}
return { parent: ListWrapper.last(this._elementStack), container: container };
return { parent: this._elementStack[this._elementStack.length - 1], container: container };
};

@@ -327,0 +326,0 @@ _TreeBuilder.prototype._addToParent = function (node) {

@@ -10,4 +10,6 @@ /**

import { CompileDiDependencyMetadata, CompileIdentifierMetadata } from './compile_metadata';
import { createDiTokenExpression } from './compiler_util/identifier_util';
import { isPresent } from './facade/lang';
import { Identifiers, resolveIdentifier, resolveIdentifierToken } from './identifiers';
import { createClassStmt } from './output/class_builder';
import * as o from './output/output_ast';

@@ -18,3 +20,2 @@ import { convertValueToOutputAst } from './output/value_util';

import { NgModuleProviderAnalyzer } from './provider_analyzer';
import { createDiTokenExpression } from './util';
export var ComponentFactoryDependency = (function () {

@@ -85,8 +86,10 @@ function ComponentFactoryDependency(comp, placeholder) {

this._sourceSpan = _sourceSpan;
this.fields = [];
this.getters = [];
this.methods = [];
this.ctorStmts = [];
this._tokens = [];
this._instances = new Map();
this._fields = [];
this._createStmts = [];
this._destroyStmts = [];
this._getters = [];
}

@@ -118,11 +121,15 @@ _InjectorBuilder.prototype.addProvider = function (resolvedProvider) {

];
var ctor = new o.ClassMethod(null, [new o.FnParam(InjectorProps.parent.name, o.importType(resolveIdentifier(Identifiers.Injector)))], [o.SUPER_EXPR
.callFn([
o.variable(InjectorProps.parent.name),
o.literalArr(this._entryComponentFactories.map(function (componentFactory) { return o.importExpr(componentFactory); })),
o.literalArr(this._bootstrapComponentFactories.map(function (componentFactory) { return o.importExpr(componentFactory); }))
])
.toStmt()]);
var parentArgs = [
o.variable(InjectorProps.parent.name),
o.literalArr(this._entryComponentFactories.map(function (componentFactory) { return o.importExpr(componentFactory); })),
o.literalArr(this._bootstrapComponentFactories.map(function (componentFactory) { return o.importExpr(componentFactory); }))
];
var injClassName = this._ngModuleMeta.type.name + "Injector";
return new o.ClassStmt(injClassName, o.importExpr(resolveIdentifier(Identifiers.NgModuleInjector), [o.importType(this._ngModuleMeta.type)]), this._fields, this._getters, ctor, methods);
return createClassStmt({
name: injClassName,
ctorParams: [new o.FnParam(InjectorProps.parent.name, o.importType(resolveIdentifier(Identifiers.Injector)))],
parent: o.importExpr(resolveIdentifier(Identifiers.NgModuleInjector), [o.importType(this._ngModuleMeta.type)]),
parentArgs: parentArgs,
builders: [{ methods: methods }, this]
});
};

@@ -166,3 +173,3 @@ _InjectorBuilder.prototype._getProviderValue = function (provider) {

if (isEager) {
this._fields.push(new o.ClassField(propName, type));
this.fields.push(new o.ClassField(propName, type));
this._createStmts.push(o.THIS_EXPR.prop(propName).set(resolvedProviderValueExpr).toStmt());

@@ -172,3 +179,3 @@ }

var internalField = "_" + propName;
this._fields.push(new o.ClassField(internalField, type));
this.fields.push(new o.ClassField(internalField, type));
// Note: Equals is important for JS so that it also checks the undefined case!

@@ -179,3 +186,3 @@ var getterStmts = [

];
this._getters.push(new o.ClassGetter(propName, getterStmts, type));
this.getters.push(new o.ClassGetter(propName, getterStmts, type));
}

@@ -182,0 +189,0 @@ return o.THIS_EXPR.prop(propName);

@@ -11,12 +11,17 @@ import { CompileNgModuleMetadata, StaticSymbol } from './compile_metadata';

export declare class SourceModule {
fileUrl: string;
moduleUrl: string;
source: string;
constructor(moduleUrl: string, source: string);
constructor(fileUrl: string, moduleUrl: string, source: string);
}
export declare class NgModulesSummary {
ngModuleByDirective: Map<StaticSymbol, CompileNgModuleMetadata>;
ngModules: CompileNgModuleMetadata[];
constructor(ngModuleByDirective: Map<StaticSymbol, CompileNgModuleMetadata>, ngModules: CompileNgModuleMetadata[]);
}
export declare function analyzeModules(ngModules: StaticSymbol[], metadataResolver: CompileMetadataResolver): NgModulesSummary;
export declare function analyzeNgModules(programStaticSymbols: StaticSymbol[], options: {
transitiveModules: boolean;
}, metadataResolver: CompileMetadataResolver): {
ngModuleByPipeOrDirective: Map<StaticSymbol, CompileNgModuleMetadata>;
files: Array<{
srcUrl: string;
directives: StaticSymbol[];
ngModules: StaticSymbol[];
}>;
};
export declare class OfflineCompiler {

@@ -36,5 +41,7 @@ private _metadataResolver;

constructor(_metadataResolver: CompileMetadataResolver, _directiveNormalizer: DirectiveNormalizer, _templateParser: TemplateParser, _styleCompiler: StyleCompiler, _viewCompiler: ViewCompiler, _dirWrapperCompiler: DirectiveWrapperCompiler, _ngModuleCompiler: NgModuleCompiler, _outputEmitter: OutputEmitter, _localeId: string, _translationFormat: string);
analyzeModules(ngModules: StaticSymbol[]): NgModulesSummary;
clearCache(): void;
compile(moduleUrl: string, ngModulesSummary: NgModulesSummary, directives: StaticSymbol[], ngModules: StaticSymbol[]): Promise<SourceModule[]>;
compileModules(staticSymbols: StaticSymbol[], options: {
transitiveModules: boolean;
}): Promise<SourceModule[]>;
private _compileSrcFile(srcFileUrl, ngModuleByPipeOrDirective, directives, ngModules);
private _compileModule(ngModuleType, targetStatements);

@@ -44,4 +51,4 @@ private _compileDirectiveWrapper(directiveType, targetStatements);

private _compileComponent(compMeta, directives, pipes, schemas, componentStyles, fileSuffix, targetStatements);
private _codgenStyles(stylesCompileResult, fileSuffix);
private _codegenSourceModule(moduleUrl, statements, exportedVars);
private _codgenStyles(fileUrl, stylesCompileResult, fileSuffix);
private _codegenSourceModule(fileUrl, moduleUrl, statements, exportedVars);
}

@@ -11,2 +11,3 @@ /**

import { CompileProviderMetadata, createHostComponentMeta } from './compile_metadata';
import { ListWrapper, MapWrapper } from './facade/collection';
import { Identifiers, resolveIdentifier, resolveIdentifierToken } from './identifiers';

@@ -16,3 +17,4 @@ import * as o from './output/output_ast';

export var SourceModule = (function () {
function SourceModule(moduleUrl, source) {
function SourceModule(fileUrl, moduleUrl, source) {
this.fileUrl = fileUrl;
this.moduleUrl = moduleUrl;

@@ -23,20 +25,58 @@ this.source = source;

}());
export var NgModulesSummary = (function () {
function NgModulesSummary(ngModuleByDirective, ngModules) {
this.ngModuleByDirective = ngModuleByDirective;
this.ngModules = ngModules;
}
return NgModulesSummary;
}());
export function analyzeModules(ngModules, metadataResolver) {
var ngModuleByDirective = new Map();
var modules = [];
ngModules.forEach(function (ngModule) {
var ngModuleMeta = metadataResolver.getNgModuleMetadata(ngModule);
modules.push(ngModuleMeta);
// Returns all the source files and a mapping from modules to directives
export function analyzeNgModules(programStaticSymbols, options, metadataResolver) {
var _a = _extractModulesAndPipesOrDirectives(programStaticSymbols, metadataResolver), programNgModules = _a.ngModules, programPipesOrDirectives = _a.pipesAndDirectives;
var moduleMetasByRef = new Map();
programNgModules.forEach(function (modMeta) {
if (options.transitiveModules) {
// For every input modules add the list of transitively included modules
modMeta.transitiveModule.modules.forEach(function (modMeta) { moduleMetasByRef.set(modMeta.type.reference, modMeta); });
}
else {
moduleMetasByRef.set(modMeta.type.reference, modMeta);
}
});
var ngModuleMetas = MapWrapper.values(moduleMetasByRef);
var ngModuleByPipeOrDirective = new Map();
var ngModulesByFile = new Map();
var ngDirectivesByFile = new Map();
var filePaths = new Set();
// Looping over all modules to construct:
// - a map from file to modules `ngModulesByFile`,
// - a map from file to directives `ngDirectivesByFile`,
// - a map from directive/pipe to module `ngModuleByPipeOrDirective`.
ngModuleMetas.forEach(function (ngModuleMeta) {
var srcFileUrl = ngModuleMeta.type.reference.filePath;
filePaths.add(srcFileUrl);
ngModulesByFile.set(srcFileUrl, (ngModulesByFile.get(srcFileUrl) || []).concat(ngModuleMeta.type.reference));
ngModuleMeta.declaredDirectives.forEach(function (dirMeta) {
ngModuleByDirective.set(dirMeta.type.reference, ngModuleMeta);
var fileUrl = dirMeta.type.reference.filePath;
filePaths.add(fileUrl);
ngDirectivesByFile.set(fileUrl, (ngDirectivesByFile.get(fileUrl) || []).concat(dirMeta.type.reference));
ngModuleByPipeOrDirective.set(dirMeta.type.reference, ngModuleMeta);
});
ngModuleMeta.declaredPipes.forEach(function (pipeMeta) {
var fileUrl = pipeMeta.type.reference.filePath;
filePaths.add(fileUrl);
ngModuleByPipeOrDirective.set(pipeMeta.type.reference, ngModuleMeta);
});
});
return new NgModulesSummary(ngModuleByDirective, modules);
// Throw an error if any of the program pipe or directives is not declared by a module
var symbolsMissingModule = programPipesOrDirectives.filter(function (s) { return !ngModuleByPipeOrDirective.has(s); });
if (symbolsMissingModule.length) {
var messages = symbolsMissingModule.map(function (s) { return ("Cannot determine the module for class " + s.name + " in " + s.filePath + "!"); });
throw new Error(messages.join('\n'));
}
var files = [];
filePaths.forEach(function (srcUrl) {
var directives = ngDirectivesByFile.get(srcUrl) || [];
var ngModules = ngModulesByFile.get(srcUrl) || [];
files.push({ srcUrl: srcUrl, directives: directives, ngModules: ngModules });
});
return {
// map directive/pipe to module
ngModuleByPipeOrDirective: ngModuleByPipeOrDirective,
// list modules and directives for every source file
files: files,
};
}

@@ -58,5 +98,2 @@ export var OfflineCompiler = (function () {

}
OfflineCompiler.prototype.analyzeModules = function (ngModules) {
return analyzeModules(ngModules, this._metadataResolver);
};
OfflineCompiler.prototype.clearCache = function () {

@@ -66,5 +103,12 @@ this._directiveNormalizer.clearCache();

};
OfflineCompiler.prototype.compile = function (moduleUrl, ngModulesSummary, directives, ngModules) {
OfflineCompiler.prototype.compileModules = function (staticSymbols, options) {
var _this = this;
var fileSuffix = _splitTypescriptSuffix(moduleUrl)[1];
var _a = analyzeNgModules(staticSymbols, options, this._metadataResolver), ngModuleByPipeOrDirective = _a.ngModuleByPipeOrDirective, files = _a.files;
var sourceModules = files.map(function (file) { return _this._compileSrcFile(file.srcUrl, ngModuleByPipeOrDirective, file.directives, file.ngModules); });
return Promise.all(sourceModules)
.then(function (modules) { return ListWrapper.flatten(modules); });
};
OfflineCompiler.prototype._compileSrcFile = function (srcFileUrl, ngModuleByPipeOrDirective, directives, ngModules) {
var _this = this;
var fileSuffix = _splitTypescriptSuffix(srcFileUrl)[1];
var statements = [];

@@ -84,5 +128,5 @@ var exportedVars = [];

}
var ngModule = ngModulesSummary.ngModuleByDirective.get(dirType);
var ngModule = ngModuleByPipeOrDirective.get(dirType);
if (!ngModule) {
throw new Error("Cannot determine the module for component " + compMeta.type.name + "!");
throw new Error("Internal Error: cannot determine the module for component " + compMeta.type.name + "!");
}

@@ -97,3 +141,3 @@ return Promise

stylesCompileResults.externalStylesheets.forEach(function (compiledStyleSheet) {
outputSourceModules.push(_this._codgenStyles(compiledStyleSheet, fileSuffix));
outputSourceModules.push(_this._codgenStyles(srcFileUrl, compiledStyleSheet, fileSuffix));
});

@@ -106,3 +150,4 @@ // compile components

if (statements.length > 0) {
outputSourceModules.unshift(_this._codegenSourceModule(_ngfactoryModuleUrl(moduleUrl), statements, exportedVars));
var srcModule = _this._codegenSourceModule(srcFileUrl, _ngfactoryModuleUrl(srcFileUrl), statements, exportedVars);
outputSourceModules.unshift(srcModule);
}

@@ -168,8 +213,8 @@ return outputSourceModules;

};
OfflineCompiler.prototype._codgenStyles = function (stylesCompileResult, fileSuffix) {
OfflineCompiler.prototype._codgenStyles = function (fileUrl, stylesCompileResult, fileSuffix) {
_resolveStyleStatements(stylesCompileResult, fileSuffix);
return this._codegenSourceModule(_stylesModuleUrl(stylesCompileResult.meta.moduleUrl, stylesCompileResult.isShimmed, fileSuffix), stylesCompileResult.statements, [stylesCompileResult.stylesVar]);
return this._codegenSourceModule(fileUrl, _stylesModuleUrl(stylesCompileResult.meta.moduleUrl, stylesCompileResult.isShimmed, fileSuffix), stylesCompileResult.statements, [stylesCompileResult.stylesVar]);
};
OfflineCompiler.prototype._codegenSourceModule = function (moduleUrl, statements, exportedVars) {
return new SourceModule(moduleUrl, this._outputEmitter.emitStatements(moduleUrl, statements, exportedVars));
OfflineCompiler.prototype._codegenSourceModule = function (fileUrl, moduleUrl, statements, exportedVars) {
return new SourceModule(fileUrl, moduleUrl, this._outputEmitter.emitStatements(moduleUrl, statements, exportedVars));
};

@@ -227,2 +272,24 @@ return OfflineCompiler;

}
// Group the symbols by types:
// - NgModules,
// - Pipes and Directives.
function _extractModulesAndPipesOrDirectives(programStaticSymbols, metadataResolver) {
var ngModules = [];
var pipesAndDirectives = [];
programStaticSymbols.forEach(function (staticSymbol) {
var ngModule = metadataResolver.getNgModuleMetadata(staticSymbol, false);
var directive = metadataResolver.getDirectiveMetadata(staticSymbol, false);
var pipe = metadataResolver.getPipeMetadata(staticSymbol, false);
if (ngModule) {
ngModules.push(ngModule);
}
else if (directive) {
pipesAndDirectives.push(staticSymbol);
}
else if (pipe) {
pipesAndDirectives.push(staticSymbol);
}
});
return { ngModules: ngModules, pipesAndDirectives: pipesAndDirectives };
}
//# sourceMappingURL=offline_compiler.js.map

@@ -8,3 +8,2 @@ /**

*/
import { ListWrapper } from '../facade/collection';
import { isPresent } from '../facade/lang';

@@ -157,3 +156,3 @@ import * as o from './output_ast';

case o.BuiltinMethod.ConcatArray:
result = ListWrapper.concat(receiver, args[0]);
result = receiver.concat(args[0]);
break;

@@ -160,0 +159,0 @@ case o.BuiltinMethod.SubscribeObservable:

@@ -25,3 +25,3 @@ export declare class ParseLocation {

}
export declare abstract class ParseError {
export declare class ParseError {
span: ParseSourceSpan;

@@ -28,0 +28,0 @@ msg: string;

@@ -14,4 +14,4 @@ /**

import { CompileDiDependencyMetadata, CompileProviderMetadata, CompileTokenMetadata, CompileTypeMetadata } from './compile_metadata';
import { ListWrapper, MapWrapper } from './facade/collection';
import { isBlank, isPresent, normalizeBlank } from './facade/lang';
import { MapWrapper } from './facade/collection';
import { isBlank, isPresent } from './facade/lang';
import { Identifiers, resolveIdentifierToken } from './identifiers';

@@ -93,4 +93,4 @@ import { ParseError } from './parse_util';

var sortedProviderTypes = this.transformProviders.map(function (provider) { return provider.token.identifier; });
var sortedDirectives = ListWrapper.clone(this._directiveAsts);
ListWrapper.sort(sortedDirectives, function (dir1, dir2) { return sortedProviderTypes.indexOf(dir1.directive.type) -
var sortedDirectives = this._directiveAsts.slice();
sortedDirectives.sort(function (dir1, dir2) { return sortedProviderTypes.indexOf(dir1.directive.type) -
sortedProviderTypes.indexOf(dir2.directive.type); });

@@ -123,3 +123,3 @@ return sortedDirectives;

if (isPresent(queries)) {
ListWrapper.addAll(result, queries.filter(function (query) { return query.descendants || distance <= 1; }));
result.push.apply(result, queries.filter(function (query) { return query.descendants || distance <= 1; }));
}

@@ -133,3 +133,3 @@ if (currentEl._directiveAsts.length > 0) {

if (isPresent(queries)) {
ListWrapper.addAll(result, queries);
result.push.apply(result, queries);
}

@@ -197,3 +197,3 @@ return result;

var attrValue = this._attrs[dep.token.value];
return new CompileDiDependencyMetadata({ isValue: true, value: normalizeBlank(attrValue) });
return new CompileDiDependencyMetadata({ isValue: true, value: attrValue == null ? null : attrValue });
}

@@ -450,3 +450,3 @@ if (isPresent(dep.query) || isPresent(dep.viewQuery)) {

if (!provider.multi) {
ListWrapper.clear(resolvedProvider.providers);
resolvedProvider.providers.length = 0;
}

@@ -453,0 +453,0 @@ resolvedProvider.providers.push(provider);

@@ -25,3 +25,3 @@ /**

*/
securityContext(tagName: string, propName: string): SecurityContext;
securityContext(tagName: string, propName: string, isAttribute: boolean): SecurityContext;
getMappedPropName(propName: string): string;

@@ -37,2 +37,3 @@ getDefaultComponentElementName(): string;

};
allKnownElementNames(): string[];
}

@@ -317,3 +317,7 @@ /**

*/
DomElementSchemaRegistry.prototype.securityContext = function (tagName, propName) {
DomElementSchemaRegistry.prototype.securityContext = function (tagName, propName, isAttribute) {
if (isAttribute) {
// NB: For security purposes, use the mapped property name, not the attribute name.
propName = this.getMappedPropName(propName);
}
// Make sure comparisons are case insensitive, so that case differences between attribute and

@@ -354,2 +358,3 @@ // property names do not have a security impact.

};
DomElementSchemaRegistry.prototype.allKnownElementNames = function () { return Object.keys(this._schema); };
DomElementSchemaRegistry.decorators = [

@@ -356,0 +361,0 @@ { type: Injectable },

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"DomElementSchemaRegistry":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"hasProperty":[{"__symbolic":"method"}],"hasElement":[{"__symbolic":"method"}],"securityContext":[{"__symbolic":"method"}],"getMappedPropName":[{"__symbolic":"method"}],"getDefaultComponentElementName":[{"__symbolic":"method"}],"validateProperty":[{"__symbolic":"method"}],"validateAttribute":[{"__symbolic":"method"}]}}}}
{"__symbolic":"module","version":1,"metadata":{"DomElementSchemaRegistry":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"hasProperty":[{"__symbolic":"method"}],"hasElement":[{"__symbolic":"method"}],"securityContext":[{"__symbolic":"method"}],"getMappedPropName":[{"__symbolic":"method"}],"getDefaultComponentElementName":[{"__symbolic":"method"}],"validateProperty":[{"__symbolic":"method"}],"validateAttribute":[{"__symbolic":"method"}],"allKnownElementNames":[{"__symbolic":"method"}]}}}}

@@ -8,7 +8,8 @@ /**

*/
import { SchemaMetadata } from '@angular/core';
import { SchemaMetadata, SecurityContext } from '@angular/core';
export declare abstract class ElementSchemaRegistry {
abstract hasProperty(tagName: string, propName: string, schemaMetas: SchemaMetadata[]): boolean;
abstract hasElement(tagName: string, schemaMetas: SchemaMetadata[]): boolean;
abstract securityContext(tagName: string, propName: string): any;
abstract securityContext(elementName: string, propName: string, isAttribute: boolean): SecurityContext;
abstract allKnownElementNames(): string[];
abstract getMappedPropName(propName: string): string;

@@ -15,0 +16,0 @@ abstract getDefaultComponentElementName(): string;

@@ -125,8 +125,8 @@ /**

function SelectorMatcher() {
this._elementMap = {};
this._elementPartialMap = {};
this._classMap = {};
this._classPartialMap = {};
this._attrValueMap = {};
this._attrValuePartialMap = {};
this._elementMap = new Map();
this._elementPartialMap = new Map();
this._classMap = new Map();
this._classPartialMap = new Map();
this._attrValueMap = new Map();
this._attrValuePartialMap = new Map();
this._listContexts = [];

@@ -188,6 +188,6 @@ }

var terminalMap = matcher._attrValueMap;
var terminalValuesMap = terminalMap[name_2];
var terminalValuesMap = terminalMap.get(name_2);
if (!terminalValuesMap) {
terminalValuesMap = {};
terminalMap[name_2] = terminalValuesMap;
terminalValuesMap = new Map();
terminalMap.set(name_2, terminalValuesMap);
}

@@ -198,6 +198,6 @@ this._addTerminal(terminalValuesMap, value, selectable);

var partialMap = matcher._attrValuePartialMap;
var partialValuesMap = partialMap[name_2];
var partialValuesMap = partialMap.get(name_2);
if (!partialValuesMap) {
partialValuesMap = {};
partialMap[name_2] = partialValuesMap;
partialValuesMap = new Map();
partialMap.set(name_2, partialValuesMap);
}

@@ -210,6 +210,6 @@ matcher = this._addPartial(partialValuesMap, value);

SelectorMatcher.prototype._addTerminal = function (map, name, selectable) {
var terminalList = map[name];
var terminalList = map.get(name);
if (!terminalList) {
terminalList = [];
map[name] = terminalList;
map.set(name, terminalList);
}

@@ -219,6 +219,6 @@ terminalList.push(selectable);

SelectorMatcher.prototype._addPartial = function (map, name) {
var matcher = map[name];
var matcher = map.get(name);
if (!matcher) {
matcher = new SelectorMatcher();
map[name] = matcher;
map.set(name, matcher);
}

@@ -259,3 +259,3 @@ return matcher;

var value = attrs[i + 1];
var terminalValuesMap = this._attrValueMap[name_3];
var terminalValuesMap = this._attrValueMap.get(name_3);
if (value) {

@@ -267,3 +267,3 @@ result =

this._matchTerminal(terminalValuesMap, value, cssSelector, matchedCallback) || result;
var partialValuesMap = this._attrValuePartialMap[name_3];
var partialValuesMap = this._attrValuePartialMap.get(name_3);
if (value) {

@@ -283,4 +283,4 @@ result = this._matchPartial(partialValuesMap, '', cssSelector, matchedCallback) || result;

}
var selectables = map[name];
var starSelectables = map['*'];
var selectables = map.get(name);
var starSelectables = map.get('*');
if (starSelectables) {

@@ -305,3 +305,3 @@ selectables = selectables.concat(starSelectables);

}
var nestedSelector = map[name];
var nestedSelector = map.get(name);
if (!nestedSelector) {

@@ -308,0 +308,0 @@ return false;

@@ -64,6 +64,7 @@ /**

securityContext: SecurityContext;
needsRuntimeSecurityContext: boolean;
value: AST;
unit: string;
sourceSpan: ParseSourceSpan;
constructor(name: string, type: PropertyBindingType, securityContext: SecurityContext, value: AST, unit: string, sourceSpan: ParseSourceSpan);
constructor(name: string, type: PropertyBindingType, securityContext: SecurityContext, needsRuntimeSecurityContext: boolean, value: AST, unit: string, sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;

@@ -70,0 +71,0 @@ isAnimation: boolean;

@@ -51,6 +51,7 @@ /**

export var BoundElementPropertyAst = (function () {
function BoundElementPropertyAst(name, type, securityContext, value, unit, sourceSpan) {
function BoundElementPropertyAst(name, type, securityContext, needsRuntimeSecurityContext, value, unit, sourceSpan) {
this.name = name;
this.type = type;
this.securityContext = securityContext;
this.needsRuntimeSecurityContext = needsRuntimeSecurityContext;
this.value = value;

@@ -57,0 +58,0 @@ this.unit = unit;

@@ -10,3 +10,2 @@ /**

import { CompileDirectiveMetadata, CompilePipeMetadata } from '../compile_metadata';
import { BindingPipe, RecursiveAstVisitor } from '../expression_parser/ast';
import { Parser } from '../expression_parser/parser';

@@ -50,5 +49,1 @@ import { I18NHtmlParser } from '../i18n/i18n_html_parser';

export declare function splitClasses(classAttrValue: string): string[];
export declare class PipeCollector extends RecursiveAstVisitor {
pipes: Set<string>;
visitPipe(ast: BindingPipe, context: any): any;
}

@@ -13,5 +13,4 @@ /**

};
import { Inject, Injectable, OpaqueToken, Optional, SecurityContext } from '@angular/core';
import { Inject, Injectable, OpaqueToken, Optional } from '@angular/core';
import { removeIdentifierDuplicates } from '../compile_metadata';
import { EmptyExpr, RecursiveAstVisitor } from '../expression_parser/ast';
import { Parser } from '../expression_parser/parser';

@@ -25,5 +24,5 @@ import { isPresent } from '../facade/lang';

import { InterpolationConfig } from '../ml_parser/interpolation_config';
import { mergeNsAndName, splitNsName } from '../ml_parser/tags';
import { splitNsName } from '../ml_parser/tags';
import { ParseError, ParseErrorLevel, ParseSourceSpan } from '../parse_util';
import { Console, view_utils } from '../private_import_core';
import { Console } from '../private_import_core';
import { ProviderElementContext, ProviderViewContext } from '../provider_analyzer';

@@ -33,4 +32,4 @@ import { ElementSchemaRegistry } from '../schema/element_schema_registry';

import { isStyleUrlResolvable } from '../style_url_resolver';
import { splitAtColon, splitAtPeriod } from '../util';
import { AttrAst, BoundDirectivePropertyAst, BoundElementPropertyAst, BoundEventAst, BoundTextAst, DirectiveAst, ElementAst, EmbeddedTemplateAst, NgContentAst, PropertyBindingType, ReferenceAst, TextAst, VariableAst, templateVisitAll } from './template_ast';
import { BindingParser } from './binding_parser';
import { AttrAst, BoundDirectivePropertyAst, BoundTextAst, DirectiveAst, ElementAst, EmbeddedTemplateAst, NgContentAst, PropertyBindingType, ReferenceAst, TextAst, VariableAst, templateVisitAll } from './template_ast';
import { PreparsedElementType, preparseElement } from './template_preparser';

@@ -58,3 +57,2 @@ // Group 1 = "bind-"

var IDENT_EVENT_IDX = 10;
var ANIMATE_PROP_PREFIX = 'animate-';
var TEMPLATE_ELEMENT = 'template';

@@ -64,6 +62,2 @@ var TEMPLATE_ATTR = 'template';

var CLASS_ATTR = 'class';
var PROPERTY_PARTS_SEPARATOR = '.';
var ATTRIBUTE_PREFIX = 'attr';
var CLASS_PREFIX = 'class';
var STYLE_PREFIX = 'style';
var TEXT_CSS_SELECTOR = CssSelector.parse('*')[0];

@@ -123,5 +117,13 @@ /**

var providerViewContext = new ProviderViewContext(component, htmlAstWithErrors.rootNodes[0].sourceSpan);
var parseVisitor = new TemplateParseVisitor(providerViewContext, uniqDirectives, uniqPipes, schemas, this._exprParser, this._schemaRegistry);
var interpolationConfig = void 0;
if (component.template && component.template.interpolation) {
interpolationConfig = {
start: component.template.interpolation[0],
end: component.template.interpolation[1]
};
}
var bindingParser = new BindingParser(this._exprParser, interpolationConfig, this._schemaRegistry, uniqPipes, errors);
var parseVisitor = new TemplateParseVisitor(providerViewContext, uniqDirectives, bindingParser, this._schemaRegistry, schemas, errors);
result = html.visitAll(parseVisitor, htmlAstWithErrors.rootNodes, EMPTY_ELEMENT_CONTEXT);
errors.push.apply(errors, parseVisitor.errors.concat(providerViewContext.errors));
errors.push.apply(errors, providerViewContext.errors);
}

@@ -185,20 +187,12 @@ else {

var TemplateParseVisitor = (function () {
function TemplateParseVisitor(providerViewContext, directives, pipes, _schemas, _exprParser, _schemaRegistry) {
function TemplateParseVisitor(providerViewContext, directives, _bindingParser, _schemaRegistry, _schemas, _targetErrors) {
var _this = this;
this.providerViewContext = providerViewContext;
this._bindingParser = _bindingParser;
this._schemaRegistry = _schemaRegistry;
this._schemas = _schemas;
this._exprParser = _exprParser;
this._schemaRegistry = _schemaRegistry;
this._targetErrors = _targetErrors;
this.selectorMatcher = new SelectorMatcher();
this.errors = [];
this.directivesIndex = new Map();
this.ngContentCount = 0;
this.pipesByName = new Map();
var tempMeta = providerViewContext.component.template;
if (tempMeta && tempMeta.interpolation) {
this._interpolationConfig = {
start: tempMeta.interpolation[0],
end: tempMeta.interpolation[1]
};
}
directives.forEach(function (directive, index) {

@@ -209,96 +203,3 @@ var selector = CssSelector.parse(directive.selector);

});
pipes.forEach(function (pipe) { return _this.pipesByName.set(pipe.name, pipe); });
}
TemplateParseVisitor.prototype._reportError = function (message, sourceSpan, level) {
if (level === void 0) { level = ParseErrorLevel.FATAL; }
this.errors.push(new TemplateParseError(message, sourceSpan, level));
};
TemplateParseVisitor.prototype._reportParserErrors = function (errors, sourceSpan) {
for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) {
var error = errors_1[_i];
this._reportError(error.message, sourceSpan);
}
};
TemplateParseVisitor.prototype._parseInterpolation = function (value, sourceSpan) {
var sourceInfo = sourceSpan.start.toString();
try {
var ast = this._exprParser.parseInterpolation(value, sourceInfo, this._interpolationConfig);
if (ast)
this._reportParserErrors(ast.errors, sourceSpan);
this._checkPipes(ast, sourceSpan);
if (isPresent(ast) &&
ast.ast.expressions.length > view_utils.MAX_INTERPOLATION_VALUES) {
throw new Error("Only support at most " + view_utils.MAX_INTERPOLATION_VALUES + " interpolation values!");
}
return ast;
}
catch (e) {
this._reportError("" + e, sourceSpan);
return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
}
};
TemplateParseVisitor.prototype._parseAction = function (value, sourceSpan) {
var sourceInfo = sourceSpan.start.toString();
try {
var ast = this._exprParser.parseAction(value, sourceInfo, this._interpolationConfig);
if (ast) {
this._reportParserErrors(ast.errors, sourceSpan);
}
if (!ast || ast.ast instanceof EmptyExpr) {
this._reportError("Empty expressions are not allowed", sourceSpan);
return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
}
this._checkPipes(ast, sourceSpan);
return ast;
}
catch (e) {
this._reportError("" + e, sourceSpan);
return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
}
};
TemplateParseVisitor.prototype._parseBinding = function (value, sourceSpan) {
var sourceInfo = sourceSpan.start.toString();
try {
var ast = this._exprParser.parseBinding(value, sourceInfo, this._interpolationConfig);
if (ast)
this._reportParserErrors(ast.errors, sourceSpan);
this._checkPipes(ast, sourceSpan);
return ast;
}
catch (e) {
this._reportError("" + e, sourceSpan);
return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
}
};
TemplateParseVisitor.prototype._parseTemplateBindings = function (value, sourceSpan) {
var _this = this;
var sourceInfo = sourceSpan.start.toString();
try {
var bindingsResult = this._exprParser.parseTemplateBindings(value, sourceInfo);
this._reportParserErrors(bindingsResult.errors, sourceSpan);
bindingsResult.templateBindings.forEach(function (binding) {
if (isPresent(binding.expression)) {
_this._checkPipes(binding.expression, sourceSpan);
}
});
bindingsResult.warnings.forEach(function (warning) { _this._reportError(warning, sourceSpan, ParseErrorLevel.WARNING); });
return bindingsResult.templateBindings;
}
catch (e) {
this._reportError("" + e, sourceSpan);
return [];
}
};
TemplateParseVisitor.prototype._checkPipes = function (ast, sourceSpan) {
var _this = this;
if (isPresent(ast)) {
var collector = new PipeCollector();
ast.visit(collector);
collector.pipes.forEach(function (pipeName) {
if (!_this.pipesByName.has(pipeName)) {
_this._reportError("The pipe '" + pipeName + "' could not be found", sourceSpan);
}
});
}
};
TemplateParseVisitor.prototype.visitExpansion = function (expansion, context) { return null; };

@@ -308,3 +209,3 @@ TemplateParseVisitor.prototype.visitExpansionCase = function (expansionCase, context) { return null; };

var ngContentIndex = parent.findNgContentIndex(TEXT_CSS_SELECTOR);
var expr = this._parseInterpolation(text.value, text.sourceSpan);
var expr = this._bindingParser.parseInterpolation(text.value, text.sourceSpan);
if (isPresent(expr)) {

@@ -342,3 +243,2 @@ return new BoundTextAst(expr, ngContentIndex, text.sourceSpan);

var elementVars = [];
var animationProps = [];
var events = [];

@@ -353,7 +253,19 @@ var templateElementOrDirectiveProps = [];

element.attrs.forEach(function (attr) {
var hasBinding = _this._parseAttr(isTemplateElement, attr, matchableAttrs, elementOrDirectiveProps, animationProps, events, elementOrDirectiveRefs, elementVars);
var hasTemplateBinding = _this._parseInlineTemplateBinding(attr, templateMatchableAttrs, templateElementOrDirectiveProps, templateElementVars);
if (hasTemplateBinding && hasInlineTemplates) {
_this._reportError("Can't have multiple template bindings on one element. Use only one attribute named 'template' or prefixed with *", attr.sourceSpan);
var hasBinding = _this._parseAttr(isTemplateElement, attr, matchableAttrs, elementOrDirectiveProps, events, elementOrDirectiveRefs, elementVars);
var templateBindingsSource;
if (_this._normalizeAttributeName(attr.name) == TEMPLATE_ATTR) {
templateBindingsSource = attr.value;
}
else if (attr.name.startsWith(TEMPLATE_ATTR_PREFIX)) {
var key = attr.name.substring(TEMPLATE_ATTR_PREFIX.length); // remove the star
templateBindingsSource = (attr.value.length == 0) ? key : key + ' ' + attr.value;
}
var hasTemplateBinding = isPresent(templateBindingsSource);
if (hasTemplateBinding) {
if (hasInlineTemplates) {
_this._reportError("Can't have multiple template bindings on one element. Use only one attribute named 'template' or prefixed with *", attr.sourceSpan);
}
hasInlineTemplates = true;
_this._bindingParser.parseInlineTemplateBinding(attr.name, templateBindingsSource, attr.sourceSpan, templateMatchableAttrs, templateElementOrDirectiveProps, templateElementVars);
}
if (!hasBinding && !hasTemplateBinding) {

@@ -364,5 +276,2 @@ // don't include the bindings as attributes as well in the AST

}
if (hasTemplateBinding) {
hasInlineTemplates = true;
}
});

@@ -373,4 +282,3 @@ var elementCssSelector = createElementCssSelector(nodeName, matchableAttrs);

var directiveAsts = this._createDirectiveAsts(isTemplateElement, element.name, directiveMetas, elementOrDirectiveProps, elementOrDirectiveRefs, element.sourceSpan, references);
var elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, directiveAsts)
.concat(animationProps);
var elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, directiveAsts);
var isViewRoot = parent.isTemplateElement || hasInlineTemplates;

@@ -439,31 +347,3 @@ var providerContext = new ProviderElementContext(this.providerViewContext, parent.providerContext, isViewRoot, directiveAsts, attrs, references, element.sourceSpan);

};
TemplateParseVisitor.prototype._parseInlineTemplateBinding = function (attr, targetMatchableAttrs, targetProps, targetVars) {
var templateBindingsSource = null;
if (this._normalizeAttributeName(attr.name) == TEMPLATE_ATTR) {
templateBindingsSource = attr.value;
}
else if (attr.name.startsWith(TEMPLATE_ATTR_PREFIX)) {
var key = attr.name.substring(TEMPLATE_ATTR_PREFIX.length); // remove the star
templateBindingsSource = (attr.value.length == 0) ? key : key + ' ' + attr.value;
}
if (isPresent(templateBindingsSource)) {
var bindings = this._parseTemplateBindings(templateBindingsSource, attr.sourceSpan);
for (var i = 0; i < bindings.length; i++) {
var binding = bindings[i];
if (binding.keyIsVar) {
targetVars.push(new VariableAst(binding.key, binding.name, attr.sourceSpan));
}
else if (isPresent(binding.expression)) {
this._parsePropertyAst(binding.key, binding.expression, attr.sourceSpan, targetMatchableAttrs, targetProps);
}
else {
targetMatchableAttrs.push([binding.key, '']);
this._parseLiteralAttr(binding.key, null, attr.sourceSpan, targetProps);
}
}
return true;
}
return false;
};
TemplateParseVisitor.prototype._parseAttr = function (isTemplateElement, attr, targetMatchableAttrs, targetProps, targetAnimationProps, targetEvents, targetRefs, targetVars) {
TemplateParseVisitor.prototype._parseAttr = function (isTemplateElement, attr, targetMatchableAttrs, targetProps, targetEvents, targetRefs, targetVars) {
var name = this._normalizeAttributeName(attr.name);

@@ -477,3 +357,3 @@ var value = attr.value;

if (isPresent(bindParts[KW_BIND_IDX])) {
this._parsePropertyOrAnimation(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetProps, targetAnimationProps);
this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
}

@@ -494,32 +374,27 @@ else if (bindParts[KW_LET_IDX]) {

else if (bindParts[KW_ON_IDX]) {
this._parseEventOrAnimationEvent(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
this._bindingParser.parseEvent(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
}
else if (bindParts[KW_BINDON_IDX]) {
this._parsePropertyOrAnimation(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetProps, targetAnimationProps);
this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
this._parseAssignmentEvent(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
}
else if (bindParts[KW_AT_IDX]) {
if (_isAnimationLabel(name) && isPresent(value) && value.length > 0) {
this._reportError("Assigning animation triggers via @prop=\"exp\" attributes with an expression is invalid." +
" Use property bindings (e.g. [@prop]=\"exp\") or use an attribute without a value (e.g. @prop) instead.", srcSpan, ParseErrorLevel.FATAL);
}
this._parseAnimation(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetAnimationProps);
this._bindingParser.parseLiteralAttr(name, value, srcSpan, targetMatchableAttrs, targetProps);
}
else if (bindParts[IDENT_BANANA_BOX_IDX]) {
this._parsePropertyOrAnimation(bindParts[IDENT_BANANA_BOX_IDX], value, srcSpan, targetMatchableAttrs, targetProps, targetAnimationProps);
this._bindingParser.parsePropertyBinding(bindParts[IDENT_BANANA_BOX_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
this._parseAssignmentEvent(bindParts[IDENT_BANANA_BOX_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
}
else if (bindParts[IDENT_PROPERTY_IDX]) {
this._parsePropertyOrAnimation(bindParts[IDENT_PROPERTY_IDX], value, srcSpan, targetMatchableAttrs, targetProps, targetAnimationProps);
this._bindingParser.parsePropertyBinding(bindParts[IDENT_PROPERTY_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
}
else if (bindParts[IDENT_EVENT_IDX]) {
this._parseEventOrAnimationEvent(bindParts[IDENT_EVENT_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
this._bindingParser.parseEvent(bindParts[IDENT_EVENT_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
}
}
else {
hasBinding =
this._parsePropertyInterpolation(name, value, srcSpan, targetMatchableAttrs, targetProps);
hasBinding = this._bindingParser.parsePropertyInterpolation(name, value, srcSpan, targetMatchableAttrs, targetProps);
}
if (!hasBinding) {
this._parseLiteralAttr(name, value, srcSpan, targetProps);
this._bindingParser.parseLiteralAttr(name, value, srcSpan, targetMatchableAttrs, targetProps);
}

@@ -543,84 +418,5 @@ return hasBinding;

};
TemplateParseVisitor.prototype._parsePropertyOrAnimation = function (name, expression, sourceSpan, targetMatchableAttrs, targetProps, targetAnimationProps) {
var animatePropLength = ANIMATE_PROP_PREFIX.length;
var isAnimationProp = _isAnimationLabel(name);
var animationPrefixLength = 1;
if (name.substring(0, animatePropLength) == ANIMATE_PROP_PREFIX) {
isAnimationProp = true;
animationPrefixLength = animatePropLength;
}
if (isAnimationProp) {
this._parseAnimation(name.substr(animationPrefixLength), expression, sourceSpan, targetMatchableAttrs, targetAnimationProps);
}
else {
this._parsePropertyAst(name, this._parseBinding(expression, sourceSpan), sourceSpan, targetMatchableAttrs, targetProps);
}
};
TemplateParseVisitor.prototype._parseAnimation = function (name, expression, sourceSpan, targetMatchableAttrs, targetAnimationProps) {
// This will occur when a @trigger is not paired with an expression.
// For animations it is valid to not have an expression since */void
// states will be applied by angular when the element is attached/detached
if (!isPresent(expression) || expression.length == 0) {
expression = 'null';
}
var ast = this._parseBinding(expression, sourceSpan);
targetMatchableAttrs.push([name, ast.source]);
targetAnimationProps.push(new BoundElementPropertyAst(name, PropertyBindingType.Animation, SecurityContext.NONE, ast, null, sourceSpan));
};
TemplateParseVisitor.prototype._parsePropertyInterpolation = function (name, value, sourceSpan, targetMatchableAttrs, targetProps) {
var expr = this._parseInterpolation(value, sourceSpan);
if (isPresent(expr)) {
this._parsePropertyAst(name, expr, sourceSpan, targetMatchableAttrs, targetProps);
return true;
}
return false;
};
TemplateParseVisitor.prototype._parsePropertyAst = function (name, ast, sourceSpan, targetMatchableAttrs, targetProps) {
targetMatchableAttrs.push([name, ast.source]);
targetProps.push(new BoundElementOrDirectiveProperty(name, ast, false, sourceSpan));
};
TemplateParseVisitor.prototype._parseAssignmentEvent = function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
this._parseEventOrAnimationEvent(name + "Change", expression + "=$event", sourceSpan, targetMatchableAttrs, targetEvents);
this._bindingParser.parseEvent(name + "Change", expression + "=$event", sourceSpan, targetMatchableAttrs, targetEvents);
};
TemplateParseVisitor.prototype._parseEventOrAnimationEvent = function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
if (_isAnimationLabel(name)) {
name = name.substr(1);
this._parseAnimationEvent(name, expression, sourceSpan, targetEvents);
}
else {
this._parseEvent(name, expression, sourceSpan, targetMatchableAttrs, targetEvents);
}
};
TemplateParseVisitor.prototype._parseAnimationEvent = function (name, expression, sourceSpan, targetEvents) {
var matches = splitAtPeriod(name, [name, '']);
var eventName = matches[0];
var phase = matches[1].toLowerCase();
if (phase) {
switch (phase) {
case 'start':
case 'done':
var ast = this._parseAction(expression, sourceSpan);
targetEvents.push(new BoundEventAst(eventName, null, phase, ast, sourceSpan));
break;
default:
this._reportError("The provided animation output phase value \"" + phase + "\" for \"@" + eventName + "\" is not supported (use start or done)", sourceSpan);
break;
}
}
else {
this._reportError("The animation trigger output event (@" + eventName + ") is missing its phase value name (start or done are currently supported)", sourceSpan);
}
};
TemplateParseVisitor.prototype._parseEvent = function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
// long format: 'target: eventName'
var _a = splitAtColon(name, [null, name]), target = _a[0], eventName = _a[1];
var ast = this._parseAction(expression, sourceSpan);
targetMatchableAttrs.push([name, ast.source]);
targetEvents.push(new BoundEventAst(eventName, target, null, ast, sourceSpan));
// Don't detect directives for event names for now,
// so don't add the event name to the matchableAttrs
};
TemplateParseVisitor.prototype._parseLiteralAttr = function (name, value, sourceSpan, targetProps) {
targetProps.push(new BoundElementOrDirectiveProperty(name, this._exprParser.wrapLiteralPrimitive(value, ''), true, sourceSpan));
};
TemplateParseVisitor.prototype._parseDirectives = function (selectorMatcher, elementCssSelector) {

@@ -652,7 +448,8 @@ var _this = this;

}
var hostProperties = [];
var hostEvents = [];
var directiveProperties = [];
_this._createDirectiveHostPropertyAsts(elementName, directive.hostProperties, sourceSpan, hostProperties);
_this._createDirectiveHostEventAsts(directive.hostListeners, sourceSpan, hostEvents);
var hostProperties = _this._bindingParser.createDirectiveHostPropertyAsts(directive, sourceSpan);
// Note: We need to check the host properties here as well,
// as we don't know the element name in the DirectiveWrapperCompiler yet.
_this._checkPropertiesInSchema(elementName, hostProperties);
var hostEvents = _this._bindingParser.createDirectiveHostEventAsts(directive, sourceSpan);
_this._createDirectivePropertyAsts(directive.inputs, props, directiveProperties);

@@ -684,31 +481,2 @@ elementOrDirectiveRefs.forEach(function (elOrDirRef) {

};
TemplateParseVisitor.prototype._createDirectiveHostPropertyAsts = function (elementName, hostProps, sourceSpan, targetPropertyAsts) {
var _this = this;
if (hostProps) {
Object.keys(hostProps).forEach(function (propName) {
var expression = hostProps[propName];
if (typeof expression === 'string') {
var exprAst = _this._parseBinding(expression, sourceSpan);
targetPropertyAsts.push(_this._createElementPropertyAst(elementName, propName, exprAst, sourceSpan));
}
else {
_this._reportError("Value of the host property binding \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan);
}
});
}
};
TemplateParseVisitor.prototype._createDirectiveHostEventAsts = function (hostListeners, sourceSpan, targetEventAsts) {
var _this = this;
if (hostListeners) {
Object.keys(hostListeners).forEach(function (propName) {
var expression = hostListeners[propName];
if (typeof expression === 'string') {
_this._parseEventOrAnimationEvent(propName, expression, sourceSpan, [], targetEventAsts);
}
else {
_this._reportError("Value of the host listener \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan);
}
});
}
};
TemplateParseVisitor.prototype._createDirectivePropertyAsts = function (directiveProperties, boundProps, targetBoundDirectiveProps) {

@@ -745,83 +513,8 @@ if (directiveProperties) {

if (!prop.isLiteral && !boundDirectivePropsIndex.get(prop.name)) {
boundElementProps.push(_this._createElementPropertyAst(elementName, prop.name, prop.expression, prop.sourceSpan));
boundElementProps.push(_this._bindingParser.createElementPropertyAst(elementName, prop));
}
});
this._checkPropertiesInSchema(elementName, boundElementProps);
return boundElementProps;
};
TemplateParseVisitor.prototype._createElementPropertyAst = function (elementName, name, ast, sourceSpan) {
var unit = null;
var bindingType;
var boundPropertyName;
var parts = name.split(PROPERTY_PARTS_SEPARATOR);
var securityContext;
if (parts.length === 1) {
var partValue = parts[0];
if (_isAnimationLabel(partValue)) {
boundPropertyName = partValue.substr(1);
bindingType = PropertyBindingType.Animation;
securityContext = SecurityContext.NONE;
}
else {
boundPropertyName = this._schemaRegistry.getMappedPropName(partValue);
securityContext = this._schemaRegistry.securityContext(elementName, boundPropertyName);
bindingType = PropertyBindingType.Property;
this._validatePropertyOrAttributeName(boundPropertyName, sourceSpan, false);
if (!this._schemaRegistry.hasProperty(elementName, boundPropertyName, this._schemas)) {
var errorMsg = "Can't bind to '" + boundPropertyName + "' since it isn't a known property of '" + elementName + "'.";
if (elementName.indexOf('-') > -1) {
errorMsg +=
("\n1. If '" + elementName + "' is an Angular component and it has '" + boundPropertyName + "' input, then verify that it is part of this module.") +
("\n2. If '" + elementName + "' is a Web Component then add \"CUSTOM_ELEMENTS_SCHEMA\" to the '@NgModule.schemas' of this component to suppress this message.\n");
}
this._reportError(errorMsg, sourceSpan);
}
}
}
else {
if (parts[0] == ATTRIBUTE_PREFIX) {
boundPropertyName = parts[1];
this._validatePropertyOrAttributeName(boundPropertyName, sourceSpan, true);
// NB: For security purposes, use the mapped property name, not the attribute name.
var mapPropName = this._schemaRegistry.getMappedPropName(boundPropertyName);
securityContext = this._schemaRegistry.securityContext(elementName, mapPropName);
var nsSeparatorIdx = boundPropertyName.indexOf(':');
if (nsSeparatorIdx > -1) {
var ns = boundPropertyName.substring(0, nsSeparatorIdx);
var name_1 = boundPropertyName.substring(nsSeparatorIdx + 1);
boundPropertyName = mergeNsAndName(ns, name_1);
}
bindingType = PropertyBindingType.Attribute;
}
else if (parts[0] == CLASS_PREFIX) {
boundPropertyName = parts[1];
bindingType = PropertyBindingType.Class;
securityContext = SecurityContext.NONE;
}
else if (parts[0] == STYLE_PREFIX) {
unit = parts.length > 2 ? parts[2] : null;
boundPropertyName = parts[1];
bindingType = PropertyBindingType.Style;
securityContext = SecurityContext.STYLE;
}
else {
this._reportError("Invalid property name '" + name + "'", sourceSpan);
bindingType = null;
securityContext = null;
}
}
return new BoundElementPropertyAst(boundPropertyName, bindingType, securityContext, ast, unit, sourceSpan);
};
/**
* @param propName the name of the property / attribute
* @param sourceSpan
* @param isAttr true when binding to an attribute
* @private
*/
TemplateParseVisitor.prototype._validatePropertyOrAttributeName = function (propName, sourceSpan, isAttr) {
var report = isAttr ? this._schemaRegistry.validateAttribute(propName) :
this._schemaRegistry.validateProperty(propName);
if (report.error) {
this._reportError(report.msg, sourceSpan, ParseErrorLevel.FATAL);
}
};
TemplateParseVisitor.prototype._findComponentDirectives = function (directives) {

@@ -883,2 +576,21 @@ return directives.filter(function (directive) { return directive.directive.isComponent; });

};
TemplateParseVisitor.prototype._checkPropertiesInSchema = function (elementName, boundProps) {
var _this = this;
boundProps.forEach(function (boundProp) {
if (boundProp.type === PropertyBindingType.Property &&
!_this._schemaRegistry.hasProperty(elementName, boundProp.name, _this._schemas)) {
var errorMsg = "Can't bind to '" + boundProp.name + "' since it isn't a known property of '" + elementName + "'.";
if (elementName.indexOf('-') > -1) {
errorMsg +=
("\n1. If '" + elementName + "' is an Angular component and it has '" + boundProp.name + "' input, then verify that it is part of this module.") +
("\n2. If '" + elementName + "' is a Web Component then add \"CUSTOM_ELEMENTS_SCHEMA\" to the '@NgModule.schemas' of this component to suppress this message.\n");
}
_this._reportError(errorMsg, boundProp.sourceSpan);
}
});
};
TemplateParseVisitor.prototype._reportError = function (message, sourceSpan, level) {
if (level === void 0) { level = ParseErrorLevel.FATAL; }
this._targetErrors.push(new ParseError(sourceSpan, message, level));
};
return TemplateParseVisitor;

@@ -917,11 +629,2 @@ }());

}());
var BoundElementOrDirectiveProperty = (function () {
function BoundElementOrDirectiveProperty(name, expression, isLiteral, sourceSpan) {
this.name = name;
this.expression = expression;
this.isLiteral = isLiteral;
this.sourceSpan = sourceSpan;
}
return BoundElementOrDirectiveProperty;
}());
var ElementOrDirectiveRef = (function () {

@@ -992,19 +695,2 @@ function ElementOrDirectiveRef(name, value, sourceSpan) {

var NON_BINDABLE_VISITOR = new NonBindableVisitor();
export var PipeCollector = (function (_super) {
__extends(PipeCollector, _super);
function PipeCollector() {
_super.apply(this, arguments);
this.pipes = new Set();
}
PipeCollector.prototype.visitPipe = function (ast, context) {
this.pipes.add(ast.name);
ast.exp.visit(this);
this.visitAll(ast.args, context);
return null;
};
return PipeCollector;
}(RecursiveAstVisitor));
function _isAnimationLabel(name) {
return name[0] == '@';
}
function _isEmptyTextNode(node) {

@@ -1011,0 +697,0 @@ return node instanceof html.Text && node.value.trim().length == 0;

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"TEMPLATE_TRANSFORMS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["TemplateTransforms"]},"TemplateParser":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"TEMPLATE_TRANSFORMS"}]}]],"parameters":[{"__symbolic":"reference","module":"../expression_parser/parser","name":"Parser"},{"__symbolic":"reference","module":"../schema/element_schema_registry","name":"ElementSchemaRegistry"},{"__symbolic":"reference","module":"../i18n/i18n_html_parser","name":"I18NHtmlParser"},{"__symbolic":"reference","module":"../private_import_core","name":"Console"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"./template_ast","name":"TemplateAstVisitor"}]}]}],"parse":[{"__symbolic":"method"}],"tryParse":[{"__symbolic":"method"}],"tryParseHtml":[{"__symbolic":"method"}],"expandHtml":[{"__symbolic":"method"}],"getInterpolationConfig":[{"__symbolic":"method"}],"_assertNoReferenceDuplicationOnTemplate":[{"__symbolic":"method"}]}},"splitClasses":{"__symbolic":"function","parameters":["classAttrValue"],"value":{"__symbolic":"error","message":"Expression form not supported","line":1126,"character":37}}}}
{"__symbolic":"module","version":1,"metadata":{"TEMPLATE_TRANSFORMS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["TemplateTransforms"]},"TemplateParser":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","name":"TEMPLATE_TRANSFORMS"}]}]],"parameters":[{"__symbolic":"reference","module":"../expression_parser/parser","name":"Parser"},{"__symbolic":"reference","module":"../schema/element_schema_registry","name":"ElementSchemaRegistry"},{"__symbolic":"reference","module":"../i18n/i18n_html_parser","name":"I18NHtmlParser"},{"__symbolic":"reference","module":"../private_import_core","name":"Console"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"./template_ast","name":"TemplateAstVisitor"}]}]}],"parse":[{"__symbolic":"method"}],"tryParse":[{"__symbolic":"method"}],"tryParseHtml":[{"__symbolic":"method"}],"expandHtml":[{"__symbolic":"method"}],"getInterpolationConfig":[{"__symbolic":"method"}],"_assertNoReferenceDuplicationOnTemplate":[{"__symbolic":"method"}]}},"splitClasses":{"__symbolic":"function","parameters":["classAttrValue"],"value":{"__symbolic":"error","message":"Expression form not supported","line":769,"character":37}}}}

@@ -1,10 +0,1 @@

/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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 { CompileTokenMetadata } from './compile_metadata';
import * as o from './output/output_ast';
export declare const MODULE_SUFFIX: string;

@@ -32,4 +23,2 @@ export declare function camelCaseToDashCase(input: string): string;

}
export declare function assetUrl(pkg: string, path?: string, type?: string): string;
export declare function createDiTokenExpression(token: CompileTokenMetadata): o.Expression;
export declare class SyncAsyncResult<T> {

@@ -36,0 +25,0 @@ syncResult: T;

@@ -8,4 +8,3 @@ /**

*/
import { isBlank, isPresent, isPrimitive, isStrictStringMap } from './facade/lang';
import * as o from './output/output_ast';
import { isBlank, isPrimitive, isStrictStringMap } from './facade/lang';
export var MODULE_SUFFIX = '';

@@ -66,24 +65,2 @@ var CAMEL_CASE_REGEXP = /([A-Z])/g;

}());
export function assetUrl(pkg, path, type) {
if (path === void 0) { path = null; }
if (type === void 0) { type = 'src'; }
if (path == null) {
return "asset:@angular/lib/" + pkg + "/index";
}
else {
return "asset:@angular/lib/" + pkg + "/src/" + path;
}
}
export function createDiTokenExpression(token) {
if (isPresent(token.value)) {
return o.literal(token.value);
}
else if (token.identifierIsInstance) {
return o.importExpr(token.identifier)
.instantiate([], o.importType(token.identifier, [], [o.TypeModifier.Const]));
}
else {
return o.importExpr(token.identifier);
}
}
export var SyncAsyncResult = (function () {

@@ -90,0 +67,0 @@ function SyncAsyncResult(syncResult, asyncResult) {

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"MODULE_SUFFIX":"","camelCaseToDashCase":{"__symbolic":"function","parameters":["input"],"value":{"__symbolic":"error","message":"Reference to a local symbol","line":14,"character":6,"context":{"name":"CAMEL_CASE_REGEXP"}}},"splitAtColon":{"__symbolic":"function","parameters":["input","defaultValues"],"value":{"__symbolic":"error","message":"Reference to a non-exported function","line":28,"character":9,"context":{"name":"_splitAt"}}},"splitAtPeriod":{"__symbolic":"function","parameters":["input","defaultValues"],"value":{"__symbolic":"error","message":"Reference to a non-exported function","line":28,"character":9,"context":{"name":"_splitAt"}}},"sanitizeIdentifier":{"__symbolic":"function","parameters":["name"],"value":{"__symbolic":"error","message":"Expression form not supported","line":35,"character":22}}}}
{"__symbolic":"module","version":1,"metadata":{"MODULE_SUFFIX":"","camelCaseToDashCase":{"__symbolic":"function","parameters":["input"],"value":{"__symbolic":"error","message":"Reference to a local symbol","line":12,"character":6,"context":{"name":"CAMEL_CASE_REGEXP"}}},"splitAtColon":{"__symbolic":"function","parameters":["input","defaultValues"],"value":{"__symbolic":"error","message":"Reference to a non-exported function","line":26,"character":9,"context":{"name":"_splitAt"}}},"splitAtPeriod":{"__symbolic":"function","parameters":["input","defaultValues"],"value":{"__symbolic":"error","message":"Reference to a non-exported function","line":26,"character":9,"context":{"name":"_splitAt"}}},"sanitizeIdentifier":{"__symbolic":"function","parameters":["name"],"value":{"__symbolic":"error","message":"Expression form not supported","line":33,"character":22}}}}

@@ -14,4 +14,5 @@ /**

import { CompileDiDependencyMetadata, CompileIdentifierMetadata, CompileProviderMetadata, CompileTokenMetadata } from '../compile_metadata';
import { createDiTokenExpression } from '../compiler_util/identifier_util';
import { DirectiveWrapperCompiler } from '../directive_wrapper_compiler';
import { ListWrapper, MapWrapper } from '../facade/collection';
import { MapWrapper } from '../facade/collection';
import { isPresent } from '../facade/lang';

@@ -22,3 +23,2 @@ import { Identifiers, identifierToken, resolveIdentifier, resolveIdentifierToken } from '../identifiers';

import { ProviderAst, ProviderAstType } from '../template_parser/template_ast';
import { createDiTokenExpression } from '../util';
import { CompileMethod } from './compile_method';

@@ -193,3 +193,3 @@ import { CompileQuery, addQueryToTokenMap, createQueryList } from './compile_query';

var queriesForProvider = _this._getQueriesFor(resolvedProvider.token);
ListWrapper.addAll(queriesWithReads, queriesForProvider.map(function (query) { return new _QueryWithRead(query, resolvedProvider.token); }));
queriesWithReads.push.apply(queriesWithReads, queriesForProvider.map(function (query) { return new _QueryWithRead(query, resolvedProvider.token); }));
});

@@ -207,3 +207,3 @@ Object.keys(this.referenceTokens).forEach(function (varName) {

var varToken = new CompileTokenMetadata({ value: varName });
ListWrapper.addAll(queriesWithReads, _this._getQueriesFor(varToken).map(function (query) { return new _QueryWithRead(query, varToken); }));
queriesWithReads.push.apply(queriesWithReads, _this._getQueriesFor(varToken).map(function (query) { return new _QueryWithRead(query, varToken); }));
});

@@ -277,3 +277,3 @@ queriesWithReads.forEach(function (queryWithRead) {

if (isPresent(queries)) {
ListWrapper.addAll(result, queries.filter(function (query) { return query.meta.descendants || distance <= 1; }));
result.push.apply(result, queries.filter(function (query) { return query.meta.descendants || distance <= 1; }));
}

@@ -287,3 +287,3 @@ if (currentEl._directives.length > 0) {

if (isPresent(queries)) {
ListWrapper.addAll(result, queries);
result.push.apply(result, queries);
}

@@ -290,0 +290,0 @@ return result;

@@ -15,2 +15,3 @@ import * as o from '../output/output_ast';

resetDebugInfo(nodeIndex: number, templateAst: TemplateAst): void;
push(...stmts: o.Statement[]): void;
addStmt(stmt: o.Statement): void;

@@ -17,0 +18,0 @@ addStmts(stmts: o.Statement[]): void;

@@ -8,3 +8,2 @@ /**

*/
import { ListWrapper } from '../facade/collection';
import { isPresent } from '../facade/lang';

@@ -58,2 +57,9 @@ import * as o from '../output/output_ast';

};
CompileMethod.prototype.push = function () {
var stmts = [];
for (var _i = 0; _i < arguments.length; _i++) {
stmts[_i - 0] = arguments[_i];
}
this.addStmts(stmts);
};
CompileMethod.prototype.addStmt = function (stmt) {

@@ -65,3 +71,4 @@ this._updateDebugContextIfNeeded();

this._updateDebugContextIfNeeded();
ListWrapper.addAll(this._bodyStatements, stmts);
(_a = this._bodyStatements).push.apply(_a, stmts);
var _a;
};

@@ -68,0 +75,0 @@ CompileMethod.prototype.finish = function () { return this._bodyStatements; };

@@ -8,5 +8,6 @@ /**

*/
import { createPureProxy } from '../compiler_util/identifier_util';
import { Identifiers, resolveIdentifier, resolveIdentifierToken } from '../identifiers';
import * as o from '../output/output_ast';
import { createPureProxy, getPropertyInView, injectFromViewParentInjector } from './util';
import { getPropertyInView, injectFromViewParentInjector } from './util';
export var CompilePipe = (function () {

@@ -63,3 +64,3 @@ function CompilePipe(view, meta) {

createPureProxy(pipeInstanceSeenFromPureProxy.prop('transform')
.callMethod(o.BuiltinMethod.Bind, [pipeInstanceSeenFromPureProxy]), args.length, purePipeProxyInstance, callingView);
.callMethod(o.BuiltinMethod.Bind, [pipeInstanceSeenFromPureProxy]), args.length, purePipeProxyInstance, { fields: callingView.fields, ctorStmts: callingView.createMethod });
return o.importExpr(resolveIdentifier(Identifiers.castByValue))

@@ -66,0 +67,0 @@ .callFn([purePipeProxyInstance, pipeInstanceSeenFromPureProxy.prop('transform')])

@@ -10,6 +10,6 @@ /**

import { CompileDirectiveMetadata, CompilePipeMetadata } from '../compile_metadata';
import { NameResolver } from '../compiler_util/expression_converter';
import { CompilerConfig } from '../config';
import * as o from '../output/output_ast';
import { ViewType } from '../private_import_core';
import { CompileBinding } from './compile_binding';
import { CompileElement, CompileNode } from './compile_element';

@@ -19,3 +19,2 @@ import { CompileMethod } from './compile_method';

import { CompileQuery } from './compile_query';
import { NameResolver } from './expression_converter';
export declare class CompileView implements NameResolver {

@@ -34,4 +33,2 @@ component: CompileDirectiveMetadata;

rootNodesOrAppElements: o.Expression[];
bindings: CompileBinding[];
classStatements: o.Statement[];
createMethod: CompileMethod;

@@ -49,3 +46,4 @@ animationBindingsMethod: CompileMethod;

detachMethod: CompileMethod;
eventHandlerMethods: o.ClassMethod[];
methods: o.ClassMethod[];
ctorStmts: o.Statement[];
fields: o.ClassField[];

@@ -69,5 +67,3 @@ getters: o.ClassGetter[];

getLocal(name: string): o.Expression;
createLiteralArray(values: o.Expression[]): o.Expression;
createLiteralMap(entries: [string, o.Expression][]): o.Expression;
afterNodes(): void;
}

@@ -9,5 +9,5 @@ /**

import { CompileIdentifierMetadata } from '../compile_metadata';
import { ListWrapper, MapWrapper } from '../facade/collection';
import { EventHandlerVars } from '../compiler_util/expression_converter';
import { MapWrapper } from '../facade/collection';
import { isPresent } from '../facade/lang';
import { Identifiers, resolveIdentifier } from '../identifiers';
import * as o from '../output/output_ast';

@@ -18,4 +18,3 @@ import { ViewType } from '../private_import_core';

import { CompileQuery, addQueryToTokenMap, createQueryList } from './compile_query';
import { EventHandlerVars } from './constants';
import { createPureProxy, getPropertyInView, getViewFactoryName } from './util';
import { getPropertyInView, getViewFactoryName } from './util';
export var CompileView = (function () {

@@ -35,5 +34,4 @@ function CompileView(component, genConfig, pipeMetas, styles, animations, viewIndex, declarationElement, templateVariableBindings) {

this.rootNodesOrAppElements = [];
this.bindings = [];
this.classStatements = [];
this.eventHandlerMethods = [];
this.methods = [];
this.ctorStmts = [];
this.fields = [];

@@ -76,3 +74,3 @@ this.getters = [];

var directiveInstance = o.THIS_EXPR.prop('context');
ListWrapper.forEachWithIndex(this.component.viewQueries, function (queryMeta, queryIndex) {
this.component.viewQueries.forEach(function (queryMeta, queryIndex) {
var propName = "_viewQuery_" + queryMeta.selectors[0].name + "_" + queryIndex;

@@ -120,34 +118,2 @@ var queryList = createQueryList(queryMeta, directiveInstance, propName, _this);

};
CompileView.prototype.createLiteralArray = function (values) {
if (values.length === 0) {
return o.importExpr(resolveIdentifier(Identifiers.EMPTY_ARRAY));
}
var proxyExpr = o.THIS_EXPR.prop("_arr_" + this.literalArrayCount++);
var proxyParams = [];
var proxyReturnEntries = [];
for (var i = 0; i < values.length; i++) {
var paramName = "p" + i;
proxyParams.push(new o.FnParam(paramName));
proxyReturnEntries.push(o.variable(paramName));
}
createPureProxy(o.fn(proxyParams, [new o.ReturnStatement(o.literalArr(proxyReturnEntries))], new o.ArrayType(o.DYNAMIC_TYPE)), values.length, proxyExpr, this);
return proxyExpr.callFn(values);
};
CompileView.prototype.createLiteralMap = function (entries) {
if (entries.length === 0) {
return o.importExpr(resolveIdentifier(Identifiers.EMPTY_MAP));
}
var proxyExpr = o.THIS_EXPR.prop("_map_" + this.literalMapCount++);
var proxyParams = [];
var proxyReturnEntries = [];
var values = [];
for (var i = 0; i < entries.length; i++) {
var paramName = "p" + i;
proxyParams.push(new o.FnParam(paramName));
proxyReturnEntries.push([entries[i][0], o.variable(paramName)]);
values.push(entries[i][1]);
}
createPureProxy(o.fn(proxyParams, [new o.ReturnStatement(o.literalMap(proxyReturnEntries))], new o.MapType(o.DYNAMIC_TYPE)), entries.length, proxyExpr, this);
return proxyExpr.callFn(values);
};
CompileView.prototype.afterNodes = function () {

@@ -154,0 +120,0 @@ var _this = this;

@@ -33,5 +33,2 @@ /**

}
export declare class EventHandlerVars {
static event: o.ReadVarExpr;
}
export declare class InjectMethodVars {

@@ -46,3 +43,2 @@ static token: o.ReadVarExpr;

static changed: o.ReadVarExpr;
static valUnwrapper: o.ReadVarExpr;
}

@@ -8,6 +8,5 @@ /**

*/
import { ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
import { Identifiers, resolveEnumIdentifier, resolveIdentifier } from '../identifiers';
import { createEnumExpression } from '../compiler_util/identifier_util';
import { Identifiers, resolveEnumIdentifier } from '../identifiers';
import * as o from '../output/output_ast';
import { ChangeDetectorStatus, ViewType } from '../private_import_core';
function _enumExpression(classIdentifier, name) {

@@ -20,13 +19,3 @@ return o.importExpr(resolveEnumIdentifier(classIdentifier, name));

ViewTypeEnum.fromValue = function (value) {
var viewType = resolveIdentifier(Identifiers.ViewType);
switch (value) {
case ViewType.HOST:
return _enumExpression(viewType, 'HOST');
case ViewType.COMPONENT:
return _enumExpression(viewType, 'COMPONENT');
case ViewType.EMBEDDED:
return _enumExpression(viewType, 'EMBEDDED');
default:
throw Error("Inavlid ViewType value: " + value);
}
return createEnumExpression(Identifiers.ViewType, value);
};

@@ -39,13 +28,3 @@ return ViewTypeEnum;

ViewEncapsulationEnum.fromValue = function (value) {
var viewEncapsulation = resolveIdentifier(Identifiers.ViewEncapsulation);
switch (value) {
case ViewEncapsulation.Emulated:
return _enumExpression(viewEncapsulation, 'Emulated');
case ViewEncapsulation.Native:
return _enumExpression(viewEncapsulation, 'Native');
case ViewEncapsulation.None:
return _enumExpression(viewEncapsulation, 'None');
default:
throw Error("Inavlid ViewEncapsulation value: " + value);
}
return createEnumExpression(Identifiers.ViewEncapsulation, value);
};

@@ -58,11 +37,3 @@ return ViewEncapsulationEnum;

ChangeDetectionStrategyEnum.fromValue = function (value) {
var changeDetectionStrategy = resolveIdentifier(Identifiers.ChangeDetectionStrategy);
switch (value) {
case ChangeDetectionStrategy.OnPush:
return _enumExpression(changeDetectionStrategy, 'OnPush');
case ChangeDetectionStrategy.Default:
return _enumExpression(changeDetectionStrategy, 'Default');
default:
throw Error("Inavlid ChangeDetectionStrategy value: " + value);
}
return createEnumExpression(Identifiers.ChangeDetectionStrategy, value);
};

@@ -75,19 +46,3 @@ return ChangeDetectionStrategyEnum;

ChangeDetectorStatusEnum.fromValue = function (value) {
var changeDetectorStatus = resolveIdentifier(Identifiers.ChangeDetectorStatus);
switch (value) {
case ChangeDetectorStatus.CheckOnce:
return _enumExpression(changeDetectorStatus, 'CheckOnce');
case ChangeDetectorStatus.Checked:
return _enumExpression(changeDetectorStatus, 'Checked');
case ChangeDetectorStatus.CheckAlways:
return _enumExpression(changeDetectorStatus, 'CheckAlways');
case ChangeDetectorStatus.Detached:
return _enumExpression(changeDetectorStatus, 'Detached');
case ChangeDetectorStatus.Errored:
return _enumExpression(changeDetectorStatus, 'Errored');
case ChangeDetectorStatus.Destroyed:
return _enumExpression(changeDetectorStatus, 'Destroyed');
default:
throw Error("Inavlid ChangeDetectorStatus value: " + value);
}
return createEnumExpression(Identifiers.ChangeDetectorStatus, value);
};

@@ -112,8 +67,2 @@ return ChangeDetectorStatusEnum;

}());
export var EventHandlerVars = (function () {
function EventHandlerVars() {
}
EventHandlerVars.event = o.variable('$event');
return EventHandlerVars;
}());
export var InjectMethodVars = (function () {

@@ -133,5 +82,4 @@ function InjectMethodVars() {

DetectChangesVars.changed = o.variable("changed");
DetectChangesVars.valUnwrapper = o.variable("valUnwrapper");
return DetectChangesVars;
}());
//# sourceMappingURL=constants.js.map

@@ -8,9 +8,8 @@ /**

*/
import { EventHandlerVars, convertActionBinding } from '../compiler_util/expression_converter';
import { isPresent } from '../facade/lang';
import { identifierToken } from '../identifiers';
import * as o from '../output/output_ast';
import { CompileBinding } from './compile_binding';
import { CompileMethod } from './compile_method';
import { EventHandlerVars, ViewProperties } from './constants';
import { convertCdStatementToIr } from './expression_converter';
import { ViewProperties } from './constants';
export var CompileEventListener = (function () {

@@ -54,18 +53,8 @@ function CompileEventListener(compileElement, eventTarget, eventName, eventPhase, listenerIndex) {

var context = directiveInstance || this.compileElement.view.componentContext;
var actionStmts = convertCdStatementToIr(this.compileElement.view, context, hostEvent.handler, this.compileElement.nodeIndex);
var lastIndex = actionStmts.length - 1;
if (lastIndex >= 0) {
var lastStatement = actionStmts[lastIndex];
var returnExpr = convertStmtIntoExpression(lastStatement);
var preventDefaultVar = o.variable("pd_" + this._actionResultExprs.length);
this._actionResultExprs.push(preventDefaultVar);
if (isPresent(returnExpr)) {
// Note: We need to cast the result of the method call to dynamic,
// as it might be a void method!
actionStmts[lastIndex] =
preventDefaultVar.set(returnExpr.cast(o.DYNAMIC_TYPE).notIdentical(o.literal(false)))
.toDeclStmt(null, [o.StmtModifier.Final]);
}
var view = this.compileElement.view;
var evalResult = convertActionBinding(view, directive ? null : view, context, hostEvent.handler, this.compileElement.nodeIndex + "_" + this._actionResultExprs.length);
if (evalResult.preventDefault) {
this._actionResultExprs.push(evalResult.preventDefault);
}
this._method.addStmts(actionStmts);
this._method.addStmts(evalResult.stmts);
};

@@ -82,3 +71,3 @@ CompileEventListener.prototype.finishMethod = function () {

// private is fine here as no child view will reference the event handler...
this.compileElement.view.eventHandlerMethods.push(new o.ClassMethod(this._methodName, [this._eventParam], stmts, o.BOOL_TYPE, [o.StmtModifier.Private]));
this.compileElement.view.methods.push(new o.ClassMethod(this._methodName, [this._eventParam], stmts, o.BOOL_TYPE, [o.StmtModifier.Private]));
};

@@ -119,3 +108,2 @@ CompileEventListener.prototype.listenToRenderer = function () {

hostEvents.forEach(function (hostEvent) {
compileElement.view.bindings.push(new CompileBinding(compileElement, hostEvent));
var listener = CompileEventListener.getOrCreate(compileElement, hostEvent.target, hostEvent.name, hostEvent.phase, eventListeners);

@@ -127,3 +115,2 @@ listener.addAction(hostEvent, null, null);

directiveAst.hostEvents.forEach(function (hostEvent) {
compileElement.view.bindings.push(new CompileBinding(compileElement, hostEvent));
var listener = CompileEventListener.getOrCreate(compileElement, hostEvent.target, hostEvent.name, hostEvent.phase, eventListeners);

@@ -130,0 +117,0 @@ listener.addAction(hostEvent, directiveAst.directive, directiveInstance);

import * as o from '../output/output_ast';
import { ElementSchemaRegistry } from '../schema/element_schema_registry';
import { BoundElementPropertyAst, BoundTextAst, DirectiveAst } from '../template_parser/template_ast';

@@ -8,3 +9,3 @@ import { CompileElement, CompileNode } from './compile_element';

export declare function bindRenderInputs(boundProps: BoundElementPropertyAst[], compileElement: CompileElement, eventListeners: CompileEventListener[]): void;
export declare function bindDirectiveHostProps(directiveAst: DirectiveAst, directiveInstance: o.Expression, compileElement: CompileElement, eventListeners: CompileEventListener[]): void;
export declare function bindDirectiveInputs(directiveAst: DirectiveAst, directiveWrapperInstance: o.Expression, compileElement: CompileElement): void;
export declare function bindDirectiveHostProps(directiveAst: DirectiveAst, directiveWrapperInstance: o.Expression, compileElement: CompileElement, eventListeners: CompileEventListener[], elementName: string, schemaRegistry: ElementSchemaRegistry): void;
export declare function bindDirectiveInputs(directiveAst: DirectiveAst, directiveWrapperInstance: o.Expression, dirIndex: number, compileElement: CompileElement): void;

@@ -8,4 +8,6 @@ /**

*/
import { SecurityContext } from '@angular/core';
import { isPresent } from '../facade/lang';
import { createCheckBindingField, createCheckBindingStmt } from '../compiler_util/binding_util';
import { convertPropertyBinding } from '../compiler_util/expression_converter';
import { createEnumExpression } from '../compiler_util/identifier_util';
import { writeToRenderer } from '../compiler_util/render_util';
import { Identifiers, resolveIdentifier } from '../identifiers';

@@ -15,67 +17,13 @@ import * as o from '../output/output_ast';

import { PropertyBindingType } from '../template_parser/template_ast';
import { CompileBinding } from './compile_binding';
import { DetectChangesVars, ViewProperties } from './constants';
import { convertCdExpressionToIr, temporaryDeclaration } from './expression_converter';
function createBindFieldExpr(exprIndex) {
return o.THIS_EXPR.prop("_expr_" + exprIndex);
}
function createCurrValueExpr(exprIndex) {
return o.variable("currVal_" + exprIndex); // fix syntax highlighting: `
}
var EvalResult = (function () {
function EvalResult(forceUpdate) {
this.forceUpdate = forceUpdate;
}
return EvalResult;
}());
function evalCdAst(view, currValExpr, parsedExpression, context, method, bindingIndex) {
var checkExpression = convertCdExpressionToIr(view, context, parsedExpression, DetectChangesVars.valUnwrapper, bindingIndex);
if (!checkExpression.expression) {
// e.g. an empty expression was given
import { DetectChangesVars } from './constants';
export function bindRenderText(boundText, compileNode, view) {
var valueField = createCheckBindingField(view);
var evalResult = convertPropertyBinding(view, view, view.componentContext, boundText.value, valueField.bindingId);
if (!evalResult) {
return null;
}
if (checkExpression.temporaryCount) {
for (var i = 0; i < checkExpression.temporaryCount; i++) {
method.addStmt(temporaryDeclaration(bindingIndex, i));
}
}
if (checkExpression.needsValueUnwrapper) {
var initValueUnwrapperStmt = DetectChangesVars.valUnwrapper.callMethod('reset', []).toStmt();
method.addStmt(initValueUnwrapperStmt);
}
method.addStmt(currValExpr.set(checkExpression.expression).toDeclStmt(null, [o.StmtModifier.Final]));
if (checkExpression.needsValueUnwrapper) {
return new EvalResult(DetectChangesVars.valUnwrapper.prop('hasWrappedValue'));
}
else {
return new EvalResult(null);
}
}
function bind(view, currValExpr, fieldExpr, parsedExpression, context, actions, method, bindingIndex) {
var evalResult = evalCdAst(view, currValExpr, parsedExpression, context, method, bindingIndex);
if (!evalResult) {
return;
}
// private is fine here as no child view will reference the cached value...
view.fields.push(new o.ClassField(fieldExpr.name, null, [o.StmtModifier.Private]));
view.createMethod.addStmt(o.THIS_EXPR.prop(fieldExpr.name)
.set(o.importExpr(resolveIdentifier(Identifiers.UNINITIALIZED)))
.toStmt());
var condition = o.importExpr(resolveIdentifier(Identifiers.checkBinding)).callFn([
DetectChangesVars.throwOnChange, fieldExpr, currValExpr
]);
if (evalResult.forceUpdate) {
condition = evalResult.forceUpdate.or(condition);
}
method.addStmt(new o.IfStmt(condition, actions.concat([o.THIS_EXPR.prop(fieldExpr.name).set(currValExpr).toStmt()])));
}
export function bindRenderText(boundText, compileNode, view) {
var bindingIndex = view.bindings.length;
view.bindings.push(new CompileBinding(compileNode, boundText));
var currValExpr = createCurrValueExpr(bindingIndex);
var valueField = createBindFieldExpr(bindingIndex);
view.detectChangesRenderPropertiesMethod.resetDebugInfo(compileNode.nodeIndex, boundText);
bind(view, currValExpr, valueField, boundText.value, view.componentContext, [o.THIS_EXPR.prop('renderer')
.callMethod('setText', [compileNode.renderNode, currValExpr])
.toStmt()], view.detectChangesRenderPropertiesMethod, bindingIndex);
view.detectChangesRenderPropertiesMethod.addStmts(createCheckBindingStmt(evalResult, valueField.expression, DetectChangesVars.throwOnChange, [o.THIS_EXPR.prop('renderer')
.callMethod('setText', [compileNode.renderNode, evalResult.currValExpr])
.toStmt()]));
}

@@ -86,9 +34,5 @@ function bindAndWriteToRenderer(boundProps, context, compileElement, isHostProp, eventListeners) {

boundProps.forEach(function (boundProp) {
var bindingIndex = view.bindings.length;
view.bindings.push(new CompileBinding(compileElement, boundProp));
var bindingField = createCheckBindingField(view);
view.detectChangesRenderPropertiesMethod.resetDebugInfo(compileElement.nodeIndex, boundProp);
var fieldExpr = createBindFieldExpr(bindingIndex);
var currValExpr = createCurrValueExpr(bindingIndex);
var oldRenderValue = sanitizedValue(boundProp, fieldExpr);
var renderValue = sanitizedValue(boundProp, currValExpr);
var evalResult = convertPropertyBinding(view, isHostProp ? null : view, context, boundProp.value, bindingField.bindingId);
var updateStmts = [];

@@ -98,30 +42,6 @@ var compileMethod = view.detectChangesRenderPropertiesMethod;

case PropertyBindingType.Property:
if (view.genConfig.logBindingUpdate) {
updateStmts.push(logBindingUpdateStmt(renderNode, boundProp.name, renderValue));
}
updateStmts.push(o.THIS_EXPR.prop('renderer')
.callMethod('setElementProperty', [renderNode, o.literal(boundProp.name), renderValue])
.toStmt());
break;
case PropertyBindingType.Attribute:
renderValue =
renderValue.isBlank().conditional(o.NULL_EXPR, renderValue.callMethod('toString', []));
updateStmts.push(o.THIS_EXPR.prop('renderer')
.callMethod('setElementAttribute', [renderNode, o.literal(boundProp.name), renderValue])
.toStmt());
break;
case PropertyBindingType.Class:
updateStmts.push(o.THIS_EXPR.prop('renderer')
.callMethod('setElementClass', [renderNode, o.literal(boundProp.name), renderValue])
.toStmt());
break;
case PropertyBindingType.Style:
var strValue = renderValue.callMethod('toString', []);
if (isPresent(boundProp.unit)) {
strValue = strValue.plus(o.literal(boundProp.unit));
}
renderValue = renderValue.isBlank().conditional(o.NULL_EXPR, strValue);
updateStmts.push(o.THIS_EXPR.prop('renderer')
.callMethod('setElementStyle', [renderNode, o.literal(boundProp.name), renderValue])
.toStmt());
updateStmts.push.apply(updateStmts, writeToRenderer(o.THIS_EXPR, boundProp, renderNode, evalResult.currValExpr, view.genConfig.logBindingUpdate));
break;

@@ -141,9 +61,11 @@ case PropertyBindingType.Animation:

.set(animationFnExpr.callFn([
o.THIS_EXPR, renderNode, oldRenderValue.equals(unitializedValue)
.conditional(emptyStateValue, oldRenderValue),
renderValue.equals(unitializedValue).conditional(emptyStateValue, renderValue)
o.THIS_EXPR, renderNode,
bindingField.expression.equals(unitializedValue)
.conditional(emptyStateValue, bindingField.expression),
evalResult.currValExpr.equals(unitializedValue)
.conditional(emptyStateValue, evalResult.currValExpr)
]))
.toDeclStmt());
detachStmts_1.push(animationTransitionVar_1
.set(animationFnExpr.callFn([o.THIS_EXPR, renderNode, oldRenderValue, emptyStateValue]))
.set(animationFnExpr.callFn([o.THIS_EXPR, renderNode, bindingField.expression, emptyStateValue]))
.toDeclStmt());

@@ -160,54 +82,49 @@ eventListeners.forEach(function (listener) {

}
bind(view, currValExpr, fieldExpr, boundProp.value, context, updateStmts, compileMethod, view.bindings.length);
compileMethod.addStmts(createCheckBindingStmt(evalResult, bindingField.expression, DetectChangesVars.throwOnChange, updateStmts));
});
}
function sanitizedValue(boundProp, renderValue) {
var enumValue;
switch (boundProp.securityContext) {
case SecurityContext.NONE:
return renderValue; // No sanitization needed.
case SecurityContext.HTML:
enumValue = 'HTML';
break;
case SecurityContext.STYLE:
enumValue = 'STYLE';
break;
case SecurityContext.SCRIPT:
enumValue = 'SCRIPT';
break;
case SecurityContext.URL:
enumValue = 'URL';
break;
case SecurityContext.RESOURCE_URL:
enumValue = 'RESOURCE_URL';
break;
default:
throw new Error("internal error, unexpected SecurityContext " + boundProp.securityContext + ".");
}
var ctx = ViewProperties.viewUtils.prop('sanitizer');
var args = [o.importExpr(resolveIdentifier(Identifiers.SecurityContext)).prop(enumValue), renderValue];
return ctx.callMethod('sanitize', args);
}
export function bindRenderInputs(boundProps, compileElement, eventListeners) {
bindAndWriteToRenderer(boundProps, compileElement.view.componentContext, compileElement, false, eventListeners);
}
export function bindDirectiveHostProps(directiveAst, directiveInstance, compileElement, eventListeners) {
bindAndWriteToRenderer(directiveAst.hostProperties, directiveInstance, compileElement, true, eventListeners);
export function bindDirectiveHostProps(directiveAst, directiveWrapperInstance, compileElement, eventListeners, elementName, schemaRegistry) {
// host properties are change detected by the DirectiveWrappers,
// except for the animation properties as they need close integration with animation events
// and DirectiveWrappers don't support
// event listeners right now.
bindAndWriteToRenderer(directiveAst.hostProperties.filter(function (boundProp) { return boundProp.isAnimation; }), directiveWrapperInstance.prop('context'), compileElement, true, eventListeners);
var methodArgs = [o.THIS_EXPR, compileElement.renderNode, DetectChangesVars.throwOnChange];
// We need to provide the SecurityContext for properties that could need sanitization.
directiveAst.hostProperties.filter(function (boundProp) { return boundProp.needsRuntimeSecurityContext; })
.forEach(function (boundProp) {
var ctx;
switch (boundProp.type) {
case PropertyBindingType.Property:
ctx = schemaRegistry.securityContext(elementName, boundProp.name, false);
break;
case PropertyBindingType.Attribute:
ctx = schemaRegistry.securityContext(elementName, boundProp.name, true);
break;
default:
throw new Error("Illegal state: Only property / attribute bindings can have an unknown security context! Binding " + boundProp.name);
}
methodArgs.push(createEnumExpression(Identifiers.SecurityContext, ctx));
});
compileElement.view.detectChangesRenderPropertiesMethod.addStmt(directiveWrapperInstance.callMethod('detectChangesInHostProps', methodArgs).toStmt());
}
export function bindDirectiveInputs(directiveAst, directiveWrapperInstance, compileElement) {
export function bindDirectiveInputs(directiveAst, directiveWrapperInstance, dirIndex, compileElement) {
var view = compileElement.view;
var detectChangesInInputsMethod = view.detectChangesInInputsMethod;
detectChangesInInputsMethod.resetDebugInfo(compileElement.nodeIndex, compileElement.sourceAst);
directiveAst.inputs.forEach(function (input) {
var bindingIndex = view.bindings.length;
view.bindings.push(new CompileBinding(compileElement, input));
directiveAst.inputs.forEach(function (input, inputIdx) {
// Note: We can't use `fields.length` here, as we are not adding a field!
var bindingId = compileElement.nodeIndex + "_" + dirIndex + "_" + inputIdx;
detectChangesInInputsMethod.resetDebugInfo(compileElement.nodeIndex, input);
var currValExpr = createCurrValueExpr(bindingIndex);
var evalResult = evalCdAst(view, currValExpr, input.value, view.componentContext, detectChangesInInputsMethod, bindingIndex);
var evalResult = convertPropertyBinding(view, view, view.componentContext, input.value, bindingId);
if (!evalResult) {
return;
}
detectChangesInInputsMethod.addStmts(evalResult.stmts);
detectChangesInInputsMethod.addStmt(directiveWrapperInstance
.callMethod("check_" + input.directiveName, [
currValExpr, DetectChangesVars.throwOnChange,
evalResult.currValExpr, DetectChangesVars.throwOnChange,
evalResult.forceUpdate || o.literal(false)

@@ -219,3 +136,3 @@ ])

!isDefaultChangeDetectionStrategy(directiveAst.directive.changeDetection);
var directiveDetectChangesExpr = directiveWrapperInstance.callMethod('detectChangesInternal', [o.THIS_EXPR, compileElement.renderNode, DetectChangesVars.throwOnChange]);
var directiveDetectChangesExpr = directiveWrapperInstance.callMethod('detectChangesInInputProps', [o.THIS_EXPR, compileElement.renderNode, DetectChangesVars.throwOnChange]);
var directiveDetectChangesStmt = isOnPushComp ?

@@ -228,7 +145,2 @@ new o.IfStmt(directiveDetectChangesExpr, [compileElement.appElement.prop('componentView')

}
function logBindingUpdateStmt(renderNode, propName, value) {
return o.importExpr(resolveIdentifier(Identifiers.setBindingDebugInfo))
.callFn([o.THIS_EXPR.prop('renderer'), renderNode, o.literal(propName), value])
.toStmt();
}
//# sourceMappingURL=property_binder.js.map

@@ -15,2 +15,1 @@ /**

export declare function createFlatArray(expressions: o.Expression[]): o.Expression;
export declare function createPureProxy(fn: o.Expression, argCount: number, pureProxyProp: o.ReadPropExpr, view: CompileView): void;

@@ -13,6 +13,5 @@ /**

};
import { createDiTokenExpression } from '../compiler_util/identifier_util';
import { isPresent } from '../facade/lang';
import { Identifiers, resolveIdentifier } from '../identifiers';
import * as o from '../output/output_ast';
import { createDiTokenExpression } from '../util';
export function getPropertyInView(property, callingView, definedView) {

@@ -93,12 +92,2 @@ if (callingView === definedView) {

}
export function createPureProxy(fn, argCount, pureProxyProp, view) {
view.fields.push(new o.ClassField(pureProxyProp.name, null));
var pureProxyId = argCount < Identifiers.pureProxies.length ? Identifiers.pureProxies[argCount] : null;
if (!pureProxyId) {
throw new Error("Unsupported number of argument for pure functions: " + argCount);
}
view.createMethod.addStmt(o.THIS_EXPR.prop(pureProxyProp.name)
.set(o.importExpr(resolveIdentifier(pureProxyId)).callFn([fn]))
.toStmt());
}
//# sourceMappingURL=util.js.map

@@ -8,4 +8,5 @@ /**

*/
import { ElementSchemaRegistry } from '../schema/element_schema_registry';
import { TemplateAst } from '../template_parser/template_ast';
import { CompileView } from './compile_view';
export declare function bindView(view: CompileView, parsedTemplate: TemplateAst[]): void;
export declare function bindView(view: CompileView, parsedTemplate: TemplateAst[], schemaRegistry: ElementSchemaRegistry): void;

@@ -12,4 +12,4 @@ /**

import { bindDirectiveHostProps, bindDirectiveInputs, bindRenderInputs, bindRenderText } from './property_binder';
export function bindView(view, parsedTemplate) {
var visitor = new ViewBinderVisitor(view);
export function bindView(view, parsedTemplate, schemaRegistry) {
var visitor = new ViewBinderVisitor(view, schemaRegistry);
templateVisitAll(visitor, parsedTemplate);

@@ -19,4 +19,5 @@ view.pipes.forEach(function (pipe) { bindPipeDestroyLifecycleCallbacks(pipe.meta, pipe.instance, pipe.view); });

var ViewBinderVisitor = (function () {
function ViewBinderVisitor(view) {
function ViewBinderVisitor(view, _schemaRegistry) {
this.view = view;
this._schemaRegistry = _schemaRegistry;
this._nodeIndex = 0;

@@ -35,2 +36,3 @@ }

ViewBinderVisitor.prototype.visitElement = function (ast, parent) {
var _this = this;
var compileElement = this.view.nodes[this._nodeIndex++];

@@ -43,7 +45,7 @@ var eventListeners = [];

bindRenderOutputs(eventListeners);
ast.directives.forEach(function (directiveAst) {
ast.directives.forEach(function (directiveAst, dirIndex) {
var directiveInstance = compileElement.instances.get(directiveAst.directive.type.reference);
var directiveWrapperInstance = compileElement.directiveWrapperInstance.get(directiveAst.directive.type.reference);
bindDirectiveInputs(directiveAst, directiveWrapperInstance, compileElement);
bindDirectiveHostProps(directiveAst, directiveInstance, compileElement, eventListeners);
bindDirectiveInputs(directiveAst, directiveWrapperInstance, dirIndex, compileElement);
bindDirectiveHostProps(directiveAst, directiveWrapperInstance, compileElement, eventListeners, ast.name, _this._schemaRegistry);
bindDirectiveOutputs(directiveAst, directiveInstance, eventListeners);

@@ -68,6 +70,6 @@ });

var eventListeners = collectEventListeners(ast.outputs, ast.directives, compileElement);
ast.directives.forEach(function (directiveAst) {
ast.directives.forEach(function (directiveAst, dirIndex) {
var directiveInstance = compileElement.instances.get(directiveAst.directive.type.reference);
var directiveWrapperInstance = compileElement.directiveWrapperInstance.get(directiveAst.directive.type.reference);
bindDirectiveInputs(directiveAst, directiveWrapperInstance, compileElement);
bindDirectiveInputs(directiveAst, directiveWrapperInstance, dirIndex, compileElement);
bindDirectiveOutputs(directiveAst, directiveInstance, eventListeners);

@@ -81,3 +83,3 @@ bindDirectiveAfterContentLifecycleCallbacks(directiveAst.directive, directiveInstance, compileElement);

});
bindView(compileElement.embeddedView, ast.children);
bindView(compileElement.embeddedView, ast.children, this._schemaRegistry);
return null;

@@ -84,0 +86,0 @@ };

@@ -10,9 +10,10 @@ /**

import { CompileIdentifierMetadata } from '../compile_metadata';
import { ListWrapper } from '../facade/collection';
import { createSharedBindingVariablesIfNeeded } from '../compiler_util/expression_converter';
import { createDiTokenExpression, createInlineArray } from '../compiler_util/identifier_util';
import { isPresent } from '../facade/lang';
import { Identifiers, identifierToken, resolveIdentifier } from '../identifiers';
import { createClassStmt } from '../output/class_builder';
import * as o from '../output/output_ast';
import { ChangeDetectorStatus, ViewType, isDefaultChangeDetectionStrategy } from '../private_import_core';
import { templateVisitAll } from '../template_parser/template_ast';
import { createDiTokenExpression } from '../util';
import { CompileElement, CompileNode } from './compile_element';

@@ -137,11 +138,23 @@ import { CompileView } from './compile_view';

var debugContextExpr = this.view.createMethod.resetDebugInfoExpr(nodeIndex, ast);
if (nodeIndex === 0 && this.view.viewType === ViewType.HOST) {
createRenderNodeExpr = o.THIS_EXPR.callMethod('selectOrCreateHostElement', [o.literal(ast.name), rootSelectorVar, debugContextExpr]);
var directives = ast.directives.map(function (directiveAst) { return directiveAst.directive; });
var component = directives.find(function (directive) { return directive.isComponent; });
if (ast.name === NG_CONTAINER_TAG) {
createRenderNodeExpr = ViewProperties.renderer.callMethod('createTemplateAnchor', [this._getParentRenderNode(parent), debugContextExpr]);
}
else {
if (ast.name === NG_CONTAINER_TAG) {
createRenderNodeExpr = ViewProperties.renderer.callMethod('createTemplateAnchor', [this._getParentRenderNode(parent), debugContextExpr]);
var htmlAttrs = _readHtmlAttrs(ast.attrs);
var attrNameAndValues = createInlineArray(_mergeHtmlAndDirectiveAttrs(htmlAttrs, directives).map(function (v) { return o.literal(v); }));
if (nodeIndex === 0 && this.view.viewType === ViewType.HOST) {
createRenderNodeExpr =
o.importExpr(resolveIdentifier(Identifiers.selectOrCreateRenderHostElement)).callFn([
ViewProperties.renderer, o.literal(ast.name), attrNameAndValues, rootSelectorVar,
debugContextExpr
]);
}
else {
createRenderNodeExpr = ViewProperties.renderer.callMethod('createElement', [this._getParentRenderNode(parent), o.literal(ast.name), debugContextExpr]);
createRenderNodeExpr =
o.importExpr(resolveIdentifier(Identifiers.createRenderElement)).callFn([
ViewProperties.renderer, this._getParentRenderNode(parent), o.literal(ast.name),
attrNameAndValues, debugContextExpr
]);
}

@@ -153,16 +166,2 @@ }

var renderNode = o.THIS_EXPR.prop(fieldName);
var directives = ast.directives.map(function (directiveAst) { return directiveAst.directive; });
var component = directives.find(function (directive) { return directive.isComponent; });
var htmlAttrs = _readHtmlAttrs(ast.attrs);
var attrNameAndValues = _mergeHtmlAndDirectiveAttrs(htmlAttrs, directives);
for (var i = 0; i < attrNameAndValues.length; i++) {
var attrName = attrNameAndValues[i][0];
if (ast.name !== NG_CONTAINER_TAG) {
// <ng-container> are not rendered in the DOM
var attrValue = attrNameAndValues[i][1];
this.view.createMethod.addStmt(ViewProperties.renderer
.callMethod('setElementAttribute', [renderNode, o.literal(attrName), o.literal(attrValue)])
.toStmt());
}
}
var compileElement = new CompileElement(parent, this.view, nodeIndex, renderNode, ast, component, directives, ast.providers, ast.hasViewContainer, false, ast.references, this.targetDependencies);

@@ -267,12 +266,16 @@ this.view.nodes.push(compileElement);

function _mergeHtmlAndDirectiveAttrs(declaredHtmlAttrs, directives) {
var result = {};
Object.keys(declaredHtmlAttrs).forEach(function (key) { result[key] = declaredHtmlAttrs[key]; });
var mapResult = {};
Object.keys(declaredHtmlAttrs).forEach(function (key) { mapResult[key] = declaredHtmlAttrs[key]; });
directives.forEach(function (directiveMeta) {
Object.keys(directiveMeta.hostAttributes).forEach(function (name) {
var value = directiveMeta.hostAttributes[name];
var prevValue = result[name];
result[name] = isPresent(prevValue) ? mergeAttributeValue(name, prevValue, value) : value;
var prevValue = mapResult[name];
mapResult[name] = isPresent(prevValue) ? mergeAttributeValue(name, prevValue, value) : value;
});
});
return mapToKeyValueArray(result);
var arrResult = [];
// Note: We need to sort to get a defined output order
// for tests and for caching generated artifacts...
Object.keys(mapResult).sort().forEach(function (attrName) { arrResult.push(attrName, mapResult[attrName]); });
return arrResult;
}

@@ -292,10 +295,2 @@ function _readHtmlAttrs(attrs) {

}
function mapToKeyValueArray(data) {
var entryArray = [];
Object.keys(data).forEach(function (name) { entryArray.push([name, data[name]]); });
// We need to sort to get a defined output order
// for tests and for caching generated artifacts...
ListWrapper.sort(entryArray);
return entryArray;
}
function createViewTopLevelStmts(view, targetStatements) {

@@ -355,3 +350,2 @@ var nodeDebugInfosVar = o.NULL_EXPR;

}
var viewConstructor = new o.ClassMethod(null, viewConstructorArgs, [o.SUPER_EXPR.callFn(superConstructorArgs).toStmt()]);
var viewMethods = [

@@ -369,5 +363,11 @@ new o.ClassMethod('createInternal', [new o.FnParam(rootSelectorVar.name, o.STRING_TYPE)], generateCreateMethod(view), o.importType(resolveIdentifier(Identifiers.AppElement))),

new o.ClassMethod('detachInternal', [], view.detachMethod.finish())
].concat(view.eventHandlerMethods);
].filter(function (method) { return method.body.length > 0; });
var superClass = view.genConfig.genDebugInfo ? Identifiers.DebugAppView : Identifiers.AppView;
var viewClass = new o.ClassStmt(view.className, o.importExpr(resolveIdentifier(superClass), [getContextType(view)]), view.fields, view.getters, viewConstructor, viewMethods.filter(function (method) { return method.body.length > 0; }));
var viewClass = createClassStmt({
name: view.className,
parent: o.importExpr(resolveIdentifier(superClass), [getContextType(view)]),
parentArgs: superConstructorArgs,
ctorParams: viewConstructorArgs,
builders: [{ methods: viewMethods }, view]
});
return viewClass;

@@ -449,4 +449,4 @@ }

}
ListWrapper.addAll(stmts, view.animationBindingsMethod.finish());
ListWrapper.addAll(stmts, view.detectChangesInInputsMethod.finish());
stmts.push.apply(stmts, view.animationBindingsMethod.finish());
stmts.push.apply(stmts, view.detectChangesInInputsMethod.finish());
stmts.push(o.THIS_EXPR.callMethod('detectContentChildrenChanges', [DetectChangesVars.throwOnChange])

@@ -458,3 +458,3 @@ .toStmt());

}
ListWrapper.addAll(stmts, view.detectChangesRenderPropertiesMethod.finish());
stmts.push.apply(stmts, view.detectChangesRenderPropertiesMethod.finish());
stmts.push(o.THIS_EXPR.callMethod('detectViewChildrenChanges', [DetectChangesVars.throwOnChange])

@@ -475,7 +475,3 @@ .toStmt());

}
if (readVars.has(DetectChangesVars.valUnwrapper.name)) {
varStmts.push(DetectChangesVars.valUnwrapper
.set(o.importExpr(resolveIdentifier(Identifiers.ValueUnwrapper)).instantiate([]))
.toDeclStmt(null, [o.StmtModifier.Final]));
}
varStmts.push.apply(varStmts, createSharedBindingVariablesIfNeeded(stmts));
return varStmts.concat(stmts);

@@ -482,0 +478,0 @@ }

@@ -5,2 +5,3 @@ import { AnimationEntryCompileResult } from '../animation/animation_compiler';

import * as o from '../output/output_ast';
import { ElementSchemaRegistry } from '../schema/element_schema_registry';
import { TemplateAst } from '../template_parser/template_ast';

@@ -17,4 +18,5 @@ import { ComponentFactoryDependency, DirectiveWrapperDependency, ViewFactoryDependency } from './deps';

private _genConfig;
constructor(_genConfig: CompilerConfig);
private _schemaRegistry;
constructor(_genConfig: CompilerConfig, _schemaRegistry: ElementSchemaRegistry);
compileComponent(component: CompileDirectiveMetadata, template: TemplateAst[], styles: o.Expression, pipes: CompilePipeMetadata[], compiledAnimations: AnimationEntryCompileResult[]): ViewCompileResult;
}

@@ -10,2 +10,3 @@ /**

import { CompilerConfig } from '../config';
import { ElementSchemaRegistry } from '../schema/element_schema_registry';
import { CompileElement } from './compile_element';

@@ -25,4 +26,5 @@ import { CompileView } from './compile_view';

export var ViewCompiler = (function () {
function ViewCompiler(_genConfig) {
function ViewCompiler(_genConfig, _schemaRegistry) {
this._genConfig = _genConfig;
this._schemaRegistry = _schemaRegistry;
}

@@ -36,3 +38,3 @@ ViewCompiler.prototype.compileComponent = function (component, template, styles, pipes, compiledAnimations) {

// variables that have been declared after usage.
bindView(view, template);
bindView(view, template, this._schemaRegistry);
finishView(view, statements);

@@ -47,2 +49,3 @@ return new ViewCompileResult(statements, view.viewFactory.name, dependencies);

{ type: CompilerConfig, },
{ type: ElementSchemaRegistry, },
];

@@ -49,0 +52,0 @@ return ViewCompiler;

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"ViewCompiler":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../config","name":"CompilerConfig"}]}],"compileComponent":[{"__symbolic":"method"}]}}},"exports":[{"from":"./deps","export":["ComponentFactoryDependency","DirectiveWrapperDependency","ViewFactoryDependency"]}]}
{"__symbolic":"module","version":1,"metadata":{"ViewCompiler":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../config","name":"CompilerConfig"},{"__symbolic":"reference","module":"../schema/element_schema_registry","name":"ElementSchemaRegistry"}]}],"compileComponent":[{"__symbolic":"method"}]}}},"exports":[{"from":"./deps","export":["ComponentFactoryDependency","DirectiveWrapperDependency","ViewFactoryDependency"]}]}

@@ -31,3 +31,3 @@

export declare function scheduleMicroTask(fn: Function): void;
declare var _global: BrowserNodeGlobal;
declare const _global: BrowserNodeGlobal;
export { _global as global };

@@ -39,3 +39,2 @@ export declare function getTypeNameForDebugging(type: any): string;

export declare function isDate(obj: any): obj is Date;
export declare function noop(): void;
export declare function stringify(token: any): string;

@@ -48,4 +47,2 @@ export declare class NumberWrapper {

export declare function looseIdentical(a: any, b: any): boolean;
export declare function normalizeBlank(obj: Object): any;
export declare function normalizeBool(obj: boolean): boolean;
export declare function isJsObject(o: any): boolean;

@@ -52,0 +49,0 @@ export declare function print(obj: Error | Object): void;

@@ -38,6 +38,6 @@ /**

export function isPresent(obj) {
return obj !== undefined && obj !== null;
return obj != null;
}
export function isBlank(obj) {
return obj === undefined || obj === null;
return obj == null;
}

@@ -51,3 +51,2 @@ var STRING_MAP_PROTO = Object.getPrototypeOf({});

}
export function noop() { }
export function stringify(token) {

@@ -106,8 +105,2 @@ if (typeof token === 'string') {

}
export function normalizeBlank(obj) {
return isBlank(obj) ? null : obj;
}
export function normalizeBool(obj) {
return isBlank(obj) ? false : obj;
}
export function isJsObject(o) {

@@ -141,4 +134,4 @@ return o !== null && (typeof o === 'function' || typeof o === 'object');

export function getSymbolIterator() {
if (isBlank(_symbolIterator)) {
if (isPresent(globalScope.Symbol) && isPresent(Symbol.iterator)) {
if (!_symbolIterator) {
if (globalScope.Symbol && Symbol.iterator) {
_symbolIterator = Symbol.iterator;

@@ -145,0 +138,0 @@ }

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"getTypeNameForDebugging":{"__symbolic":"function","parameters":["type"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"type"},"index":"name"},"right":{"__symbolic":"error","message":"Expression form not supported","line":61,"character":25}}},"isPresent":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isStrictStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":81,"character":9},"right":"object"},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{}]}}}},"isDate":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"Date"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"valueOf"}}]}}}},"looseIdentical":{"__symbolic":"function","parameters":["a","b"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"a"},"right":{"__symbolic":"reference","name":"b"}},"right":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":143,"character":20},"right":"number"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":143,"character":45},"right":"number"}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"a"}]}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"b"}]}}}},"normalizeBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isBlank"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"thenExpression":null,"elseExpression":{"__symbolic":"reference","name":"obj"}}},"normalizeBool":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isBlank"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"thenExpression":false,"elseExpression":{"__symbolic":"reference","name":"obj"}}},"isJsObject":{"__symbolic":"function","parameters":["o"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"o"},"right":null},"right":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":155,"character":24},"right":"function"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":155,"character":51},"right":"object"}}}},"isPrimitive":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isJsObject"},"arguments":[{"__symbolic":"reference","name":"obj"}]}}},"escapeRegExp":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Expression form not supported","line":210,"character":19}}}}
{"__symbolic":"module","version":1,"metadata":{"getTypeNameForDebugging":{"__symbolic":"function","parameters":["type"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"type"},"index":"name"},"right":{"__symbolic":"error","message":"Expression form not supported","line":60,"character":25}}},"isPresent":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"!=","left":{"__symbolic":"reference","name":"obj"},"right":null}},"isBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"==","left":{"__symbolic":"reference","name":"obj"},"right":null}},"isStrictStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":80,"character":9},"right":"object"},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{}]}}}},"isDate":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"Date"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"valueOf"}}]}}}},"looseIdentical":{"__symbolic":"function","parameters":["a","b"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"a"},"right":{"__symbolic":"reference","name":"b"}},"right":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":140,"character":20},"right":"number"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":140,"character":45},"right":"number"}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"a"}]}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"b"}]}}}},"isJsObject":{"__symbolic":"function","parameters":["o"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"o"},"right":null},"right":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":144,"character":24},"right":"function"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":144,"character":51},"right":"object"}}}},"isPrimitive":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isJsObject"},"arguments":[{"__symbolic":"reference","name":"obj"}]}}},"escapeRegExp":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Expression form not supported","line":199,"character":19}}}}

@@ -31,3 +31,4 @@ /**

hasElement(tagName: string, schemaMetas: SchemaMetadata[]): boolean;
securityContext(tagName: string, property: string): SecurityContext;
allKnownElementNames(): string[];
securityContext(selector: string, property: string, isAttribute: boolean): SecurityContext;
getMappedPropName(attrName: string): string;

@@ -34,0 +35,0 @@ getDefaultComponentElementName(): string;

@@ -25,3 +25,4 @@ /**

};
MockSchemaRegistry.prototype.securityContext = function (tagName, property) {
MockSchemaRegistry.prototype.allKnownElementNames = function () { return Object.keys(this.existingElements); };
MockSchemaRegistry.prototype.securityContext = function (selector, property, isAttribute) {
return SecurityContext.NONE;

@@ -28,0 +29,0 @@ };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc