@@ -130,11 +130,11 @@ export class Record {
130130 this . _mode = protoRecord . _mode ;
131131
132132 // Return early for collections, further init delayed until updateContext()
133- if ( this . isCollection ) return ;
133+ if ( this . isCollection ( ) ) return ;
134134
135135 this . currentValue = _fresh ;
136136
137- var type = this . type ;
137+ var type = this . getType ( ) ;
138138
139139 if ( type === RECORD_TYPE_CONST ) {
140140 this . funcOrValue = protoRecord . funcOrValue ;
@@ -159,22 +159,22 @@ export class Record {
159159 }
160160 }
161161
162- // todo(vicb): getter / setters are much slower than regular methods
163- // todo(vicb): update the whole code base
164- get type ( ) :int {
162+ // getters & setters perform much worse on some browsers
163+ // see http://jsperf.com/vicb-getter-vs-function
164+ getType ( ) :int {
165165 return this . _mode & RECORD_TYPE_MASK ;
166166 }
167167
168- set type ( value :int ) {
168+ setType ( value :int ) {
169169 this . _mode = ( this . _mode & ~ RECORD_TYPE_MASK ) | value ;
170170 }
171171
172- get disabled ( ) :boolean {
172+ isDisabled ( ) :boolean {
173173 return ( this . _mode & RECORD_FLAG_DISABLED ) === RECORD_FLAG_DISABLED ;
174174 }
175175
176176 isEnabled ( ) :boolean {
177- return ! this . disabled ;
177+ return ! this . isDisabled ( ) ;
178178 }
179179
180180 _setDisabled ( value :boolean ) {
@@ -210,11 +210,11 @@ export class Record {
210210 this . _setDisabled ( true ) ;
211211 }
212212
213- get isImplicitReceiver ( ) :boolean {
213+ isImplicitReceiver ( ) :boolean {
214214 return ( this . _mode & RECORD_FLAG_IMPLICIT_RECEIVER ) === RECORD_FLAG_IMPLICIT_RECEIVER ;
215215 }
216216
217- get isCollection ( ) :boolean {
217+ isCollection ( ) :boolean {
218218 return ( this . _mode & RECORD_FLAG_COLLECTION ) === RECORD_FLAG_COLLECTION ;
219219 }
220220
@@ -223,7 +223,7 @@ export class Record {
223223 }
224224
225225 check ( ) :boolean {
226- if ( this . isCollection ) {
226+ if ( this . isCollection ( ) ) {
227227 return this . _checkCollection ( ) ;
228228 } else {
229229 return this . _checkSingleRecord ( ) ;
@@ -250,7 +250,7 @@ export class Record {
250250
251251 // return whether the content has changed
252252 _checkCollection ( ) :boolean {
253- switch ( this . type ) {
253+ switch ( this . getType ( ) ) {
254254 case RECORD_TYPE_KEY_VALUE :
255255 var kvChangeDetector :KeyValueChanges = this . currentValue ;
256256 return kvChangeDetector . check ( this . context ) ;
@@ -266,12 +266,12 @@ export class Record {
266266 return true ;
267267
268268 default :
269- throw new BaseException ( `Unsupported record type (${ this . type } )` ) ;
269+ throw new BaseException ( `Unsupported record type (${ this . getType ( ) } )` ) ;
270270 }
271271 }
272272
273273 _calculateNewValue ( ) {
274- switch ( this . type ) {
274+ switch ( this . getType ( ) ) {
275275 case RECORD_TYPE_PROPERTY :
276276 return this . funcOrValue ( this . context ) ;
277277
@@ -291,7 +291,7 @@ export class Record {
291291 return this . funcOrValue ;
292292
293293 default :
294- throw new BaseException ( `Unsupported record type (${ this . type } )` ) ;
294+ throw new BaseException ( `Unsupported record type (${ this . getType ( ) } )` ) ;
295295 }
296296 }
297297
@@ -304,25 +304,25 @@ export class Record {
304304 this . context = value ;
305305 this . enable ( ) ;
306306
307- if ( this . isCollection ) {
307+ if ( this . isCollection ( ) ) {
308308 if ( ArrayChanges . supports ( value ) ) {
309- if ( this . type != RECORD_TYPE_ARRAY ) {
310- this . type = RECORD_TYPE_ARRAY ;
309+ if ( this . getType ( ) != RECORD_TYPE_ARRAY ) {
310+ this . setType ( RECORD_TYPE_ARRAY ) ;
311311 this . currentValue = new ArrayChanges ( ) ;
312312 }
313313 return ;
314314 }
315315
316316 if ( KeyValueChanges . supports ( value ) ) {
317- if ( this . type != RECORD_TYPE_KEY_VALUE ) {
318- this . type = RECORD_TYPE_KEY_VALUE ;
317+ if ( this . getType ( ) != RECORD_TYPE_KEY_VALUE ) {
318+ this . setType ( RECORD_TYPE_KEY_VALUE ) ;
319319 this . currentValue = new KeyValueChanges ( ) ;
320320 }
321321 return ;
322322 }
323323
324324 if ( isBlank ( value ) ) {
325- this . type = RECORD_TYPE_NULL ;
325+ this . setType ( RECORD_TYPE_NULL ) ;
326326 } else {
327327 throw new BaseException ( "Collection records must be array like, map like or null" ) ;
328328 }
@@ -333,8 +333,8 @@ export class Record {
333333 return ! ( this . dest instanceof Record ) ;
334334 }
335335
336- get isMarkerRecord ( ) {
337- return this . type == RECORD_TYPE_MARKER ;
336+ isMarkerRecord ( ) : boolean {
337+ return this . getType ( ) == RECORD_TYPE_MARKER ;
338338 }
339339
340340 expressionMemento ( ) {
@@ -357,8 +357,8 @@ export class Record {
357357 if ( this . isEnabled ( ) ) return this . nextEnabled ;
358358
359359 var record = this . next ;
360- while ( isPresent ( record ) && record . disabled ) {
361- if ( record . isMarkerRecord && record . recordRange . disabled ) {
360+ while ( isPresent ( record ) && record . isDisabled ( ) ) {
361+ if ( record . isMarkerRecord ( ) && record . recordRange . disabled ) {
362362 record = record . recordRange . tailRecord . next ;
363363 } else {
364364 record = record . next ;
@@ -378,8 +378,8 @@ export class Record {
378378 if ( this . isEnabled ( ) ) return this . prevEnabled ;
379379
380380 var record = this . prev ;
381- while ( isPresent ( record ) && record . disabled ) {
382- if ( record . isMarkerRecord && record . recordRange . disabled ) {
381+ while ( isPresent ( record ) && record . isDisabled ( ) ) {
382+ if ( record . isMarkerRecord ( ) && record . recordRange . disabled ) {
383383 record = record . recordRange . headRecord . prev ;
384384 } else {
385385 record = record . prev ;
0 commit comments