This repository has been archived by the owner on Jul 6, 2023. It is now read-only.
forked from Bluefire2/xic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix multiple field access bug due to non initializable fields
- Loading branch information
1 parent
cb88491
commit 44caff8
Showing
6 changed files
with
166 additions
and
68 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
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 |
---|---|---|
@@ -1 +1,8 @@ | ||
Valid Xi Program | ||
97 | ||
11 | ||
11 | ||
22 | ||
22 | ||
0 | ||
1 | ||
2 |
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,26 @@ | ||
use io | ||
use conv | ||
use point | ||
|
||
class Color { | ||
r, g, b: int | ||
} | ||
|
||
class ColoredPoint extends Point { | ||
col: Color | ||
color(): Color { return col } | ||
|
||
initColoredPoint(x0: int, y0: int, c: Color): ColoredPoint { | ||
col = c | ||
_ = initPoint(x0, y0) | ||
return this | ||
} | ||
} | ||
|
||
main(args:int[][]) { | ||
c:Color = new Color | ||
c.r = 1; c.g = 2; c.b = 3; | ||
|
||
p:Point = new ColoredPoint | ||
_ = p.initPoint(1, 2) | ||
} |
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,25 @@ | ||
class Point{ // a mutable point | ||
x, y: int | ||
|
||
move(dx: int, dy: int) { | ||
x = x + dx | ||
y = y + dy | ||
} | ||
coords(): int, int { | ||
return x, y | ||
} | ||
add(p: Point): Point { | ||
return createPoint(x + p.x, y + p.y) | ||
} | ||
initPoint(x0: int, y0: int): Point { | ||
x = x0 | ||
y = y0 | ||
return this | ||
} | ||
clone(): Point { return createPoint(x, y) } | ||
} | ||
|
||
createPoint(x: int, y:int): Point { | ||
return new Point.initPoint(x, y) | ||
} | ||
|
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