This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git


The following commit(s) were added to refs/heads/develop by this push:
     new cc2dcdbfa ExcludeTagNode: improved parsing of [Exclude] metadata to 
make the member name an identifier for tooling
cc2dcdbfa is described below

commit cc2dcdbfa11b0b0fafcb72ba6be4569058898fd3
Author: Josh Tynjala <[email protected]>
AuthorDate: Fri Apr 17 16:02:05 2026 -0700

    ExcludeTagNode: improved parsing of [Exclude] metadata to make the member 
name an identifier for tooling
    
    Will be used for renaming properties/styles/etc. in editors and IDEs that 
use the compiler for code intelligence.
---
 RELEASE_NOTES.md                                   |  1 +
 .../parsing/as/ImportMetadataTokenTypes.txt        |  3 +-
 .../compiler/internal/parsing/as/MetadataParser.g  | 17 +++++
 .../internal/parsing/as/MetadataTokenizer.java     |  1 +
 .../internal/tree/as/metadata/ExcludeTagNode.java  | 87 ++++++++++++++++++++++
 .../compiler/tree/metadata/IExcludeTagNode.java    | 47 ++++++++++++
 6 files changed, 155 insertions(+), 1 deletion(-)

diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index cb5f82ef7..8410ba0b0 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -75,6 +75,7 @@ Apache Royale Compiler 1.0.0
 - compiler: Fixed intermittent missing `goog.require()` calls when using JS 
target.
 - compiler: Added support for `mx.core.IDeferredInstance` for default 
properties with `-children-as-data=false` for JavaScript.
 - compiler: Added support for `mx.core.UIComponentDescriptor` with 
`-children-as-data=false` for JavaScript.
+- compiler: Improved parsing of `[Exclude]` metadata to make the member name 
an identifier for tooling.
 - debugger: Added missing isolate ID to SWF load and unload events.
 - debugger: Fixed debugger targeting the current JDK version instead of the 
intended minimum JDK version.
 - debugger: Fixed localized messages appearing as unprocessed tokens.
diff --git 
a/compiler/src/main/antlr/org/apache/royale/compiler/internal/parsing/as/ImportMetadataTokenTypes.txt
 
b/compiler/src/main/antlr/org/apache/royale/compiler/internal/parsing/as/ImportMetadataTokenTypes.txt
index bf99d0d5c..0d52d34fa 100644
--- 
a/compiler/src/main/antlr/org/apache/royale/compiler/internal/parsing/as/ImportMetadataTokenTypes.txt
+++ 
b/compiler/src/main/antlr/org/apache/royale/compiler/internal/parsing/as/ImportMetadataTokenTypes.txt
@@ -66,4 +66,5 @@ TOKEN_SKIN_STATES_KEYWORD=54
 TOKEN_ASDOC_COMMENT = 55
 TOKEN_HOST_COMPONENT_KEYWORD = 56
 TOKEN_RESOURCEBUNDLE_KEYWORD = 59
-TOKEN_ATTR_OPERATOR_NS_QUALIFIER = 62
\ No newline at end of file
+TOKEN_ATTR_OPERATOR_NS_QUALIFIER = 62
+TOKEN_EXCLUDE_KEYWORD = 63
\ No newline at end of file
diff --git 
a/compiler/src/main/antlr/org/apache/royale/compiler/internal/parsing/as/MetadataParser.g
 
b/compiler/src/main/antlr/org/apache/royale/compiler/internal/parsing/as/MetadataParser.g
index 2e8a023c0..3b429b78f 100644
--- 
a/compiler/src/main/antlr/org/apache/royale/compiler/internal/parsing/as/MetadataParser.g
+++ 
b/compiler/src/main/antlr/org/apache/royale/compiler/internal/parsing/as/MetadataParser.g
@@ -66,6 +66,7 @@ meta[MetaTagsNode parent]
        | tag = typedTag[parent]
        | tag = inspectable[parent]
        | tag = defaultproperty[parent]
+       | tag = exclude[parent]
        | tag = accessibilityClass[parent]
        | tag = multiValue[parent]
        | tag = skinClass[parent]
@@ -341,6 +342,22 @@ defaultproperty[MetaTagsNode parent] returns 
[DefaultPropertyTagNode node]
        }
        ;
        
+       
+exclude[MetaTagsNode parent] returns [ExcludeTagNode node]
+       {       
+               IdentifierNode name = null;
+               node = new ExcludeTagNode();
+               resetComments(node.getTagName());
+       }
+       : TOKEN_EXCLUDE_KEYWORD 
+               (TOKEN_ATTR_NAME nameString:TOKEN_STRING
+                { name = build(nameString); if(name != null) { 
node.setNameNode(name); } }
+               | unknownProperty[node]
+               | TOKEN_OPEN_PAREN {})*
+       {       parent.addTag(node); }
+       ;
+       
+       
 resourcebundle[MetaTagsNode parent] returns [ResourceBundleTagNode node]
        {       
                IdentifierNode bundleNameNode = null;
diff --git 
a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/MetadataTokenizer.java
 
b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/MetadataTokenizer.java
index 95f247122..439be4d12 100644
--- 
a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/MetadataTokenizer.java
+++ 
b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/MetadataTokenizer.java
@@ -64,6 +64,7 @@ public class MetadataTokenizer
             .put(IMetaAttributeConstants.ATTRIBUTE_HOST_COMPONENT, 
MetadataTokenTypes.TOKEN_HOST_COMPONENT_KEYWORD)
             .put(IMetaAttributeConstants.ATTRIBUTE_SKIN_CLASS, 
MetadataTokenTypes.TOKEN_SKINCLASS_KEYWORD)
             .put(IMetaAttributeConstants.ATTRIBUTE_ALTERNATIVE, 
MetadataTokenTypes.TOKEN_ALTERNATIVE_KEYWORD)
+            .put(IMetaAttributeConstants.ATTRIBUTE_EXCLUDE, 
MetadataTokenTypes.TOKEN_EXCLUDE_KEYWORD)
             .build();
 
     private static final Map<String, Integer> attrToTokenMap = new 
ImmutableMap.Builder<String, Integer>()
diff --git 
a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/metadata/ExcludeTagNode.java
 
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/metadata/ExcludeTagNode.java
new file mode 100644
index 000000000..81f4e9f37
--- /dev/null
+++ 
b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/metadata/ExcludeTagNode.java
@@ -0,0 +1,87 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.royale.compiler.internal.tree.as.metadata;
+
+import org.apache.royale.compiler.constants.IMetaAttributeConstants;
+import org.apache.royale.compiler.definitions.IDefinition;
+import org.apache.royale.compiler.definitions.IVariableDefinition;
+import org.apache.royale.compiler.internal.tree.as.IdentifierNode;
+import org.apache.royale.compiler.projects.ICompilerProject;
+import org.apache.royale.compiler.tree.metadata.IExcludeTagNode;
+
+/**
+ * Implementation of {@link IExcludeTagNode}.
+ */
+public class ExcludeTagNode extends MetaTagNode implements IExcludeTagNode
+{
+    /**
+     * Constructor.
+     */
+    public ExcludeTagNode()
+    {
+        super(IMetaAttributeConstants.ATTRIBUTE_EXCLUDE);
+    }
+
+    private IdentifierNode nameNode;
+
+    public void setNameNode(IdentifierNode nameNode)
+    {
+        this.nameNode = nameNode;
+        nameNode.setParent(this);
+        addToMap(IMetaAttributeConstants.NAME_EXCLUDE_NAME, 
nameNode.getName());
+    }
+
+    @Override
+    protected void setChildren(boolean fillInOffsets)
+    {
+        addChildInOrder(nameNode, fillInOffsets);
+    }
+
+    @Override
+    protected int getInitialChildCount()
+    {
+        return 1;
+    }
+
+    @Override
+    public IDefinition resolve(ICompilerProject project)
+    {
+        if (nameNode == null)
+            return null;
+        
+        return nameNode.resolve(project);
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (obj instanceof ExcludeTagNode)
+        {
+            if (!equals(((ExcludeTagNode)obj).nameNode, nameNode))
+                return false;
+        }
+        else
+        {
+            return false;
+        }
+
+        return super.equals(obj);
+    }
+}
diff --git 
a/compiler/src/main/java/org/apache/royale/compiler/tree/metadata/IExcludeTagNode.java
 
b/compiler/src/main/java/org/apache/royale/compiler/tree/metadata/IExcludeTagNode.java
new file mode 100644
index 000000000..eb49df9ea
--- /dev/null
+++ 
b/compiler/src/main/java/org/apache/royale/compiler/tree/metadata/IExcludeTagNode.java
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.royale.compiler.tree.metadata;
+
+import org.apache.royale.compiler.definitions.IDefinition;
+import org.apache.royale.compiler.projects.ICompilerProject;
+
+/**
+ * Represents an Exclude metadata tag, of the form
+ * [Exclude(name="propertyName", kind="property")]
+ */
+public interface IExcludeTagNode extends IMetaTagNode
+{
+    /**
+     * Resolves the property to an {@link IDefinition}
+     * 
+     * @param project an {@link ICompilerProject} to use for lookups
+     * @return an {@link IDefinition} or null
+     */
+    IDefinition resolve(ICompilerProject project);
+}

Reply via email to