|
7 | 7 | */
|
8 | 8 |
|
9 | 9 | import {assertEqual, assertLessThan} from './assert';
|
10 |
| -import {NO_CHANGE, _getViewData, bindingUpdated, bindingUpdated2, bindingUpdated4, createLNode, getPreviousOrParentNode, getRenderer, load, resetApplicationState} from './instructions'; |
| 10 | +import {NO_CHANGE, _getViewData, bindingUpdated, bindingUpdated2, bindingUpdated3, bindingUpdated4, createLNode, getPreviousOrParentNode, getRenderer, initBindings, load, resetApplicationState} from './instructions'; |
11 | 11 | import {RENDER_PARENT} from './interfaces/container';
|
12 | 12 | import {LContainerNode, LNode, TContainerNode, TElementNode, TNodeType} from './interfaces/node';
|
13 | 13 | import {BINDING_INDEX, HEADER_OFFSET, TVIEW} from './interfaces/view';
|
@@ -383,7 +383,8 @@ export function i18nExpMapping(
|
383 | 383 | * @returns The concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
|
384 | 384 | */
|
385 | 385 | export function i18nInterpolation1(instructions: I18nExpInstruction[], v0: any): string|NO_CHANGE {
|
386 |
| - const different = bindingUpdated(v0); |
| 386 | + initBindings(); |
| 387 | + const different = bindingUpdated(_getViewData()[BINDING_INDEX]++, v0); |
387 | 388 |
|
388 | 389 | if (!different) {
|
389 | 390 | return NO_CHANGE;
|
@@ -414,7 +415,10 @@ export function i18nInterpolation1(instructions: I18nExpInstruction[], v0: any):
|
414 | 415 | */
|
415 | 416 | export function i18nInterpolation2(instructions: I18nExpInstruction[], v0: any, v1: any): string|
|
416 | 417 | NO_CHANGE {
|
417 |
| - const different = bindingUpdated2(v0, v1); |
| 418 | + initBindings(); |
| 419 | + const viewData = _getViewData(); |
| 420 | + const different = bindingUpdated2(viewData[BINDING_INDEX], v0, v1); |
| 421 | + viewData[BINDING_INDEX] += 2; |
418 | 422 |
|
419 | 423 | if (!different) {
|
420 | 424 | return NO_CHANGE;
|
@@ -452,8 +456,10 @@ export function i18nInterpolation2(instructions: I18nExpInstruction[], v0: any,
|
452 | 456 | */
|
453 | 457 | export function i18nInterpolation3(
|
454 | 458 | instructions: I18nExpInstruction[], v0: any, v1: any, v2: any): string|NO_CHANGE {
|
455 |
| - let different = bindingUpdated2(v0, v1); |
456 |
| - different = bindingUpdated(v2) || different; |
| 459 | + initBindings(); |
| 460 | + const viewData = _getViewData(); |
| 461 | + const different = bindingUpdated3(viewData[BINDING_INDEX], v0, v1, v2); |
| 462 | + viewData[BINDING_INDEX] += 3; |
457 | 463 |
|
458 | 464 | if (!different) {
|
459 | 465 | return NO_CHANGE;
|
@@ -493,7 +499,10 @@ export function i18nInterpolation3(
|
493 | 499 | */
|
494 | 500 | export function i18nInterpolation4(
|
495 | 501 | instructions: I18nExpInstruction[], v0: any, v1: any, v2: any, v3: any): string|NO_CHANGE {
|
496 |
| - const different = bindingUpdated4(v0, v1, v2, v3); |
| 502 | + initBindings(); |
| 503 | + const viewData = _getViewData(); |
| 504 | + const different = bindingUpdated4(viewData[BINDING_INDEX], v0, v1, v2, v3); |
| 505 | + viewData[BINDING_INDEX] += 4; |
497 | 506 |
|
498 | 507 | if (!different) {
|
499 | 508 | return NO_CHANGE;
|
@@ -535,8 +544,11 @@ export function i18nInterpolation4(
|
535 | 544 | export function i18nInterpolation5(
|
536 | 545 | instructions: I18nExpInstruction[], v0: any, v1: any, v2: any, v3: any, v4: any): string|
|
537 | 546 | NO_CHANGE {
|
538 |
| - let different = bindingUpdated4(v0, v1, v2, v3); |
539 |
| - different = bindingUpdated(v4) || different; |
| 547 | + initBindings(); |
| 548 | + const viewData = _getViewData(); |
| 549 | + let different = bindingUpdated4(viewData[BINDING_INDEX], v0, v1, v2, v3); |
| 550 | + different = bindingUpdated(viewData[BINDING_INDEX] + 4, v4) || different; |
| 551 | + viewData[BINDING_INDEX] += 5; |
540 | 552 |
|
541 | 553 | if (!different) {
|
542 | 554 | return NO_CHANGE;
|
@@ -580,8 +592,11 @@ export function i18nInterpolation5(
|
580 | 592 | i18nInterpolation6(
|
581 | 593 | instructions: I18nExpInstruction[], v0: any, v1: any, v2: any, v3: any, v4: any, v5: any):
|
582 | 594 | string|NO_CHANGE {
|
583 |
| - let different = bindingUpdated4(v0, v1, v2, v3); |
584 |
| - different = bindingUpdated2(v4, v5) || different; |
| 595 | + initBindings(); |
| 596 | + const viewData = _getViewData(); |
| 597 | + let different = bindingUpdated4(viewData[BINDING_INDEX], v0, v1, v2, v3); |
| 598 | + different = bindingUpdated2(viewData[BINDING_INDEX] + 4, v4, v5) || different; |
| 599 | + viewData[BINDING_INDEX] += 6; |
585 | 600 |
|
586 | 601 | if (!different) {
|
587 | 602 | return NO_CHANGE;
|
@@ -626,9 +641,11 @@ i18nInterpolation6(
|
626 | 641 | export function i18nInterpolation7(
|
627 | 642 | instructions: I18nExpInstruction[], v0: any, v1: any, v2: any, v3: any, v4: any, v5: any,
|
628 | 643 | v6: any): string|NO_CHANGE {
|
629 |
| - let different = bindingUpdated4(v0, v1, v2, v3); |
630 |
| - different = bindingUpdated2(v4, v5) || different; |
631 |
| - different = bindingUpdated(v6) || different; |
| 644 | + initBindings(); |
| 645 | + const viewData = _getViewData(); |
| 646 | + let different = bindingUpdated4(viewData[BINDING_INDEX], v0, v1, v2, v3); |
| 647 | + different = bindingUpdated3(viewData[BINDING_INDEX] + 4, v4, v5, v6) || different; |
| 648 | + viewData[BINDING_INDEX] += 7; |
632 | 649 |
|
633 | 650 | if (!different) {
|
634 | 651 | return NO_CHANGE;
|
@@ -674,8 +691,11 @@ export function i18nInterpolation7(
|
674 | 691 | export function i18nInterpolation8(
|
675 | 692 | instructions: I18nExpInstruction[], v0: any, v1: any, v2: any, v3: any, v4: any, v5: any,
|
676 | 693 | v6: any, v7: any): string|NO_CHANGE {
|
677 |
| - let different = bindingUpdated4(v0, v1, v2, v3); |
678 |
| - different = bindingUpdated4(v4, v5, v6, v7) || different; |
| 694 | + initBindings(); |
| 695 | + const viewData = _getViewData(); |
| 696 | + let different = bindingUpdated4(viewData[BINDING_INDEX], v0, v1, v2, v3); |
| 697 | + different = bindingUpdated4(viewData[BINDING_INDEX] + 4, v4, v5, v6, v7) || different; |
| 698 | + viewData[BINDING_INDEX] += 8; |
679 | 699 |
|
680 | 700 | if (!different) {
|
681 | 701 | return NO_CHANGE;
|
@@ -713,10 +733,12 @@ export function i18nInterpolation8(
|
713 | 733 | */
|
714 | 734 | export function i18nInterpolationV(instructions: I18nExpInstruction[], values: any[]): string|
|
715 | 735 | NO_CHANGE {
|
| 736 | + initBindings(); |
| 737 | + const viewData = _getViewData(); |
716 | 738 | let different = false;
|
717 | 739 | for (let i = 0; i < values.length; i++) {
|
718 | 740 | // Check if bindings have changed
|
719 |
| - bindingUpdated(values[i]) && (different = true); |
| 741 | + bindingUpdated(viewData[BINDING_INDEX]++, values[i]) && (different = true); |
720 | 742 | }
|
721 | 743 |
|
722 | 744 | if (!different) {
|
|
0 commit comments