C# Class Pchp.CodeAnalysis.NameUtils

Show file Open project: iolevel/peachpie Class Usage Examples

Public Methods

Method Description
AsVarName ( string varname ) : string

Gets variable name without leading $.

ClrName ( this qname ) : string

Gets CLR name using dot as a name separator.

GetNamingContext ( NamespaceDecl ns, SourceUnit unit ) : NamingContext

Create naming context.

GetNamingContext ( TypeDecl type ) : NamingContext

Create naming context in context of given type declaration.

GetNamingContext ( this routine ) : NamingContext

Create naming context.

IsEmpty ( this qname ) : bool

Gets value indicating whether given qualified name was not set.

IsGlobalVar ( ItemUse itemUse ) : bool

Gets value indicating whether the expression is in form of $GLOBALS[...].

MakeQualifiedName ( Name name, NamespaceDecl ns ) : QualifiedName

Combines name and its namespace.

MakeQualifiedName ( string name, bool fullyQualified ) : QualifiedName

Make QualifiedName from the string like AAA\BBB\XXX

MakeQualifiedName ( this type ) : QualifiedName

Gets full qualified name of the type declaration.

NamesEquals ( this names1, Name names2 ) : bool

Compares two arrays.

TryGetGlobalVarName ( ItemUse itemUse, VariableName &varname ) : bool

Tries to resolve global variable name from array item use. (eg. $GLOBALS["varname"]).

Method Details

AsVarName() public static method

Gets variable name without leading $.
public static AsVarName ( string varname ) : string
varname string String in form of $varname or $GLOBALS['varname'] or 'varname'
return string

ClrName() public static method

Gets CLR name using dot as a name separator.
public static ClrName ( this qname ) : string
qname this
return string

GetNamingContext() public static method

Create naming context.
public static GetNamingContext ( NamespaceDecl ns, SourceUnit unit ) : NamingContext
ns NamespaceDecl Current namespace declaration. In case it is null, context for global code is created.
unit SourceUnit Global code used when is null.
return NamingContext

GetNamingContext() public static method

Create naming context in context of given type declaration.
public static GetNamingContext ( TypeDecl type ) : NamingContext
type TypeDecl
return NamingContext

GetNamingContext() public static method

Create naming context.
public static GetNamingContext ( this routine ) : NamingContext
routine this
return NamingContext

IsEmpty() public static method

Gets value indicating whether given qualified name was not set.
public static IsEmpty ( this qname ) : bool
qname this
return bool

IsGlobalVar() public static method

Gets value indicating whether the expression is in form of $GLOBALS[...].
public static IsGlobalVar ( ItemUse itemUse ) : bool
itemUse ItemUse
return bool

MakeQualifiedName() public static method

Combines name and its namespace.
public static MakeQualifiedName ( Name name, NamespaceDecl ns ) : QualifiedName
name Name Name.
ns NamespaceDecl Can be null.
return QualifiedName

MakeQualifiedName() public static method

Make QualifiedName from the string like AAA\BBB\XXX
public static MakeQualifiedName ( string name, bool fullyQualified ) : QualifiedName
name string
fullyQualified bool
return QualifiedName

MakeQualifiedName() public static method

Gets full qualified name of the type declaration.
public static MakeQualifiedName ( this type ) : QualifiedName
type this Type, cannot be null.
return QualifiedName

NamesEquals() public static method

Compares two arrays.
public static NamesEquals ( this names1, Name names2 ) : bool
names1 this
names2 Name
return bool

TryGetGlobalVarName() public static method

Tries to resolve global variable name from array item use. (eg. $GLOBALS["varname"]).
public static TryGetGlobalVarName ( ItemUse itemUse, VariableName &varname ) : bool
itemUse ItemUse
varname VariableName
return bool