public NewEx(Position position, TypeRef/*!*/ classNameRef, List<ActualParam>/*!*/ parameters) : base(position) { Debug.Assert(classNameRef != null && parameters != null); this.classNameRef = classNameRef; this.callSignature = new CallSignature(parameters, TypeRef.EmptyList); }
public StaticFieldUse(Position position, TypeRef typeRef) : base(position) { Debug.Assert(typeRef != null); this.typeRef = typeRef; }
public InstanceOfEx(Text.Span span, Expression/*!*/ expression, TypeRef/*!*/ classNameRef) : base(span) { Debug.Assert(expression != null && classNameRef != null); this.expression = expression; this.classNameRef = classNameRef; }
public StaticFieldUse(Text.Span span, Text.Span nameSpan, TypeRef typeRef) : base(span) { Debug.Assert(typeRef != null); this.typeRef = typeRef; this.NameSpan = nameSpan; }
public InstanceOfEx(Position position, Expression/*!*/ expression, TypeRef/*!*/ classNameRef) : base(position) { Debug.Assert(expression != null && classNameRef != null); this.expression = expression; this.classNameRef = classNameRef; }
/// <summary> /// Emits IL instructions that ensure that a static field is of <see cref="PhpObject"/> or <see cref="PhpArray"/> /// type. Handles the case when field name is known at compile time (see <see cref="AST.DirectStFldUse"/>). /// </summary> /// <param name="property">The corresponding <see cref="DProperty"/> or <B>null</B>.</param> /// <param name="typeRef">The class type reference (identifier index).</param> /// <param name="fieldName">The field name (identifier index).</param> /// <param name="ensureArray">Whether to ensure that static field is an array (or an object).</param> /// <remarks> /// Nothing is expected on the evaluation stack. A <see cref="PhpObject"/> or <see cref="DObject"/> is left /// on the evaluation stack or the last emitted instruction is unconditional branch to <see cref="Chain.ErrorLabel"/>. /// </remarks> public PhpTypeCode EmitEnsureStaticProperty(DProperty property, TypeRef typeRef, VariableName fieldName, bool ensureArray) { ILEmitter il = codeGenerator.IL; PhpField php_field = property as PhpField; if (php_field != null) { // HACK HACK EmitEnsureStaticPhpFieldDirect(php_field, ensureArray); EmitErrorCheck(ensureArray); return (ensureArray) ? PhpTypeCode.PhpArray : PhpTypeCode.DObject; } else return EmitEnsureStaticProperty(typeRef, fieldName, null, ensureArray); }
/// <summary> /// Emits IL instructions that ensure that a static field is of <see cref="PhpObject"/> or <see cref="PhpArray"/> /// type. Handles the case when field name is unknown at compile time (see <see cref="AST.IndirectStFldUse"/>). /// </summary> /// <param name="typeRef">The class name (identifier index).</param> /// <param name="propertyName">The property name.</param> /// <param name="propertyNameExpr">The expression that evaluates to property name.</param> /// <param name="ensureArray">Whether to ensure that static field is an array (or an object).</param> /// <remarks> /// Nothing is expected on the evaluation stack. A <see cref="PhpArray"/> or <see cref="DObject"/> is left on the /// evaluation stack. /// </remarks> public PhpTypeCode EmitEnsureStaticProperty(TypeRef typeRef, VariableName? propertyName, Expression propertyNameExpr, bool ensureArray) { Debug.Assert(propertyName != null ^ propertyNameExpr != null); ResolveTypeFlags flags = ResolveTypeFlags.UseAutoload | ResolveTypeFlags.ThrowErrors; // LOAD Operators.EnsureStaticFieldIs[Object|Array](<type desc>, <field name>, <type desc>, <context>) typeRef.EmitLoadTypeDesc(codeGenerator, flags); if (propertyNameExpr != null) codeGenerator.EmitBoxing(propertyNameExpr.Emit(codeGenerator)); else codeGenerator.IL.Emit(OpCodes.Ldstr, propertyName.Value.ToString()); codeGenerator.EmitLoadClassContext(); codeGenerator.EmitLoadScriptContext(); if (ensureArray) codeGenerator.IL.Emit(OpCodes.Call, Methods.Operators.EnsureStaticPropertyIsArray); else codeGenerator.IL.Emit(OpCodes.Call, Methods.Operators.EnsureStaticPropertyIsObject); EmitErrorCheck(ensureArray); return (ensureArray) ? PhpTypeCode.PhpArray : PhpTypeCode.DObject; }
public IndirectStMtdCall(Text.Span span, TypeRef/*!*/typeRef, CompoundVarUse/*!*/ mtdNameVar, List<ActualParam>/*!*/ parameters, List<TypeRef>/*!*/ genericParams) : base(span, mtdNameVar.Span, typeRef, parameters, genericParams) { this.methodNameVar = mtdNameVar; }
public StaticMtdCall(Text.Span span, Text.Span methodNamePosition, TypeRef typeRef, List<ActualParam>/*!*/ parameters, List<TypeRef>/*!*/ genericParams) : base(span, methodNamePosition, parameters, genericParams) { Debug.Assert(typeRef != null); this.typeRef = typeRef; }
public IndirectStFldUse(Text.Span span, TypeRef typeRef, Expression/*!*/ fieldNameExpr) : base(span, fieldNameExpr.Span, typeRef) { this.fieldNameExpr = fieldNameExpr; }
public ClassConstUse(Position position, TypeRef/*!*/typeRef, string/*!*/ name, Position namePosition) : base(position) { Debug.Assert(typeRef != null); Debug.Assert(!string.IsNullOrEmpty(name)); this.typeRef = typeRef; this.name = new VariableName(name); this.NamePosition = namePosition; }
internal void EmitInstanceOfOperator(string typeFullName, TypeRef typeNameRef, DType type) { DebugHelper.AssertNonNull(1, typeFullName, typeNameRef, type); // LOAD Operators.InstanceOf(STACK, <type desc>); EmitLoadTypeDesc(typeFullName, typeNameRef, type, ResolveTypeFlags.None); il.Emit(OpCodes.Call, Methods.Operators.InstanceOf); }
public TypeOfEx(Text.Span span, TypeRef/*!*/ classNameRef) : base(span) { Debug.Assert(classNameRef != null); this.classNameRef = classNameRef; }
public PseudoClassConstUse(Text.Span span, TypeRef/*!*/typeRef, Types type, Text.Span namePosition) : base(span, typeRef, type.ToString().ToLowerInvariant(), namePosition) { this.consttype = type; }
public PseudoClassConstUse(Position position, TypeRef/*!*/typeRef, Types type, Position namePosition) : base(position, typeRef, type.ToString().ToLowerInvariant(), namePosition) { this.consttype = type; }
public DirectStFldUse(Text.Span span, TypeRef typeRef, VariableName propertyName, Text.Span propertyNamePosition) : base(span, propertyNamePosition, typeRef) { this.propertyName = propertyName; }
private void EmitLoadTypeDesc(string typeFullName, TypeRef typeNameRef, DType type, ResolveTypeFlags flags) { DebugHelper.AssertNonNull(1, typeFullName, typeNameRef, type); if (typeFullName != null) EmitLoadTypeDescOperator(typeFullName, null, flags); else if (typeNameRef != null) typeNameRef.EmitLoadTypeDesc(this, flags); else type.EmitLoadTypeDesc(this, flags); }
internal void EmitNewOperator(string typeFullName, TypeRef typeNameRef, DType type, CallSignature callSignature) { DebugHelper.AssertNonNull(1, typeFullName, typeNameRef, type); // prepare stack frame for the constructor: callSignature.EmitLoadOnPhpStack(this); // CALL Operators.New(<type desc>, <context type desc>, <context>); EmitLoadTypeDesc(typeFullName, typeNameRef, type, ResolveTypeFlags.UseAutoload | ResolveTypeFlags.ThrowErrors); this.EmitLoadClassContext(); this.EmitLoadScriptContext(); this.EmitLoadNamingContext(); il.Emit(OpCodes.Call, Methods.Operators.New); }
public TypeOfEx(Position position, TypeRef/*!*/ classNameRef) : base(position) { Debug.Assert(classNameRef != null); this.classNameRef = classNameRef; }
internal void EmitTypeOfOperator(string typeFullName, TypeRef typeNameRef, DType type) { DebugHelper.AssertNonNull(1, typeFullName, typeNameRef, type); // LOAD Operators.InstanceOf(STACK, <type desc>, <context type desc>, <script context>); EmitLoadTypeDesc(typeFullName, typeNameRef, type, ResolveTypeFlags.UseAutoload | ResolveTypeFlags.ThrowErrors); il.Emit(OpCodes.Call, Methods.Operators.TypeOf); }
public IndirectStFldUse(Position position, TypeRef typeRef, Expression/*!*/ fieldNameExpr) : base(position, fieldNameExpr.Position, typeRef) { this.fieldNameExpr = fieldNameExpr; }
public StaticMtdCall(Position position, TypeRef typeRef, List<ActualParam>/*!*/ parameters, List<TypeRef>/*!*/ genericParams) : base(position, parameters, genericParams) { Debug.Assert(typeRef != null); this.typeRef = typeRef; }
public DirectStFldUse(Position position, TypeRef typeRef, VariableName propertyName, Position propertyNamePosition) : base(position, propertyNamePosition, typeRef) { this.propertyName = propertyName; }