feat(ivy): accept multiple values for exportAs in the compiler (#28001)
exportAs in @Directive metadata supports multiple values, separated by commas. Previously it was treated as a single value string. This commit modifies the compiler to understand that exportAs is a string[]. It stops short of carrying the multiple values through to the runtime. Instead, it only emits the first one. A future commit will modify the runtime to accept all the values. PR Close #28001
This commit is contained in:

committed by
Andrew Kushnir

parent
6003145422
commit
142553abc6
@ -117,7 +117,9 @@ function baseDirectiveFields(
|
||||
definitionMap.set('outputs', conditionallyCreateMapObjectLiteral(meta.outputs));
|
||||
|
||||
if (meta.exportAs !== null) {
|
||||
definitionMap.set('exportAs', o.literal(meta.exportAs));
|
||||
// TODO: handle multiple exportAs values (currently only the first is taken).
|
||||
const [exportAs] = meta.exportAs;
|
||||
definitionMap.set('exportAs', o.literal(exportAs));
|
||||
}
|
||||
|
||||
return {definitionMap, statements: result.statements};
|
||||
@ -605,7 +607,8 @@ function createTypeForDef(meta: R3DirectiveMetadata, typeBase: o.ExternalReferen
|
||||
return o.expressionType(o.importExpr(typeBase, [
|
||||
typeWithParameters(meta.type, meta.typeArgumentCount),
|
||||
stringAsType(selectorForType),
|
||||
meta.exportAs !== null ? stringAsType(meta.exportAs) : o.NONE_TYPE,
|
||||
// TODO: handle multiple exportAs values (currently only the first is taken).
|
||||
meta.exportAs !== null ? stringArrayAsType(meta.exportAs) : o.NONE_TYPE,
|
||||
stringMapAsType(meta.inputs),
|
||||
stringMapAsType(meta.outputs),
|
||||
stringArrayAsType(meta.queries.map(q => q.propertyName)),
|
||||
|
Reference in New Issue
Block a user