Skip to content

Commit 72e1372

Browse files
committed
(feat) Add String Interpolation to AssemblyScript near/near-sdk-as#201
1 parent 1733927 commit 72e1372

File tree

4 files changed

+11
-138
lines changed

4 files changed

+11
-138
lines changed

NOTICE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ under the licensing terms detailed in LICENSE:
2525
* Guido Zuidhof <[email protected]>
2626
2727
* Andrew Davis <[email protected]>
28+
2829

2930
Portions of this software are derived from third-party works licensed under
3031
the following terms:

src/ast.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,7 @@ export abstract class Node {
376376
value: string,
377377
range: Range
378378
): StringLiteralExpression {
379-
var expr = new StringLiteralExpression();
380-
expr.range = range;
381-
expr.value = value;
382-
return expr;
379+
return new TemplateLiteralExpression(value, range);
383380
}
384381

385382
static createSuperExpression(
@@ -1445,10 +1442,13 @@ export class StringLiteralExpression extends LiteralExpression {
14451442

14461443
/** Represents a string template literal expression. */
14471444
export class TemplateLiteralExpression extends LiteralExpression {
1448-
literalKind = LiteralKind.TEMPLATE;
1449-
1450-
/** String value without quotes. */
1451-
value: string;
1445+
constructor(
1446+
/** String value without quotes. */
1447+
public expresssionParts: Expression[],
1448+
/** Source range. */
1449+
range: Range
1450+
) {
1451+
super(LiteralKind.TEMPLATE, range);
14521452
}
14531453

14541454
/** Represents a `super` expression. */

src/compiler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8780,8 +8780,8 @@ export class Compiler extends DiagnosticEmitter {
87808780
return module.unreachable();
87818781
}
87828782

8783-
compileTemplateLiteral(arg0: TemplateLiteralExpression, constraints: Constraints): ExpressionRef {
8784-
const innerExpressions: ExpressionRef[] = [];
8783+
compileTemplateLiteral(expr: TemplateLiteralExpression, constraints: Constraints): ExpressionRef {
8784+
const innerExpressions: ExpressionRef[] = expr.expresssionParts;
87858785

87868786
return 0;
87878787
}

yarn-error.log

Lines changed: 0 additions & 128 deletions
This file was deleted.

0 commit comments

Comments
 (0)