This file contains hidden or 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
| import haxe.macro.Context; | |
| import haxe.macro.Expr; | |
| import haxe.macro.ExprTools; | |
| class ClassBuild{ | |
| //the entire contents of a class is contained in the class's fields | |
| //a class-building-macro's job is to return an array of fields | |
| static function saveClass():Array<Field>{ |
This file contains hidden or 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
| // Sample demo of how to gain access to "private" variables in JavaScript, | |
| // even if they'd normally be inaccessible due to the closure. | |
| var Table = function () { | |
| var _array = ["super", "secret", "message"]; | |
| return { | |
| get: function (i) { return _array[i]; }, | |
| store: function (i,v) { _array[i] = v; }, | |
| append: function (v) { _array.push(v); } | |
| }; | |
| }; |