You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2019/06/27 18:23:19 UTC
[royale-compiler] 02/03: MXMLRoyalePublisher: small optimization to
sortClosureFile()
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
commit 89949646f233f76a9ecf069088762525a0d6f2ce
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Thu Jun 27 10:23:00 2019 -0700
MXMLRoyalePublisher: small optimization to sortClosureFile()
---
.../codegen/mxml/royale/MXMLRoyalePublisher.java | 73 ++++++++++++----------
1 file changed, 39 insertions(+), 34 deletions(-)
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyalePublisher.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyalePublisher.java
index 80c6fba..6840385 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyalePublisher.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyalePublisher.java
@@ -619,23 +619,23 @@ public class MXMLRoyalePublisher extends JSGoogPublisher implements IJSPublisher
for (String dep : deps)
{
int open = dep.indexOf("[");
- int close = dep.indexOf("]");
+ int close = dep.indexOf("]", open + 1);
String list = dep.substring(open + 1, close);
String[] parts = list.split(",");
- ArrayList<String> provideds = new ArrayList<String>();
for (String part : parts)
{
part = part.trim();
- if (part.startsWith("'"))
- part = part.substring(1, part.length() - 1);
- provideds.add(part);
+ if (part.startsWith("'"))
+ {
+ part = part.substring(1, part.length() - 1);
+ }
+ if(part.equals(name))
+ {
+ open = dep.indexOf("'");
+ close = dep.indexOf("'", open + 1);
+ return dep.substring(open + 1, close);
+ }
}
- if (provideds.contains(name))
- {
- open = dep.indexOf("'");
- close = dep.indexOf("'", open + 1);
- return dep.substring(open + 1, close);
- }
}
return null;
}
@@ -645,35 +645,40 @@ public class MXMLRoyalePublisher extends JSGoogPublisher implements IJSPublisher
for (String dep : deps)
{
int open = dep.indexOf("[");
- int close = dep.indexOf("]");
+ int close = dep.indexOf("]", open + 1);
String list = dep.substring(open + 1, close);
String[] parts = list.split(",");
- ArrayList<String> provideds = new ArrayList<String>();
for (String part : parts)
{
part = part.trim();
- if (part.startsWith("'"))
- part = part.substring(1, part.length() - 1);
- provideds.add(part);
+ if (part.startsWith("'"))
+ {
+ part = part.substring(1, part.length() - 1);
+ }
+
+ if(part.equals(name))
+ {
+ open = dep.indexOf("[", close + 1);
+ close = dep.indexOf("]", open + 1);
+ if (open + 1 == close)
+ {
+ return null;
+ }
+ String list2 = dep.substring(open + 1, close);
+ String[] parts2 = list2.split(",");
+ ArrayList<String> reqs = new ArrayList<String>();
+ for (String part2 : parts2)
+ {
+ part2 = part2.trim();
+ if (part2.startsWith("'"))
+ {
+ part2 = part2.substring(1, part2.length() - 1);
+ }
+ reqs.add(part2);
+ }
+ return reqs;
+ }
}
- if (provideds.contains(name))
- {
- open = dep.indexOf("[", close + 1);
- close = dep.indexOf("]", open + 1);
- if (open + 1 == close)
- return null;
- String list2 = dep.substring(open + 1, close);
- String[] parts2 = list2.split(",");
- ArrayList<String> reqs = new ArrayList<String>();
- for (String part : parts2)
- {
- part = part.trim();
- if (part.startsWith("'"))
- part = part.substring(1, part.length() - 1);
- reqs.add(part);
- }
- return reqs;
- }
}
return null;
}