Example #1
0
		internal override PhpTypeCode Emit(CodeGenerator/*!*/ codeGenerator)
		{
			Statistics.AST.AddNode("NewEx");

			PhpTypeCode result;

			if (classNameRef.ResolvedType != null && typeArgsResolved)
			{
				// constructor is resolvable (doesn't mean that known) //

				result = classNameRef.ResolvedType.EmitNew(codeGenerator, null, constructor, callSignature, runtimeVisibilityCheck);
			}
			else
			{
				// constructor is unresolvable (a variable is used in type name => type is unresolvable as well) //

				codeGenerator.EmitNewOperator(null, classNameRef, null, callSignature);
				result = PhpTypeCode.Object;
			}

			codeGenerator.EmitReturnValueHandling(this, false, ref result);
			return result;
		}