예제 #1
0
        internal override Type Get(ILGenerator generator)
        {
            if (Property == null && Field == null)
            {
                Resolve(null);
            }

            if (Property != null)
            {
                // Call the get method:
                generator.Call(Property.GetMethod);
                return(_Type);
            }

            if (Field != null)
            {
                // Load the field:
                generator.LoadField(Field);
            }
            else if (IsConstant)
            {
                // Emit the default constant value:
                EmitHelpers.EmitValue(generator, ConstantValue);
            }
            else
            {
                // Emit undefined:
                EmitHelpers.EmitUndefined(generator);
            }

            return(_Type);
        }
예제 #2
0
            /// <summary>
            /// Generates a method that does type conversion and calls the bound method.
            /// </summary>
            /// <param name="generator"> The ILGenerator used to output the body of the method. </param>
            /// <param name="argumentCount"> The number of arguments that will be passed to the delegate. </param>
            /// <returns> A delegate that does type conversion and calls the method represented by this
            /// object. </returns>
            protected override void GenerateStub(Jurassic.Compiler.ILGenerator generator, int argumentCount)
            {
                // Emit undefined.
                EmitHelpers.EmitUndefined(generator);

                // End the IL.
                generator.Complete();
            }