Skip to content

Commit 1d93877

Browse files
committed
Fix unsupported element access on 'this', see AssemblyScript#349
1 parent 7596d73 commit 1d93877

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/resolver.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ export class Resolver extends DiagnosticEmitter {
505505
}
506506
break;
507507
}
508-
case ElementKind.CLASS: { // element access on element access
508+
case ElementKind.CLASS: {
509509
let indexedGet = (<Class>target).lookupOverload(OperatorKind.INDEXED_GET);
510510
if (!indexedGet) {
511511
if (reportMode == ReportMode.REPORT) {
@@ -516,13 +516,18 @@ export class Resolver extends DiagnosticEmitter {
516516
}
517517
return null;
518518
}
519-
let returnType = indexedGet.signature.returnType;
520-
if (target = returnType.classReference) {
521-
this.currentThisExpression = targetExpression;
522-
this.currentElementExpression = elementAccess.elementExpression;
523-
return target;
519+
if (targetExpression.kind == NodeKind.ELEMENTACCESS) { // nested element access
520+
let returnType = indexedGet.signature.returnType;
521+
if (target = returnType.classReference) {
522+
this.currentThisExpression = targetExpression;
523+
this.currentElementExpression = elementAccess.elementExpression;
524+
return target;
525+
}
526+
return null;
524527
}
525-
break;
528+
this.currentThisExpression = targetExpression;
529+
this.currentElementExpression = elementAccess.elementExpression;
530+
return target;
526531
}
527532
}
528533
if (reportMode == ReportMode.REPORT) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy