Skip to content

Commit

Permalink
Make it work on latest haxe/hscript
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyfa committed May 2, 2019
1 parent 2b60e2e commit 4e8c3d6
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
/test.js.map
/host.js
/host.js.map
.DS_Store
/dump
4 changes: 2 additions & 2 deletions interpret/DynamicModule.hx
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,15 @@ class DynamicModule {
interfaceExprs.push(expr);
}

var result = macro function() {
var result = macro (function() {
var module = new interpret.DynamicModule();
module.pack = $v{packString};
$b{aliasExprs};
$b{superClassExprs};
$b{interfaceExprs};
module.lazyLoad = function(mod) $b{addExprs};
return module;
}();
})();

//trace(new haxe.macro.Printer().printExpr(result));

Expand Down
2 changes: 1 addition & 1 deletion interpret/Interpreter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class Interpreter extends hscript.Interp {

var v = expr(e2);

switch( edef(e1) ) {
switch( hscript.Tools.expr(e1) ) {
case EIdent(id):
var l = locals.get(id);
if( l == null ) {
Expand Down
3 changes: 2 additions & 1 deletion interpret/TypeUtils.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package interpret;

import haxe.Constraints.IMap;
import interpret.Types;

using StringTools;
Expand All @@ -23,7 +24,7 @@ class TypeUtils {
if (Std.is(obj, Float)) return 'Float';
if (Std.is(obj, Bool)) return 'Bool';
if (Std.is(obj, Array)) return 'Array';
if (Std.is(obj, Map)) return 'Map';
if (Std.is(obj, IMap)) return 'Map';

if (Std.is(obj, DynamicClass)) {
var c:DynamicClass = cast obj;
Expand Down
2 changes: 1 addition & 1 deletion test/Host.hx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Host {
env.addModule('test.native.NativeInterface', DynamicModule.fromStatic(test.native.NativeInterface));
env.addModule('test.native.NativeGroup', DynamicModule.fromStatic(test.native.NativeGroup));
#if (sys || nodejs)
env.addModule('Sys', DynamicModule.fromStatic(Sys));
//env.addModule('Sys', DynamicModule.fromStatic(Sys));
#end

// Modules from interpreted code
Expand Down
3 changes: 2 additions & 1 deletion test/Test.hx
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,9 @@ class Test extends buddy.SingleSuite {

// OK constructor with arguments
// OK module with multiple types (native)
// OK module with multiple types (interpreted)

// TODO module with multiple types and module type included (native & interpreted)
// TODO module with multiple types (interpreted)
// TODO test.script.SomeClass.SomeSubClass
// TODO call static method from instance method
// TODO call static method from static method
Expand Down

0 comments on commit 4e8c3d6

Please sign in to comment.