mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-07-02 16:11:49 +00:00
Parser fixes; Lib updates
This commit is contained in:
@ -33,10 +33,12 @@ import {
|
||||
DecoratorKind,
|
||||
|
||||
Expression,
|
||||
AssertionExpression,
|
||||
ElementAccessExpression,
|
||||
IdentifierExpression,
|
||||
LiteralExpression,
|
||||
LiteralKind,
|
||||
ParenthesizedExpression,
|
||||
PropertyAccessExpression,
|
||||
StringLiteralExpression,
|
||||
SuperExpression,
|
||||
@ -66,7 +68,8 @@ import {
|
||||
hasDecorator,
|
||||
hasModifier,
|
||||
mangleInternalName,
|
||||
getFirstDecorator
|
||||
getFirstDecorator,
|
||||
BinaryExpression
|
||||
} from "./ast";
|
||||
|
||||
import {
|
||||
@ -1156,8 +1159,22 @@ export class Program extends DiagnosticEmitter {
|
||||
|
||||
resolveExpression(expression: Expression, contextualFunction: Function): ResolvedElement | null {
|
||||
var classType: Class | null;
|
||||
|
||||
while (expression.kind == NodeKind.PARENTHESIZED)
|
||||
expression = (<ParenthesizedExpression>expression).expression;
|
||||
|
||||
switch (expression.kind) {
|
||||
|
||||
case NodeKind.ASSERTION:
|
||||
var type = this.resolveType((<AssertionExpression>expression).toType); // reports
|
||||
if (type && (classType = type.classType))
|
||||
return (resolvedElement || (resolvedElement = new ResolvedElement())).set(classType);
|
||||
return null;
|
||||
|
||||
case NodeKind.BINARY:
|
||||
// TODO: string concatenation, mostly
|
||||
throw new Error("not implemented");
|
||||
|
||||
case NodeKind.THIS: // -> Class
|
||||
if (classType = contextualFunction.instanceMethodOf)
|
||||
return (resolvedElement || (resolvedElement = new ResolvedElement())).set(classType);
|
||||
|
Reference in New Issue
Block a user