Only clear result of executable snippets. Fixes #24.

This commit is contained in:
SpencerPark 2018-08-21 13:05:45 -04:00
parent 807592e25f
commit 32974b3f39
2 changed files with 11 additions and 3 deletions

View File

@ -12,7 +12,7 @@ import com.github.jk1.license.filter.*
import io.github.spencerpark.gradle.*
group = 'io.github.spencerpark'
version = '1.1.1'
version = '1.1.2'
wrapper {
gradleVersion = '4.8.1'

View File

@ -75,8 +75,16 @@ public class CodeEvaluator {
String key = event.value();
if (key == null) continue;
Object value = executionControl.takeResult(key);
switch (event.snippet().subKind()) {
Snippet.SubKind subKind = event.snippet().subKind();
// Only executable snippets make their way through the machinery we have setup in the
// IJavaExecutionControl. Declarations for example simply take their default value without
// being executed.
Object value = subKind.isExecutable()
? executionControl.takeResult(key)
: event.value();
switch (subKind) {
case VAR_VALUE_SUBKIND:
case OTHER_EXPRESSION_SUBKIND:
case TEMP_VAR_EXPRESSION_SUBKIND: