use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.
the class SmallVisitor method visit.
@Override
public void visit(Tree.Parameter that) {
Declaration preva = assigning;
assigning = that.getParameterModel().getModel();
super.visit(that);
assigning = preva;
}
use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.
the class SmallVisitor method visit.
@Override
public void visit(Tree.AnyAttribute that) {
Declaration preva = assigning;
assigning = that.getDeclarationModel();
super.visit(that);
assigning = preva;
}
use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.
the class SmallVisitor method visit.
@Override
public void visit(Tree.SpecifierStatement that) {
Declaration d = that.getDeclaration();
if (d == null) {
if (that.getBaseMemberExpression() instanceof Tree.MemberOrTypeExpression) {
d = ((Tree.MemberOrTypeExpression) that.getBaseMemberExpression()).getDeclaration();
}
}
Declaration preva = assigning;
assigning = d;
super.visit(that);
assigning = preva;
/*
Declaration d = that.getDeclaration();
if (Decl.isSmall(d)) {
Tree.Term term = that.getSpecifierExpression().getExpression().getTerm();
checkSmallAssignment(d, term);
}*/
}
use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.
the class SmallVisitor method visit.
@Override
public void visit(Tree.PositionalArgument that) {
Declaration d;
if (that.getParameter() != null) {
d = that.getParameter().getModel();
} else {
d = null;
}
Declaration preva = assigning;
assigning = d;
super.visit(that);
assigning = preva;
}
use of org.eclipse.ceylon.model.typechecker.model.Declaration in project ceylon by eclipse.
the class JsonPackage method loadMethod.
@SuppressWarnings("unchecked")
Function loadMethod(String name, Map<String, Object> m, Scope parent, final List<TypeParameter> existing) {
Function md = new Function();
md.setName(name);
m.remove(KEY_NAME);
md.setContainer(parent);
md.setScope(parent);
setAnnotations(md, (Integer) m.remove(KEY_PACKED_ANNS), m.remove(KEY_ANNOTATIONS));
md.setUnit(u2);
if (parent == this) {
// Top-level declarations are directly added to the unit
u2.addDeclaration(md);
addMember(null);
}
if (m.containsKey(KEY_FLAGS)) {
int flags = (int) m.remove(KEY_FLAGS);
md.setDeclaredVoid((flags & 1) > 0);
md.setDeferred((flags & 2) > 0);
}
md.setDynamic(m.remove(KEY_DYNAMIC) != null);
final List<TypeParameter> tparms = parseTypeParameters((List<Map<String, Object>>) m.get(KEY_TYPE_PARAMS), md, existing);
final List<TypeParameter> allparms = JsonPackage.merge(tparms, existing);
md.setType(getTypeFromJson((Map<String, Object>) m.remove(KEY_TYPE), parent instanceof Declaration ? (Declaration) parent : null, allparms));
List<List<Map<String, Object>>> paramLists = (List<List<Map<String, Object>>>) m.remove(KEY_PARAMS);
if (paramLists == null) {
md.addParameterList(new ParameterList());
} else {
boolean first = true;
for (List<Map<String, Object>> plist : paramLists) {
ParameterList _params = parseParameters(plist, md, allparms);
_params.setNamedParametersSupported(first);
first = false;
md.addParameterList(_params);
for (Parameter p : _params.getParameters()) {
md.addMember(p.getModel());
}
}
}
return md;
}
Aggregations