refactor(OutputAst): BuiltinMethod.bind renamed to Bind (#10739)
This commit is contained in:
parent
7f6685e451
commit
e9479b30e8
|
@ -157,7 +157,7 @@ export abstract class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
||||||
case o.BuiltinMethod.SubscribeObservable:
|
case o.BuiltinMethod.SubscribeObservable:
|
||||||
name = 'subscribe';
|
name = 'subscribe';
|
||||||
break;
|
break;
|
||||||
case o.BuiltinMethod.bind:
|
case o.BuiltinMethod.Bind:
|
||||||
name = 'bind';
|
name = 'bind';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -260,7 +260,7 @@ export class WritePropExpr extends Expression {
|
||||||
export enum BuiltinMethod {
|
export enum BuiltinMethod {
|
||||||
ConcatArray,
|
ConcatArray,
|
||||||
SubscribeObservable,
|
SubscribeObservable,
|
||||||
bind
|
Bind
|
||||||
}
|
}
|
||||||
|
|
||||||
export class InvokeMethodExpr extends Expression {
|
export class InvokeMethodExpr extends Expression {
|
||||||
|
|
|
@ -159,7 +159,7 @@ class StatementInterpreter implements o.StatementVisitor, o.ExpressionVisitor {
|
||||||
case o.BuiltinMethod.SubscribeObservable:
|
case o.BuiltinMethod.SubscribeObservable:
|
||||||
result = receiver.subscribe({next: args[0]});
|
result = receiver.subscribe({next: args[0]});
|
||||||
break;
|
break;
|
||||||
case o.BuiltinMethod.bind:
|
case o.BuiltinMethod.Bind:
|
||||||
result = receiver.bind(args[0]);
|
result = receiver.bind(args[0]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -277,7 +277,7 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
|
||||||
case o.BuiltinMethod.SubscribeObservable:
|
case o.BuiltinMethod.SubscribeObservable:
|
||||||
name = 'subscribe';
|
name = 'subscribe';
|
||||||
break;
|
break;
|
||||||
case o.BuiltinMethod.bind:
|
case o.BuiltinMethod.Bind:
|
||||||
name = 'bind';
|
name = 'bind';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -65,7 +65,7 @@ export class CompilePipe {
|
||||||
var pipeInstanceSeenFromPureProxy = getPropertyInView(this.instance, callingView, this.view);
|
var pipeInstanceSeenFromPureProxy = getPropertyInView(this.instance, callingView, this.view);
|
||||||
createPureProxy(
|
createPureProxy(
|
||||||
pipeInstanceSeenFromPureProxy.prop('transform')
|
pipeInstanceSeenFromPureProxy.prop('transform')
|
||||||
.callMethod(o.BuiltinMethod.bind, [pipeInstanceSeenFromPureProxy]),
|
.callMethod(o.BuiltinMethod.Bind, [pipeInstanceSeenFromPureProxy]),
|
||||||
args.length, purePipeProxyInstance, callingView);
|
args.length, purePipeProxyInstance, callingView);
|
||||||
return o.importExpr(Identifiers.castByValue)
|
return o.importExpr(Identifiers.castByValue)
|
||||||
.callFn([purePipeProxyInstance, pipeInstanceSeenFromPureProxy.prop('transform')])
|
.callFn([purePipeProxyInstance, pipeInstanceSeenFromPureProxy.prop('transform')])
|
||||||
|
|
|
@ -97,7 +97,7 @@ export class CompileEventListener {
|
||||||
var listenExpr: any /** TODO #9100 */;
|
var listenExpr: any /** TODO #9100 */;
|
||||||
var eventListener = o.THIS_EXPR.callMethod(
|
var eventListener = o.THIS_EXPR.callMethod(
|
||||||
'eventHandler',
|
'eventHandler',
|
||||||
[o.THIS_EXPR.prop(this._methodName).callMethod(o.BuiltinMethod.bind, [o.THIS_EXPR])]);
|
[o.THIS_EXPR.prop(this._methodName).callMethod(o.BuiltinMethod.Bind, [o.THIS_EXPR])]);
|
||||||
if (isPresent(this.eventTarget)) {
|
if (isPresent(this.eventTarget)) {
|
||||||
listenExpr = ViewProperties.renderer.callMethod(
|
listenExpr = ViewProperties.renderer.callMethod(
|
||||||
'listenGlobal', [o.literal(this.eventTarget), o.literal(this.eventName), eventListener]);
|
'listenGlobal', [o.literal(this.eventTarget), o.literal(this.eventName), eventListener]);
|
||||||
|
@ -117,7 +117,7 @@ export class CompileEventListener {
|
||||||
this.compileElement.view.subscriptions.push(subscription);
|
this.compileElement.view.subscriptions.push(subscription);
|
||||||
var eventListener = o.THIS_EXPR.callMethod(
|
var eventListener = o.THIS_EXPR.callMethod(
|
||||||
'eventHandler',
|
'eventHandler',
|
||||||
[o.THIS_EXPR.prop(this._methodName).callMethod(o.BuiltinMethod.bind, [o.THIS_EXPR])]);
|
[o.THIS_EXPR.prop(this._methodName).callMethod(o.BuiltinMethod.Bind, [o.THIS_EXPR])]);
|
||||||
this.compileElement.view.createMethod.addStmt(
|
this.compileElement.view.createMethod.addStmt(
|
||||||
subscription
|
subscription
|
||||||
.set(directiveInstance.prop(observablePropName)
|
.set(directiveInstance.prop(observablePropName)
|
||||||
|
|
|
@ -95,7 +95,7 @@ export function main() {
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
emitStmt(
|
emitStmt(
|
||||||
o.variable('fn').callMethod(o.BuiltinMethod.bind, [o.variable('someObj')]).toStmt()))
|
o.variable('fn').callMethod(o.BuiltinMethod.Bind, [o.variable('someObj')]).toStmt()))
|
||||||
.toEqual('fn.bind(someObj);');
|
.toEqual('fn.bind(someObj);');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ var _getExpressionsStmts: o.Statement[] = [
|
||||||
'invokeMethodExternalInstanceViaBind',
|
'invokeMethodExternalInstanceViaBind',
|
||||||
o.variable('externalInstance')
|
o.variable('externalInstance')
|
||||||
.prop('someMethod')
|
.prop('someMethod')
|
||||||
.callMethod(o.BuiltinMethod.bind, [o.variable('externalInstance')])
|
.callMethod(o.BuiltinMethod.Bind, [o.variable('externalInstance')])
|
||||||
.callFn([o.literal('someParam')])
|
.callFn([o.literal('someParam')])
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -124,7 +124,7 @@ var _getExpressionsStmts: o.Statement[] = [
|
||||||
'invokeMethodDynamicInstanceViaBind',
|
'invokeMethodDynamicInstanceViaBind',
|
||||||
o.variable('dynamicInstance')
|
o.variable('dynamicInstance')
|
||||||
.prop('dynamicMethod')
|
.prop('dynamicMethod')
|
||||||
.callMethod(o.BuiltinMethod.bind, [o.variable('dynamicInstance')])
|
.callMethod(o.BuiltinMethod.Bind, [o.variable('dynamicInstance')])
|
||||||
.callFn([o.literal('someParam')])
|
.callFn([o.literal('someParam')])
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
|
@ -97,7 +97,7 @@ export function main() {
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
emitStmt(
|
emitStmt(
|
||||||
o.variable('fn').callMethod(o.BuiltinMethod.bind, [o.variable('someObj')]).toStmt()))
|
o.variable('fn').callMethod(o.BuiltinMethod.Bind, [o.variable('someObj')]).toStmt()))
|
||||||
.toEqual('fn.bind(someObj);');
|
.toEqual('fn.bind(someObj);');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue