Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay creation of project root EnsoFile until it is really needed #6149

Merged
merged 21 commits into from
Apr 3, 2023
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
95e8918
Delay creation of project root EnsoFile until it is really needed
JaroslavTulach Mar 30, 2023
1e2b2c7
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Mar 30, 2023
0bd9e45
I/O operations shall be behind @TruffleBoundary
JaroslavTulach Mar 31, 2023
eef1296
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Mar 31, 2023
fb54884
javafmtAll
JaroslavTulach Mar 31, 2023
69d4624
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Mar 31, 2023
416e7fb
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Mar 31, 2023
3ed4fc7
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Mar 31, 2023
45b5da1
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Mar 31, 2023
dae7cba
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Mar 31, 2023
1433847
Move project description creation into its own method
JaroslavTulach Apr 1, 2023
6d60607
Merge branch 'wip/jtulach/DelayCreationOfProjectAtom' of enso:enso-or…
JaroslavTulach Apr 1, 2023
3792399
javafmtAll
JaroslavTulach Apr 1, 2023
ad50df2
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Apr 1, 2023
4b5d152
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Apr 1, 2023
e23fc4d
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Apr 2, 2023
7d7c23b
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Apr 3, 2023
ae30353
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Apr 3, 2023
d79f994
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Apr 3, 2023
efd8947
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Apr 3, 2023
5fe8bc6
Merge branch 'develop' into wip/jtulach/DelayCreationOfProjectAtom
mergify[bot] Apr 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.enso.interpreter.node.expression.constant;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.TruffleFile;
import com.oracle.truffle.api.TruffleLanguage;
import com.oracle.truffle.api.frame.VirtualFrame;
Expand All @@ -14,30 +15,38 @@

@NodeInfo(description = "Returns a language-level representation of the given Enso project.")
public class EnsoProjectNode extends RootNode {
private final Object result;
private final Optional<Package<TruffleFile>> pkgOpt;

public EnsoProjectNode(
TruffleLanguage<?> language, EnsoContext context, Optional<Package<TruffleFile>> pkgOpt) {
super(language);
this.pkgOpt = pkgOpt;
}

@Override
public Object execute(VirtualFrame frame) {
return createProjectDescription();
}

@CompilerDirectives.TruffleBoundary
private Object createProjectDescription() {
var context = EnsoContext.get(this);
if (pkgOpt.isPresent()) {
Package<TruffleFile> pkg = pkgOpt.get();
EnsoFile rootPath = new EnsoFile(pkg.root().normalize());
Object cfg = context.getEnvironment().asGuestValue(pkg.config());
result =
var result =
context
.getBuiltins()
.getProjectDescription()
.getUniqueConstructor()
.newInstance(rootPath, cfg);
return result;
} else {
result =
var result =
DataflowError.withoutTrace(
context.getBuiltins().error().makeModuleNotInPackageError(), this);
return result;
}
}

@Override
public Object execute(VirtualFrame frame) {
return result;
}
}