X Tutup
Skip to content

Commit 867c08a

Browse files
committed
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 angular#4638
1 parent 95f9846 commit 867c08a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+369
-31
lines changed

modules/angular2/src/core/application_ref.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ export abstract class PlatformRef {
204204
}
205205

206206
export class PlatformRef_ extends PlatformRef {
207+
/** @internal */
207208
_applications: ApplicationRef[] = [];
208209

209210
constructor(private _injector: Injector, private _dispose: () => void) { super(); }
@@ -256,6 +257,7 @@ export class PlatformRef_ extends PlatformRef {
256257
this._dispose();
257258
}
258259

260+
/** @internal */
259261
_applicationDisposed(app: ApplicationRef): void { ListWrapper.remove(this._applications, app); }
260262
}
261263

modules/angular2/src/core/change_detection/abstract_change_detector.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,15 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
178178

179179
afterViewLifecycleCallbacksInternal(): void {}
180180

181+
/** @internal */
181182
_detectChangesInLightDomChildren(throwOnChange: boolean): void {
182183
var c = this.lightDomChildren;
183184
for (var i = 0; i < c.length; ++i) {
184185
c[i].runDetectChanges(throwOnChange);
185186
}
186187
}
187188

189+
/** @internal */
188190
_detectChangesInShadowDomChildren(throwOnChange: boolean): void {
189191
var c = this.shadowDomChildren;
190192
for (var i = 0; i < c.length; ++i) {

modules/angular2/src/core/change_detection/change_detection_jit_generator.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,20 @@ export class ChangeDetectorJITGenerator {
109109
`;
110110
}
111111

112+
/** @internal */
112113
_genPropertyBindingTargets(): string {
113114
var targets = this._logic.genPropertyBindingTargets(this.propertyBindingTargets,
114115
this.genConfig.genDebugInfo);
115116
return `${this.typeName}.gen_propertyBindingTargets = ${targets};`;
116117
}
117118

119+
/** @internal */
118120
_genDirectiveIndices(): string {
119121
var indices = this._logic.genDirectiveIndices(this.directiveRecords);
120122
return `${this.typeName}.gen_directiveIndices = ${indices};`;
121123
}
122124

125+
/** @internal */
123126
_maybeGenHandleEventInternal(): string {
124127
if (this.eventBindings.length > 0) {
125128
var handlers = this.eventBindings.map(eb => this._genEventBinding(eb)).join("\n");
@@ -136,6 +139,7 @@ export class ChangeDetectorJITGenerator {
136139
}
137140
}
138141

142+
/** @internal */
139143
_genEventBinding(eb: EventBinding): string {
140144
var recs = eb.records.map(r => this._genEventBindingEval(eb, r)).join("\n");
141145
return `
@@ -144,6 +148,7 @@ export class ChangeDetectorJITGenerator {
144148
}`;
145149
}
146150

151+
/** @internal */
147152
_genEventBindingEval(eb: EventBinding, r: ProtoRecord): string {
148153
if (r.lastInBinding) {
149154
var evalRecord = this._logic.genEventBindingEvalValue(eb, r);
@@ -155,6 +160,7 @@ export class ChangeDetectorJITGenerator {
155160
}
156161
}
157162

163+
/** @internal */
158164
_genMarkPathToRootAsCheckOnce(r: ProtoRecord): string {
159165
var br = r.bindingRecord;
160166
if (br.isDefaultChangeDetection()) {
@@ -164,11 +170,13 @@ export class ChangeDetectorJITGenerator {
164170
}
165171
}
166172

173+
/** @internal */
167174
_genUpdatePreventDefault(eb: EventBinding, r: ProtoRecord): string {
168175
var local = this._names.getEventLocalName(eb, r.selfIndex);
169176
return `if (${local} === false) { ${this._names.getPreventDefaultAccesor()} = true};`;
170177
}
171178

179+
/** @internal */
172180
_maybeGenDehydrateDirectives(): string {
173181
var destroyPipesCode = this._names.genPipeOnDestroy();
174182
if (destroyPipesCode) {
@@ -182,6 +190,7 @@ export class ChangeDetectorJITGenerator {
182190
}`;
183191
}
184192

193+
/** @internal */
185194
_maybeGenHydrateDirectives(): string {
186195
var hydrateDirectivesCode = this._logic.genHydrateDirectives(this.directiveRecords);
187196
var hydrateDetectorsCode = this._logic.genHydrateDetectors(this.directiveRecords);
@@ -192,6 +201,7 @@ export class ChangeDetectorJITGenerator {
192201
}`;
193202
}
194203

204+
/** @internal */
195205
_maybeGenAfterContentLifecycleCallbacks(): string {
196206
var notifications = this._logic.genContentLifecycleCallbacks(this.directiveRecords);
197207
if (notifications.length > 0) {
@@ -206,6 +216,7 @@ export class ChangeDetectorJITGenerator {
206216
}
207217
}
208218

219+
/** @internal */
209220
_maybeGenAfterViewLifecycleCallbacks(): string {
210221
var notifications = this._logic.genViewLifecycleCallbacks(this.directiveRecords);
211222
if (notifications.length > 0) {
@@ -220,6 +231,7 @@ export class ChangeDetectorJITGenerator {
220231
}
221232
}
222233

234+
/** @internal */
223235
_genRecord(r: ProtoRecord): string {
224236
var rec;
225237
if (r.isLifeCycleRecord()) {
@@ -236,6 +248,7 @@ export class ChangeDetectorJITGenerator {
236248
`;
237249
}
238250

251+
/** @internal */
239252
_genDirectiveLifecycle(r: ProtoRecord): string {
240253
if (r.name === "DoCheck") {
241254
return this._genOnCheck(r);
@@ -248,6 +261,7 @@ export class ChangeDetectorJITGenerator {
248261
}
249262
}
250263

264+
/** @internal */
251265
_genPipeCheck(r: ProtoRecord): string {
252266
var context = this._names.getLocalName(r.contextIndex);
253267
var argString = r.args.map((arg) => this._names.getLocalName(arg)).join(", ");
@@ -288,6 +302,7 @@ export class ChangeDetectorJITGenerator {
288302
}
289303
}
290304

305+
/** @internal */
291306
_genReferenceCheck(r: ProtoRecord): string {
292307
var oldValue = this._names.getFieldName(r.selfIndex);
293308
var newValue = this._names.getLocalName(r.selfIndex);
@@ -318,10 +333,12 @@ export class ChangeDetectorJITGenerator {
318333
}
319334
}
320335

336+
/** @internal */
321337
_genChangeMarker(r: ProtoRecord): string {
322338
return r.argumentToPureFunction ? `${this._names.getChangeName(r.selfIndex)} = true` : ``;
323339
}
324340

341+
/** @internal */
325342
_genUpdateDirectiveOrElement(r: ProtoRecord): string {
326343
if (!r.lastInBinding) return "";
327344

@@ -348,6 +365,7 @@ export class ChangeDetectorJITGenerator {
348365
}
349366
}
350367

368+
/** @internal */
351369
_genThrowOnChangeCheck(oldValue: string, newValue: string): string {
352370
if (this.genConfig.genCheckNoChanges) {
353371
return `
@@ -360,6 +378,7 @@ export class ChangeDetectorJITGenerator {
360378
}
361379
}
362380

381+
/** @internal */
363382
_genCheckNoChanges(): string {
364383
if (this.genConfig.genCheckNoChanges) {
365384
return `${this.typeName}.prototype.checkNoChanges = function() { this.runDetectChanges(true); }`;
@@ -368,13 +387,15 @@ export class ChangeDetectorJITGenerator {
368387
}
369388
}
370389

390+
/** @internal */
371391
_genAddToChanges(r: ProtoRecord): string {
372392
var newValue = this._names.getLocalName(r.selfIndex);
373393
var oldValue = this._names.getFieldName(r.selfIndex);
374394
if (!r.bindingRecord.callOnChanges()) return "";
375395
return `${CHANGES_LOCAL} = this.addChange(${CHANGES_LOCAL}, ${oldValue}, ${newValue});`;
376396
}
377397

398+
/** @internal */
378399
_maybeFirstInBinding(r: ProtoRecord): string {
379400
var prev = ChangeDetectionUtil.protoByIndex(this.records, r.selfIndex - 1);
380401
var firstInBindng = isBlank(prev) || prev.bindingRecord !== r.bindingRecord;
@@ -383,6 +404,7 @@ export class ChangeDetectorJITGenerator {
383404
'';
384405
}
385406

407+
/** @internal */
386408
_maybeGenLastInDirective(r: ProtoRecord): string {
387409
if (!r.lastInDirective) return "";
388410
return `
@@ -392,21 +414,25 @@ export class ChangeDetectorJITGenerator {
392414
`;
393415
}
394416

417+
/** @internal */
395418
_genOnCheck(r: ProtoRecord): string {
396419
var br = r.bindingRecord;
397420
return `if (!throwOnChange) ${this._names.getDirectiveName(br.directiveRecord.directiveIndex)}.doCheck();`;
398421
}
399422

423+
/** @internal */
400424
_genOnInit(r: ProtoRecord): string {
401425
var br = r.bindingRecord;
402426
return `if (!throwOnChange && !${this._names.getAlreadyCheckedName()}) ${this._names.getDirectiveName(br.directiveRecord.directiveIndex)}.onInit();`;
403427
}
404428

429+
/** @internal */
405430
_genOnChange(r: ProtoRecord): string {
406431
var br = r.bindingRecord;
407432
return `if (!throwOnChange && ${CHANGES_LOCAL}) ${this._names.getDirectiveName(br.directiveRecord.directiveIndex)}.onChanges(${CHANGES_LOCAL});`;
408433
}
409434

435+
/** @internal */
410436
_genNotifyOnPushDetectors(r: ProtoRecord): string {
411437
var br = r.bindingRecord;
412438
if (!r.lastInDirective || br.isDefaultChangeDetection()) return "";

modules/angular2/src/core/change_detection/codegen_logic_util.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export class CodegenLogicUtil {
111111
return `${getLocalName(protoRec.selfIndex)} = ${rhs};`;
112112
}
113113

114+
/** @internal */
114115
_observe(exp: string, rec: ProtoRecord): string {
115116
// This is an experimental feature. Works only in Dart.
116117
if (this._changeDetection === ChangeDetectionStrategy.OnPushObserve) {
@@ -138,6 +139,7 @@ export class CodegenLogicUtil {
138139
return `[${bs.join(", ")}]`;
139140
}
140141

142+
/** @internal */
141143
_genInterpolation(protoRec: ProtoRecord): string {
142144
var iVals = [];
143145
for (var i = 0; i < protoRec.args.length; ++i) {

modules/angular2/src/core/change_detection/codegen_name_util.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ export class CodegenNameUtil {
4040
/**
4141
* Record names sanitized for use as fields.
4242
* See [sanitizeName] for details.
43+
* @internal
4344
*/
4445
_sanitizedNames: string[];
46+
/** @internal */
4547
_sanitizedEventNames = new Map<EventBinding, string[]>();
4648

4749
constructor(private _records: ProtoRecord[], private _eventBindings: EventBinding[],
@@ -62,6 +64,7 @@ export class CodegenNameUtil {
6264
}
6365
}
6466

67+
/** @internal */
6568
_addFieldPrefix(name: string): string { return `${_FIELD_PREFIX}${name}`; }
6669

6770
getDispatcherName(): string { return this._addFieldPrefix(_DISPATCHER_ACCESSOR); }

modules/angular2/src/core/change_detection/differs/default_iterable_differ.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
151151
* currentKey, and clear all of the queues (additions, moves, removals).
152152
* Set the previousIndexes of moved and added items to their currentIndexes
153153
* Reset the list of additions, moves and removals
154+
*
155+
* @internal
154156
*/
155157
_reset() {
156158
if (this.isDirty) {
@@ -185,6 +187,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
185187
* item.
186188
* - `item` is the current item in the collection
187189
* - `index` is the position of the item in the collection
190+
*
191+
* @internal
188192
*/
189193
_mismatch(record: CollectionChangeRecord, item, index: number): CollectionChangeRecord {
190194
// The previous record after which we will append the current one.
@@ -241,6 +245,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
241245
* at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
242246
* better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
243247
* at the end.
248+
*
249+
* @internal
244250
*/
245251
_verifyReinsertion(record: CollectionChangeRecord, item, index: number): CollectionChangeRecord {
246252
var reinsertRecord: CollectionChangeRecord =
@@ -258,6 +264,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
258264
* Get rid of any excess {@link CollectionChangeRecord}s from the previous collection
259265
*
260266
* - `record` The first excess {@link CollectionChangeRecord}.
267+
*
268+
* @internal
261269
*/
262270
_truncate(record: CollectionChangeRecord) {
263271
// Anything after that needs to be removed;
@@ -284,6 +292,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
284292
}
285293
}
286294

295+
/** @internal */
287296
_reinsertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
288297
index: number): CollectionChangeRecord {
289298
if (this._unlinkedRecords !== null) {
@@ -308,6 +317,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
308317
return record;
309318
}
310319

320+
/** @internal */
311321
_moveAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
312322
index: number): CollectionChangeRecord {
313323
this._unlink(record);
@@ -316,6 +326,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
316326
return record;
317327
}
318328

329+
/** @internal */
319330
_addAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
320331
index: number): CollectionChangeRecord {
321332
this._insertAfter(record, prevRecord, index);
@@ -333,6 +344,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
333344
return record;
334345
}
335346

347+
/** @internal */
336348
_insertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
337349
index: number): CollectionChangeRecord {
338350
// todo(vicb)
@@ -366,10 +378,12 @@ export class DefaultIterableDiffer implements IterableDiffer {
366378
return record;
367379
}
368380

381+
/** @internal */
369382
_remove(record: CollectionChangeRecord): CollectionChangeRecord {
370383
return this._addToRemovals(this._unlink(record));
371384
}
372385

386+
/** @internal */
373387
_unlink(record: CollectionChangeRecord): CollectionChangeRecord {
374388
if (this._linkedRecords !== null) {
375389
this._linkedRecords.remove(record);
@@ -396,6 +410,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
396410
return record;
397411
}
398412

413+
/** @internal */
399414
_addToMoves(record: CollectionChangeRecord, toIndex: number): CollectionChangeRecord {
400415
// todo(vicb)
401416
// assert(record._nextMoved === null);
@@ -417,6 +432,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
417432
return record;
418433
}
419434

435+
/** @internal */
420436
_addToRemovals(record: CollectionChangeRecord): CollectionChangeRecord {
421437
if (this._unlinkedRecords === null) {
422438
this._unlinkedRecords = new _DuplicateMap();
@@ -477,14 +493,23 @@ export class CollectionChangeRecord {
477493
currentIndex: number = null;
478494
previousIndex: number = null;
479495

496+
/** @internal */
480497
_nextPrevious: CollectionChangeRecord = null;
498+
/** @internal */
481499
_prev: CollectionChangeRecord = null;
500+
/** @internal */
482501
_next: CollectionChangeRecord = null;
502+
/** @internal */
483503
_prevDup: CollectionChangeRecord = null;
504+
/** @internal */
484505
_nextDup: CollectionChangeRecord = null;
506+
/** @internal */
485507
_prevRemoved: CollectionChangeRecord = null;
508+
/** @internal */
486509
_nextRemoved: CollectionChangeRecord = null;
510+
/** @internal */
487511
_nextAdded: CollectionChangeRecord = null;
512+
/** @internal */
488513
_nextMoved: CollectionChangeRecord = null;
489514

490515
constructor(public item: any) {}
@@ -499,7 +524,9 @@ export class CollectionChangeRecord {
499524

500525
// A linked list of CollectionChangeRecords with the same CollectionChangeRecord.item
501526
class _DuplicateItemRecordList {
527+
/** @internal */
502528
_head: CollectionChangeRecord = null;
529+
/** @internal */
503530
_tail: CollectionChangeRecord = null;
504531

505532
/**

0 commit comments

Comments
 (0)
X Tutup