}
}
static void generateMemberLiteral(final Tree.MemberLiteral that, final GenerateJsVisitor gen) {
final com.redhat.ceylon.compiler.typechecker.model.ProducedReference ref = that.getTarget();
final ProducedType ltype = that.getType() == null ? null : that.getType().getTypeModel();
final Declaration d = ref.getDeclaration();
final Class anonClass = d.isMember()&&d.getContainer() instanceof Class && ((Class)d.getContainer()).isAnonymous()?(Class)d.getContainer():null;
if (that instanceof Tree.FunctionLiteral || d instanceof Method) {
gen.out(gen.getClAlias(), d.isMember()&&anonClass==null?"AppliedMethod$meta$model(":"AppliedFunction$meta$model(");
if (ltype == null) {
if (anonClass != null) {
gen.qualify(that, anonClass);
gen.out(gen.getNames().objectName(anonClass), ".");
} else {
gen.qualify(that, d);
}
} else {
if (ltype.getDeclaration().isMember()) {
outputPathToDeclaration(that, ltype.getDeclaration(), gen);
} else {
gen.qualify(that, ltype.getDeclaration());
}
gen.out(gen.getNames().name(ltype.getDeclaration()));
gen.out(".$$.prototype.");
}
if (d instanceof Value) {
gen.out("$prop$", gen.getNames().getter(d), ",");
} else {
gen.out(gen.getNames().name(d),",");
}
if (d.isMember()&&anonClass==null) {
if (that.getTypeArgumentList()!=null) {
gen.out("[");
boolean first=true;
for (ProducedType targ : that.getTypeArgumentList().getTypeModels()) {
if (first)first=false;else gen.out(",");
gen.out(gen.getClAlias(),"typeLiteral$meta({Type$typeLiteral:");
TypeUtils.typeNameOrList(that, targ, gen, false);
gen.out("})");
}
gen.out("]");
gen.out(",");
} else {
gen.out("undefined,");
}
TypeUtils.printTypeArguments(that, that.getTypeModel().getTypeArguments(), gen, false,
that.getTypeModel().getVarianceOverrides());
} else {
TypeUtils.printTypeArguments(that, that.getTypeModel().getTypeArguments(), gen, false,
that.getTypeModel().getVarianceOverrides());
if (anonClass != null) {
gen.out(",");
gen.qualify(that, anonClass);
gen.out(gen.getNames().objectName(anonClass));
}
if (ref.getTypeArguments() != null && !ref.getTypeArguments().isEmpty()) {
if (anonClass == null) {
gen.out(",undefined");
}
gen.out(",");
TypeUtils.printTypeArguments(that, ref.getTypeArguments(), gen, false,
ref.getType().getVarianceOverrides());
}
}
gen.out(")");
} else if (that instanceof ValueLiteral || d instanceof Value) {
Value vd = (Value)d;
if (vd.isMember() && anonClass==null) {
gen.out(gen.getClAlias(), "$init$AppliedAttribute$meta$model()('");
gen.out(d.getName(), "',");
} else {
gen.out(gen.getClAlias(), "$init$AppliedValue$jsint()(");
if (anonClass == null) {
gen.out("undefined");
} else {
gen.qualify(that, anonClass);
gen.out(gen.getNames().objectName(anonClass));
}
gen.out(",");
}
if (ltype == null) {
if (anonClass != null) {
gen.qualify(that, anonClass);
gen.out(gen.getNames().objectName(anonClass), ".");
} else {
gen.qualify(that, d);
}
} else {
gen.qualify(that, ltype.getDeclaration());
gen.out(gen.getNames().name(ltype.getDeclaration()));
gen.out(".$$.prototype.");
}
if (d instanceof Value) {
gen.out("$prop$", gen.getNames().getter(d),",");
} else {
gen.out(gen.getNames().name(d),",");
}
TypeUtils.printTypeArguments(that, that.getTypeModel().getTypeArguments(), gen, false,
that.getTypeModel().getVarianceOverrides());
gen.out(")");
} else {
gen.out(gen.getClAlias(), "/*TODO:closed member literal*/typeLiteral$meta({Type$typeLiteral:");
gen.out("{t:");
if (ltype == null) {
gen.qualify(that, d);
} else {
gen.qualify(that, ltype.getDeclaration());
gen.out(gen.getNames().name(ltype.getDeclaration()));
gen.out(".$$.prototype.");
}
if (d instanceof Value) {
gen.out("$prop$", gen.getNames().getter(d));
} else {
gen.out(gen.getNames().name(d));
}
if (ltype != null && ltype.getTypeArguments() != null && !ltype.getTypeArguments().isEmpty()) {
gen.out(",a:");
TypeUtils.printTypeArguments(that, ltype.getTypeArguments(), gen, false,
ltype.getVarianceOverrides());
}
gen.out("}})");
}
}