Differences From Artifact [9cdb01160429b059]:
- File
polemy/failure.d
- 2010-11-24 03:30:56 - part of checkin [20be503cae] on branch trunk - set up referece manual (user: kinaba) [annotate]
To Artifact [2827b7df74d1df19]:
- File
polemy/failure.d
- 2010-11-24 13:22:04 - part of checkin [f9c31f3cd8] on branch trunk - Fixed the null dereference bug when directly wrote "case 1 when 2: 3" in REPL. It was due to null LexPosition in the AST. Now AST.pos !is null is an invariant of AST. (user: kinaba) [annotate]
19 immutable int lineno; /// 1-origin 19 immutable int lineno; /// 1-origin
20 immutable int column; /// 1-origin 20 immutable int column; /// 1-origin
21 21
22 mixin SimpleClass; 22 mixin SimpleClass;
23 override string toString() const 23 override string toString() const
24 { return sprintf!("%s:%d:%d")(filename, lineno, column); } 24 { return sprintf!("%s:%d:%d")(filename, lineno, column); }
25 static LexPosition dummy; 25 static LexPosition dummy;
26 static this(){ dummy = new LexPosition("<unnamed>",0,0); } | 26 static this(){ dummy = new LexPosition("<nowhere>",0,0); }
27 } 27 }
28 28
29 unittest 29 unittest
30 { 30 {
31 auto p = new LexPosition("hello.cpp", 123, 45); 31 auto p = new LexPosition("hello.cpp", 123, 45);
32 32
33 assert_eq( p.filename, "hello.cpp" ); 33 assert_eq( p.filename, "hello.cpp" );