refactor(ivy): Move instructions back to ɵɵ (#30546)

There is an encoding issue with using delta `Δ`, where the browser will attempt to detect the file encoding if the character set is not explicitly declared on a `<script/>` tag, and Chrome will find the `Δ` character and decide it is window-1252 encoding, which misinterprets the `Δ` character to be some other character that is not a valid JS identifier character

So back to the frog eyes we go.

```
    __
   /ɵɵ\
  ( -- ) - I am ineffable. I am forever.
 _/    \_
/  \  /  \
==  ==  ==
```

PR Close #30546
This commit is contained in:
Ben Lesh
2019-05-17 18:49:21 -07:00
committed by Jason Aden
parent 1c3ee41902
commit d7eaae6f22
141 changed files with 5361 additions and 5344 deletions

View File

@ -9,7 +9,7 @@ import {createLView, createTView} from '@angular/core/src/render3/instructions/s
import {createRootContext} from '../../../src/render3/component';
import {getLContext} from '../../../src/render3/context_discovery';
import {ΔclassMap, ΔclassProp, ΔdefineComponent, ΔdefineDirective, ΔelementEnd, ΔelementStart, ΔnamespaceSVG, Δselect, ΔstyleMap, ΔstyleProp, Δstyling, ΔstylingApply} from '../../../src/render3/index';
import {ɵɵclassMap, ɵɵclassProp, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵelementEnd, ɵɵelementStart, ɵɵnamespaceSVG, ɵɵselect, ɵɵstyleMap, ɵɵstyleProp, ɵɵstyling, ɵɵstylingApply} from '../../../src/render3/index';
import {RenderFlags} from '../../../src/render3/interfaces/definition';
import {AttributeMarker, TAttributes} from '../../../src/render3/interfaces/node';
import {BindingStore, BindingType, PlayState, Player, PlayerContext, PlayerFactory, PlayerHandler} from '../../../src/render3/interfaces/player';
@ -22,7 +22,7 @@ import {CorePlayerHandler} from '../../../src/render3/styling/core_player_handle
import {registerHostDirective} from '../../../src/render3/styling/host_instructions_queue';
import {BoundPlayerFactory, bindPlayerFactory} from '../../../src/render3/styling/player_factory';
import {allocStylingContext, createEmptyStylingContext} from '../../../src/render3/styling/util';
import {ΔdefaultStyleSanitizer} from '../../../src/sanitization/sanitization';
import {ɵɵdefaultStyleSanitizer} from '../../../src/sanitization/sanitization';
import {StyleSanitizeFn} from '../../../src/sanitization/style_sanitizer';
import {ComponentFixture, renderToHtml} from '../render_util';
@ -383,7 +383,7 @@ describe('style and class based bindings', () => {
() => {
function Template(rf: RenderFlags, ctx: any) {
if (rf & RenderFlags.Create) {
ΔelementStart(0, 'span', [
ɵɵelementStart(0, 'span', [
AttributeMarker.Styles,
'width',
'200px',
@ -392,14 +392,14 @@ describe('style and class based bindings', () => {
'opacity',
'0.5',
]);
Δstyling(null, ['width']);
ΔelementEnd();
ɵɵstyling(null, ['width']);
ɵɵelementEnd();
}
if (rf & RenderFlags.Update) {
Δselect(0);
ΔstyleMap(ctx.myStyles);
ΔstyleProp(0, ctx.myWidth);
ΔstylingApply();
ɵɵselect(0);
ɵɵstyleMap(ctx.myStyles);
ɵɵstyleProp(0, ctx.myWidth);
ɵɵstylingApply();
}
}
@ -419,7 +419,7 @@ describe('style and class based bindings', () => {
class Comp {
diameter: number = 100;
static ngComponentDef = ΔdefineComponent({
static ngComponentDef = ɵɵdefineComponent({
type: Comp,
selectors: [['comp']],
factory: () => new Comp(),
@ -427,18 +427,18 @@ describe('style and class based bindings', () => {
vars: 0,
template: (rf: RenderFlags, ctx: Comp) => {
if (rf & RenderFlags.Create) {
ΔnamespaceSVG();
ΔelementStart(0, 'svg');
Δstyling(null, ['width', 'height']);
ΔelementStart(1, 'circle', ['stroke', 'green', 'fill', 'yellow']);
ΔelementEnd();
ΔelementEnd();
ɵɵnamespaceSVG();
ɵɵelementStart(0, 'svg');
ɵɵstyling(null, ['width', 'height']);
ɵɵelementStart(1, 'circle', ['stroke', 'green', 'fill', 'yellow']);
ɵɵelementEnd();
ɵɵelementEnd();
}
if (rf & RenderFlags.Update) {
Δselect(0);
ΔstyleProp(0, ctx.diameter, 'px');
ΔstyleProp(1, ctx.diameter, 'px');
ΔstylingApply();
ɵɵselect(0);
ɵɵstyleProp(0, ctx.diameter, 'px');
ɵɵstyleProp(1, ctx.diameter, 'px');
ɵɵstylingApply();
}
}
});
@ -462,7 +462,7 @@ describe('style and class based bindings', () => {
borderWidth: string = '3px';
borderColor: string = 'red';
static ngComponentDef = ΔdefineComponent({
static ngComponentDef = ɵɵdefineComponent({
type: Comp,
selectors: [['comp']],
factory: () => new Comp(),
@ -470,15 +470,15 @@ describe('style and class based bindings', () => {
vars: 0,
template: (rf: RenderFlags, ctx: Comp) => {
if (rf & RenderFlags.Create) {
ΔelementStart(0, 'div');
Δstyling(null, ['borderWidth', 'border-color']);
ΔelementEnd();
ɵɵelementStart(0, 'div');
ɵɵstyling(null, ['borderWidth', 'border-color']);
ɵɵelementEnd();
}
if (rf & RenderFlags.Update) {
Δselect(0);
ΔstyleProp(0, ctx.borderWidth);
ΔstyleProp(1, ctx.borderColor);
ΔstylingApply();
ɵɵselect(0);
ɵɵstyleProp(0, ctx.borderWidth);
ɵɵstyleProp(1, ctx.borderColor);
ɵɵstylingApply();
}
}
});
@ -1279,7 +1279,7 @@ describe('style and class based bindings', () => {
() => {
const getStyles = trackStylesFactory();
const styleBindings = ['border-image', 'border-width'];
const styleSanitizer = ΔdefaultStyleSanitizer;
const styleSanitizer = ɵɵdefaultStyleSanitizer;
const stylingContext =
createStylingContext(null, styleBindings, null, null, styleSanitizer);
@ -3099,7 +3099,7 @@ describe('style and class based bindings', () => {
const fooFactory = bindPlayerFactory(classBuildFn, true);
class Comp {
static ngComponentDef = ΔdefineComponent({
static ngComponentDef = ɵɵdefineComponent({
type: Comp,
selectors: [['comp']],
directives: [Comp],
@ -3108,17 +3108,17 @@ describe('style and class based bindings', () => {
vars: 0,
template: (rf: RenderFlags, ctx: Comp) => {
if (rf & RenderFlags.Create) {
ΔelementStart(0, 'div');
Δstyling(['foo'], ['width']);
ΔelementEnd();
ɵɵelementStart(0, 'div');
ɵɵstyling(['foo'], ['width']);
ɵɵelementEnd();
}
if (rf & RenderFlags.Update) {
Δselect(0);
ΔstyleMap(styleMapFactory);
ΔclassMap(classMapFactory);
ΔstyleProp(0, widthFactory);
ΔclassProp(0, fooFactory);
ΔstylingApply();
ɵɵselect(0);
ɵɵstyleMap(styleMapFactory);
ɵɵclassMap(classMapFactory);
ɵɵstyleProp(0, widthFactory);
ɵɵclassProp(0, fooFactory);
ɵɵstylingApply();
}
}
});
@ -3174,7 +3174,7 @@ describe('style and class based bindings', () => {
let fooFactory = bindPlayerFactory(buildFn, true) as BoundPlayerFactory<any>;
class Comp {
static ngComponentDef = ΔdefineComponent({
static ngComponentDef = ɵɵdefineComponent({
type: Comp,
selectors: [['comp']],
directives: [Comp],
@ -3183,17 +3183,17 @@ describe('style and class based bindings', () => {
vars: 0,
template: (rf: RenderFlags, ctx: Comp) => {
if (rf & RenderFlags.Create) {
ΔelementStart(0, 'div');
Δstyling(['foo'], ['width']);
ΔelementEnd();
ɵɵelementStart(0, 'div');
ɵɵstyling(['foo'], ['width']);
ɵɵelementEnd();
}
if (rf & RenderFlags.Update) {
Δselect(0);
ΔstyleMap(styleMapFactory);
ΔclassMap(classMapFactory);
ΔstyleProp(0, widthFactory);
ΔclassProp(0, fooFactory);
ΔstylingApply();
ɵɵselect(0);
ɵɵstyleMap(styleMapFactory);
ɵɵclassMap(classMapFactory);
ɵɵstyleProp(0, widthFactory);
ɵɵclassProp(0, fooFactory);
ɵɵstylingApply();
}
}
});
@ -3251,18 +3251,18 @@ describe('style and class based bindings', () => {
const fooFactory2 = bindPlayerFactory(classBuildFn, true);
class MyDir {
static ngDirectiveDef = ΔdefineDirective({
static ngDirectiveDef = ɵɵdefineDirective({
type: MyDir,
selectors: [['', 'my-dir', '']],
factory: () => new MyDir(),
hostBindings: function(rf: RenderFlags, ctx: MyDir, elementIndex: number) {
if (rf & RenderFlags.Create) {
Δstyling(['foo'], ['width']);
ɵɵstyling(['foo'], ['width']);
}
if (rf & RenderFlags.Update) {
ΔstyleProp(0, ctx.widthFactory);
ΔclassProp(0, ctx.fooFactory);
ΔstylingApply();
ɵɵstyleProp(0, ctx.widthFactory);
ɵɵclassProp(0, ctx.fooFactory);
ɵɵstylingApply();
}
}
});
@ -3272,7 +3272,7 @@ describe('style and class based bindings', () => {
}
class Comp {
static ngComponentDef = ΔdefineComponent({
static ngComponentDef = ɵɵdefineComponent({
type: Comp,
selectors: [['comp']],
directives: [Comp, MyDir],
@ -3281,15 +3281,15 @@ describe('style and class based bindings', () => {
vars: 0,
template: (rf: RenderFlags, ctx: Comp) => {
if (rf & RenderFlags.Create) {
ΔelementStart(0, 'div', ['my-dir', '']);
Δstyling(['foo'], ['width']);
ΔelementEnd();
ɵɵelementStart(0, 'div', ['my-dir', '']);
ɵɵstyling(['foo'], ['width']);
ɵɵelementEnd();
}
if (rf & RenderFlags.Update) {
Δselect(0);
ΔstyleProp(0, ctx.widthFactory);
ΔclassProp(0, ctx.fooFactory);
ΔstylingApply();
ɵɵselect(0);
ɵɵstyleProp(0, ctx.widthFactory);
ɵɵclassProp(0, ctx.fooFactory);
ɵɵstylingApply();
}
}
});

View File

@ -8,12 +8,12 @@
import {QueryList} from '@angular/core';
import {RenderFlags} from '@angular/core/src/render3';
import {getHostElement, ΔdefineComponent, ΔloadViewQuery, ΔviewQuery} from '../../../src/render3/index';
import {markDirty, Δelement, ΔelementEnd, ΔelementStart, Δselect, Δstyling, ΔstylingApply} from '../../../src/render3/instructions/all';
import {getHostElement, ɵɵdefineComponent, ɵɵloadViewQuery, ɵɵviewQuery} from '../../../src/render3/index';
import {markDirty, ɵɵelement, ɵɵelementEnd, ɵɵelementStart, ɵɵselect, ɵɵstyling, ɵɵstylingApply} from '../../../src/render3/instructions/all';
import {PlayState, Player, PlayerHandler} from '../../../src/render3/interfaces/player';
import {RElement} from '../../../src/render3/interfaces/renderer';
import {addPlayer, getPlayers} from '../../../src/render3/players';
import {ΔqueryRefresh} from '../../../src/render3/query';
import {ɵɵqueryRefresh} from '../../../src/render3/query';
import {getOrCreatePlayerContext} from '../../../src/render3/styling/util';
import {ComponentFixture} from '../render_util';
@ -228,7 +228,7 @@ function buildElementWithStyling() {
}
class Comp {
static ngComponentDef = ΔdefineComponent({
static ngComponentDef = ɵɵdefineComponent({
type: Comp,
exportAs: ['child'],
selectors: [['child-comp']],
@ -237,7 +237,7 @@ class Comp {
vars: 0,
template: (rf: RenderFlags, ctx: Comp) => {
if (rf & RenderFlags.Create) {
Δelement(0, 'div');
ɵɵelement(0, 'div');
}
ctx.logger();
}
@ -248,7 +248,7 @@ class Comp {
}
class CompWithStyling {
static ngComponentDef = ΔdefineComponent({
static ngComponentDef = ɵɵdefineComponent({
type: CompWithStyling,
exportAs: ['child-styled'],
selectors: [['child-styled-comp']],
@ -257,13 +257,13 @@ class CompWithStyling {
vars: 0,
template: (rf: RenderFlags, ctx: CompWithStyling) => {
if (rf & RenderFlags.Create) {
ΔelementStart(0, 'div');
Δstyling(['fooClass']);
ΔelementEnd();
ɵɵelementStart(0, 'div');
ɵɵstyling(['fooClass']);
ɵɵelementEnd();
}
if (rf & RenderFlags.Update) {
Δselect(0);
ΔstylingApply();
ɵɵselect(0);
ɵɵstylingApply();
}
}
});
@ -272,7 +272,7 @@ class CompWithStyling {
}
class SuperComp {
static ngComponentDef = ΔdefineComponent({
static ngComponentDef = ɵɵdefineComponent({
type: SuperComp,
selectors: [['super-comp']],
factory: () => new SuperComp(),
@ -280,18 +280,18 @@ class SuperComp {
vars: 0,
template: (rf: RenderFlags, ctx: SuperComp) => {
if (rf & RenderFlags.Create) {
ΔelementStart(0, 'div');
Δelement(1, 'child-comp', ['child', ''], ['child', 'child']);
ΔelementEnd();
ɵɵelementStart(0, 'div');
ɵɵelement(1, 'child-comp', ['child', ''], ['child', 'child']);
ɵɵelementEnd();
}
},
viewQuery: function(rf: RenderFlags, ctx: SuperComp) {
if (rf & RenderFlags.Create) {
ΔviewQuery(['child'], true, null);
ɵɵviewQuery(['child'], true, null);
}
if (rf & RenderFlags.Update) {
let tmp: any;
ΔqueryRefresh(tmp = ΔloadViewQuery<QueryList<any>>()) &&
ɵɵqueryRefresh(tmp = ɵɵloadViewQuery<QueryList<any>>()) &&
(ctx.query = tmp as QueryList<any>);
}
},