-
Notifications
You must be signed in to change notification settings - Fork 119
Аннотация как значение параметра Аннотации #1576
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7ae9f9a
Аннотация как значение параметра Аннотации.
dmpas 78f78b6
Merge remote-tracking branch 'us/develop' into feature/deep-annotations
dmpas c0a0fcd
Кодировка файла теста.
dmpas 7df3a85
Замечания от кролика.
dmpas eb5fe02
Аннотация убрана из базовых типов.
dmpas a2fa4ea
Убрана завязка на константы образа.
dmpas c514629
Почищен неиспользуемый код.
dmpas 67edf3a
Изменено представление аннотаций в образе.
dmpas 89cdeef
Слияние с develop
dmpas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /*---------------------------------------------------------- | ||
| This Source Code Form is subject to the terms of the | ||
| Mozilla Public License, v.2.0. If a copy of the MPL | ||
| was not distributed with this file, You can obtain one | ||
| at http://mozilla.org/MPL/2.0/. | ||
| ----------------------------------------------------------*/ | ||
|
|
||
| using System; | ||
| using OneScript.Contexts; | ||
| using OneScript.Exceptions; | ||
| using OneScript.Localization; | ||
| using OneScript.Types; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace OneScript.Values | ||
| { | ||
| public sealed class BslAnnotationValue : BslPrimitiveValue | ||
| { | ||
| public BslAnnotationValue(string name) { | ||
| Name = name; | ||
| } | ||
|
|
||
| public string Name { get; } | ||
|
|
||
| public List<BslAnnotationParameter> Parameters { get; } = new List<BslAnnotationParameter>(); | ||
|
|
||
|
|
||
| public override int CompareTo(BslValue other) { | ||
| var msg = new BilingualString("Сравнение на больше/меньше для данного типа не поддерживается", | ||
| "Comparison for less/greater is not supported for this type"); | ||
|
|
||
| throw new RuntimeException(msg); | ||
| } | ||
|
|
||
| public override bool Equals(BslValue other) { | ||
| return ReferenceEquals(this, other); | ||
| } | ||
|
|
||
| public override string ToString() | ||
| { | ||
| var sb = new StringBuilder("&"); | ||
| sb.Append(Name); | ||
| if (Parameters.Count != 0) | ||
| { | ||
| var prefix = "("; | ||
| foreach (var parameter in Parameters) | ||
| { | ||
| sb.Append(prefix); | ||
| sb.Append(parameter); | ||
| prefix = ","; | ||
| } | ||
| sb.Append(")"); | ||
| } | ||
| return sb.ToString(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /*---------------------------------------------------------- | ||
| This Source Code Form is subject to the terms of the | ||
| Mozilla Public License, v.2.0. If a copy of the MPL | ||
| was not distributed with this file, You can obtain one | ||
| at http://mozilla.org/MPL/2.0/. | ||
| ----------------------------------------------------------*/ | ||
| using System; | ||
| using System.Text; | ||
|
|
||
| namespace ScriptEngine.Machine | ||
| { | ||
| [Serializable] | ||
| public struct AnnotationDefinition | ||
| { | ||
| public string Name; | ||
| public AnnotationParameter[] Parameters; | ||
|
|
||
| public int ParamCount => Parameters?.Length ?? 0; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /*---------------------------------------------------------- | ||
| This Source Code Form is subject to the terms of the | ||
| Mozilla Public License, v.2.0. If a copy of the MPL | ||
| was not distributed with this file, You can obtain one | ||
| at http://mozilla.org/MPL/2.0/. | ||
| ----------------------------------------------------------*/ | ||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace ScriptEngine.Machine | ||
| { | ||
| [Serializable] | ||
| public struct AnnotationParameter | ||
| { | ||
| public string Name; | ||
|
|
||
| [NonSerialized] | ||
| public IValue RuntimeValue; | ||
|
|
||
| public const int UNDEFINED_VALUE_INDEX = -1; | ||
|
|
||
|
|
||
| public override string ToString() | ||
| { | ||
| var list = new List<string>(); | ||
| if (!string.IsNullOrEmpty(Name)) | ||
| { | ||
| list.Add(Name); | ||
| } | ||
| if (RuntimeValue != null) | ||
| { | ||
| list.Add(RuntimeValue.ToString()); | ||
| } | ||
| return string.Join("=", list); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.