Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to compile a cs files without a project #958

Merged
merged 4 commits into from
Feb 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
start
shargon committed Feb 26, 2024
commit 7cbd9ff0f39b8382030824dff0cd4796320c07d7
2 changes: 1 addition & 1 deletion src/Neo.Compiler.CSharp/CompilationEngine.cs
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ public List<CompilationContext> Compile(IEnumerable<string> sourceFiles, IEnumer
return CompileProjectContracts(Compilation);
}

public List<CompilationContext> CompileSources(string[] sourceFiles)
public List<CompilationContext> CompileSources(params string[] sourceFiles)
{
List<MetadataReference> references = new(CommonReferences)
{

Unchanged files with check annotations Beta

/// <param name="from">The address of the payer</param>
/// <param name="amount">The amount of token to be transferred</param>
/// <param name="data">Additional payment description data</param>
public void OnNEP17Payment(UInt160 from, BigInteger amount, object? data = null);

Check warning on line 17 in src/Neo.SmartContract.Framework/Interfaces/INEP17Payment.cs

GitHub Actions / Test

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
}
/// <param name="from">The address of the payer</param>
/// <param name="amount">The amount of token to be transferred</param>
/// <param name="data">Additional payment description data</param>
public void OnNEP11Payment(UInt160 from, BigInteger amount, object? data = null);

Check warning on line 17 in src/Neo.SmartContract.Framework/Interfaces/INEP11Payment.cs

GitHub Actions / Test

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
}
return Array.Empty<AbiMethod>();
}
public override bool Equals(object obj)

Check warning on line 87 in src/Neo.SmartContract.Testing/Coverage/AbiMethod.cs

GitHub Actions / Test

Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes).
{
if (obj is not AbiMethod other) return false;
return PCount == other.PCount && Name == other.Name;
}
bool IEquatable<AbiMethod>.Equals(AbiMethod other) => PCount == other.PCount && Name == other.Name;

Check warning on line 94 in src/Neo.SmartContract.Testing/Coverage/AbiMethod.cs

GitHub Actions / Test

Nullability of reference types in type of parameter 'other' doesn't match implemented member 'bool IEquatable<AbiMethod>.Equals(AbiMethod? other)' (possibly because of nullability attributes).
public override int GetHashCode() => HashCode.Combine(PCount, Name);
public override string ToString() => _toString;
}
return false;
}
var basePath = Path.Combine(Path.GetDirectoryName(manifestPath), GetBaseName(manifestPath, MANIFEST_FILE_EXTENSION));

Check warning on line 58 in src/Neo.SmartContract.Testing/Coverage/NeoDebugInfo.cs

GitHub Actions / Test

Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'.
var nefdbgnfoPath = Path.ChangeExtension(basePath, NEF_DBG_NFO_EXTENSION);
if (TryLoadCompressed(nefdbgnfoPath, out debugInfo))
[ManifestExtra("E-mail", "dev@neo.org")]
public class Contract_ExtraAttribute : SmartContract
{
public static object Main(string method, object[] args)

Check warning on line 9 in tests/Neo.SmartContract.Framework.TestContracts/Contract_ExtraAttribute.cs

GitHub Actions / Test

'Contract_ExtraAttribute.Main(string, object[])' has the wrong signature to be an entry point
{
return true;
}
[SupportedStandards(NEPStandard.NEP17)]
public class Contract_SupportedStandard17Enum : Nep17Token, INep17Payment
{
public override string Symbol { [Safe] get; }

Check warning on line 18 in tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard17Enum.cs

GitHub Actions / Test

Non-nullable property 'Symbol' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public override byte Decimals { [Safe] get; }
public void OnNEP17Payment(UInt160 from, BigInteger amount, object? data = null)
return true;
}
public override string Symbol { [Safe] get; }

Check warning on line 15 in tests/Neo.SmartContract.Framework.TestContracts/Contract_SupportedStandard11Enum.cs

GitHub Actions / Test

Non-nullable property 'Symbol' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public void OnNEP11Payment(UInt160 from, BigInteger amount, object? data = null)
{
if (block == null)
{
Runtime.Log("NULL Block");
return null;

Check warning on line 37 in tests/Neo.SmartContract.Framework.TestContracts/Contract_Blockchain.cs

GitHub Actions / Test

Possible null reference return.
}
if (whatReturn == "Hash") return block.Hash;
if (tx == null)
{
Runtime.Log("NULL Tx");
return null;

Check warning on line 75 in tests/Neo.SmartContract.Framework.TestContracts/Contract_Blockchain.cs

GitHub Actions / Test

Possible null reference return.
}
if (whatReturn == "Hash") return tx.Hash;