C# 클래스 Pchp.CodeAnalysis.CodeGen.CodeGenerator

파일 보기 프로젝트 열기: iolevel/peachpie 1 사용 예제들

공개 메소드들

메소드 설명
Emit ( BoundExpression expr ) : TypeSymbol
EmitBox ( TypeSymbol valuetype ) : void
EmitCallMain ( MethodSymbol mainmethod ) : TypeSymbol

Emits call to main method.

EmitCallerRuntimeTypeHandle ( ) : void
EmitConvert ( BoundExpression expr, TypeSymbol to ) : void
EmitConvert ( TypeSymbol from, TypeRefMask fromHint, TypeSymbol to ) : void

Emits conversion from one CLR type to another using PHP conventions.

EmitConvertToBool ( BoundExpression expr, bool negation = false ) : void
EmitConvertToBool ( TypeSymbol from, TypeRefMask fromHint, bool negation = false ) : void
EmitConvertToDouble ( TypeSymbol from, TypeRefMask fromHint ) : TypeSymbol
EmitConvertToInt ( TypeSymbol from, TypeRefMask fromHint ) : void
EmitConvertToIntStringKey ( TypeSymbol from, TypeRefMask fromHint ) : void
EmitConvertToLong ( TypeSymbol from, TypeRefMask fromHint ) : void
EmitConvertToPhpArray ( TypeSymbol from, TypeRefMask fromHint ) : void

Emits conversion to PhpArray.

EmitConvertToPhpNumber ( TypeSymbol from, TypeRefMask fromHint ) : void
EmitConvertToPhpString ( TypeSymbol from, TypeRefMask fromHint ) : void

Emits conversion to Pchp.Core.PhpString (aka writable string).

EmitConvertToPhpValue ( TypeSymbol from, TypeRefMask fromHint ) : TypeSymbol
EmitConvertToPhpValue ( TypeSymbol from, TypeRefMask fromHint, ILBuilder il, Emit module, DiagnosticBag diagnostic ) : TypeSymbol
EmitConvertToString ( TypeSymbol from, TypeRefMask fromHint ) : void

Emits conversion to System.String.

EmitDebugAssert ( string messageOpt = null ) : void

Emits Debug.Assert([stack]).

EmitDebugAssertNotNull ( IPlace place, string messageOpt = null ) : void

Emits Debug.Assert([place]) in debug compile mode.

EmitDeclareFunction ( SourceFunctionSymbol f ) : void

Emits declaring function into the context.

EmitDeclareType ( SourceTypeSymbol t ) : void

Emits declaring type into the context.

EmitEcho ( BoundExpression expr ) : void
EmitFieldAddress ( FieldSymbol fld ) : void

Loads field address on top of evaluation stack.

EmitIntStringKey ( BoundExpression expr ) : void
EmitIntStringKey ( int key ) : void
EmitLoadArgument ( ParameterSymbol targetp, BoundExpression expr, List writebacks ) : void

Loads argument

EmitLoadConstant ( object value, TypeSymbol targetOpt = null ) : TypeSymbol
EmitLoadContext ( ) : TypeSymbol

Emits context onto the evaluation stack.

EmitLoadDefault ( TypeSymbol type, TypeRefMask typemask ) : void
EmitLoadDefaultOfValueType ( TypeSymbol valuetype ) : void

Emits default(valuetype). Handles special types with a default ctor.

EmitLoadToken ( MethodSymbol method, Microsoft.CodeAnalysis.SyntaxNode syntaxNodeOpt ) : TypeSymbol

Loads RuntimeMethodHandle of given method.

EmitLoadToken ( TypeSymbol type, Microsoft.CodeAnalysis.SyntaxNode syntaxNodeOpt ) : TypeSymbol

Loads RuntimeTypeHandle of given type.

EmitLogicNegation ( ) : void

Emits "!= 0" operation. This method expects I4 value on top of evaluation stack.

EmitNotNull ( IPlace place ) : void

Emits place != null expression.

EmitOpCode ( ILOpCode code ) : void
EmitParameterDefaultValue ( ParameterSymbol targetp ) : void

Emits default value of given parameter. Puts value of target parameter's type.

EmitPop ( TypeSymbol type ) : void
EmitRet ( TypeSymbol stack ) : void

Emits .ret instruction with sequence point at closing brace.

EmitRetDefault ( ) : void
EmitThis ( ) : TypeSymbol

Emits reference to this.

EmitThisOrNull ( ) : TypeSymbol
EmitUnset ( BoundReferenceExpression expr ) : void
EmitWithDisabledErrorReporting ( BoundExpression expr ) : TypeSymbol

Emits the expression decorated with error reporting disabling routine.

Emit_NewArray ( TypeSymbol elementType, BoundExpression values ) : void
Emit_PhpAlias_GetValue ( ) : TypeSymbol

Emits load of PhpAlias.Value, expecting PhpAlias on top of evaluation stack, pushing PhpValue on top of the stack.

Emit_PhpAlias_GetValueRef ( ) : void

Emits load of PhpAlias.Value, expecting PhpAlias on top of evaluation stack, pushing PhpValue on top of the stack.

Emit_PhpAlias_SetValue ( ) : void

Emits store to PhpAlias.Value, expecting PhpAlias and PhpValue on top of evaluation stack.

Emit_PhpValue_MakeAlias ( ) : TypeSymbol

Emits new PhpAlias, expecting PhpValue on top of the evaluation stack.

Emit_PhpValue_Null ( ) : TypeSymbol

Emits load of PhpValue representing null.

Emit_PhpValue_Void ( ) : TypeSymbol

Emits load of PhpValue representing void.

GetTemporaryLocal ( TypeSymbol type ) : Microsoft.CodeAnalysis.CodeGen.LocalDefinition

Returns a LocalDefinition of a temporary local variable of a specified TypeSymbol.

If a LocalDefinition of the given TypeSymbol has already been declared and returned to the pool, this local is reused. Otherwise, a new local is declared. Use this method to obtain a short-lived temporary local. Return the local to the pool of locals available for reuse by calling ReturnTemporaryLocal.

GetTemporaryLocal ( TypeSymbol type, bool immediateReturn ) : Microsoft.CodeAnalysis.CodeGen.LocalDefinition

Returns a LocalDefinition of a temporary local variable of a specified TypeSymbol.

If a LocalDefinition of the given TypeSymbol has already been declared and returned to the pool, this local is reused. Otherwise, a new local is declared. Use this method to obtain a short-lived temporary local. If immediateReturn is false, return the local to the pool of locals available for reuse by calling ReturnTemporaryLocal.

ReturnTemporaryLocal ( Microsoft.CodeAnalysis.CodeGen.LocalDefinition definition ) : void

Returns a LocalDefinition previously obtained from GetTemporaryLocal(TypeSymbol,bool) to the pool of locals available for reuse.

비공개 메소드들

메소드 설명
EmitCall ( ILOpCode code, MethodSymbol method ) : TypeSymbol

Emits call to given method.

EmitCall ( ILOpCode code, MethodSymbol method, BoundExpression thisExpr, ImmutableArray arguments ) : TypeSymbol
EmitCastClass ( TypeSymbol type ) : void
EmitCastClass ( TypeSymbol from, TypeSymbol to ) : void
EmitConvertIntToLong ( TypeSymbol stack ) : TypeSymbol

In case there is Int32 or bool on the top of evaluation stack, converts it to Int64.

EmitConvertNumberToDouble ( BoundExpression expr ) : TypeSymbol

In case there is Int32 or bool or PhpNumber on the top of evaluation stack, converts it to double.

EmitConvertToClass ( TypeSymbol from, TypeRefMask fromHint, TypeSymbol to ) : void

Emits conversion to a class object.

EmitConvertToEnum ( TypeSymbol from, NamedTypeSymbol to ) : void
EmitGetProperty ( IPlace holder, PropertySymbol prop ) : TypeSymbol
EmitInitializePlace ( IPlace place ) : void

Initializes place with a default value. This applies to structs without default ctor that won't work properly when uninitialized.

EmitPhpNumberAddr ( ) : void

Copies PhpNumber into a temp variable and loads its address.

EmitPhpValueAddr ( ) : void

Copies PhpValue into a temp variable and loads its address.

EmitSequencePoint ( LangElement element ) : void
EmitSequencePoint ( Span span ) : void
EmitSpecialize ( BoundExpression expr ) : TypeSymbol

If possible, based on type analysis, unwraps more specific type from a value currently on stack without a runtime type check.

EmitSpecialize ( TypeSymbol stack, TypeRefMask tmask ) : TypeSymbol

If possible, based on type analysis, unwraps more specific type from a value currently on stack without a runtime type check.

EmitStructAddr ( TypeSymbol t ) : void

Copies a value type from the top of evaluation stack into a temporary variable and loads its address.

EmitSymbolToken ( FieldSymbol symbol, Microsoft.CodeAnalysis.SyntaxNode syntaxNode ) : void
EmitSymbolToken ( TypeSymbol symbol, Microsoft.CodeAnalysis.SyntaxNode syntaxNode ) : void
EmitThisCall ( MethodSymbol target, MethodSymbol thismethod ) : TypeSymbol

Emits .call to target assuming it takes the same arguments as passed to the caller method (thismethod).

Emit_PhpValue_Void ( ILBuilder il, Emit module, DiagnosticBag diagnostic ) : TypeSymbol

Emits load of PhpValue representing void.

IsArrayOnly ( TypeRefMask tmask ) : bool

Gets value indicating the given type represents only PHP Array.

IsBooleanOnly ( TypeRefMask tmask ) : bool

Gets value indicating the given type represents a long and nothing else.

IsClassOnly ( TypeRefMask tmask ) : bool

Gets value indicating the given type represents only class types.

IsDoubleOnly ( TypeRefMask tmask ) : bool

Gets value indicating the given type represents a double and nothing else.

IsLongOnly ( TypeRefMask tmask ) : bool

Gets value indicating the given type represents a long and nothing else.

IsReadonlyStringOnly ( TypeRefMask tmask ) : bool

Gets value indicating the given type represents UTF16 readonly string and nothing else.

PlaceOrNull ( BoundExpression expr ) : IPlace

If possible, gets IPlace representing given expression (in case of a field or variable).

TryEmitVariableSpecialize ( BoundExpression expr ) : TypeSymbol

If possible, based on type analysis, unwraps most specific type from give variable without a runtime type check.

TryEmitVariableSpecialize ( IPlace place, TypeRefMask tmask ) : TypeSymbol

If possible, based on type analysis, unwraps most specific type from give variable without a runtime type check.

메소드 상세

Emit() 공개 메소드

public Emit ( BoundExpression expr ) : TypeSymbol
expr Pchp.CodeAnalysis.Semantics.BoundExpression
리턴 TypeSymbol

EmitBox() 공개 메소드

public EmitBox ( TypeSymbol valuetype ) : void
valuetype TypeSymbol
리턴 void

EmitCallMain() 공개 메소드

Emits call to main method.
public EmitCallMain ( MethodSymbol mainmethod ) : TypeSymbol
mainmethod Pchp.CodeAnalysis.Symbols.MethodSymbol Static Main method representing the script global code.
리턴 TypeSymbol

EmitCallerRuntimeTypeHandle() 공개 메소드

public EmitCallerRuntimeTypeHandle ( ) : void
리턴 void

EmitConvert() 공개 메소드

public EmitConvert ( BoundExpression expr, TypeSymbol to ) : void
expr Pchp.CodeAnalysis.Semantics.BoundExpression
to TypeSymbol
리턴 void

EmitConvert() 공개 메소드

Emits conversion from one CLR type to another using PHP conventions.
public EmitConvert ( TypeSymbol from, TypeRefMask fromHint, TypeSymbol to ) : void
from TypeSymbol Type of value on top of evaluation stack.
fromHint TypeRefMask Type hint in case of a multityple type choices (like PhpValue or PhpNumber or PhpAlias).
to TypeSymbol Target CLR type.
리턴 void

EmitConvertToBool() 공개 메소드

public EmitConvertToBool ( BoundExpression expr, bool negation = false ) : void
expr Pchp.CodeAnalysis.Semantics.BoundExpression
negation bool
리턴 void

EmitConvertToBool() 공개 메소드

public EmitConvertToBool ( TypeSymbol from, TypeRefMask fromHint, bool negation = false ) : void
from TypeSymbol
fromHint TypeRefMask
negation bool
리턴 void

EmitConvertToDouble() 공개 메소드

public EmitConvertToDouble ( TypeSymbol from, TypeRefMask fromHint ) : TypeSymbol
from TypeSymbol
fromHint TypeRefMask
리턴 TypeSymbol

EmitConvertToInt() 공개 메소드

public EmitConvertToInt ( TypeSymbol from, TypeRefMask fromHint ) : void
from TypeSymbol
fromHint TypeRefMask
리턴 void

EmitConvertToIntStringKey() 공개 메소드

public EmitConvertToIntStringKey ( TypeSymbol from, TypeRefMask fromHint ) : void
from TypeSymbol
fromHint TypeRefMask
리턴 void

EmitConvertToLong() 공개 메소드

public EmitConvertToLong ( TypeSymbol from, TypeRefMask fromHint ) : void
from TypeSymbol
fromHint TypeRefMask
리턴 void

EmitConvertToPhpArray() 공개 메소드

Emits conversion to PhpArray.
public EmitConvertToPhpArray ( TypeSymbol from, TypeRefMask fromHint ) : void
from TypeSymbol
fromHint TypeRefMask
리턴 void

EmitConvertToPhpNumber() 공개 메소드

public EmitConvertToPhpNumber ( TypeSymbol from, TypeRefMask fromHint ) : void
from TypeSymbol
fromHint TypeRefMask
리턴 void

EmitConvertToPhpString() 공개 메소드

Emits conversion to Pchp.Core.PhpString (aka writable string).
public EmitConvertToPhpString ( TypeSymbol from, TypeRefMask fromHint ) : void
from TypeSymbol
fromHint TypeRefMask
리턴 void

EmitConvertToPhpValue() 공개 메소드

public EmitConvertToPhpValue ( TypeSymbol from, TypeRefMask fromHint ) : TypeSymbol
from TypeSymbol
fromHint TypeRefMask
리턴 TypeSymbol

EmitConvertToPhpValue() 공개 정적인 메소드

public static EmitConvertToPhpValue ( TypeSymbol from, TypeRefMask fromHint, ILBuilder il, Emit module, DiagnosticBag diagnostic ) : TypeSymbol
from TypeSymbol
fromHint TypeRefMask
il Microsoft.CodeAnalysis.CodeGen.ILBuilder
module Emit
diagnostic DiagnosticBag
리턴 TypeSymbol

EmitConvertToString() 공개 메소드

Emits conversion to System.String.
public EmitConvertToString ( TypeSymbol from, TypeRefMask fromHint ) : void
from TypeSymbol
fromHint TypeRefMask
리턴 void

EmitDebugAssert() 공개 메소드

Emits Debug.Assert([stack]).
public EmitDebugAssert ( string messageOpt = null ) : void
messageOpt string Optional second argument for assert.
리턴 void

EmitDebugAssertNotNull() 공개 메소드

Emits Debug.Assert([place]) in debug compile mode.
public EmitDebugAssertNotNull ( IPlace place, string messageOpt = null ) : void
place IPlace The variable to emit assertion for.
messageOpt string Optional second argument for assert.
리턴 void

EmitDeclareFunction() 공개 메소드

Emits declaring function into the context.
public EmitDeclareFunction ( SourceFunctionSymbol f ) : void
f Pchp.CodeAnalysis.Symbols.SourceFunctionSymbol
리턴 void

EmitDeclareType() 공개 메소드

Emits declaring type into the context.
public EmitDeclareType ( SourceTypeSymbol t ) : void
t Pchp.CodeAnalysis.Symbols.SourceTypeSymbol
리턴 void

EmitEcho() 공개 메소드

public EmitEcho ( BoundExpression expr ) : void
expr Pchp.CodeAnalysis.Semantics.BoundExpression
리턴 void

EmitFieldAddress() 공개 메소드

Loads field address on top of evaluation stack.
public EmitFieldAddress ( FieldSymbol fld ) : void
fld Pchp.CodeAnalysis.Symbols.FieldSymbol
리턴 void

EmitIntStringKey() 공개 메소드

public EmitIntStringKey ( BoundExpression expr ) : void
expr Pchp.CodeAnalysis.Semantics.BoundExpression
리턴 void

EmitIntStringKey() 공개 메소드

public EmitIntStringKey ( int key ) : void
key int
리턴 void

EmitLoadArgument() 공개 메소드

Loads argument
public EmitLoadArgument ( ParameterSymbol targetp, BoundExpression expr, List writebacks ) : void
targetp Pchp.CodeAnalysis.Symbols.ParameterSymbol
expr Pchp.CodeAnalysis.Semantics.BoundExpression
writebacks List
리턴 void

EmitLoadConstant() 공개 메소드

public EmitLoadConstant ( object value, TypeSymbol targetOpt = null ) : TypeSymbol
value object
targetOpt TypeSymbol
리턴 TypeSymbol

EmitLoadContext() 공개 메소드

Emits context onto the evaluation stack.
public EmitLoadContext ( ) : TypeSymbol
리턴 TypeSymbol

EmitLoadDefault() 공개 메소드

public EmitLoadDefault ( TypeSymbol type, TypeRefMask typemask ) : void
type TypeSymbol
typemask TypeRefMask
리턴 void

EmitLoadDefaultOfValueType() 공개 메소드

Emits default(valuetype). Handles special types with a default ctor.
public EmitLoadDefaultOfValueType ( TypeSymbol valuetype ) : void
valuetype TypeSymbol
리턴 void

EmitLoadToken() 공개 메소드

Loads RuntimeMethodHandle of given method.
public EmitLoadToken ( MethodSymbol method, Microsoft.CodeAnalysis.SyntaxNode syntaxNodeOpt ) : TypeSymbol
method Pchp.CodeAnalysis.Symbols.MethodSymbol
syntaxNodeOpt Microsoft.CodeAnalysis.SyntaxNode
리턴 TypeSymbol

EmitLoadToken() 공개 메소드

Loads RuntimeTypeHandle of given type.
public EmitLoadToken ( TypeSymbol type, Microsoft.CodeAnalysis.SyntaxNode syntaxNodeOpt ) : TypeSymbol
type TypeSymbol
syntaxNodeOpt Microsoft.CodeAnalysis.SyntaxNode
리턴 TypeSymbol

EmitLogicNegation() 공개 메소드

Emits "!= 0" operation. This method expects I4 value on top of evaluation stack.
public EmitLogicNegation ( ) : void
리턴 void

EmitNotNull() 공개 메소드

Emits place != null expression.
public EmitNotNull ( IPlace place ) : void
place IPlace
리턴 void

EmitOpCode() 공개 메소드

public EmitOpCode ( ILOpCode code ) : void
code ILOpCode
리턴 void

EmitParameterDefaultValue() 공개 메소드

Emits default value of given parameter. Puts value of target parameter's type.
public EmitParameterDefaultValue ( ParameterSymbol targetp ) : void
targetp Pchp.CodeAnalysis.Symbols.ParameterSymbol Parameter to emit its default value.
리턴 void

EmitPop() 공개 메소드

public EmitPop ( TypeSymbol type ) : void
type TypeSymbol
리턴 void

EmitRet() 공개 메소드

Emits .ret instruction with sequence point at closing brace.
public EmitRet ( TypeSymbol stack ) : void
stack TypeSymbol
리턴 void

EmitRetDefault() 공개 메소드

public EmitRetDefault ( ) : void
리턴 void

EmitThis() 공개 메소드

Emits reference to this.
public EmitThis ( ) : TypeSymbol
리턴 TypeSymbol

EmitThisOrNull() 공개 메소드

public EmitThisOrNull ( ) : TypeSymbol
리턴 TypeSymbol

EmitUnset() 공개 메소드

public EmitUnset ( BoundReferenceExpression expr ) : void
expr Pchp.CodeAnalysis.Semantics.BoundReferenceExpression
리턴 void

EmitWithDisabledErrorReporting() 공개 메소드

Emits the expression decorated with error reporting disabling routine.
public EmitWithDisabledErrorReporting ( BoundExpression expr ) : TypeSymbol
expr Pchp.CodeAnalysis.Semantics.BoundExpression
리턴 TypeSymbol

Emit_NewArray() 공개 메소드

public Emit_NewArray ( TypeSymbol elementType, BoundExpression values ) : void
elementType TypeSymbol
values Pchp.CodeAnalysis.Semantics.BoundExpression
리턴 void

Emit_PhpAlias_GetValue() 공개 메소드

Emits load of PhpAlias.Value, expecting PhpAlias on top of evaluation stack, pushing PhpValue on top of the stack.
public Emit_PhpAlias_GetValue ( ) : TypeSymbol
리턴 TypeSymbol

Emit_PhpAlias_GetValueRef() 공개 메소드

Emits load of PhpAlias.Value, expecting PhpAlias on top of evaluation stack, pushing PhpValue on top of the stack.
public Emit_PhpAlias_GetValueRef ( ) : void
리턴 void

Emit_PhpAlias_SetValue() 공개 메소드

Emits store to PhpAlias.Value, expecting PhpAlias and PhpValue on top of evaluation stack.
public Emit_PhpAlias_SetValue ( ) : void
리턴 void

Emit_PhpValue_MakeAlias() 공개 메소드

Emits new PhpAlias, expecting PhpValue on top of the evaluation stack.
public Emit_PhpValue_MakeAlias ( ) : TypeSymbol
리턴 TypeSymbol

Emit_PhpValue_Null() 공개 메소드

Emits load of PhpValue representing null.
public Emit_PhpValue_Null ( ) : TypeSymbol
리턴 TypeSymbol

Emit_PhpValue_Void() 공개 메소드

Emits load of PhpValue representing void.
public Emit_PhpValue_Void ( ) : TypeSymbol
리턴 TypeSymbol

GetTemporaryLocal() 공개 메소드

Returns a LocalDefinition of a temporary local variable of a specified TypeSymbol.
If a LocalDefinition of the given TypeSymbol has already been declared and returned to the pool, this local is reused. Otherwise, a new local is declared. Use this method to obtain a short-lived temporary local. Return the local to the pool of locals available for reuse by calling ReturnTemporaryLocal.
public GetTemporaryLocal ( TypeSymbol type ) : Microsoft.CodeAnalysis.CodeGen.LocalDefinition
type TypeSymbol The requested of the local.
리턴 Microsoft.CodeAnalysis.CodeGen.LocalDefinition

GetTemporaryLocal() 공개 메소드

Returns a LocalDefinition of a temporary local variable of a specified TypeSymbol.
If a LocalDefinition of the given TypeSymbol has already been declared and returned to the pool, this local is reused. Otherwise, a new local is declared. Use this method to obtain a short-lived temporary local. If immediateReturn is false, return the local to the pool of locals available for reuse by calling ReturnTemporaryLocal.
public GetTemporaryLocal ( TypeSymbol type, bool immediateReturn ) : Microsoft.CodeAnalysis.CodeGen.LocalDefinition
type TypeSymbol The requested of the local.
immediateReturn bool True to immediately return the local builder to the pool of locals /// available for reuse (no need to call ).
리턴 Microsoft.CodeAnalysis.CodeGen.LocalDefinition

ReturnTemporaryLocal() 공개 메소드

Returns a LocalDefinition previously obtained from GetTemporaryLocal(TypeSymbol,bool) to the pool of locals available for reuse.
public ReturnTemporaryLocal ( Microsoft.CodeAnalysis.CodeGen.LocalDefinition definition ) : void
definition Microsoft.CodeAnalysis.CodeGen.LocalDefinition The to return to the pool.
리턴 void