chore(typings): mark underscore methods @internal.
This allows TypeScript to produce an API surface which matches the Dart semantics. I found these with: gulp build.js.dev && find dist/js/dev/es5/angular2/src -name "*.d.ts" -exec grep -H -n '^ *_' {} \; Closes #4638
This commit is contained in:
@ -178,6 +178,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
|
||||
|
||||
afterViewLifecycleCallbacksInternal(): void {}
|
||||
|
||||
/** @internal */
|
||||
_detectChangesInLightDomChildren(throwOnChange: boolean): void {
|
||||
var c = this.lightDomChildren;
|
||||
for (var i = 0; i < c.length; ++i) {
|
||||
@ -185,6 +186,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_detectChangesInShadowDomChildren(throwOnChange: boolean): void {
|
||||
var c = this.shadowDomChildren;
|
||||
for (var i = 0; i < c.length; ++i) {
|
||||
|
@ -109,17 +109,20 @@ export class ChangeDetectorJITGenerator {
|
||||
`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genPropertyBindingTargets(): string {
|
||||
var targets = this._logic.genPropertyBindingTargets(this.propertyBindingTargets,
|
||||
this.genConfig.genDebugInfo);
|
||||
return `${this.typeName}.gen_propertyBindingTargets = ${targets};`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genDirectiveIndices(): string {
|
||||
var indices = this._logic.genDirectiveIndices(this.directiveRecords);
|
||||
return `${this.typeName}.gen_directiveIndices = ${indices};`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_maybeGenHandleEventInternal(): string {
|
||||
if (this.eventBindings.length > 0) {
|
||||
var handlers = this.eventBindings.map(eb => this._genEventBinding(eb)).join("\n");
|
||||
@ -136,6 +139,7 @@ export class ChangeDetectorJITGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genEventBinding(eb: EventBinding): string {
|
||||
var recs = eb.records.map(r => this._genEventBindingEval(eb, r)).join("\n");
|
||||
return `
|
||||
@ -144,6 +148,7 @@ export class ChangeDetectorJITGenerator {
|
||||
}`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genEventBindingEval(eb: EventBinding, r: ProtoRecord): string {
|
||||
if (r.lastInBinding) {
|
||||
var evalRecord = this._logic.genEventBindingEvalValue(eb, r);
|
||||
@ -155,6 +160,7 @@ export class ChangeDetectorJITGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genMarkPathToRootAsCheckOnce(r: ProtoRecord): string {
|
||||
var br = r.bindingRecord;
|
||||
if (br.isDefaultChangeDetection()) {
|
||||
@ -164,11 +170,13 @@ export class ChangeDetectorJITGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genUpdatePreventDefault(eb: EventBinding, r: ProtoRecord): string {
|
||||
var local = this._names.getEventLocalName(eb, r.selfIndex);
|
||||
return `if (${local} === false) { ${this._names.getPreventDefaultAccesor()} = true};`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_maybeGenDehydrateDirectives(): string {
|
||||
var destroyPipesCode = this._names.genPipeOnDestroy();
|
||||
if (destroyPipesCode) {
|
||||
@ -182,6 +190,7 @@ export class ChangeDetectorJITGenerator {
|
||||
}`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_maybeGenHydrateDirectives(): string {
|
||||
var hydrateDirectivesCode = this._logic.genHydrateDirectives(this.directiveRecords);
|
||||
var hydrateDetectorsCode = this._logic.genHydrateDetectors(this.directiveRecords);
|
||||
@ -192,6 +201,7 @@ export class ChangeDetectorJITGenerator {
|
||||
}`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_maybeGenAfterContentLifecycleCallbacks(): string {
|
||||
var notifications = this._logic.genContentLifecycleCallbacks(this.directiveRecords);
|
||||
if (notifications.length > 0) {
|
||||
@ -206,6 +216,7 @@ export class ChangeDetectorJITGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_maybeGenAfterViewLifecycleCallbacks(): string {
|
||||
var notifications = this._logic.genViewLifecycleCallbacks(this.directiveRecords);
|
||||
if (notifications.length > 0) {
|
||||
@ -220,6 +231,7 @@ export class ChangeDetectorJITGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genRecord(r: ProtoRecord): string {
|
||||
var rec;
|
||||
if (r.isLifeCycleRecord()) {
|
||||
@ -236,6 +248,7 @@ export class ChangeDetectorJITGenerator {
|
||||
`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genDirectiveLifecycle(r: ProtoRecord): string {
|
||||
if (r.name === "DoCheck") {
|
||||
return this._genOnCheck(r);
|
||||
@ -248,6 +261,7 @@ export class ChangeDetectorJITGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genPipeCheck(r: ProtoRecord): string {
|
||||
var context = this._names.getLocalName(r.contextIndex);
|
||||
var argString = r.args.map((arg) => this._names.getLocalName(arg)).join(", ");
|
||||
@ -288,6 +302,7 @@ export class ChangeDetectorJITGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genReferenceCheck(r: ProtoRecord): string {
|
||||
var oldValue = this._names.getFieldName(r.selfIndex);
|
||||
var newValue = this._names.getLocalName(r.selfIndex);
|
||||
@ -318,10 +333,12 @@ export class ChangeDetectorJITGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genChangeMarker(r: ProtoRecord): string {
|
||||
return r.argumentToPureFunction ? `${this._names.getChangeName(r.selfIndex)} = true` : ``;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genUpdateDirectiveOrElement(r: ProtoRecord): string {
|
||||
if (!r.lastInBinding) return "";
|
||||
|
||||
@ -348,6 +365,7 @@ export class ChangeDetectorJITGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genThrowOnChangeCheck(oldValue: string, newValue: string): string {
|
||||
if (this.genConfig.genCheckNoChanges) {
|
||||
return `
|
||||
@ -360,6 +378,7 @@ export class ChangeDetectorJITGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genCheckNoChanges(): string {
|
||||
if (this.genConfig.genCheckNoChanges) {
|
||||
return `${this.typeName}.prototype.checkNoChanges = function() { this.runDetectChanges(true); }`;
|
||||
@ -368,6 +387,7 @@ export class ChangeDetectorJITGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genAddToChanges(r: ProtoRecord): string {
|
||||
var newValue = this._names.getLocalName(r.selfIndex);
|
||||
var oldValue = this._names.getFieldName(r.selfIndex);
|
||||
@ -375,6 +395,7 @@ export class ChangeDetectorJITGenerator {
|
||||
return `${CHANGES_LOCAL} = this.addChange(${CHANGES_LOCAL}, ${oldValue}, ${newValue});`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_maybeFirstInBinding(r: ProtoRecord): string {
|
||||
var prev = ChangeDetectionUtil.protoByIndex(this.records, r.selfIndex - 1);
|
||||
var firstInBindng = isBlank(prev) || prev.bindingRecord !== r.bindingRecord;
|
||||
@ -383,6 +404,7 @@ export class ChangeDetectorJITGenerator {
|
||||
'';
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_maybeGenLastInDirective(r: ProtoRecord): string {
|
||||
if (!r.lastInDirective) return "";
|
||||
return `
|
||||
@ -392,21 +414,25 @@ export class ChangeDetectorJITGenerator {
|
||||
`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genOnCheck(r: ProtoRecord): string {
|
||||
var br = r.bindingRecord;
|
||||
return `if (!throwOnChange) ${this._names.getDirectiveName(br.directiveRecord.directiveIndex)}.doCheck();`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genOnInit(r: ProtoRecord): string {
|
||||
var br = r.bindingRecord;
|
||||
return `if (!throwOnChange && !${this._names.getAlreadyCheckedName()}) ${this._names.getDirectiveName(br.directiveRecord.directiveIndex)}.onInit();`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genOnChange(r: ProtoRecord): string {
|
||||
var br = r.bindingRecord;
|
||||
return `if (!throwOnChange && ${CHANGES_LOCAL}) ${this._names.getDirectiveName(br.directiveRecord.directiveIndex)}.onChanges(${CHANGES_LOCAL});`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genNotifyOnPushDetectors(r: ProtoRecord): string {
|
||||
var br = r.bindingRecord;
|
||||
if (!r.lastInDirective || br.isDefaultChangeDetection()) return "";
|
||||
|
@ -111,6 +111,7 @@ export class CodegenLogicUtil {
|
||||
return `${getLocalName(protoRec.selfIndex)} = ${rhs};`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_observe(exp: string, rec: ProtoRecord): string {
|
||||
// This is an experimental feature. Works only in Dart.
|
||||
if (this._changeDetection === ChangeDetectionStrategy.OnPushObserve) {
|
||||
@ -138,6 +139,7 @@ export class CodegenLogicUtil {
|
||||
return `[${bs.join(", ")}]`;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_genInterpolation(protoRec: ProtoRecord): string {
|
||||
var iVals = [];
|
||||
for (var i = 0; i < protoRec.args.length; ++i) {
|
||||
|
@ -40,8 +40,10 @@ export class CodegenNameUtil {
|
||||
/**
|
||||
* Record names sanitized for use as fields.
|
||||
* See [sanitizeName] for details.
|
||||
* @internal
|
||||
*/
|
||||
_sanitizedNames: string[];
|
||||
/** @internal */
|
||||
_sanitizedEventNames = new Map<EventBinding, string[]>();
|
||||
|
||||
constructor(private _records: ProtoRecord[], private _eventBindings: EventBinding[],
|
||||
@ -62,6 +64,7 @@ export class CodegenNameUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_addFieldPrefix(name: string): string { return `${_FIELD_PREFIX}${name}`; }
|
||||
|
||||
getDispatcherName(): string { return this._addFieldPrefix(_DISPATCHER_ACCESSOR); }
|
||||
|
@ -151,6 +151,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
* currentKey, and clear all of the queues (additions, moves, removals).
|
||||
* Set the previousIndexes of moved and added items to their currentIndexes
|
||||
* Reset the list of additions, moves and removals
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
_reset() {
|
||||
if (this.isDirty) {
|
||||
@ -185,6 +187,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
* item.
|
||||
* - `item` is the current item in the collection
|
||||
* - `index` is the position of the item in the collection
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
_mismatch(record: CollectionChangeRecord, item, index: number): CollectionChangeRecord {
|
||||
// The previous record after which we will append the current one.
|
||||
@ -241,6 +245,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
* at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
|
||||
* better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
|
||||
* at the end.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
_verifyReinsertion(record: CollectionChangeRecord, item, index: number): CollectionChangeRecord {
|
||||
var reinsertRecord: CollectionChangeRecord =
|
||||
@ -258,6 +264,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
* Get rid of any excess {@link CollectionChangeRecord}s from the previous collection
|
||||
*
|
||||
* - `record` The first excess {@link CollectionChangeRecord}.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
_truncate(record: CollectionChangeRecord) {
|
||||
// Anything after that needs to be removed;
|
||||
@ -284,6 +292,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_reinsertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||
index: number): CollectionChangeRecord {
|
||||
if (this._unlinkedRecords !== null) {
|
||||
@ -308,6 +317,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
return record;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_moveAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||
index: number): CollectionChangeRecord {
|
||||
this._unlink(record);
|
||||
@ -316,6 +326,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
return record;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_addAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||
index: number): CollectionChangeRecord {
|
||||
this._insertAfter(record, prevRecord, index);
|
||||
@ -333,6 +344,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
return record;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_insertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||
index: number): CollectionChangeRecord {
|
||||
// todo(vicb)
|
||||
@ -366,10 +378,12 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
return record;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_remove(record: CollectionChangeRecord): CollectionChangeRecord {
|
||||
return this._addToRemovals(this._unlink(record));
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_unlink(record: CollectionChangeRecord): CollectionChangeRecord {
|
||||
if (this._linkedRecords !== null) {
|
||||
this._linkedRecords.remove(record);
|
||||
@ -396,6 +410,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
return record;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_addToMoves(record: CollectionChangeRecord, toIndex: number): CollectionChangeRecord {
|
||||
// todo(vicb)
|
||||
// assert(record._nextMoved === null);
|
||||
@ -417,6 +432,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||
return record;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_addToRemovals(record: CollectionChangeRecord): CollectionChangeRecord {
|
||||
if (this._unlinkedRecords === null) {
|
||||
this._unlinkedRecords = new _DuplicateMap();
|
||||
@ -477,14 +493,23 @@ export class CollectionChangeRecord {
|
||||
currentIndex: number = null;
|
||||
previousIndex: number = null;
|
||||
|
||||
/** @internal */
|
||||
_nextPrevious: CollectionChangeRecord = null;
|
||||
/** @internal */
|
||||
_prev: CollectionChangeRecord = null;
|
||||
/** @internal */
|
||||
_next: CollectionChangeRecord = null;
|
||||
/** @internal */
|
||||
_prevDup: CollectionChangeRecord = null;
|
||||
/** @internal */
|
||||
_nextDup: CollectionChangeRecord = null;
|
||||
/** @internal */
|
||||
_prevRemoved: CollectionChangeRecord = null;
|
||||
/** @internal */
|
||||
_nextRemoved: CollectionChangeRecord = null;
|
||||
/** @internal */
|
||||
_nextAdded: CollectionChangeRecord = null;
|
||||
/** @internal */
|
||||
_nextMoved: CollectionChangeRecord = null;
|
||||
|
||||
constructor(public item: any) {}
|
||||
@ -499,7 +524,9 @@ export class CollectionChangeRecord {
|
||||
|
||||
// A linked list of CollectionChangeRecords with the same CollectionChangeRecord.item
|
||||
class _DuplicateItemRecordList {
|
||||
/** @internal */
|
||||
_head: CollectionChangeRecord = null;
|
||||
/** @internal */
|
||||
_tail: CollectionChangeRecord = null;
|
||||
|
||||
/**
|
||||
|
@ -129,6 +129,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||
return this.isDirty;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_reset() {
|
||||
if (this.isDirty) {
|
||||
var record: KVChangeRecord;
|
||||
@ -176,6 +177,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_truncate(lastRecord: KVChangeRecord, record: KVChangeRecord) {
|
||||
while (record !== null) {
|
||||
if (lastRecord === null) {
|
||||
@ -201,11 +203,13 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_isInRemovals(record: KVChangeRecord) {
|
||||
return record === this._removalsHead || record._nextRemoved !== null ||
|
||||
record._prevRemoved !== null;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_addToRemovals(record: KVChangeRecord) {
|
||||
// todo(vicb) assert
|
||||
// assert(record._next == null);
|
||||
@ -222,6 +226,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_removeFromSeq(prev: KVChangeRecord, record: KVChangeRecord) {
|
||||
var next = record._next;
|
||||
if (prev === null) {
|
||||
@ -236,6 +241,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||
//})());
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_removeFromRemovals(record: KVChangeRecord) {
|
||||
// todo(vicb) assert
|
||||
// assert(record._next == null);
|
||||
@ -257,6 +263,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||
record._prevRemoved = record._nextRemoved = null;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_addToAdditions(record: KVChangeRecord) {
|
||||
// todo(vicb): assert
|
||||
// assert(record._next == null);
|
||||
@ -272,6 +279,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_addToChanges(record: KVChangeRecord) {
|
||||
// todo(vicb) assert
|
||||
// assert(record._nextAdded == null);
|
||||
@ -315,6 +323,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||
"removals: " + removals.join(', ') + "\n";
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_forEach(obj, fn: Function) {
|
||||
if (obj instanceof Map) {
|
||||
(<Map<any, any>>obj).forEach(<any>fn);
|
||||
@ -329,11 +338,17 @@ export class KVChangeRecord {
|
||||
previousValue: any = null;
|
||||
currentValue: any = null;
|
||||
|
||||
/** @internal */
|
||||
_nextPrevious: KVChangeRecord = null;
|
||||
/** @internal */
|
||||
_next: KVChangeRecord = null;
|
||||
/** @internal */
|
||||
_nextAdded: KVChangeRecord = null;
|
||||
/** @internal */
|
||||
_nextRemoved: KVChangeRecord = null;
|
||||
/** @internal */
|
||||
_prevRemoved: KVChangeRecord = null;
|
||||
/** @internal */
|
||||
_nextChanged: KVChangeRecord = null;
|
||||
|
||||
constructor(public key: any) {}
|
||||
|
@ -49,6 +49,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
return preventDefault;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_processEventBinding(eb: EventBinding, locals: Locals): any {
|
||||
var values = ListWrapper.createFixedSize(eb.records.length);
|
||||
values[0] = this.values[0];
|
||||
@ -67,6 +68,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
throw new BaseException("Cannot be reached");
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_markPathAsCheckOnce(proto: ProtoRecord): void {
|
||||
if (!proto.bindingRecord.isDefaultChangeDetection()) {
|
||||
var dir = proto.bindingRecord.directiveRecord;
|
||||
@ -74,6 +76,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_matchingEventBindings(eventName: string, elIndex: number): EventBinding[] {
|
||||
return ListWrapper.filter(this._eventBindings,
|
||||
eb => eb.eventName == eventName && eb.elIndex === elIndex);
|
||||
@ -103,6 +106,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
ListWrapper.fill(this.prevContexts, ChangeDetectionUtil.uninitialized);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_destroyPipes() {
|
||||
for (var i = 0; i < this.localPipes.length; ++i) {
|
||||
if (isPresent(this.localPipes[i])) {
|
||||
@ -156,6 +160,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_firstInBinding(r: ProtoRecord): boolean {
|
||||
var prev = ChangeDetectionUtil.protoByIndex(this._records, r.selfIndex - 1);
|
||||
return isBlank(prev) || prev.bindingRecord !== r.bindingRecord;
|
||||
@ -188,6 +193,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_updateDirectiveOrElement(change, bindingRecord) {
|
||||
if (isBlank(bindingRecord.directiveRecord)) {
|
||||
super.notifyDispatcher(change.currentValue);
|
||||
@ -201,6 +207,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_addChange(bindingRecord: BindingRecord, change, changes) {
|
||||
if (bindingRecord.callOnChanges()) {
|
||||
return super.addChange(changes, change.previousValue, change.currentValue);
|
||||
@ -209,10 +216,13 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_getDirectiveFor(directiveIndex) { return this.directives.getDirectiveFor(directiveIndex); }
|
||||
|
||||
/** @internal */
|
||||
_getDetectorFor(directiveIndex) { return this.directives.getDetectorFor(directiveIndex); }
|
||||
|
||||
/** @internal */
|
||||
_check(proto: ProtoRecord, throwOnChange: boolean, values: any[], locals: Locals): SimpleChange {
|
||||
if (proto.isPipeRecord()) {
|
||||
return this._pipeCheck(proto, throwOnChange, values);
|
||||
@ -221,6 +231,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_referenceCheck(proto: ProtoRecord, throwOnChange: boolean, values: any[], locals: Locals) {
|
||||
if (this._pureFuncAndArgsDidNotChange(proto)) {
|
||||
this._setChanged(proto, false);
|
||||
@ -259,6 +270,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_calculateCurrValue(proto: ProtoRecord, values: any[], locals: Locals) {
|
||||
switch (proto.mode) {
|
||||
case RecordType.Self:
|
||||
@ -326,6 +338,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_pipeCheck(proto: ProtoRecord, throwOnChange: boolean, values: any[]) {
|
||||
var context = this._readContext(proto, values);
|
||||
var selectedPipe = this._pipeFor(proto, context);
|
||||
@ -364,6 +377,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_pipeFor(proto: ProtoRecord, context) {
|
||||
var storedPipe = this._readPipe(proto);
|
||||
if (isPresent(storedPipe)) return storedPipe;
|
||||
@ -373,6 +387,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
return pipe;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_readContext(proto: ProtoRecord, values: any[]) {
|
||||
if (proto.contextIndex == -1) {
|
||||
return this._getDirectiveFor(proto.directiveIndex);
|
||||
@ -383,22 +398,29 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
return values[proto.contextIndex];
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_readSelf(proto: ProtoRecord, values: any[]) { return values[proto.selfIndex]; }
|
||||
|
||||
/** @internal */
|
||||
_writeSelf(proto: ProtoRecord, value, values: any[]) { values[proto.selfIndex] = value; }
|
||||
|
||||
/** @internal */
|
||||
_readPipe(proto: ProtoRecord) { return this.localPipes[proto.selfIndex]; }
|
||||
|
||||
/** @internal */
|
||||
_writePipe(proto: ProtoRecord, value) { this.localPipes[proto.selfIndex] = value; }
|
||||
|
||||
/** @internal */
|
||||
_setChanged(proto: ProtoRecord, value: boolean) {
|
||||
if (proto.argumentToPureFunction) this.changes[proto.selfIndex] = value;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_pureFuncAndArgsDidNotChange(proto: ProtoRecord): boolean {
|
||||
return proto.isPureFunction() && !this._argsChanged(proto);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_argsChanged(proto: ProtoRecord): boolean {
|
||||
var args = proto.args;
|
||||
for (var i = 0; i < args.length; ++i) {
|
||||
@ -409,10 +431,12 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_argsOrContextChanged(proto: ProtoRecord): boolean {
|
||||
return this._argsChanged(proto) || this.changes[proto.contextIndex];
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_readArgs(proto: ProtoRecord, values: any[]) {
|
||||
var res = ListWrapper.createFixedSize(proto.args.length);
|
||||
var args = proto.args;
|
||||
|
@ -5,6 +5,7 @@ import {ProtoChangeDetector, ChangeDetector, ChangeDetectorDefinition} from './i
|
||||
import {ChangeDetectorJITGenerator} from './change_detection_jit_generator';
|
||||
|
||||
export class JitProtoChangeDetector implements ProtoChangeDetector {
|
||||
/** @internal */
|
||||
_factory: Function;
|
||||
|
||||
constructor(private definition: ChangeDetectorDefinition) {
|
||||
@ -15,6 +16,7 @@ export class JitProtoChangeDetector implements ProtoChangeDetector {
|
||||
|
||||
instantiate(dispatcher: any): ChangeDetector { return this._factory(dispatcher); }
|
||||
|
||||
/** @internal */
|
||||
_createFactory(definition: ChangeDetectorDefinition) {
|
||||
return new ChangeDetectorJITGenerator(definition, 'util', 'AbstractChangeDetector').generate();
|
||||
}
|
||||
|
@ -58,9 +58,11 @@ class ParseException extends BaseException {
|
||||
|
||||
@Injectable()
|
||||
export class Parser {
|
||||
/** @internal */
|
||||
_reflector: Reflector;
|
||||
|
||||
constructor(public _lexer: Lexer, providedReflector: Reflector = null) {
|
||||
constructor(/** @internal */
|
||||
public _lexer: Lexer, providedReflector: Reflector = null) {
|
||||
this._reflector = isPresent(providedReflector) ? providedReflector : reflector;
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,13 @@ import {coalesce} from './coalesce';
|
||||
import {ProtoRecord, RecordType} from './proto_record';
|
||||
|
||||
export class DynamicProtoChangeDetector implements ProtoChangeDetector {
|
||||
/** @internal */
|
||||
_propertyBindingRecords: ProtoRecord[];
|
||||
/** @internal */
|
||||
_propertyBindingTargets: BindingTarget[];
|
||||
/** @internal */
|
||||
_eventBindingRecords: EventBinding[];
|
||||
/** @internal */
|
||||
_directiveIndices: DirectiveIndex[];
|
||||
|
||||
constructor(private _definition: ChangeDetectorDefinition) {
|
||||
@ -96,6 +100,7 @@ export class ProtoRecordBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_setArgumentToPureFunction(startIndex: number): void {
|
||||
for (var i = startIndex; i < this.records.length; ++i) {
|
||||
var rec = this.records[i];
|
||||
@ -111,6 +116,7 @@ export class ProtoRecordBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_appendRecords(b: BindingRecord, variableNames: string[], bindingIndex: number) {
|
||||
if (b.isDirectiveLifecycle()) {
|
||||
this.records.push(new ProtoRecord(RecordType.DirectiveLifecycle, b.lifecycleEvent, null, [],
|
||||
|
Reference in New Issue
Block a user