use of org.eclipse.ceylon.model.typechecker.model.Scope in project ceylon by eclipse.
the class DeclarationVisitor method visit.
@Override
public void visit(Tree.FunctionArgument that) {
Tree.Type type = that.getType();
final Function f = new Function();
f.setName("anonymous#" + fid++);
f.setAnonymous(true);
if (type.getToken() != null) {
f.setDeclaredVoid(type instanceof Tree.VoidModifier);
} else {
Tree.Block block = that.getBlock();
if (block != null) {
f.setDeclaredVoid(true);
new Visitor() {
@Override
public void visit(Tree.Declaration that) {
}
@Override
public void visit(Tree.TypedArgument that) {
}
@Override
public void visit(Tree.ObjectExpression that) {
}
@Override
public void visit(Tree.FunctionArgument that) {
}
@Override
public void visit(Tree.Return that) {
if (that.getExpression() != null) {
f.setDeclaredVoid(false);
}
super.visit(that);
}
}.visit(block);
}
}
that.setDeclarationModel(f);
visitArgument(that, f);
Scope o = enterScope(f);
Declaration d = beginDeclaration(f);
super.visit(that);
endDeclaration(d);
exitScope(o);
setParameterLists(f, that.getParameterLists(), that);
}
use of org.eclipse.ceylon.model.typechecker.model.Scope in project ceylon by eclipse.
the class DeclarationVisitor method visit.
@Override
public void visit(Tree.ObjectExpression that) {
Class c = new Class();
c.setName("anonymous#" + fid++);
c.setNamed(false);
defaultExtendedToBasic(c);
c.setAnonymous(true);
that.setAnonymousClass(c);
visitArgument(that, c);
Scope o = enterScope(c);
super.visit(that);
exitScope(o);
}
use of org.eclipse.ceylon.model.typechecker.model.Scope in project ceylon by eclipse.
the class DeclarationVisitor method visit.
@Override
public void visit(Tree.AnyMethod that) {
Function m = new Function();
that.setDeclarationModel(m);
visitDeclaration(that, m);
Scope o = enterScope(m);
super.visit(that);
exitScope(o);
setParameterLists(m, that.getParameterLists(), that);
Tree.Type type = that.getType();
m.setDeclaredVoid(type instanceof Tree.VoidModifier);
if (type instanceof Tree.ValueModifier) {
type.addError("functions may not be declared using the keyword value");
}
if (type instanceof Tree.DynamicModifier) {
m.setDynamicallyTyped(true);
}
}
use of org.eclipse.ceylon.model.typechecker.model.Scope in project ceylon by eclipse.
the class DeclarationVisitor method visit.
@Override
public void visit(Tree.ObjectArgument that) {
Class c = new Class();
defaultExtendedToBasic(c);
c.setAnonymous(true);
that.setAnonymousClass(c);
visitArgument(that, c);
Value v = new Value();
that.setDeclarationModel(v);
visitArgument(that, v);
Type t = c.getType();
that.getType().setTypeModel(t);
v.setType(t);
Scope o = enterScope(c);
super.visit(that);
exitScope(o);
}
use of org.eclipse.ceylon.model.typechecker.model.Scope in project ceylon by eclipse.
the class DeclarationVisitor method visit.
@Override
public void visit(Tree.ImportModuleList that) {
ModuleImportList il = new ModuleImportList();
il.setContainer(scope);
il.setUnit(unit);
Scope o = enterScope(il);
super.visit(that);
exitScope(o);
}
Aggregations