Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubmisek committed Aug 16, 2024
1 parent a2a5080 commit 0f7b911
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,30 @@ bool TryResolveParentClassInCurrentClassContext(SourceRoutineSymbol routine, out
{
// method_exists(FALSE, ...) -> FALSE
var value = x.ArgumentsInSourceOrder[0].Value.ConstantValue;
if (value.HasValue && value.TryConvertToBool(out var bvalue) && !bvalue)
if (value.TryConvertToBool(out var bvalue) && !bvalue)
{
return new BoundLiteral(false.AsObject()).WithContext(x);
}
}
return null;
} },
//{ NameUtils.SpecialNames.interface_exists, x =>
//{
// // interface_exists(class_name [, autoload]) -> TRUE
// if (x.ArgumentsInSourceOrder.Length >= 1)
// {
// var value = x.ArgumentsInSourceOrder[0].Value.ConstantValue;
// if (value.TryConvertToString(out var classname))
// {
// var symbol = DeclaringCompilation.GetTypeByMetadataName( QualifiedName.Parse(classname, true).ClrName() );
// if (symbol != null && symbol.TypeKind == TypeKind.Interface)
// {
// return new BoundLiteral(true.AsObject()).WithContext(x);
// }
// }
// }
// return null;
//} },
{ NameUtils.SpecialNames.ini_get, x =>
{
// ini_get( {svalue} ) : string|FALSE
Expand Down
3 changes: 3 additions & 0 deletions src/Peachpie.CodeAnalysis/Utilities/NameUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ public struct SpecialNames
/// <summary><c>method_exists</c> function name.</summary>
public static QualifiedName method_exists => new QualifiedName(new Name("method_exists"));

/// <summary><c>interface_exists</c> function name.</summary>
public static QualifiedName interface_exists => new QualifiedName(new Name("interface_exists"));

public static QualifiedName ini_get = new QualifiedName(new Name("ini_get"));

public static QualifiedName extension_loaded = new QualifiedName(new Name("extension_loaded"));
Expand Down

0 comments on commit 0f7b911

Please sign in to comment.