Skip to content

Commit

Permalink
Fix unsupported element access on 'this', see AssemblyScript#349
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO authored and Willem Wyndham committed Dec 26, 2018
1 parent 2846e81 commit 7a002d2
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ export class Resolver extends DiagnosticEmitter {
}
break;
}
case ElementKind.CLASS: { // element access on element access
case ElementKind.CLASS: {
let indexedGet = (<Class>target).lookupOverload(OperatorKind.INDEXED_GET);
if (!indexedGet) {
if (reportMode == ReportMode.REPORT) {
Expand All @@ -516,13 +516,18 @@ export class Resolver extends DiagnosticEmitter {
}
return null;
}
let returnType = indexedGet.signature.returnType;
if (target = returnType.classReference) {
this.currentThisExpression = targetExpression;
this.currentElementExpression = elementAccess.elementExpression;
return target;
if (targetExpression.kind == NodeKind.ELEMENTACCESS) { // nested element access
let returnType = indexedGet.signature.returnType;
if (target = returnType.classReference) {
this.currentThisExpression = targetExpression;
this.currentElementExpression = elementAccess.elementExpression;
return target;
}
return null;
}
break;
this.currentThisExpression = targetExpression;
this.currentElementExpression = elementAccess.elementExpression;
return target;
}
}
if (reportMode == ReportMode.REPORT) {
Expand Down

0 comments on commit 7a002d2

Please sign in to comment.