-
-
Notifications
You must be signed in to change notification settings - Fork 658
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(or at least the part of it that's fixed)
- Loading branch information
Showing
7 changed files
with
103 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
--main Main | ||
--interp | ||
-D use-rtti-doc | ||
# -D test=Issue7326 | ||
# -D test=Issue7877 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// from vshaxe | ||
|
||
import haxe.display.Position.Range; | ||
|
||
enum abstract UnresolvedIdentifierSuggestion(Int) { | ||
var UISImport; | ||
var UISTypo; | ||
} | ||
|
||
enum abstract DiagnosticKind<T>(Int) from Int to Int { | ||
var DKUnusedImport:DiagnosticKind<Void>; | ||
var DKUnresolvedIdentifier:DiagnosticKind<Array<{kind:UnresolvedIdentifierSuggestion, name:String}>>; | ||
var DKCompilerError:DiagnosticKind<String>; | ||
var DKRemovableCode:DiagnosticKind<{description:String, range:Range}>; | ||
} | ||
|
||
enum abstract DiagnosticSeverity(Int) { | ||
var Error = 1; | ||
var Warning; | ||
var Information; | ||
var Hint; | ||
} | ||
|
||
typedef Diagnostic<T> = { | ||
var kind:DiagnosticKind<T>; | ||
var range:Range; | ||
var severity:DiagnosticSeverity; | ||
var args:T; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package cases; | ||
|
||
class Issue7877 extends DisplayTestCase { | ||
/** | ||
class Main { | ||
public static function main() { | ||
new misc.issue7877.ProcessedClass(false); | ||
new misc.issue7877.ProcessedClass(true); | ||
} | ||
} | ||
**/ | ||
function test() { | ||
arrayEq([], diagnostics()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package misc.issue7877; | ||
|
||
import haxe.macro.Expr; | ||
import haxe.macro.Context; | ||
|
||
class ProcessMacro { | ||
public static macro function build():Array<Field> { | ||
var fields = Context.getBuildFields(); | ||
var toInit = [ | ||
for (field in fields) { | ||
switch (field) { | ||
case {name: name, kind: FVar(t, e), access: [AFinal]}: | ||
{name: name, type: t, def: e}; | ||
case _: | ||
continue; | ||
} | ||
} | ||
]; | ||
|
||
var args:Array<FunctionArg> = []; | ||
var exprs = []; | ||
for (init in toInit) { | ||
args.push({ | ||
name: init.name, | ||
opt: init.def != null, | ||
type: init.type, | ||
value: init.def | ||
}); | ||
var n = init.name; | ||
exprs.push(macro this.$n = $i{n}); | ||
} | ||
fields.push({ | ||
pos: Context.currentPos(), | ||
name: 'new', | ||
access: [APublic], | ||
kind: FFun({ret: null, args: args, expr: {pos: Context.currentPos(), expr: EBlock(exprs)}}) | ||
}); | ||
return fields; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package misc.issue7877; | ||
|
||
@:build(misc.issue7877.ProcessMacro.build()) class ProcessedClass { | ||
final foo:Bool; // = false; | ||
|
||
function bar() { | ||
trace(foo); | ||
} | ||
} |