Skip to content

Commit

Permalink
small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Frotty committed Dec 17, 2020
1 parent be4b7d9 commit 90da8e3
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 43 deletions.
Expand Up @@ -58,12 +58,6 @@ public ModelManagerImpl(File projectPath, BufferManager bufferManager) {

private WurstModel newModel(CompilationUnit cu, WurstGui gui) {
try {
Path jassdoc = getBuildDir().toPath().resolve("dependencies").resolve("jassdoc");
if (jassdoc.toFile().exists()) {
List<CompilationUnit> jassdocCUs = getJassdocCUs(jassdoc, gui);
jassdocCUs.add(cu);
return Ast.WurstModel(jassdocCUs);
}
CompilationUnit commonJ = compileFromJar(gui, "common.j");
CompilationUnit blizzardJ = compileFromJar(gui, "blizzard.j");
return Ast.WurstModel(blizzardJ, commonJ, cu);
Expand Down
Expand Up @@ -17,11 +17,13 @@ public static String normalizeAnnotation(String string) {

public static boolean hasAnnotation(NameDef e, String annotation) {
String norm = normalizeAnnotation(annotation);
for (Modifier m : e.getModifiers()) {
if (m instanceof Annotation) {
Annotation a = (Annotation) m;
if (normalizeAnnotation(a.getAnnotationType()).equals(norm)) {
return true;
if (e.getModifiers().size() > 0) {
for (Modifier m : e.getModifiers()) {
if (m instanceof Annotation) {
Annotation a = (Annotation) m;
if (normalizeAnnotation(a.getAnnotationType()).equals(norm)) {
return true;
}
}
}
}
Expand All @@ -30,11 +32,13 @@ public static boolean hasAnnotation(NameDef e, String annotation) {

public static Annotation getAnnotation(NameDef e, String annotation) {
String norm = normalizeAnnotation(annotation);
for (Modifier m : e.getModifiers()) {
if (m instanceof Annotation) {
Annotation a = (Annotation) m;
if (normalizeAnnotation(a.getAnnotationType()).equals(norm)) {
return a;
if (e.getModifiers().size() > 0) {
for (Modifier m : e.getModifiers()) {
if (m instanceof Annotation) {
Annotation a = (Annotation) m;
if (normalizeAnnotation(a.getAnnotationType()).equals(norm)) {
return a;
}
}
}
}
Expand Down
Expand Up @@ -49,9 +49,11 @@ public static boolean isConstant(HasModifier e) {
}

static boolean containsType(de.peeeq.wurstscript.ast.Modifiers modifiers, Class<? extends Modifier> class1) {
for (Modifier m : modifiers) {
if (m.getClass().getName().startsWith(class1.getName())) {
return true;
if (modifiers.size() > 0) {
for (Modifier m : modifiers) {
if (m.getClass().getName().startsWith(class1.getName())) {
return true;
}
}
}
return false;
Expand Down Expand Up @@ -103,4 +105,4 @@ private static boolean hasAnnotation(Modifiers modifiers, String name) {
}


}
}
Expand Up @@ -31,7 +31,7 @@ public ILInterpreter(ImProg prog, WurstGui gui, Optional<File> mapFile, ProgramS
this.prog = prog;
this.globalState = globalState;
globalState.addNativeProvider(new BuiltinFuncs(globalState));
globalState.addNativeProvider(new NativeFunctions());
// globalState.addNativeProvider(new NativeFunctions());
}

public ILInterpreter(ImProg prog, WurstGui gui, Optional<File> mapFile, boolean isCompiletime) {
Expand Down

This file was deleted.

Expand Up @@ -835,7 +835,7 @@ private boolean isExtern(TranslatedToImFunction funcDef) {

private boolean isBJ(WPos source) {
String f = source.getFile().toLowerCase();
return f.endsWith("blizzard.j") || f.endsWith("common.j") || FileUtils.getWPosParent(source).equals("jassdoc");
return f.endsWith("blizzard.j") || f.endsWith("common.j");
}

public ImFunction getInitFuncFor(WPackage p) {
Expand Down
Expand Up @@ -1184,8 +1184,7 @@ private void checkUninitializedVars(FunctionLike f) {

if (!f.getSource().getFile().endsWith("common.j")
&& !f.getSource().getFile().endsWith("blizzard.j")
&& !f.getSource().getFile().endsWith("war3map.j")
&& !FileUtils.getWPosParent(f.getSource()).equals("jassdoc")) {
&& !f.getSource().getFile().endsWith("war3map.j")) {
new DataflowAnomalyAnalysis(Utils.isJassCode(Optional.of(f))).execute(f);
}
}
Expand Down

0 comments on commit 90da8e3

Please sign in to comment.