Skip to content

Commit 87877f4

Browse files
committed
minor
1 parent d61b3e1 commit 87877f4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

hscript/Live.hx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ package hscript;
55
the code of a function or add a variable, the class will get retyped with hscript.Checker and modified
66
functions will be patched so they are run using hscript.Interp mode. This is slower than native compilation
77
but allows for faster iteration.
8+
9+
You will also need to call the init macro `--macro hscript.LiveClass.enable("api.xml",["src"])` in order to
10+
specify both the XML types output file (generated by haxe compiler output `-xml api.xml` and the class paths
11+
of your local sources.
812
**/
913
@:autoBuild(hscript.LiveClass.build())
1014
extern interface Live {

hscript/LiveClass.hx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import haxe.macro.Expr;
1010
class LiveClass {
1111

1212
@:persistent static var CONFIG : { api : String, srcPath : Array<String> } #if !macro = getMacroConfig() #end;
13+
14+
public static function isEnable() {
15+
return CONFIG != null;
16+
}
1317

1418
static macro function getMacroConfig() {
1519
return macro $v{CONFIG};
@@ -66,7 +70,7 @@ class LiveClass {
6670
var noCompletion : Metadata = [{ name : ":noCompletion", pos : pos }];
6771
var cl = Context.getLocalClass().get();
6872
var className = cl.name;
69-
var classFile = getClassFile(pos);
73+
var classFile = getFilePath(pos);
7074
fields.push({
7175
name : "__interp_inst",
7276
pos : pos,
@@ -91,7 +95,7 @@ class LiveClass {
9195
return fields;
9296
}
9397

94-
static function getClassFile( pos : Position ) {
98+
public static function getFilePath( pos : Position ) {
9599
var filePath = Context.getPosInfos(pos).file.split("\\").join("/");
96100
var classPath = Context.getClassPath();
97101
classPath.push(Sys.getCwd());

0 commit comments

Comments
 (0)