D_Parser icon indicating copy to clipboard operation
D_Parser copied to clipboard

Make Symbol BaseType resolution entirely lazy

Open aBothe opened this issue 9 years ago • 1 comments

When resolving symbols, just return a DSymbol featuring information where a future resolver may get a basetype from.

The information required for later symbol evaluation is essentially a clone of the ResolutionContext that was passed to the place where the first symbol should be resolved. ResolutionContext References to caches shall be kept original in order to avoid unnecessary double resolutions.

  • What about template parameters and deduced types in general? Will they share some sort of DeducedTypeDictionary?
  • What about fully resolving template parameters when trying to deduce symbols? - Well, just keep resolving them, and if any of its symbolic value is needed, it'll be resolved later on.
  • What kinds of visitors shall be changed so they'll not visit the base type unnecessarily?
  • What about the anticipated immutabitility of AbstractTypes? Screw immutability, we want performance + the results are being discarded on the next fly to resolve stuff later on anyway!

aBothe avatar Aug 12 '15 19:08 aBothe

  • [ ] Make a PrepareForLazyResolution(ResolutionContext ctxt, ISyntaxRegion idOrExpression) method that partially clones ctxt and its ContextFrames and puts idOrExpression into private class locals. Or expect these in the ctor. Or make some factory.
  • [ ] Make a HasBeenResolved getter or so to get an idea whether it's been resolved already. Probably useful for some visitors.
  • [ ] Replace DerivedDataType.Base with a virtual getter. This getter will perform the resolution, put the returned type into some result cache.
  • [ ] Profit!!

aBothe avatar Aug 12 '15 20:08 aBothe