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

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

5
  */
5
  */
6
 package org.openzen.zenscript.javashared.prepare;
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
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
8
 import org.openzen.zenscript.codemodel.HighLevelDefinition;
13
 import org.openzen.zenscript.codemodel.annotations.NativeTag;
9
 import org.openzen.zenscript.codemodel.annotations.NativeTag;
14
 import org.openzen.zenscript.codemodel.definition.AliasDefinition;
10
 import org.openzen.zenscript.codemodel.definition.AliasDefinition;
33
 import org.openzen.zenscript.javashared.JavaContext;
29
 import org.openzen.zenscript.javashared.JavaContext;
34
 import org.openzen.zenscript.javashared.JavaMethod;
30
 import org.openzen.zenscript.javashared.JavaMethod;
35
 import org.openzen.zenscript.javashared.JavaModifiers;
31
 import org.openzen.zenscript.javashared.JavaModifiers;
32
+import org.openzen.zenscript.javashared.JavaNativeClass;
36
 import org.openzen.zenscript.javashared.JavaVariantOption;
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
  * @author Hoofdgebruiker
41
  * @author Hoofdgebruiker
72
 			JavaNativeClass list = new JavaNativeClass(new JavaClass("java.util", "List", JavaClass.Kind.INTERFACE));
73
 			JavaNativeClass list = new JavaNativeClass(new JavaClass("java.util", "List", JavaClass.Kind.INTERFACE));
73
 			JavaClass arrayList = new JavaClass("java.util", "ArrayList", JavaClass.Kind.CLASS);
74
 			JavaClass arrayList = new JavaClass("java.util", "ArrayList", JavaClass.Kind.CLASS);
74
 			list.addMethod("constructor", JavaMethod.getNativeConstructor(arrayList, "()V"));
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
 			list.addInstanceMethod("insert", "add", "(Ljava/lang/Object;I)V");
77
 			list.addInstanceMethod("insert", "add", "(Ljava/lang/Object;I)V");
77
 			list.addInstanceMethod("remove", "remove", "(Ljava/lang/Object;)Z");
78
 			list.addInstanceMethod("remove", "remove", "(Ljava/lang/Object;)Z");
78
 			list.addInstanceMethod("indexOf", "indexOf", "(Ljava/lang/Object;)I");
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
 import org.openzen.zenscript.codemodel.member.FunctionalMember;
14
 import org.openzen.zenscript.codemodel.member.FunctionalMember;
15
 import org.openzen.zenscript.codemodel.scope.TypeScope;
15
 import org.openzen.zenscript.codemodel.scope.TypeScope;
16
 import org.openzen.zenscript.codemodel.type.StoredType;
16
 import org.openzen.zenscript.codemodel.type.StoredType;
17
+import org.openzen.zenscript.codemodel.type.member.BuiltinID;
17
 import org.openzen.zenscript.parser.ParsedAnnotation;
18
 import org.openzen.zenscript.parser.ParsedAnnotation;
18
 import org.openzen.zenscript.parser.definitions.ParsedFunctionHeader;
19
 import org.openzen.zenscript.parser.definitions.ParsedFunctionHeader;
19
 import org.openzen.zenscript.parser.statements.ParsedFunctionBody;
20
 import org.openzen.zenscript.parser.statements.ParsedFunctionBody;
34
 
35
 
35
 	@Override
36
 	@Override
36
 	public void linkTypes(TypeResolutionContext context) {
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
 	@Override
41
 	@Override

Loading…
Cancel
Save