92503ae8db
The editor no longer needs to create temporary instances to get the default values. The initializer values of the exported properties are still evaluated at runtime. For example, in the following example, `GetInitialValue()` will be called when first looks for default values: ``` [Export] int MyValue = GetInitialValue(); ``` Exporting fields with a non-supported type now results in a compiler error rather than a runtime error when the script is used.
46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using System.Collections.Immutable;
|
|
using Microsoft.CodeAnalysis;
|
|
|
|
namespace Godot.SourceGenerators
|
|
{
|
|
public struct GodotMethodData
|
|
{
|
|
public GodotMethodData(IMethodSymbol method, ImmutableArray<MarshalType> paramTypes,
|
|
ImmutableArray<ITypeSymbol> paramTypeSymbols, MarshalType? retType)
|
|
{
|
|
Method = method;
|
|
ParamTypes = paramTypes;
|
|
ParamTypeSymbols = paramTypeSymbols;
|
|
RetType = retType;
|
|
}
|
|
|
|
public IMethodSymbol Method { get; }
|
|
public ImmutableArray<MarshalType> ParamTypes { get; }
|
|
public ImmutableArray<ITypeSymbol> ParamTypeSymbols { get; }
|
|
public MarshalType? RetType { get; }
|
|
}
|
|
|
|
public struct GodotPropertyData
|
|
{
|
|
public GodotPropertyData(IPropertySymbol propertySymbol, MarshalType type)
|
|
{
|
|
PropertySymbol = propertySymbol;
|
|
Type = type;
|
|
}
|
|
|
|
public IPropertySymbol PropertySymbol { get; }
|
|
public MarshalType Type { get; }
|
|
}
|
|
|
|
public struct GodotFieldData
|
|
{
|
|
public GodotFieldData(IFieldSymbol fieldSymbol, MarshalType type)
|
|
{
|
|
FieldSymbol = fieldSymbol;
|
|
Type = type;
|
|
}
|
|
|
|
public IFieldSymbol FieldSymbol { get; }
|
|
public MarshalType Type { get; }
|
|
}
|
|
}
|