HaxeDoc2

(やまだぃちぅ) #1

  • The result of the constructor call must be directly assigned to a local variable.

  • The expression of the constructor field must only contain assignments to its fields.


The following example demonstrates constructor inlining:
1 class Point {
2 public var x:Float;
3 public var y:Float;
4
5 public inline function
6 new(x:Float, y:Float){
7 this.x = x;
8 this.y = y;
9 }
10 }
11
12 class Main {
13 static public function main() {
14 var pt = new Point(1.2, 9.3);
15 }
16 }


A look at the Javascript output reveals the effect:
1 Main.main = function() {
2 var pt_x = 1.2;
3 var pt_y = 9.3;
4 };

6.12 Remoting...........................................

Free download pdf