use of org.eclipse.ceylon.model.typechecker.model.Module in project ceylon by eclipse.
the class ExpressionTransformer method makePackageLiteralCall.
private JCExpression makePackageLiteralCall(Package pkg) {
// get the module
Module module = pkg.getModule();
JCExpression moduleCall = makeModuleLiteralCall(module);
// now get the package
return make().Apply(null, makeSelect(moduleCall, "findPackage"), List.<JCExpression>of(ceylonLiteral(pkg.getNameAsString())));
}
use of org.eclipse.ceylon.model.typechecker.model.Module in project ceylon by eclipse.
the class CeylonClassWriter method writeClass.
@Override
public JavaFileObject writeClass(ClassSymbol c) throws IOException, PoolOverflow, StringOverflow {
String packageName = c.packge().getQualifiedName().toString();
Package pkg = modelLoader.findPackage(packageName);
if (pkg == null)
throw new RuntimeException("Failed to find package: " + packageName);
Module module = pkg.getModule();
fileManager.setModule(module);
return super.writeClass(c);
}
use of org.eclipse.ceylon.model.typechecker.model.Module in project ceylon by eclipse.
the class JsIdentifierNames method setter.
/**
* Determine the function name to be used in the generated JavaScript code
* for the setter of the given declaration.
*/
public String setter(Declaration decl) {
String name = getName(decl, true, false);
final Module mod = decl.getUnit().getPackage().getModule();
if (mod.getJsMajor() > 0 && (mod.getJsMajor() < 9 || (mod.getJsMajor() == 9 && mod.getJsMinor() < 1))) {
return String.format("set%c%s", Character.toUpperCase(name.charAt(0)), name.substring(1));
}
return String.format("set$%s", name);
}
use of org.eclipse.ceylon.model.typechecker.model.Module in project ceylon by eclipse.
the class JsOutput method encodeModel.
public void encodeModel(final JsIdentifierNames names) throws IOException {
if (!modelDone) {
modelDone = true;
writeModelFile();
out("\nvar _CTM$;function $CCMM$(){if (_CTM$===undefined)_CTM$=");
writeModelRetriever();
out(";return _CTM$;}\n");
out("ex$.$CCMM$=$CCMM$;\n");
if (!compilingLanguageModule) {
Module clm = module.getLanguageModule();
clalias = names.moduleAlias(clm) + ".";
require(clm, names);
out(clalias, "$addmod$(ex$,'", module.getNameAsString(), "/", module.getVersion(), "');\n");
}
}
}
use of org.eclipse.ceylon.model.typechecker.model.Module in project ceylon by eclipse.
the class ModuleSourceMapper method attachErrorToDependencyDeclaration.
public void attachErrorToDependencyDeclaration(ModuleImport moduleImport, List<Module> dependencyTree, String error, boolean isError) {
if (!attachErrorToDependencyDeclaration(moduleImport, error, isError)) {
// the error to
if (dependencyTree.size() >= 2) {
Module rootModule = dependencyTree.get(0);
Module originalImportedModule = dependencyTree.get(1);
// find the original import
for (ModuleImport imp : rootModule.getImports()) {
if (imp.getModule() == originalImportedModule) {
// found it, try to attach the error
if (attachErrorToDependencyDeclaration(imp, error, isError)) {
// we're done
return;
} else {
// failed
break;
}
}
}
}
System.err.println("This might be a type checker bug, please report. \nExpecting to add missing dependency error on non present definition: " + error);
}
}
Aggregations