I don't understand why there are two different EObjects that (for me) should mean the same thing
var script1 = resource.getContents().get(0) as Script
var script2 = resource.parseResult.rootASTElement as Script
They seem to contain different information and I don't see why that would be.(yeah they come from different places) but more importantly I don't see why I'm there are two ways of getting (different) Script implementations (from the same sourcecode / resource).
script1 gets passed to the infererer. Why not script2?
The model inference is triggered by the invocation of #getContents. Besides from that, both variables should point to the very same instance.