public override void Prepare(Generator generator, TypeReference inferredType) { base.Prepare(generator, inferredType); Resolver.ImplicitField implicitSlot = generator.Resolver.FindImplicitField(name); if (implicitSlot != null) { Expression thisSlot = new DirectSlotExpression(this, implicitSlot.slot, implicitSlot.type); field = new FieldExpression(this, thisSlot, name); field.Resolve(generator); field.Prepare(generator, inferredType); type = field.TypeReference; sideEffects = field.HasSideEffects(); } else { if (generator.Resolver.ContainsSlot(name)) { type = generator.Resolver.ResolveSlotType(name); } else if (!hasTypeName) { throw new CompilerException(this, string.Format(Resource.Culture, Resource.FailedToResolveVariable, name.Data)); } else { if (typeName != null) { type = typeName; //todo } useTypeName = true; } } }
protected override bool InnerNeedsInference(Generator generator, TypeReference inferredHint) { Resolver.ImplicitField implicitSlot = generator.Resolver.FindImplicitField(name); if (implicitSlot != null) { Expression thisSlot = new DirectSlotExpression(this, implicitSlot.slot, implicitSlot.type); FieldExpression field = new FieldExpression(this, thisSlot, name); field.Resolve(generator); return(field.NeedsInference(generator, inferredHint)); } return(false); }