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
diff --git a/Nitra/DotNetLang/Collectors/BaseTypeReferenceSet.n b/Nitra/DotNetLang/Collectors/BaseTypeReferenceSet.n | |
index b533192..27471a9 100644 | |
--- a/Nitra/DotNetLang/Collectors/BaseTypeReferenceSet.n | |
+++ b/Nitra/DotNetLang/Collectors/BaseTypeReferenceSet.n | |
@@ -33,8 +33,9 @@ namespace DotNet | |
private mutable _ancestorTypes : HashSet[TypeSymbol]; | |
private mutable _parentClassScope : Scope; | |
private mutable _parentFullScope : Scope; | |
+ private mutable _ancestorsFullScope : Scope; | |
private _parentTypes : HashSet[TypeSymbol]; |
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
abstract ast NodeMember { | |
in Parent : Node; | |
in TemplateScope : Scope; | |
TemplateScope = TableScope("Templates", null); | |
} | |
ast Node : NodeMember { | |
Members : NodeMember*; | |
Members.TemplateScope = TemplateScope; |
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
interface IService { | |
IObservable<int> Values { get; } | |
} | |
viewmodel StatusViewModel { | |
string Name = { | |
var val = stream service.Values; | |
return val + 3; | |
} | |
// Is translated to |
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
viewmodel StatusViewModel | |
{ | |
// Simple property definition, by default public and defines both get/set | |
string Name; | |
// Getter only | |
string Name get; | |
// Private field is everything prefixed by '_' | |
string _name; |
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
new TestScheduler().With(sc => { | |
var bus = MessageBus.Current; | |
var quad = Substitute.For<IQuad>(); | |
var vm = new MapViewModel(new Mission(quad, bus), quad, bus); | |
bus.SendMessage(new StartAddingWaypointsMessage()); | |
Assert.IsTrue(vm.IsAddingWaypoints); | |
bus.SendMessage(new StopAddingWaypointsMessage()); |
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
new TestScheduler().With(sc => { | |
var client = Substitute.For<IQuadClient>(); | |
var packets = new Subject<IMavLinkPacket>(); | |
client.Packets.Returns(packets); | |
var quad = new Quad(client, MessageBus.Current); | |
packets.OnNext(new Mav.mavlink_heartbeat_t { base_mode = (byte)Mav.MAV_MODE_FLAG.SAFETY_ARMED }); | |
sc.AdvanceByMs(1); | |
quad.State = new LandState(); |
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
[Unit] | |
public class ReactiveToDo | |
{ | |
[Dto] public class Task { Name : string; IsDone : bool; Priority : string; } | |
mutable _tasks = List.[Task](); | |
mutable _todoName = "New task"; | |
mutable _todoPriority = "high"; | |
public this() |
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
Начали писать серию статей по NemerleWeb, и там понадобился макрос, который сделал бы объявление типов более лаконичными. | |
На данный момент первый пример — это классический todo список. Для такого списка неплохо было бы создать тип: | |
public class Task | |
{ | |
public Name : string { get; set; } | |
public Priority : string { get; set; } | |
public IsDone : bool { get; set; } | |
} |
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
public static string Translate(int commandId) | |
{ | |
string ret; | |
if (Translations.TryGetValue(commandId, out ret)) | |
return ret; | |
return "unknown"; | |
} |