Skip to content

Commit

Permalink
Merge branch 'feature/generic-and-type-aliases-imrovements'
Browse files Browse the repository at this point in the history
  • Loading branch information
0xF6 committed Jun 29, 2024
2 parents 8aa6748 + 4f71174 commit cbf7fe5
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 44 deletions.
4 changes: 2 additions & 2 deletions lib/vein.std/std/Testable.vein
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Testable

aboba(1, "test string");

abobus(delMethod);
abobus(&delMethod);
}


Expand All @@ -28,4 +28,4 @@ public class Testable
}
}

global alias testMethod(i: i32): Void;
global alias testMethod <| (i: i32): Void;
19 changes: 1 addition & 18 deletions lib/vein.std/std/reflection/Function.vein
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,5 @@ public class Function : Object
|> this._target;

internal new() { } // internal ctor
}

/*
public call(): Object
|> self._call(this, Array.empty);
public call(args: Array): Object
|> self._call(this, args);

public static createFunctionFrom(target: Object, name: string): Function
|> self._createFn(target, name, false, true);
public static createFunctionFrom(target: Object, name: string, ignoreCase: boolean): Function
|> self._createFn(target, name, ignoreCase, true);
public static createFunctionFrom(target: Object, name: string, ignoreCase: boolean, throwWhenFailBind: boolean): Function
|> self._createFn(target, name, ignoreCase, throwWhenFailBind);

[native("__internal__", "i_call_Function_call")]
private static extern _call(f: Function, args: Array): Object;
[native("__internal__", "i_call_Function_create")]
private static extern _createFn(target: Object, name: string, ignoreCase: boolean, throwWhenFailBind: boolean): Function;*/
}
4 changes: 4 additions & 0 deletions lib/vein.std/std/reflection/FunctionMulticast.vein
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#space "std"

// base class for methods alias and other cases with method signatures
public class FunctionMulticast : Function { }
6 changes: 4 additions & 2 deletions runtime/ishtar.generator/generators/types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public static VeinTypeCode GetTypeCode(this ExpressionSyntax exp, GeneratorConte
}
catch (Exception e)
{
Debug.WriteLine(e);
gen.LogError($"Error determining type for identifier '{id}': {e.Message}", id);
throw;
}
}

Expand Down Expand Up @@ -61,7 +62,8 @@ public static VeinClass GetType(this ExpressionSyntax exp, GeneratorContext gen)
}
catch (Exception e)
{
Debug.WriteLine(e);
gen.LogError($"Error determining type for identifier '{id}': {e.Message}", id);
throw;
}
}

Expand Down
19 changes: 2 additions & 17 deletions runtime/ishtar.vm/runtime/io/TaskScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public unsafe struct TaskScheduler(NativeQueue<IshtarTask>* queue) : IDisposable
return scheduler;
}


public static void Free(TaskScheduler* scheduler)
{
// TODO
Expand Down Expand Up @@ -110,21 +109,7 @@ static void execute_scheduler(IshtarRawThread* thread)
GlobalPrintln("execute_scheduler:end");
}

//new Thread((x) =>
//{
// RuntimeIshtarModule* module = (RuntimeIshtarModule*)(nint)x;
// var vm = module->vm;
// var gcInfo = new GC_stack_base();

// vm.GC.get_stack_base(&gcInfo);

// vm.GC.register_thread(&gcInfo);

// vm.task_scheduler->run();

// vm.GC.unregister_thread();
//}).Start((nint)entryModule);

entryModule->vm.threading.CreateRawThread(entryModule, &execute_scheduler);
entryModule->vm.threading
.CreateRawThread(entryModule, &execute_scheduler);
}
}
4 changes: 2 additions & 2 deletions runtime/ishtar.vm/runtime/vm/RuntimeIshtarClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,9 @@ public void init_vtable(VirtualMachine vm, CallFrame* fr = null)
return Parent->FindMethod(fullyName, predicate);
}

public RuntimeIshtarMethod* GetDefaultDtor() => _get_tor("dtor");
public RuntimeIshtarMethod* GetDefaultDtor() => _get_tor(VeinMethod.METHOD_NAME_DECONSTRUCTOR);

public RuntimeIshtarMethod* GetDefaultCtor() => _get_tor("ctor");
public RuntimeIshtarMethod* GetDefaultCtor() => _get_tor(VeinMethod.METHOD_NAME_CONSTRUCTOR);


private RuntimeIshtarMethod* _get_tor(string name, bool isStatic = false)
Expand Down
6 changes: 3 additions & 3 deletions runtime/ishtar.vm/runtime/vm/RuntimeIshtarModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,23 +187,23 @@ public string Name
bool filter(RuntimeIshtarClass* x) => RuntimeQualityTypeName.Eq(x->FullName, type);

if (!findExternally)
throw new TypeNotFoundException($"'{type->NameWithNS}' not found in modules and dependency assemblies.");
throw new TypeNotFoundException($"'{type->ToString()}' not found in modules and dependency assemblies.");

var dm = deps_table->FirstOrNull(x => x->FindType(type, true, dropUnresolvedException) is not null);


if (dm is not null)
return dm->FindType(type, true, dropUnresolvedException);

throw new TypeNotFoundException($"'{type->NameWithNS}' not found in modules and dependency assemblies.");
throw new TypeNotFoundException($"'{type->ToString()}' not found in modules and dependency assemblies.");
}



public RuntimeIshtarClass* DefineClass(RuntimeQualityTypeName* fullName, RuntimeIshtarClass* parent)
{
var exist = class_table->FirstOrNull(x
=> x->FullName->NameWithNS.Equals(fullName->NameWithNS));
=> x->FullName->ToString().Equals(fullName->ToString()));

if (exist is not null)
return exist;
Expand Down
1 change: 1 addition & 0 deletions vein_lang.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=jitted/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=landingpad/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=langserver/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=LDARG/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=lerp/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=libdl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=libgc/@EntryIndexedValue">True</s:Boolean>
Expand Down

0 comments on commit cbf7fe5

Please sign in to comment.