Skip to content

Commit 9b23412

Browse files
committed
Frege 3.21.232-g7b05453 changes
1 parent 6ea3d8d commit 9b23412

File tree

2 files changed

+29
-36
lines changed

2 files changed

+29
-36
lines changed

pom.xml

+17-32
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
<properties>
1111
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1212
<project.build.sourceDirectory>src/main/frege</project.build.sourceDirectory>
13-
<frege.version>3.21.190-g714a7cc</frege.version>
13+
<frege.version>frege-3.21.232-g7b05453</frege.version>
14+
<frege.plugin.version>1.0.5</frege.plugin.version>
1415
</properties>
1516
<build>
1617
<pluginManagement>
@@ -44,36 +45,25 @@
4445
</pluginManagement>
4546
<plugins>
4647
<plugin>
47-
<artifactId>maven-antrun-plugin</artifactId>
48-
<version>1.7</version>
48+
<groupId>com.theoryinpractise.frege</groupId>
49+
<artifactId>frege-maven-plugin</artifactId>
50+
<version>${frege.plugin.version}</version>
4951
<executions>
5052
<execution>
51-
<phase>compile</phase>
52-
<configuration>
53-
<target>
54-
<property name="compile_classpath" refid="maven.compile.classpath" />
55-
<property name="outputDir"
56-
value="${project.build.outputDirectory}" />
57-
<property name="sourceDir" value="src/main/frege" />
58-
<property name="fregec" value="${frege:frege:jar}" />
59-
<exec executable="java" failonerror="true">
60-
<arg value="-Xss1m" />
61-
<arg value="-Dfrege.javac=javac" />
62-
<arg value="-classpath" />
63-
<arg value="${compile_classpath}" />
64-
<arg value="frege.compiler.Main" />
65-
<arg value="-d" />
66-
<arg path="${outputDir}" />
67-
<arg value="${sourceDir}/frege/repl/FregeRepl.fr" />
68-
</exec>
69-
</target>
70-
</configuration>
53+
<id>compile</id>
54+
<phase>generate-sources</phase>
7155
<goals>
72-
<goal>run</goal>
56+
<goal>compile</goal>
7357
</goals>
7458
</execution>
7559
</executions>
60+
<configuration>
61+
<inline>true</inline>
62+
<hints>true</hints>
63+
<includeStale>false</includeStale>
64+
</configuration>
7665
</plugin>
66+
7767
<plugin>
7868
<groupId>org.codehaus.mojo</groupId>
7969
<artifactId>exec-maven-plugin</artifactId>
@@ -143,11 +133,6 @@
143133
<artifactId>jline</artifactId>
144134
<version>2.10</version>
145135
</dependency>
146-
<dependency>
147-
<groupId>frege</groupId>
148-
<artifactId>frege</artifactId>
149-
<version>${frege.version}</version>
150-
</dependency>
151136
<dependency>
152137
<groupId>frege</groupId>
153138
<artifactId>frege-interpreter</artifactId>
@@ -159,9 +144,9 @@
159144
<version>1.0-SNAPSHOT</version>
160145
</dependency>
161146
<dependency>
162-
<groupId>org.eclipse.jdt.core.compiler</groupId>
163-
<artifactId>ecj</artifactId>
164-
<version>3.7.2</version>
147+
<groupId>org.eclipse.jdt.core.compiler</groupId>
148+
<artifactId>ecj</artifactId>
149+
<version>4.2.2</version>
165150
</dependency>
166151
</dependencies>
167152
</project>

src/main/frege/frege/repl/FregeRepl.fr

+12-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import frege.interpreter.FregeScriptCompiler hiding(compile)
99
import frege.interpreter.FregeInterpreter
1010
import frege.compiler.Data(Global)
1111
import frege.compiler.EclipseUtil as EU()
12-
import frege.List as FL (Tree, values)
1312

1413
data ReplState = ReplState {
1514
lastExternalScript :: Maybe String,
@@ -69,7 +68,9 @@ evalScript (BrowseModule m) = do
6968
let moduleName = trim m
7069
replState <- Repl.get
7170
state <- Repl . lift $ Interpreter.get
72-
global <- liftIO $ MemoryClassLoader.new state.loader state.classes >>= standardOptions
71+
javac <- liftIO $ MemoryJavaCompiler.new state.loader state.classes
72+
loader <- liftIO $ javac.classLoader
73+
global <- liftIO $ standardOptions loader
7374
let res = outlineModule moduleName global
7475
return . ReplSuccess $ intercalate newLine res
7576

@@ -81,14 +82,21 @@ evalScript Browse = do
8182
else
8283
evalScript $ BrowseModule state.moduleName
8384

84-
evalScript (Type expr) = Repl.get >>= Repl . lift . interpret where
85-
interpret replState = do
85+
evalScript (Type expr) = do
86+
state <- Repl . lift $ Interpreter.get
87+
javac <- liftIO $ MemoryJavaCompiler.new state.loader state.classes
88+
loader <- liftIO $ javac.classLoader
89+
global <- liftIO $ standardOptions loader
90+
let typeOfExpr = Repl . lift . interpret $ state
91+
interpret replState = do
8692
oldState <- Interpreter.get
8793
typeOfExpression <- typeOfExpression expr
8894
Interpreter.put oldState
8995
case typeOfExpression of
9096
Right typ -> return $ ReplSuccess typ
9197
Left errs -> return $ ReplError errs
98+
maybe typeOfExpr (return . ReplSuccess . flip getSymbolType global) $ lookupVarSymbol global.thisTab expr
99+
92100

93101
evalScript (Load (urlSpec@#.*?://#)) = do
94102
urle <- liftIO $ URL.new urlSpec

0 commit comments

Comments
 (0)