Skip to content

Commit 0435566

Browse files
committed
class renaming
1 parent 1278539 commit 0435566

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

hscript/Expr.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ enum Error {
122122

123123
enum ModuleDecl {
124124
DPackage( path : Array<String> );
125-
DImport( path : Array<String>, ?everything : Bool );
125+
DImport( path : Array<String>, ?everything : Bool, ?name : String );
126126
DClass( c : ClassDecl );
127127
DTypedef( c : TypeDecl );
128128
}

hscript/Parser.hx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,8 +1149,18 @@ class Parser {
11491149
unexpected(t);
11501150
}
11511151
}
1152+
var name = null;
1153+
if ( maybe(TId("as")) && !star) {
1154+
var t = token();
1155+
switch( t ) {
1156+
case TId(id):
1157+
name = id;
1158+
default:
1159+
unexpected(t);
1160+
}
1161+
}
11521162
ensure(TSemicolon);
1153-
return DImport(path, star);
1163+
return DImport(path, star, name);
11541164
case "class":
11551165
var name = getIdent();
11561166
var params = parseParams();

0 commit comments

Comments
 (0)