Skip to content

Commit 7f86977

Browse files
committed
Rename isAttribute -> isProperty
1 parent 38b8148 commit 7f86977

File tree

12 files changed

+52
-52
lines changed

12 files changed

+52
-52
lines changed

lkql_jit/builtins_annotations/src/main/java/com/adacore/lkql_jit/annotations/BuiltInMethod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@
3030
* Whether method is a property. A property is a built-in method that doesn't need any
3131
* arguments, and that doesn't take parens when you call it.
3232
*/
33-
boolean isAttribute() default false;
33+
boolean isProperty() default false;
3434
}

lkql_jit/builtins_annotations/src/main/java/com/adacore/lkql_jit/annotations/BuiltInProcessor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ private void processBuiltInFactory(TypeElement builtInFactoryClass) throws IOExc
356356

357357
var name = methodAnnotation.name();
358358
var doc = methodAnnotation.doc();
359-
var isAttribute = methodAnnotation.isAttribute();
359+
var isProperty = methodAnnotation.isProperty();
360360

361361
if (fnAnnotation != null) {
362362
if (name.equals("")) {
@@ -398,15 +398,15 @@ private void processBuiltInFactory(TypeElement builtInFactoryClass) throws IOExc
398398

399399
var wrapper =
400400
"BuiltInMethodFactory."
401-
+ (isAttribute
401+
+ (isProperty
402402
? "createAttribute"
403403
: "createMethod")
404404
+ "(\""
405405
+ name
406406
+ "\", \""
407407
+ doc
408408
+ "\""
409-
+ (isAttribute
409+
+ (isProperty
410410
? ""
411411
: ", "
412412
+ builtInArguments(

lkql_jit/language/src/main/java/com/adacore/lkql_jit/built_ins/BuiltInFunctions.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class BuiltInFunctions {
4444
@BuiltInFunction(
4545
name = "unique",
4646
doc = "Given a collection, create a list with all duplicates removed")
47-
@BuiltInMethod(targetTypes = LKQLTypesHelper.LKQL_LIST, isAttribute = true)
47+
@BuiltInMethod(targetTypes = LKQLTypesHelper.LKQL_LIST, isProperty = true)
4848
abstract static class UniqueExpr extends BuiltInBody {
4949
@Specialization
5050
protected LKQLList onIndexable(Indexable indexable) {
@@ -64,7 +64,7 @@ protected LKQLPattern onValidArgs(String regex, @DefaultVal("true") boolean case
6464

6565
/** Expression of the "print" function. */
6666
@BuiltInFunction(name = "print", doc = "Built-in print function. Prints the argument")
67-
@BuiltInMethod(isAttribute = true)
67+
@BuiltInMethod(isProperty = true)
6868
abstract static class PrintExpr extends BuiltInBody {
6969
@Specialization(limit = Constants.SPECIALIZED_LIB_LIMIT)
7070
protected LKQLUnit onBoolean(
@@ -83,7 +83,7 @@ protected LKQLUnit onBoolean(
8383
}
8484

8585
@BuiltInFunction(name = "img", doc = "Return a string representation of an object")
86-
@BuiltInMethod(isAttribute = true)
86+
@BuiltInMethod(isProperty = true)
8787
abstract static class ImgExpr extends BuiltInBody {
8888
@Specialization
8989
protected String onString(String string) {
@@ -99,7 +99,7 @@ protected String onObject(Object obj, @CachedLibrary("obj") InteropLibrary objLi
9999
@BuiltInFunction(
100100
name = "doc",
101101
doc = "Given any object, return the documentation associated with it")
102-
@BuiltInMethod(isAttribute = true)
102+
@BuiltInMethod(isProperty = true)
103103
abstract static class DocExpr extends BuiltInBody {
104104
@Specialization
105105
protected String onLKQLValue(LKQLValue value) {
@@ -241,7 +241,7 @@ public static String exec() {
241241
doc = "Given a string that represents a file name, returns the basename")
242242
@BuiltInMethod(
243243
targetTypes = {LKQLTypesHelper.LKQL_STRING},
244-
isAttribute = true)
244+
isProperty = true)
245245
abstract static class BaseNameExpr extends BuiltInBody {
246246
@Specialization
247247
protected String executeOnString(String fileName) {
@@ -415,7 +415,7 @@ protected String impl(LKQLNamespace namespace, String name) {
415415
}
416416

417417
@BuiltInFunction(name = "help", doc = "Print formatted help for the given object")
418-
@BuiltInMethod(isAttribute = true)
418+
@BuiltInMethod(isProperty = true)
419419
abstract static class HelpExpr extends BuiltInBody {
420420
@Specialization
421421
protected Object onLKQLValue(LKQLValue value) {

lkql_jit/language/src/main/java/com/adacore/lkql_jit/built_ins/BuiltInMethodFactory.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public final class BuiltInMethodFactory {
2626
public final BuiltInBody methodBody;
2727

2828
/**
29-
* Whether the factory should produce "attribute" value. See the {@link BuiltInAttributeValue}
29+
* Whether the factory should produce "attribute" value. See the {@link BuiltInPropertyValue}
3030
* class for more information.
3131
*/
32-
public final boolean isAttribute;
32+
public final boolean isProperty;
3333

3434
// ----- Constructors -----
3535

@@ -40,21 +40,21 @@ public BuiltInMethodFactory(
4040
String[] names,
4141
String[] defaultValues,
4242
BuiltInBody methodBody,
43-
boolean isAttribute) {
43+
boolean isProperty) {
4444
this.name = name;
4545
this.documentation = documentation;
4646
this.paramNames = names;
4747
this.defaultValues = defaultValues;
4848
this.methodBody = methodBody;
49-
this.isAttribute = isAttribute;
49+
this.isProperty = isProperty;
5050
}
5151

5252
// ----- Instance methods -----
5353

5454
/** Instantiate the method with the given "thisValue" and return the LKQL value. */
5555
public BuiltInMethodValue instantiate(Object thisValue) {
56-
return this.isAttribute
57-
? new BuiltInAttributeValue(
56+
return this.isProperty
57+
? new BuiltInPropertyValue(
5858
this.name, this.documentation, this.methodBody, thisValue)
5959
: new BuiltInMethodValue(
6060
this.name,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
* This class represents the LKQL value of an instantiated attribute. An attribute is a special
1010
* method with not other arguments than "this" and is called implicitly by the dotted-name notation.
1111
*/
12-
public class BuiltInAttributeValue extends BuiltInMethodValue {
12+
public class BuiltInPropertyValue extends BuiltInMethodValue {
1313
/** Create a new built-in attribute value. */
14-
public BuiltInAttributeValue(
14+
public BuiltInPropertyValue(
1515
String name, String documentation, BuiltInBody body, Object thisValue) {
1616
super(name, documentation, new String[] {"this"}, new String[] {null}, body, thisValue);
1717
}

lkql_jit/language/src/main/java/com/adacore/lkql_jit/built_ins/methods/AnalysisUnitMethods.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@BuiltinMethodContainer(targetTypes = {LKQLTypesHelper.ANALYSIS_UNIT})
2121
public final class AnalysisUnitMethods {
2222

23-
@BuiltInMethod(name = "root", doc = "Return the root for this unit", isAttribute = true)
23+
@BuiltInMethod(name = "root", doc = "Return the root for this unit", isProperty = true)
2424
abstract static class RootExpr extends BuiltInBody {
2525
@Specialization
2626
public Object onUnit(AnalysisUnit self) {
@@ -29,15 +29,15 @@ public Object onUnit(AnalysisUnit self) {
2929
}
3030
}
3131

32-
@BuiltInMethod(name = "name", doc = "Return the name for this unit", isAttribute = true)
32+
@BuiltInMethod(name = "name", doc = "Return the name for this unit", isProperty = true)
3333
abstract static class NameExpr extends BuiltInBody {
3434
@Specialization
3535
public String onUnit(AnalysisUnit self) {
3636
return self.getFileName();
3737
}
3838
}
3939

40-
@BuiltInMethod(name = "tokens", doc = "Return the tokens for this unit", isAttribute = true)
40+
@BuiltInMethod(name = "tokens", doc = "Return the tokens for this unit", isProperty = true)
4141
abstract static class TokensExpr extends BuiltInBody {
4242
@Specialization
4343
public LKQLList onUnit(AnalysisUnit self) {
@@ -52,7 +52,7 @@ public LKQLList onUnit(AnalysisUnit self) {
5252
}
5353
}
5454

55-
@BuiltInMethod(name = "text", doc = "Return the text for this unit", isAttribute = true)
55+
@BuiltInMethod(name = "text", doc = "Return the text for this unit", isProperty = true)
5656
abstract static class TextExpr extends BuiltInBody {
5757
@Specialization
5858
public String onUnit(AnalysisUnit self) {

lkql_jit/language/src/main/java/com/adacore/lkql_jit/built_ins/methods/IterableMethods.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class IterableMethods {
3232
"""
3333
Return the content of the iterable object with each element associated \
3434
to its index in a tuple: [(<index>, <elem>), ...]""",
35-
isAttribute = true)
35+
isProperty = true)
3636
abstract static class EnumerateExpr extends BuiltInBody {
3737
@Specialization
3838
public LKQLList execute(LKQLList receiver) {
@@ -50,7 +50,7 @@ public LKQLList execute(LKQLList receiver) {
5050
}
5151
}
5252

53-
@BuiltInMethod(name = "to_list", doc = "Transform into a list", isAttribute = true)
53+
@BuiltInMethod(name = "to_list", doc = "Transform into a list", isProperty = true)
5454
abstract static class ToListExpr extends BuiltInBody {
5555
@Specialization
5656
public LKQLList onIterable(Iterable self) {
@@ -66,7 +66,7 @@ public LKQLList onIterable(Iterable self) {
6666
}
6767
}
6868

69-
@BuiltInMethod(name = "length", doc = "Return the length of the iterable", isAttribute = true)
69+
@BuiltInMethod(name = "length", doc = "Return the length of the iterable", isProperty = true)
7070
abstract static class LengthExpr extends BuiltInBody {
7171
@Specialization
7272
public long onIterable(Iterable self) {

lkql_jit/language/src/main/java/com/adacore/lkql_jit/built_ins/methods/NodeMethods.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
@BuiltinMethodContainer(targetTypes = {LKQLTypesHelper.ADA_NODE})
3131
public final class NodeMethods {
3232

33-
@BuiltInMethod(name = "children", doc = "Return the node's children", isAttribute = true)
33+
@BuiltInMethod(name = "children", doc = "Return the node's children", isProperty = true)
3434
abstract static class ChildrenExpr extends BuiltInBody {
3535
@Specialization
3636
public LKQLList onNode(AdaNode self) {
@@ -44,7 +44,7 @@ public LKQLList onNode(AdaNode self) {
4444
}
4545
}
4646

47-
@BuiltInMethod(name = "parent", doc = "Return the node's parent", isAttribute = true)
47+
@BuiltInMethod(name = "parent", doc = "Return the node's parent", isProperty = true)
4848
abstract static class ParentExpr extends BuiltInBody {
4949
@Specialization
5050
public AdaNode onNode(AdaNode self) {
@@ -56,7 +56,7 @@ public AdaNode onNode(AdaNode self) {
5656
@BuiltInMethod(
5757
name = "children_count",
5858
doc = "Return the node's children count",
59-
isAttribute = true)
59+
isProperty = true)
6060
abstract static class ChildrenCountExpr extends BuiltInBody {
6161
@Specialization
6262
public long onNode(AdaNode self) {
@@ -67,7 +67,7 @@ public long onNode(AdaNode self) {
6767
@BuiltInMethod(
6868
name = "dump",
6969
doc = "Dump the node's content in a structured tree",
70-
isAttribute = true)
70+
isProperty = true)
7171
abstract static class DumpExpr extends BuiltInBody {
7272
@Specialization
7373
public LKQLUnit onNode(AdaNode self) {
@@ -76,39 +76,39 @@ public LKQLUnit onNode(AdaNode self) {
7676
}
7777
}
7878

79-
@BuiltInMethod(name = "text", doc = "Return the node's text", isAttribute = true)
79+
@BuiltInMethod(name = "text", doc = "Return the node's text", isProperty = true)
8080
abstract static class TextExpr extends BuiltInBody {
8181
@Specialization
8282
public String onNode(AdaNode self) {
8383
return self.getText();
8484
}
8585
}
8686

87-
@BuiltInMethod(name = "image", doc = "Return the node's image", isAttribute = true)
87+
@BuiltInMethod(name = "image", doc = "Return the node's image", isProperty = true)
8888
abstract static class ImageExpr extends BuiltInBody {
8989
@Specialization
9090
public String onNode(AdaNode self) {
9191
return self.getImage();
9292
}
9393
}
9494

95-
@BuiltInMethod(name = "unit", doc = "Return the node's analysis unit", isAttribute = true)
95+
@BuiltInMethod(name = "unit", doc = "Return the node's analysis unit", isProperty = true)
9696
abstract static class UnitExpr extends BuiltInBody {
9797
@Specialization
9898
public AnalysisUnit onNode(AdaNode self) {
9999
return self.getUnit();
100100
}
101101
}
102102

103-
@BuiltInMethod(name = "kind", doc = "Return the node's kind", isAttribute = true)
103+
@BuiltInMethod(name = "kind", doc = "Return the node's kind", isProperty = true)
104104
abstract static class KindExpr extends BuiltInBody {
105105
@Specialization
106106
public String onNode(AdaNode self) {
107107
return ReflectionUtils.getClassSimpleName(self);
108108
}
109109
}
110110

111-
@BuiltInMethod(name = "tokens", doc = "Return the node's tokens", isAttribute = true)
111+
@BuiltInMethod(name = "tokens", doc = "Return the node's tokens", isProperty = true)
112112
abstract static class TokensExpr extends BuiltInBody {
113113
@Specialization
114114
public LKQLList onNode(AdaNode self) {

lkql_jit/language/src/main/java/com/adacore/lkql_jit/built_ins/methods/RewritingNodeMethods.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public final class RewritingNodeMethods {
1919
@BuiltInMethod(
2020
name = "clone",
2121
doc = "Given a rewriting node, clone it and return its copy",
22-
isAttribute = true)
22+
isProperty = true)
2323
public abstract static class CloneExpr extends BuiltInBody {
2424
@Specialization
2525
public Object execute(Libadalang.RewritingNode node) {

lkql_jit/language/src/main/java/com/adacore/lkql_jit/built_ins/methods/StrMethods.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class StrMethods {
2626
@BuiltInMethod(
2727
name = "to_lower_case",
2828
doc = "Return the string in lowercase",
29-
isAttribute = true)
29+
isProperty = true)
3030
public abstract static class ToLowerCaseExpr extends BuiltInBody {
3131
@Specialization
3232
public Object execute(String arg) {
@@ -37,7 +37,7 @@ public Object execute(String arg) {
3737
@BuiltInMethod(
3838
name = "is_lower_case",
3939
doc = "Return whether the string is in lowercase",
40-
isAttribute = true)
40+
isProperty = true)
4141
public abstract static class IsLowerCaseExpr extends BuiltInBody {
4242
@Specialization
4343
public Object executeGeneric(String arg) {
@@ -48,7 +48,7 @@ public Object executeGeneric(String arg) {
4848
@BuiltInMethod(
4949
name = "to_upper_case",
5050
doc = "Return the string in uppercase",
51-
isAttribute = true)
51+
isProperty = true)
5252
public abstract static class ToUpperCaseExpr extends BuiltInBody {
5353
@Specialization
5454
public Object executeGeneric(String arg) {
@@ -59,7 +59,7 @@ public Object executeGeneric(String arg) {
5959
@BuiltInMethod(
6060
name = "is_upper_case",
6161
doc = "Return whether the string is in uppercase",
62-
isAttribute = true)
62+
isProperty = true)
6363
public abstract static class IsUpperCaseExpr extends BuiltInBody {
6464
@Specialization
6565
public Object executeGeneric(String arg) {
@@ -73,7 +73,7 @@ public Object executeGeneric(String arg) {
7373
"Return whether the given string is written in mixed case, that is,"
7474
+ " with only lower case characters except the first one and every"
7575
+ " character following an underscore",
76-
isAttribute = true)
76+
isProperty = true)
7777
public abstract static class IsMixedCaseExpr extends BuiltInBody {
7878
@Specialization
7979
public Object executeGeneric(String arg) {
@@ -104,7 +104,7 @@ public Object executeGeneric(String arg) {
104104
}
105105
}
106106

107-
@BuiltInMethod(name = "length", doc = "Return the string's length", isAttribute = true)
107+
@BuiltInMethod(name = "length", doc = "Return the string's length", isProperty = true)
108108
public abstract static class LengthExpr extends BuiltInBody {
109109
@Specialization
110110
public Object executeGeneric(String arg) {

0 commit comments

Comments
 (0)