Add an extra flag in the JSON AST to tell apart "x->f" (field access) and
"x->f()" (which actually means "f(x)").
This commit is contained in:
Jonathan Protzenko 2015-05-19 15:10:00 -07:00
Родитель 10c7f04346
Коммит 45ccbfae36
3 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -553,6 +553,7 @@ module TDev.AST.Json
var r = this.visitPropertyRef(n.propRef)
r.nodeType = "call";
r.args = this.toJsons(n.args);
r.isExtensionMethod = n.propRef.prop instanceof AST.ExtensionProperty;
return r;
}

Просмотреть файл

@ -126,6 +126,11 @@ module TDev.AST.Json
export interface JCall extends JPropertyRef, JExpr
{
args:JExpr[];
// The field below allows to tell the difference between f->x (a
// reference to a field from a record, for which [isExtensionMethod] is
// false) and f->x() (a call to function x which takes f as a parameter,
// but that is represented as an "extension method")
isExtensionMethod: boolean;
}
// Expressions can be represented in two different manners.

Просмотреть файл

@ -31,6 +31,7 @@ module TDev {
}],
name: libs[i].name,
parent: null,
isExtensionMethod: false,
};
}