File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,11 @@ class PlaceholderSubstituter {
76
76
}
77
77
}
78
78
79
+ const kText = Symbol ( 'kText' )
80
+
79
81
class StandardTemplateContext /* implements TemplateContext */ {
82
+ private [ kText ] : string | undefined = undefined
83
+
80
84
constructor (
81
85
public readonly typescript : typeof ts ,
82
86
public readonly fileName : string ,
@@ -113,13 +117,16 @@ class StandardTemplateContext /* implements TemplateContext */ {
113
117
114
118
// @memoize
115
119
public get text ( ) : string {
116
- return this . typescript . isTemplateExpression ( this . node )
117
- ? PlaceholderSubstituter . replacePlaceholders (
118
- this . typescript ,
119
- this . templateSettings ,
120
- this . node ,
121
- )
122
- : this . node . text
120
+ return (
121
+ this [ kText ] ||
122
+ ( this [ kText ] = this . typescript . isTemplateExpression ( this . node )
123
+ ? PlaceholderSubstituter . replacePlaceholders (
124
+ this . typescript ,
125
+ this . templateSettings ,
126
+ this . node ,
127
+ )
128
+ : this . node . text )
129
+ )
123
130
}
124
131
125
132
// @memoize
You can’t perform that action at this time.
0 commit comments