Browse Source

work on getting this working

Jared 5 years ago
parent
commit
4cbbe1f387
No account linked to committer's email address

+ 1
- 0
JavaIntegration/src/main/java/org/openzen/zencode/java/ScriptingEngine.java View File

@@ -47,6 +47,7 @@ public class ScriptingEngine {
47 47
             SemanticModule stdlibModule = stdlibs.loadModule(space, "stdlib", null, new SemanticModule[0], FunctionParameter.NONE, stdlib);
48 48
 			stdlibModule = Validator.validate(stdlibModule, error -> System.out.println(error.toString()));
49 49
 			space.addModule("stdlib", stdlibModule);
50
+			registerCompiled(stdlibModule);
50 51
 		} catch (CompileException | ParseException | IOException ex) {
51 52
 			throw new RuntimeException(ex);
52 53
 		}

+ 6
- 5
JavaShared/src/main/java/org/openzen/zenscript/javashared/prepare/JavaPrepareDefinitionVisitor.java View File

@@ -5,10 +5,6 @@
5 5
  */
6 6
 package org.openzen.zenscript.javashared.prepare;
7 7
 
8
-import org.openzen.zenscript.javashared.JavaNativeClass;
9
-import java.util.HashMap;
10
-import java.util.List;
11
-import java.util.Map;
12 8
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
13 9
 import org.openzen.zenscript.codemodel.annotations.NativeTag;
14 10
 import org.openzen.zenscript.codemodel.definition.AliasDefinition;
@@ -33,8 +29,13 @@ import org.openzen.zenscript.javashared.JavaCompiledModule;
33 29
 import org.openzen.zenscript.javashared.JavaContext;
34 30
 import org.openzen.zenscript.javashared.JavaMethod;
35 31
 import org.openzen.zenscript.javashared.JavaModifiers;
32
+import org.openzen.zenscript.javashared.JavaNativeClass;
36 33
 import org.openzen.zenscript.javashared.JavaVariantOption;
37 34
 
35
+import java.util.HashMap;
36
+import java.util.List;
37
+import java.util.Map;
38
+
38 39
 /**
39 40
  *
40 41
  * @author Hoofdgebruiker
@@ -72,7 +73,7 @@ public class JavaPrepareDefinitionVisitor implements DefinitionVisitor<JavaClass
72 73
 			JavaNativeClass list = new JavaNativeClass(new JavaClass("java.util", "List", JavaClass.Kind.INTERFACE));
73 74
 			JavaClass arrayList = new JavaClass("java.util", "ArrayList", JavaClass.Kind.CLASS);
74 75
 			list.addMethod("constructor", JavaMethod.getNativeConstructor(arrayList, "()V"));
75
-			list.addInstanceMethod("add", "add", "(Ljava/lang/Object;)Z"); List<?> l;
76
+			list.addInstanceMethod("add", "add", "(TE;)Z"); List<?> l;
76 77
 			list.addInstanceMethod("insert", "add", "(Ljava/lang/Object;I)V");
77 78
 			list.addInstanceMethod("remove", "remove", "(Ljava/lang/Object;)Z");
78 79
 			list.addInstanceMethod("indexOf", "indexOf", "(Ljava/lang/Object;)I");

+ 2
- 1
Parser/src/main/java/org/openzen/zenscript/parser/member/ParsedConstructor.java View File

@@ -14,6 +14,7 @@ import org.openzen.zenscript.codemodel.member.ConstructorMember;
14 14
 import org.openzen.zenscript.codemodel.member.FunctionalMember;
15 15
 import org.openzen.zenscript.codemodel.scope.TypeScope;
16 16
 import org.openzen.zenscript.codemodel.type.StoredType;
17
+import org.openzen.zenscript.codemodel.type.member.BuiltinID;
17 18
 import org.openzen.zenscript.parser.ParsedAnnotation;
18 19
 import org.openzen.zenscript.parser.definitions.ParsedFunctionHeader;
19 20
 import org.openzen.zenscript.parser.statements.ParsedFunctionBody;
@@ -34,7 +35,7 @@ public class ParsedConstructor extends ParsedFunctionalMember {
34 35
 
35 36
 	@Override
36 37
 	public void linkTypes(TypeResolutionContext context) {
37
-		compiled = new ConstructorMember(position, definition, modifiers, header.compile(context), null);
38
+        compiled = new ConstructorMember(position, definition, modifiers, header.compile(context), header.parameters.isEmpty() ? BuiltinID.CLASS_DEFAULT_CONSTRUCTOR : null);
38 39
 	}
39 40
 
40 41
 	@Override

Loading…
Cancel
Save