()
| 39 | } |
| 40 | |
| 41 | override execute(): TcbExpr { |
| 42 | const rawType = this.tcb.env.referenceTcbValue(this.dir.ref); |
| 43 | |
| 44 | let type: TcbExpr; |
| 45 | let span: ParseSourceSpan; |
| 46 | if ( |
| 47 | this.dir.isGeneric === false || |
| 48 | this.dir.typeParameters === null || |
| 49 | this.dir.typeParameters.length === 0 |
| 50 | ) { |
| 51 | type = rawType; |
| 52 | } else { |
| 53 | const typeArguments = Array(this.dir.typeParameters?.length ?? 0) |
| 54 | .fill('any') |
| 55 | .join(', '); |
| 56 | type = new TcbExpr(`${rawType.print()}<${typeArguments}>`); |
| 57 | } |
| 58 | |
| 59 | if (this.node instanceof HostElement) { |
| 60 | span = this.node.sourceSpan; |
| 61 | } else { |
| 62 | span = this.node.startSourceSpan || this.node.sourceSpan; |
| 63 | } |
| 64 | |
| 65 | const identifier = |
| 66 | this.dir.matchSource === MatchSource.HostDirective |
| 67 | ? ExpressionIdentifier.HOST_DIRECTIVE |
| 68 | : ExpressionIdentifier.DIRECTIVE; |
| 69 | const id = new TcbExpr(this.tcb.allocateId()) |
| 70 | .addExpressionIdentifier(identifier, this.directiveIndex) |
| 71 | .addParseSpanInfo(span); |
| 72 | this.scope.addStatement(declareVariable(id, type)); |
| 73 | return id; |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | /** |
nothing calls this directly
no test coverage detected
searching dependent graphs…