SetInferredType() private méthode

private SetInferredType ( IReflect ir, AST expr ) : void
ir IReflect
expr AST
Résultat void
Exemple #1
0
 internal override void SetPartialValue(AST partial_value)
 {
     //ResolveLHValue has already been called and has already checked if the target is accessible and assignable
     if (this.members == null || this.members.Length == 0)
     {
         return;                                               //Assignment to an undeclared variable. Nothing further to do.
     }
     if (this.member is JSLocalField)
     {
         //If we are dealing with an assignment to an untyped local variable, we need to tell the type inferencer about the assignment
         JSLocalField lfield = (JSLocalField)this.member;
         if (lfield.type == null)
         {
             IReflect ir = partial_value.InferType(lfield);
             if (ir == Typeob.String && partial_value is Plus)
             {
                 lfield.SetInferredType(Typeob.Object, partial_value);
             }
             else
             {
                 lfield.SetInferredType(ir, partial_value);
             }
             //but then we are done
             return;
         }
         lfield.isDefined = true;
     }
     Binding.AssignmentCompatible(this.InferType(null), partial_value, partial_value.InferType(null), this.isFullyResolved);
 }
Exemple #2
0
 internal void HandleUnitializedVariables()
 {
     for (int i = 0, n = this.field_table.Count; i < n; i++)
     {
         JSLocalField field = (JSLocalField)this.field_table[i];
         if (field.isUsedBeforeDefinition)
         {
             field.SetInferredType(Typeob.Object, null);
         }
     }
 }
 internal override void SetPartialValue(AST partial_value)
 {
     if ((base.members != null) && (base.members.Length != 0))
     {
         if (base.member is JSLocalField)
         {
             JSLocalField member = (JSLocalField)base.member;
             if (member.type == null)
             {
                 IReflect ir = partial_value.InferType(member);
                 if ((ir == Typeob.String) && (partial_value is Plus))
                 {
                     member.SetInferredType(Typeob.Object, partial_value);
                     return;
                 }
                 member.SetInferredType(ir, partial_value);
                 return;
             }
             member.isDefined = true;
         }
         Binding.AssignmentCompatible(this.InferType(null), partial_value, partial_value.InferType(null), base.isFullyResolved);
     }
 }
Exemple #4
0
        internal void HandleUnitializedVariables()
        {
            int num   = 0;
            int count = base.field_table.Count;

            while (num < count)
            {
                JSLocalField field = (JSLocalField)base.field_table[num];
                if (field.isUsedBeforeDefinition)
                {
                    field.SetInferredType(Typeob.Object, null);
                }
                num++;
            }
        }