You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2016/10/01 06:41:22 UTC
[1/9] git commit: [flex-falcon]
[refs/heads/feature-autobuild/maven-archetypes] - import Alias =
com.example.ClassToImport
Repository: flex-falcon
Updated Branches:
refs/heads/feature-autobuild/maven-archetypes 35c5ab2b2 -> 506025f4d
import Alias = com.example.ClassToImport
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/9189c0f9
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/9189c0f9
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/9189c0f9
Branch: refs/heads/feature-autobuild/maven-archetypes
Commit: 9189c0f99b94b6e39af381d54f1b197c4aed0ce6
Parents: 1dabb68
Author: Josh Tynjala <jo...@gmail.com>
Authored: Fri Sep 23 17:12:50 2016 -0700
Committer: Josh Tynjala <jo...@gmail.com>
Committed: Mon Sep 26 15:31:22 2016 -0700
----------------------------------------------------------------------
.../compiler/internal/parsing/as/ASParser.g | 11 +-
.../flex/compiler/internal/scopes/ASScope.java | 123 ++++++++++++++++++-
.../compiler/internal/tree/as/ImportNode.java | 42 ++++++-
.../problems/DuplicateImportAliasProblem.java | 42 +++++++
.../flex/compiler/tree/as/IImportNode.java | 7 ++
5 files changed, 221 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9189c0f9/compiler/src/main/antlr/org/apache/flex/compiler/internal/parsing/as/ASParser.g
----------------------------------------------------------------------
diff --git a/compiler/src/main/antlr/org/apache/flex/compiler/internal/parsing/as/ASParser.g b/compiler/src/main/antlr/org/apache/flex/compiler/internal/parsing/as/ASParser.g
index e5af0f9..20afd5c 100644
--- a/compiler/src/main/antlr/org/apache/flex/compiler/internal/parsing/as/ASParser.g
+++ b/compiler/src/main/antlr/org/apache/flex/compiler/internal/parsing/as/ASParser.g
@@ -472,6 +472,7 @@ importDirective[ContainerNode c]
{
ExpressionNodeBase n = null;
ImportNode i = null;
+ IIdentifierNode alias = null;
}
: importT:TOKEN_KEYWORD_IMPORT
{
@@ -479,11 +480,19 @@ importDirective[ContainerNode c]
i.startBefore(importT);
i.endAfter(importT);
c.addItem(i);
+ if (LA(2) == TOKEN_OPERATOR_ASSIGNMENT)
+ {
+ alias = identifier();
+ match(TOKEN_OPERATOR_ASSIGNMENT);
+ }
}
-
+
n=importName
{
if(n != null) {
+ if(alias != null) {
+ i.setImportAlias(alias.getName());
+ }
i.setImportTarget(n);
i.setEnd(n.getEnd());
encounteredImport(i);
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9189c0f9/compiler/src/main/java/org/apache/flex/compiler/internal/scopes/ASScope.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/scopes/ASScope.java b/compiler/src/main/java/org/apache/flex/compiler/internal/scopes/ASScope.java
index 953f14b..904c547 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/scopes/ASScope.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/scopes/ASScope.java
@@ -48,8 +48,10 @@ import org.apache.flex.compiler.internal.definitions.InterfaceDefinition;
import org.apache.flex.compiler.internal.definitions.NamespaceDefinition;
import org.apache.flex.compiler.internal.definitions.ScopedDefinitionBase;
import org.apache.flex.compiler.internal.projects.CompilerProject;
+import org.apache.flex.compiler.internal.tree.as.FileNode;
import org.apache.flex.compiler.internal.tree.as.ScopedBlockNode;
import org.apache.flex.compiler.internal.workspaces.Workspace;
+import org.apache.flex.compiler.problems.DuplicateImportAliasProblem;
import org.apache.flex.compiler.projects.ICompilerProject;
import org.apache.flex.compiler.scopes.IDefinitionSet;
import org.apache.flex.compiler.tree.as.IScopedNode;
@@ -108,6 +110,11 @@ public abstract class ASScope extends ASScopeBase
*/
private Object importsInScope = null;
+ /**
+ * List of all aliases for imports in scope
+ */
+ private Map<String, String> aliasToImportQualifiedName = null;
+
private Set<String> packageNames = null;
private Object usedNamespaces = null;
@@ -170,6 +177,23 @@ public abstract class ASScope extends ASScopeBase
CheapArray.add(useDirective, usedNamespaces);
}
+ public boolean hasImportAlias(String alias)
+ {
+ return aliasToImportQualifiedName != null
+ && aliasToImportQualifiedName.containsKey(alias);
+ }
+
+ public void addImport(String target, String alias)
+ {
+ if (aliasToImportQualifiedName == null)
+ {
+ aliasToImportQualifiedName = new HashMap<String, String>();
+ }
+ assert !hasImportAlias(alias) : "addImport() should not be called with an existing alias";
+ addImport(target);
+ aliasToImportQualifiedName.put(alias, target);
+ }
+
public void addImport(String target)
{
if (importsInScope == null)
@@ -408,6 +432,8 @@ public abstract class ASScope extends ASScopeBase
*/
public Set<INamespaceDefinition> getNamespaceSetForName(ICompilerProject project, String name)
{
+ // if the name is an alias, we want the original name -JT
+ name = resolveBaseNameFromAlias(name);
if (namespaceSetSameAsContainingScopeNamespaceSet() && getContainingScope() != null)
{
// If this scope doesn't contribute anything to the namespace set, then just ask our containing
@@ -900,6 +926,63 @@ public abstract class ASScope extends ASScopeBase
getLocalProperty(project, defs, baseName, true);
}
+ protected String resolveBaseNameFromAlias(String possibleAlias)
+ {
+ if (aliasToImportQualifiedName != null
+ && aliasToImportQualifiedName.containsKey(possibleAlias))
+ {
+ String qualifiedName = aliasToImportQualifiedName.get(possibleAlias);
+ int index = qualifiedName.lastIndexOf(".");
+ if (index != -1)
+ {
+ return qualifiedName.substring(index + 1);
+ }
+ return qualifiedName;
+ }
+ ASScope containingScope = getContainingScope();
+ if (containingScope != null)
+ {
+ return containingScope.resolveBaseNameFromAlias(possibleAlias);
+ }
+ return possibleAlias;
+ }
+
+ protected String resolveAliasFromQualifiedImport(String qualifiedName)
+ {
+ if (aliasToImportQualifiedName != null
+ && aliasToImportQualifiedName.containsValue(qualifiedName))
+ {
+ for (String key : aliasToImportQualifiedName.keySet())
+ {
+ if (aliasToImportQualifiedName.get(key).equals(qualifiedName))
+ {
+ return key;
+ }
+ }
+ }
+ ASScope containingScope = getContainingScope();
+ if (containingScope != null)
+ {
+ return containingScope.resolveAliasFromQualifiedImport(qualifiedName);
+ }
+ return null;
+ }
+
+ protected String resolveQualifiedNameFromAlias(String possibleAlias)
+ {
+ if (aliasToImportQualifiedName != null
+ && aliasToImportQualifiedName.containsKey(possibleAlias))
+ {
+ return aliasToImportQualifiedName.get(possibleAlias);
+ }
+ ASScope containingScope = getContainingScope();
+ if (containingScope != null)
+ {
+ return containingScope.resolveQualifiedNameFromAlias(possibleAlias);
+ }
+ return possibleAlias;
+ }
+
/**
* This is called by {@link ASScopeCache} when there was a cache miss.
*
@@ -1026,6 +1109,7 @@ public abstract class ASScope extends ASScopeBase
// This loop may go as far as the file scope, whose containing scope is null.
// But it may break out early; lastSearchScope will keep track of how far it went.
ASScope lastSearchedScope = null;
+ String baseNameForAlias = this.resolveBaseNameFromAlias(baseName);
for (ASScope currentScope = this; currentScope != null; currentScope = currentScope.getContainingScope())
{
// If we're not looking for all matching definitions,
@@ -1034,7 +1118,7 @@ public abstract class ASScope extends ASScopeBase
break;
// Search one scope for any definitions matching baseName and naamespaceSet.
- currentScope.getPropertyForScopeChain(project, accumulator, baseName, nsPred, findAll);
+ currentScope.getPropertyForScopeChain(project, accumulator, baseNameForAlias, nsPred, findAll);
// Keep track of the last scope that was searched.
lastSearchedScope = currentScope;
@@ -1069,7 +1153,42 @@ public abstract class ASScope extends ASScopeBase
if (searchProjectScope)
{
ASProjectScope projectScope = project.getScope();
- projectScope.getPropertyForScopeChain(this, accumulator, baseName, nsPred.getNamespaceSet(), dt);
+ projectScope.getPropertyForScopeChain(this, accumulator, baseNameForAlias, nsPred.getNamespaceSet(), dt);
+ }
+ if(!baseName.equals(baseNameForAlias)) // has alias
+ {
+ // remove anything with the same base name that doesn't have an
+ // alias, unless its base name is equal to the alias. that is the
+ // only time where there will be ambiguity. -JT
+ String alias = baseName; //for clarity
+ ArrayList<IDefinition> toRemove = new ArrayList<IDefinition>();
+ String qualifiedNameForAlias = resolveQualifiedNameFromAlias(alias);
+ for(IDefinition definition : accumulator)
+ {
+ if(!definition.getBaseName().equals(alias)
+ && !definition.getQualifiedName().equals(qualifiedNameForAlias))
+ {
+ toRemove.add(definition);
+ }
+ }
+ // some collections can't remove while iterating, so do it after
+ // collecting all of the definitions to remove -JT
+ accumulator.removeAll(toRemove);
+ }
+ else // no alias
+ {
+ // remove anything that has an alias, unless its alias is equal to
+ // the original base name.
+ ArrayList<IDefinition> toRemove = new ArrayList<IDefinition>();
+ for (IDefinition definition : accumulator)
+ {
+ String otherAlias = resolveAliasFromQualifiedImport(definition.getQualifiedName());
+ if (otherAlias != null && !otherAlias.equals(baseName))
+ {
+ toRemove.add(definition);
+ }
+ }
+ accumulator.removeAll(toRemove);
}
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9189c0f9/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/ImportNode.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/ImportNode.java b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/ImportNode.java
index 0002474..709e54a 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/ImportNode.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/ImportNode.java
@@ -34,7 +34,9 @@ import org.apache.flex.compiler.internal.parsing.as.ASTokenTypes;
import org.apache.flex.compiler.internal.scopes.ASScope;
import org.apache.flex.compiler.internal.semantics.PostProcessStep;
import org.apache.flex.compiler.parsing.IASToken;
+import org.apache.flex.compiler.problems.DuplicateImportAliasProblem;
import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.problems.UnknownImportProblem;
import org.apache.flex.compiler.projects.ICompilerProject;
import org.apache.flex.compiler.tree.ASTNodeID;
import org.apache.flex.compiler.tree.as.IASNode;
@@ -98,6 +100,8 @@ public class ImportNode extends FixedChildrenNode implements IImportNode
protected ImportKind importKind;
+ protected String importAlias;
+
//
// NodeBase overrides
//
@@ -145,7 +149,25 @@ public class ImportNode extends FixedChildrenNode implements IImportNode
protected void analyze(EnumSet<PostProcessStep> set, ASScope scope, Collection<ICompilerProblem> problems)
{
if (set.contains(PostProcessStep.POPULATE_SCOPE))
- scope.addImport(this.getImportName());
+ {
+ if (importAlias != null)
+ {
+ if (scope.hasImportAlias(importAlias))
+ {
+ //we can't have duplicates, or it will be ambiguous -JT
+ FileNode fileNode = (FileNode) getAncestorOfType(FileNode.class);
+ fileNode.addProblem(new DuplicateImportAliasProblem(this, this.getImportAlias()));
+ }
+ else
+ {
+ scope.addImport(this.getImportName(), this.getImportAlias());
+ }
+ }
+ else
+ {
+ scope.addImport(this.getImportName());
+ }
+ }
}
/*
@@ -237,4 +259,22 @@ public class ImportNode extends FixedChildrenNode implements IImportNode
{
this.targetImportNode = targetImportNode;
}
+
+ /**
+ * Gets the optional alias of the import.
+ */
+ public String getImportAlias()
+ {
+ return this.importAlias;
+ }
+
+ /**
+ * Sets the optional alias of the import.
+ *
+ * @param importAlias The alias of the import.
+ */
+ public void setImportAlias(String importAlias)
+ {
+ this.importAlias = importAlias;
+ }
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9189c0f9/compiler/src/main/java/org/apache/flex/compiler/problems/DuplicateImportAliasProblem.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/problems/DuplicateImportAliasProblem.java b/compiler/src/main/java/org/apache/flex/compiler/problems/DuplicateImportAliasProblem.java
new file mode 100644
index 0000000..881c709
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/problems/DuplicateImportAliasProblem.java
@@ -0,0 +1,42 @@
+/*
+ *
+ * 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.flex.compiler.problems;
+
+import org.apache.flex.compiler.tree.as.IASNode;
+
+/**
+ * Diagnostic emitted when semantic analysis detects
+ * a duplicate import alias.
+ */
+public final class DuplicateImportAliasProblem extends SemanticProblem
+{
+ public static final String DESCRIPTION =
+ "Duplicate import alias: ${importAlias}.";
+
+ public static final int errorCode = 9999;
+ public DuplicateImportAliasProblem(IASNode site, String importAlias)
+ {
+ super(site);
+ this.importAlias = importAlias;
+ }
+
+ public final String importAlias;
+}
+
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9189c0f9/compiler/src/main/java/org/apache/flex/compiler/tree/as/IImportNode.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/tree/as/IImportNode.java b/compiler/src/main/java/org/apache/flex/compiler/tree/as/IImportNode.java
index 5441e63..d001155 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/tree/as/IImportNode.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/tree/as/IImportNode.java
@@ -96,6 +96,13 @@ public interface IImportNode extends IASNode
IImportTarget getImportTarget();
/**
+ * Returns the alias for this import, if one exists
+ *
+ * @return an alias or null
+ */
+ String getImportAlias();
+
+ /**
* Returns whether an import statement is a wildcard import or not
*
* @return true if a wildcard import
[8/9] git commit: [flex-falcon]
[refs/heads/feature-autobuild/maven-archetypes] - eliminate circularities
from package and reflection output
Posted by cd...@apache.org.
eliminate circularities from package and reflection output
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/c11b36f2
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/c11b36f2
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/c11b36f2
Branch: refs/heads/feature-autobuild/maven-archetypes
Commit: c11b36f279bef87445d2a6f60254ccc1fb94296d
Parents: bdc4023
Author: Alex Harui <ah...@apache.org>
Authored: Fri Sep 30 08:08:31 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Sep 30 08:08:31 2016 -0700
----------------------------------------------------------------------
.../codegen/js/jx/PackageFooterEmitter.java | 23 +++++++++++---------
.../codegen/js/jx/PackageHeaderEmitter.java | 6 ++---
.../flexjs/projects/overrides/Test_result.js | 2 --
.../projects/overrides/classes/A_result.js | 2 --
.../projects/overrides/interfaces/IA_result.js | 2 --
5 files changed, 16 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c11b36f2/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java
index fc4b4de..7509699 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java
@@ -34,6 +34,7 @@ import org.apache.flex.compiler.internal.codegen.js.JSSessionModel.BindableVarIn
import org.apache.flex.compiler.internal.codegen.js.JSSessionModel.ImplicitBindableImplementation;
import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSDocEmitter;
+import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitterTokens;
import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
@@ -245,6 +246,8 @@ public class PackageFooterEmitter extends JSSubEmitter implements
public void collectReflectionData(ITypeNode tnode)
{
+ JSFlexJSEmitter fjs = (JSFlexJSEmitter)getEmitter();
+
varData = new ArrayList<VariableData>();
accessorData = new ArrayList<AccessorData>();
methodData = new ArrayList<MethodData>();
@@ -293,7 +296,7 @@ public class PackageFooterEmitter extends JSSubEmitter implements
bindableAccessor.name = name;
bindableAccessor.access = "readwrite";
bindableAccessor.type = bindableVars.get(name).type;
- bindableAccessor.declaredBy = getEmitter().formatQualifiedName(tnode.getQualifiedName());
+ bindableAccessor.declaredBy = fjs.formatQualifiedName(tnode.getQualifiedName(), true);
bindableAccessor.isStatic = isStatic;
//attribute the metadata from the var definition to the Bindable Accessor implementation
if (metaData != null)
@@ -313,7 +316,7 @@ public class PackageFooterEmitter extends JSSubEmitter implements
data.name = name;
data.isStatic = isStatic;
String qualifiedTypeName = varNode.getVariableTypeNode().resolveType(getProject()).getQualifiedName();
- data.type = getEmitter().formatQualifiedName(qualifiedTypeName);
+ data.type = fjs.formatQualifiedName(qualifiedTypeName, true);
if (metaData != null)
{
@@ -331,8 +334,8 @@ public class PackageFooterEmitter extends JSSubEmitter implements
AccessorData staticEventDispatcher = new AccessorData();
staticEventDispatcher.name = BindableEmitter.STATIC_DISPATCHER_GETTER;
staticEventDispatcher.access = "readonly";
- staticEventDispatcher.type = getEmitter().formatQualifiedName(BindableEmitter.DISPATCHER_CLASS_QNAME);
- staticEventDispatcher.declaredBy = getEmitter().formatQualifiedName(tnode.getQualifiedName());
+ staticEventDispatcher.type = fjs.formatQualifiedName(BindableEmitter.DISPATCHER_CLASS_QNAME, true);
+ staticEventDispatcher.declaredBy = fjs.formatQualifiedName(tnode.getQualifiedName(), true);
staticEventDispatcher.isStatic = true;
accessorData.add(staticEventDispatcher);
}
@@ -371,11 +374,11 @@ public class PackageFooterEmitter extends JSSubEmitter implements
} else data.access = "readwrite";
}
accessorMap.put(data.name, data);
- data.type = getEmitter().formatQualifiedName(data.type);
+ data.type = fjs.formatQualifiedName(data.type, true);
IClassNode declarer = (IClassNode)fnNode.getAncestorOfType(IClassNode.class);
- String declarant = getEmitter().formatQualifiedName(tnode.getQualifiedName());
+ String declarant = fjs.formatQualifiedName(tnode.getQualifiedName(), true);
if (declarer != null)
- declarant = getEmitter().formatQualifiedName(declarer.getQualifiedName());
+ declarant = fjs.formatQualifiedName(declarer.getQualifiedName(), true);
data.declaredBy = declarant;
data.isStatic = isStatic;
IMetaTagsNode metaData = fnNode.getMetaTags();
@@ -407,15 +410,15 @@ public class PackageFooterEmitter extends JSSubEmitter implements
if (!(qualifiedTypeName.equals("") || qualifiedTypeName.equals("void"))) {
qualifiedTypeName = fnNode.getReturnTypeNode().resolveType(getProject()).getQualifiedName();
}
- data.type = getEmitter().formatQualifiedName(qualifiedTypeName);
+ data.type = fjs.formatQualifiedName(qualifiedTypeName, true);
ITypeNode declarer;
if (isInterface)
declarer = (IInterfaceNode)fnNode.getAncestorOfType(IInterfaceNode.class);
else
declarer = (IClassNode)fnNode.getAncestorOfType(IClassNode.class);
- String declarant = getEmitter().formatQualifiedName(tnode.getQualifiedName());
+ String declarant = fjs.formatQualifiedName(tnode.getQualifiedName(), true);
if (declarer != null)
- declarant = getEmitter().formatQualifiedName(declarer.getQualifiedName());
+ declarant = fjs.formatQualifiedName(declarer.getQualifiedName(), true);
data.declaredBy = declarant;
IMetaTagsNode metaData = fnNode.getMetaTags();
if (metaData != null)
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c11b36f2/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
index 585ace8..56bfeb8 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
@@ -130,7 +130,7 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
write(JSGoogEmitterTokens.GOOG_PROVIDE);
write(ASEmitterTokens.PAREN_OPEN);
write(ASEmitterTokens.SINGLE_QUOTE);
- write(getEmitter().formatQualifiedName(qname));
+ write(((JSFlexJSEmitter)getEmitter()).formatQualifiedName(qname, true));
write(ASEmitterTokens.SINGLE_QUOTE);
write(ASEmitterTokens.PAREN_CLOSE);
writeNewline(ASEmitterTokens.SEMICOLON);
@@ -315,7 +315,7 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
write(JSGoogEmitterTokens.GOOG_REQUIRE);
write(ASEmitterTokens.PAREN_OPEN);
write(ASEmitterTokens.SINGLE_QUOTE);
- write(getEmitter().formatQualifiedName(imp));
+ write(((JSFlexJSEmitter)getEmitter()).formatQualifiedName(imp, true));
write(ASEmitterTokens.SINGLE_QUOTE);
write(ASEmitterTokens.PAREN_CLOSE);
writeNewline(ASEmitterTokens.SEMICOLON);
@@ -342,7 +342,7 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
write(JSGoogEmitterTokens.GOOG_REQUIRE);
write(ASEmitterTokens.PAREN_OPEN);
write(ASEmitterTokens.SINGLE_QUOTE);
- write(getEmitter().formatQualifiedName(imp));
+ write(((JSFlexJSEmitter)getEmitter()).formatQualifiedName(imp, true));
write(ASEmitterTokens.SINGLE_QUOTE);
write(ASEmitterTokens.PAREN_CLOSE);
writeNewline(ASEmitterTokens.SEMICOLON);
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c11b36f2/compiler-jx/src/test/resources/flexjs/projects/overrides/Test_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/overrides/Test_result.js b/compiler-jx/src/test/resources/flexjs/projects/overrides/Test_result.js
index 2a1c92a..1ff92d3 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/overrides/Test_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/overrides/Test_result.js
@@ -22,8 +22,6 @@
goog.provide('Test');
goog.require('classes.A');
-goog.require('classes.C');
-goog.require('interfaces.IC');
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c11b36f2/compiler-jx/src/test/resources/flexjs/projects/overrides/classes/A_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/overrides/classes/A_result.js b/compiler-jx/src/test/resources/flexjs/projects/overrides/classes/A_result.js
index 0eea031..31cb53a 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/overrides/classes/A_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/overrides/classes/A_result.js
@@ -21,9 +21,7 @@
goog.provide('classes.A');
-goog.require('classes.B');
goog.require('interfaces.IA');
-goog.require('interfaces.IB');
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c11b36f2/compiler-jx/src/test/resources/flexjs/projects/overrides/interfaces/IA_result.js
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/projects/overrides/interfaces/IA_result.js b/compiler-jx/src/test/resources/flexjs/projects/overrides/interfaces/IA_result.js
index ec8a343..722bc2e 100644
--- a/compiler-jx/src/test/resources/flexjs/projects/overrides/interfaces/IA_result.js
+++ b/compiler-jx/src/test/resources/flexjs/projects/overrides/interfaces/IA_result.js
@@ -21,8 +21,6 @@
goog.provide('interfaces.IA');
-goog.require('classes.B');
-goog.require('interfaces.IB');
[3/9] git commit: [flex-falcon]
[refs/heads/feature-autobuild/maven-archetypes] - Add Error to js natives
Posted by cd...@apache.org.
Add Error to js natives
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/05672812
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/05672812
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/05672812
Branch: refs/heads/feature-autobuild/maven-archetypes
Commit: 05672812b81f9080307f14f57339aa1a06f4aa63
Parents: e9a7ccf
Author: greg-dove <gr...@gmail.com>
Authored: Fri Sep 30 10:34:51 2016 +1300
Committer: greg-dove <gr...@gmail.com>
Committed: Fri Sep 30 10:34:51 2016 +1300
----------------------------------------------------------------------
.../src/main/java/org/apache/flex/compiler/utils/NativeUtils.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/05672812/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
index acc1126..c389a10 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/utils/NativeUtils.java
@@ -91,6 +91,7 @@ public class NativeUtils
Array("Array"),
Date("Date"),
Math("Math"),
+ Error("Error"),
Boolean("Boolean"),
decodeURI("decodeURI"),
decodeURIComponent("decodeURIComponent"),
[2/9] git commit: [flex-falcon]
[refs/heads/feature-autobuild/maven-archetypes] - Merge branch 'develop' into
rename-import
Posted by cd...@apache.org.
Merge branch 'develop' into rename-import
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/e9a7ccfb
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/e9a7ccfb
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/e9a7ccfb
Branch: refs/heads/feature-autobuild/maven-archetypes
Commit: e9a7ccfbdc15814a858fcbebf0a6112f3f99d922
Parents: 9189c0f 35c5ab2
Author: Josh Tynjala <jo...@gmail.com>
Authored: Thu Sep 29 13:18:09 2016 -0700
Committer: Josh Tynjala <jo...@gmail.com>
Committed: Thu Sep 29 13:18:09 2016 -0700
----------------------------------------------------------------------
Jenkinsfile | 32 +-
.../internal/codegen/js/JSSessionModel.java | 11 +-
.../codegen/js/flexjs/JSFlexJSEmitter.java | 76 +-
.../js/flexjs/JSFlexJSEmitterTokens.java | 5 +
.../codegen/js/goog/JSGoogDocEmitter.java | 7 +
.../internal/codegen/js/jx/AccessorEmitter.java | 431 ++++++-----
.../codegen/js/jx/BinaryOperatorEmitter.java | 23 +-
.../internal/codegen/js/jx/FieldEmitter.java | 26 +-
.../codegen/js/jx/MemberAccessEmitter.java | 14 +-
.../codegen/js/jx/PackageFooterEmitter.java | 760 +++++++++++++------
.../codegen/js/jx/SuperCallEmitter.java | 18 +-
.../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 210 ++++-
.../mxml/flexjs/MXMLFlexJSPublisher.java | 77 +-
.../js/flexjs/JSCSSCompilationSession.java | 20 +-
.../driver/js/goog/JSGoogConfiguration.java | 46 ++
.../internal/projects/FlexJSProject.java | 24 +
.../apache/flex/compiler/utils/NativeUtils.java | 2 +
.../js/flexjs/TestFlexJSAccessorMembers.java | 48 +-
.../codegen/js/flexjs/TestFlexJSAccessors.java | 29 +-
.../codegen/js/flexjs/TestFlexJSClass.java | 27 +-
.../codegen/js/flexjs/TestFlexJSEmitter.java | 132 ++--
.../js/flexjs/TestFlexJSExpressions.java | 10 +-
.../js/flexjs/TestFlexJSFieldMembers.java | 20 +-
.../js/flexjs/TestFlexJSMethodMembers.java | 2 +-
.../codegen/js/flexjs/TestFlexJSPackage.java | 262 +++----
.../codegen/js/flexjs/TestFlexJSProject.java | 3 +-
.../codegen/js/flexjs/TestFlexJSStatements.java | 17 +-
.../codegen/js/goog/TestGoogProject.java | 5 +-
.../codegen/js/vf2js/TestVF2JSClass.java | 2 +-
.../mxml/flexjs/TestFlexJSMXMLApplication.java | 46 +-
.../mxml/flexjs/TestFlexJSMXMLScript.java | 88 +--
.../flex/compiler/internal/test/TestBase.java | 4 +
.../flexjs/files/FlexJSTest_again_result.js | 80 +-
.../flexjs/files/LocalFunction_result.js | 12 +-
.../flexjs/files/MyInitialView_result.js | 150 ++--
.../files/controllers/MyController_result.js | 16 +-
.../flexjs/files/models/MyModel_result.js | 51 +-
.../flexjs/files/wildcard_import_result.js | 33 +-
.../projects/bad_overrides/Test_result.js | 12 +-
.../projects/bad_overrides/classes/A_result.js | 18 +-
.../projects/bad_overrides/classes/B_result.js | 12 +-
.../projects/bad_overrides/classes/C_result.js | 12 +-
.../bad_overrides/interfaces/IA_result.js | 23 +-
.../bad_overrides/interfaces/IB_result.js | 22 +-
.../bad_overrides/interfaces/IC_result.js | 22 +-
.../flexjs/projects/circular/Base_result.js | 12 +-
.../flexjs/projects/circular/Super_result.js | 12 +-
.../flexjs/projects/interfaces/Test_result.js | 14 +-
.../projects/interfaces/classes/A_result.js | 12 +-
.../projects/interfaces/classes/B_result.js | 12 +-
.../projects/interfaces/classes/C_result.js | 12 +-
.../projects/interfaces/interfaces/IA_result.js | 22 +-
.../projects/interfaces/interfaces/IB_result.js | 2 +-
.../projects/interfaces/interfaces/IC_result.js | 22 +-
.../projects/interfaces/interfaces/ID_result.js | 22 +-
.../projects/interfaces/interfaces/IE_result.js | 14 +-
.../projects/internal/MainClass_result.js | 19 +-
.../projects/internal/OtherClass_result.js | 12 +-
.../flexjs/projects/overrides/Test_result.js | 18 +-
.../projects/overrides/classes/A_result.js | 18 +-
.../projects/overrides/classes/B_result.js | 12 +-
.../projects/overrides/classes/C_result.js | 12 +-
.../projects/overrides/interfaces/IA_result.js | 23 +-
.../projects/overrides/interfaces/IB_result.js | 22 +-
.../projects/overrides/interfaces/IC_result.js | 22 +-
.../AmbiguousDefinition_result.js | 2 +-
.../Event_result.js | 2 +-
.../DifferentPackageAsConflict_result.js | 12 +-
.../Event_result.js | 12 +-
.../mypackage/TestClass_result.js | 12 +-
.../otherpackage/Event_result.js | 12 +-
.../Event_result.js | 12 +-
.../NoConflictNoWindow_result.js | 12 +-
.../mypackage/TestClass_result.js | 12 +-
.../Event_result.js | 12 +-
.../NoConflictUseWindow_result.js | 12 +-
.../mypackage/TestClass_result.js | 12 +-
.../Event_result.js | 12 +-
.../SamePackageAsConflict_result.js | 12 +-
.../mypackage/Event_result.js | 12 +-
.../mypackage/TestClass_result.js | 12 +-
.../Event_result.js | 12 +-
.../UseWindow_result.js | 12 +-
.../mypackage/TestClass_result.js | 12 +-
.../otherpackage/Event_result.js | 12 +-
.../flexjs/projects/super/Base_result.js | 32 +-
.../flexjs/projects/super/Super_result.js | 29 +-
.../projects/xml_requires/XMLRequire_result.js | 12 +-
.../as/codegen/GlobalDirectiveProcessor.java | 6 +
.../semantics/MethodBodySemanticChecker.java | 7 +-
.../src/test/java/as/ASInheritanceTests.java | 87 +++
pom.xml | 11 +-
src/site/asciidoc/featurebranch-autobuild.adoc | 45 ++
.../featurebranch-autobuild-branch-overview.png | Bin 0 -> 309602 bytes
.../featurebranch-autobuild-overview.png | Bin 0 -> 121026 bytes
src/site/site.xml | 5 +-
96 files changed, 2107 insertions(+), 1601 deletions(-)
----------------------------------------------------------------------
[6/9] git commit: [flex-falcon]
[refs/heads/feature-autobuild/maven-archetypes] - Look for [ArrayElementType]
on class (not property) when a class is accessed via numeric dynamic access
such as [i] and resolve the results to that type. Allows dynamic ar
Posted by cd...@apache.org.
Look for [ArrayElementType] on class (not property) when a class is accessed via numeric dynamic access such as [i] and resolve the results to that type. Allows dynamic array access to Float32Array and things like that
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/ed2c72a6
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/ed2c72a6
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/ed2c72a6
Branch: refs/heads/feature-autobuild/maven-archetypes
Commit: ed2c72a69113344d561471d93848d18ee654c275
Parents: 7a44e38
Author: Alex Harui <ah...@apache.org>
Authored: Wed Sep 28 07:52:50 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Sep 29 20:56:44 2016 -0700
----------------------------------------------------------------------
.../codegen/js/jx/BinaryOperatorEmitter.java | 51 +++++++++++++++-----
.../codegen/js/jx/VarDeclarationEmitter.java | 51 +++++++++++++++-----
.../js/flexjs/TestFlexJSExpressions.java | 10 ++++
.../js/flexjs/TestFlexJSFieldMembers.java | 9 ++++
4 files changed, 99 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ed2c72a6/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
index 38d13fe..141949b 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
@@ -23,6 +23,8 @@ import org.apache.flex.compiler.codegen.ISubEmitter;
import org.apache.flex.compiler.codegen.js.IJSEmitter;
import org.apache.flex.compiler.constants.IASLanguageConstants;
import org.apache.flex.compiler.definitions.IDefinition;
+import org.apache.flex.compiler.definitions.metadata.IMetaTag;
+import org.apache.flex.compiler.definitions.metadata.IMetaTagAttribute;
import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSDocEmitter;
@@ -31,6 +33,7 @@ import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitterTokens
import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
import org.apache.flex.compiler.internal.definitions.AccessorDefinition;
import org.apache.flex.compiler.internal.projects.FlexJSProject;
+import org.apache.flex.compiler.internal.tree.as.DynamicAccessNode;
import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
import org.apache.flex.compiler.internal.tree.as.IdentifierNode;
import org.apache.flex.compiler.internal.tree.as.MemberAccessExpressionNode;
@@ -270,18 +273,44 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
boolean rightIsNumber = (rightDef != null && (rightDef.getQualifiedName().equals(IASLanguageConstants.Number) ||
rightDef.getQualifiedName().equals(IASLanguageConstants._int) ||
rightDef.getQualifiedName().equals(IASLanguageConstants.uint)));
- if (leftIsNumber && !rightIsNumber && (rightDef == null || rightDef.getQualifiedName().equals(IASLanguageConstants.ANY_TYPE))
- && rNode.getNodeID() == ASTNodeID.FunctionCallID)
+ if (leftIsNumber && !rightIsNumber && (rightDef == null || rightDef.getQualifiedName().equals(IASLanguageConstants.ANY_TYPE)))
{
- IExpressionNode fnNameNode = ((FunctionCallNode)rNode).getNameNode();
- if (fnNameNode.getNodeID() == ASTNodeID.MemberAccessExpressionID)
- {
- MemberAccessExpressionNode mae = (MemberAccessExpressionNode)fnNameNode;
- IExpressionNode rightNode = mae.getRightOperandNode();
- rightIsNumber = rightNode.getNodeID() == ASTNodeID.IdentifierID &&
- ((IdentifierNode)rightNode).getName().equals("length") &&
- fjs.isXMLList(mae);
- }
+ if (rNode.getNodeID() == ASTNodeID.FunctionCallID)
+ {
+ IExpressionNode fnNameNode = ((FunctionCallNode)rNode).getNameNode();
+ if (fnNameNode.getNodeID() == ASTNodeID.MemberAccessExpressionID)
+ {
+ MemberAccessExpressionNode mae = (MemberAccessExpressionNode)fnNameNode;
+ IExpressionNode rightNode = mae.getRightOperandNode();
+ rightIsNumber = rightNode.getNodeID() == ASTNodeID.IdentifierID &&
+ ((IdentifierNode)rightNode).getName().equals("length") &&
+ fjs.isXMLList(mae);
+ }
+ }
+ else if (rNode.getNodeID() == ASTNodeID.ArrayIndexExpressionID)
+ {
+ DynamicAccessNode dyn = (DynamicAccessNode)rNode;
+ IDefinition lDef = dyn.getLeftOperandNode().resolveType(getProject());
+ IDefinition rDef = dyn.getRightOperandNode().resolveType(getProject());
+ // numeric indexing?
+ if (rDef.getQualifiedName().equals(IASLanguageConstants.Number))
+ {
+ IMetaTag[] metas = lDef.getAllMetaTags();
+ for (IMetaTag meta : metas)
+ {
+ if (meta.getTagName().equals("ArrayElementType"))
+ {
+ IMetaTagAttribute[] attrs = meta.getAllAttributes();
+ for (IMetaTagAttribute attr : attrs)
+ {
+ String t = attr.getValue();
+ if (t.equals(IASLanguageConstants.Number))
+ rightIsNumber = true;
+ }
+ }
+ }
+ }
+ }
}
String coercion = (leftIsNumber && !rightIsNumber && isAssignment) ? "Number(" : "";
if (isAssignment && leftDef != null && leftDef.getQualifiedName().equals(IASLanguageConstants.String))
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ed2c72a6/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
index 3d66f97..4e35e39 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
@@ -23,10 +23,13 @@ import org.apache.flex.compiler.codegen.ISubEmitter;
import org.apache.flex.compiler.codegen.js.IJSEmitter;
import org.apache.flex.compiler.constants.IASLanguageConstants;
import org.apache.flex.compiler.definitions.IDefinition;
+import org.apache.flex.compiler.definitions.metadata.IMetaTag;
+import org.apache.flex.compiler.definitions.metadata.IMetaTagAttribute;
import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
import org.apache.flex.compiler.internal.tree.as.ChainedVariableNode;
+import org.apache.flex.compiler.internal.tree.as.DynamicAccessNode;
import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
import org.apache.flex.compiler.internal.tree.as.IdentifierNode;
import org.apache.flex.compiler.internal.tree.as.MemberAccessExpressionNode;
@@ -119,18 +122,44 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
boolean valIsNumber = (avdef != null && (avdef.getQualifiedName().equals(IASLanguageConstants.Number) ||
avdef.getQualifiedName().equals(IASLanguageConstants._int) ||
avdef.getQualifiedName().equals(IASLanguageConstants.uint)));
- if (varIsNumber && !valIsNumber && (avdef == null || avdef.getQualifiedName().equals(IASLanguageConstants.ANY_TYPE))
- && avnode.getNodeID() == ASTNodeID.FunctionCallID)
+ if (varIsNumber && !valIsNumber && (avdef == null || avdef.getQualifiedName().equals(IASLanguageConstants.ANY_TYPE)))
{
- IExpressionNode fnNameNode = ((FunctionCallNode)avnode).getNameNode();
- if (fnNameNode.getNodeID() == ASTNodeID.MemberAccessExpressionID)
- {
- MemberAccessExpressionNode mae = (MemberAccessExpressionNode)fnNameNode;
- IExpressionNode rightNode = mae.getRightOperandNode();
- valIsNumber = rightNode.getNodeID() == ASTNodeID.IdentifierID &&
- ((IdentifierNode)rightNode).getName().equals("length") &&
- fjs.isXMLList(mae);
- }
+ if (avnode.getNodeID() == ASTNodeID.FunctionCallID)
+ {
+ IExpressionNode fnNameNode = ((FunctionCallNode)avnode).getNameNode();
+ if (fnNameNode.getNodeID() == ASTNodeID.MemberAccessExpressionID)
+ {
+ MemberAccessExpressionNode mae = (MemberAccessExpressionNode)fnNameNode;
+ IExpressionNode rightNode = mae.getRightOperandNode();
+ valIsNumber = rightNode.getNodeID() == ASTNodeID.IdentifierID &&
+ ((IdentifierNode)rightNode).getName().equals("length") &&
+ fjs.isXMLList(mae);
+ }
+ }
+ else if (avnode.getNodeID() == ASTNodeID.ArrayIndexExpressionID)
+ {
+ DynamicAccessNode dyn = (DynamicAccessNode)avnode;
+ IDefinition leftDef = dyn.getLeftOperandNode().resolveType(getProject());
+ IDefinition rightDef = dyn.getRightOperandNode().resolveType(getProject());
+ // numeric indexing?
+ if (rightDef.getQualifiedName().equals(IASLanguageConstants.Number))
+ {
+ IMetaTag[] metas = leftDef.getAllMetaTags();
+ for (IMetaTag meta : metas)
+ {
+ if (meta.getTagName().equals("ArrayElementType"))
+ {
+ IMetaTagAttribute[] attrs = meta.getAllAttributes();
+ for (IMetaTagAttribute attr : attrs)
+ {
+ String t = attr.getValue();
+ if (t.equals(IASLanguageConstants.Number))
+ valIsNumber = true;
+ }
+ }
+ }
+ }
+ }
}
String coercion = "";
if (varIsNumber && !valIsNumber)
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ed2c72a6/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
index c9594c5..e46d9ca 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
@@ -653,6 +653,16 @@ public class TestFlexJSExpressions extends TestGoogExpressions
}
@Test
+ public void testVisitBinaryOperatorNode_ArrayElementType()
+ {
+ IBinaryOperatorNode node = (IBinaryOperatorNode) getNode(
+ "public class B {public function d() { var b:Number; b = c[0]; var c:C;}}\n[ArrayElementType(\"Number\")]\nclass C {}",
+ IBinaryOperatorNode.class, WRAP_LEVEL_PACKAGE);
+ asBlockWalker.visitBinaryOperator(node);
+ assertOut("b = c[0]");
+ }
+
+ @Test
public void testNamedFunctionAsArgument()
{
IFunctionNode node = (IFunctionNode) getNode(
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ed2c72a6/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
index ef54f29..4725485 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
@@ -81,6 +81,15 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
assertOut("/**\n * @export\n * @type {number}\n */\nFalconTest_A.prototype.foo = -420");
}
+ @Test
+ public void testVariable_withTypeValue_ArrayElementType()
+ {
+ IVariableNode node = (IVariableNode)getNode("public class A { function foobar():void {var foo:Number = bar[0];var bar:B;}}\n[ArrayElementType(\"Number\")]\nclass B {}",
+ IVariableNode.class, WRAP_LEVEL_PACKAGE);
+ asBlockWalker.visitVariable(node);
+ assertOut("var /** @type {number} */ foo = bar[0]");
+ }
+
@Override
@Test
public void testField_withNamespaceTypeValue()
[4/9] git commit: [flex-falcon]
[refs/heads/feature-autobuild/maven-archetypes] - inject [ArrayElementType]
metadata when IArrayLike is found. Might allow us to allow type-checking of
[i] array access
Posted by cd...@apache.org.
inject [ArrayElementType] metadata when IArrayLike is found. Might allow us to allow type-checking of [i] array access
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/7a44e380
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/7a44e380
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/7a44e380
Branch: refs/heads/feature-autobuild/maven-archetypes
Commit: 7a44e380f67a0f16bfba0db44c1fb152e2541f47
Parents: 0567281
Author: Alex Harui <ah...@apache.org>
Authored: Wed Sep 28 07:51:40 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Sep 29 20:56:43 2016 -0700
----------------------------------------------------------------------
.../externals/reference/ClassReference.java | 31 ++++++++++++++++++++
1 file changed, 31 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7a44e380/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
index 6e4e9fb..469a5df 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
@@ -768,11 +768,42 @@ public class ClassReference extends BaseReference
sb.append(" * @constructor\n");
if (getComment().hasBaseType())
{
+ sb.append(" * @");
emitSuperClass(sb);
+ sb.append("\n");
}
if (!isInterface())
{
+ sb.append(" * @");
emitImplements(sb);
+ sb.append("\n");
+ List<JSTypeExpression> implementedInterfaces = getComment().getImplementedInterfaces();
+ int len = implementedInterfaces.size();
+ if (len != 0)
+ {
+ for (int i = 0; i < len; i++)
+ {
+ String value = getModel().evaluate(implementedInterfaces.get(i)).getDisplayName();
+
+ if (value.equals("IArrayLike"))
+ {
+ String comment = getComment().getOriginalCommentString();
+ int c = comment.indexOf("IArrayLike");
+ int c1 = comment.indexOf('<', c);
+ if (c1 == c + 10)
+ {
+ int c2 = comment.indexOf('>', c1);
+ if (c2 != -1)
+ {
+ String type = comment.substring(c1 + 1, c2);
+ int insert = sb.toString().indexOf("\n");
+ sb.insert(insert + 1, "\n[ArrayElementType(\"" + JSTypeUtils.transformType(type) + "\")]\n");
+ }
+ }
+ break;
+ }
+ }
+ }
}
}
[7/9] git commit: [flex-falcon]
[refs/heads/feature-autobuild/maven-archetypes] - use current class since
cnode can be null in MXML script blocks
Posted by cd...@apache.org.
use current class since cnode can be null in MXML script blocks
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/25358a83
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/25358a83
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/25358a83
Branch: refs/heads/feature-autobuild/maven-archetypes
Commit: 25358a8377c11131c4c0901668c4e6d5787ac034
Parents: ed2c72a
Author: Alex Harui <ah...@apache.org>
Authored: Wed Sep 28 13:59:29 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Sep 29 20:56:44 2016 -0700
----------------------------------------------------------------------
.../compiler/internal/codegen/js/jx/MemberAccessEmitter.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/25358a83/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
index 88a0262..14ea245 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
@@ -290,10 +290,8 @@ public class MemberAccessEmitter extends JSSubEmitter implements
else if (leftNode.getNodeID() == ASTNodeID.SuperID
&& (rightNode.getNodeID() == ASTNodeID.GetterID || (rightDef != null && rightDef instanceof AccessorDefinition)))
{
- IClassNode cnode = (IClassNode) node
- .getAncestorOfType(IClassNode.class);
write(getEmitter().formatQualifiedName(
- cnode.getQualifiedName()));
+ getEmitter().getModel().getCurrentClass().getQualifiedName()));
write(ASEmitterTokens.MEMBER_ACCESS);
write(JSGoogEmitterTokens.GOOG_BASE);
write(ASEmitterTokens.PAREN_OPEN);
[5/9] git commit: [flex-falcon]
[refs/heads/feature-autobuild/maven-archetypes] - teach COMPJSC to insert its
output into an existing SWC
Posted by cd...@apache.org.
teach COMPJSC to insert its output into an existing SWC
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/bdc4023f
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/bdc4023f
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/bdc4023f
Branch: refs/heads/feature-autobuild/maven-archetypes
Commit: bdc4023f6edd1b9586d1b434bd814af488496427
Parents: 25358a8
Author: Alex Harui <ah...@apache.org>
Authored: Thu Sep 29 15:41:50 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Sep 29 20:56:44 2016 -0700
----------------------------------------------------------------------
.../apache/flex/compiler/clients/COMPJSC.java | 179 +++++++++++++++----
1 file changed, 145 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bdc4023f/compiler-jx/src/main/java/org/apache/flex/compiler/clients/COMPJSC.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/COMPJSC.java b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/COMPJSC.java
index b3b9c64..697954f 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/clients/COMPJSC.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/clients/COMPJSC.java
@@ -24,12 +24,19 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Enumeration;
import java.util.List;
import java.util.Set;
+import java.util.zip.Deflater;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
import org.apache.flex.compiler.codegen.as.IASWriter;
import org.apache.flex.compiler.driver.IBackend;
import org.apache.flex.compiler.driver.js.IJSApplication;
@@ -46,12 +53,16 @@ import org.apache.flex.compiler.internal.driver.mxml.vf2js.MXMLVF2JSSWCBackend;
import org.apache.flex.compiler.internal.projects.CompilerProject;
import org.apache.flex.compiler.internal.targets.FlexJSSWCTarget;
import org.apache.flex.compiler.internal.targets.JSTarget;
+import org.apache.flex.compiler.problems.FileNotFoundProblem;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.problems.InternalCompilerProblem;
+import org.apache.flex.compiler.problems.LibraryNotFoundProblem;
import org.apache.flex.compiler.problems.UnableToBuildSWFProblem;
import org.apache.flex.compiler.targets.ITarget.TargetType;
import org.apache.flex.compiler.targets.ITargetSettings;
import org.apache.flex.compiler.units.ICompilationUnit;
+import org.apache.flex.swc.ISWC;
+import org.apache.flex.swc.io.SWCReader;
/**
* @author Erik de Bruin
@@ -194,7 +205,67 @@ public class COMPJSC extends MXMLJSC
return false;
}
- File outputFolder = new File(getOutputFilePath());
+ boolean packingSWC = false;
+ String outputFolderName = getOutputFilePath();
+ File swcFile = new File(outputFolderName);
+ File jsOut = new File("js/out");
+ ZipFile zipFile = null;
+ ZipOutputStream zipOutputStream = null;
+ String catalog = null;
+ StringBuilder fileList = new StringBuilder();
+ if (outputFolderName.endsWith(".swc"))
+ {
+ packingSWC = true;
+ if (!swcFile.exists())
+ {
+ problems.add(new LibraryNotFoundProblem(outputFolderName));
+ return false;
+ }
+ zipFile = new ZipFile(swcFile, ZipFile.OPEN_READ);
+ final InputStream catalogInputStream = SWCReader.getInputStream(zipFile, SWCReader.CATALOG_XML);
+
+ catalog = IOUtils.toString(catalogInputStream);
+ catalogInputStream.close();
+ zipOutputStream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(outputFolderName + ".new")));
+ zipOutputStream.setLevel(Deflater.NO_COMPRESSION);
+ for (final Enumeration<? extends ZipEntry> entryEnum = zipFile.entries(); entryEnum.hasMoreElements();)
+ {
+ final ZipEntry entry = entryEnum.nextElement();
+ if (!entry.getName().contains("js/out") &&
+ !entry.getName().contains(SWCReader.CATALOG_XML))
+ {
+ InputStream input = zipFile.getInputStream(entry);
+ zipOutputStream.putNextEntry(entry);
+ IOUtils.copy(input, zipOutputStream);
+ zipOutputStream.closeEntry();
+ }
+ }
+ int filesIndex = catalog.indexOf("<files>");
+ if (filesIndex != -1)
+ {
+ int filesIndex2 = catalog.indexOf("</files>");
+ String files = catalog.substring(filesIndex, filesIndex2);
+ int fileIndex = files.indexOf("<file", 6);
+ int pathIndex = files.indexOf("path=");
+ while (pathIndex != -1)
+ {
+ int pathIndex2 = files.indexOf("\"", pathIndex + 6);
+ int fileIndex2 = files.indexOf("/>", fileIndex);
+ String path = files.substring(pathIndex + 6, pathIndex2);
+ if (!path.startsWith("js/out"))
+ {
+ fileList.append(files.substring(fileIndex - 8, fileIndex2 + 3));
+ }
+ pathIndex = files.indexOf("path=", pathIndex2);
+ fileIndex = files.indexOf("<file", fileIndex2);
+ }
+ catalog = catalog.substring(0, filesIndex) + catalog.substring(filesIndex2 + 8);
+ }
+ }
+
+ File outputFolder = null;
+ if (!packingSWC)
+ outputFolder = new File(outputFolderName);
Set<String> externs = config.getExterns();
Collection<ICompilationUnit> roots = ((FlexJSSWCTarget)target).getReachableCompilationUnits(errors);
@@ -209,36 +280,81 @@ public class COMPJSC extends MXMLJSC
String symbol = cu.getQualifiedNames().get(0);
if (externs.contains(symbol)) continue;
- final File outputClassFile = getOutputClassFile(
- cu.getQualifiedNames().get(0), outputFolder);
-
- System.out.println("Compiling file: " + outputClassFile);
-
- ICompilationUnit unit = cu;
-
- IASWriter writer;
- if (cuType == ICompilationUnit.UnitType.AS_UNIT)
- {
- writer = JSSharedData.backend.createWriter(project,
- (List<ICompilerProblem>) errors, unit,
- false);
- }
- else
- {
- writer = JSSharedData.backend.createMXMLWriter(
- project, (List<ICompilerProblem>) errors,
- unit, false);
- }
- problems.addAll(errors);
- BufferedOutputStream out = new BufferedOutputStream(
- new FileOutputStream(outputClassFile));
- writer.writeTo(out);
- out.flush();
- out.close();
- writer.close();
+ if (!packingSWC)
+ {
+ final File outputClassFile = getOutputClassFile(
+ cu.getQualifiedNames().get(0), outputFolder);
+
+ System.out.println("Compiling file: " + outputClassFile);
+
+ ICompilationUnit unit = cu;
+
+ IASWriter writer;
+ if (cuType == ICompilationUnit.UnitType.AS_UNIT)
+ {
+ writer = JSSharedData.backend.createWriter(project,
+ (List<ICompilerProblem>) errors, unit,
+ false);
+ }
+ else
+ {
+ writer = JSSharedData.backend.createMXMLWriter(
+ project, (List<ICompilerProblem>) errors,
+ unit, false);
+ }
+ problems.addAll(errors);
+ BufferedOutputStream out = new BufferedOutputStream(
+ new FileOutputStream(outputClassFile));
+ writer.writeTo(out);
+ out.flush();
+ out.close();
+ writer.close();
+ }
+ else
+ {
+ String outputClassFile = getOutputClassFile(
+ cu.getQualifiedNames().get(0), jsOut).getPath();
+ System.out.println("Compiling file: " + outputClassFile);
+
+ ICompilationUnit unit = cu;
+
+ IASWriter writer;
+ if (cuType == ICompilationUnit.UnitType.AS_UNIT)
+ {
+ writer = JSSharedData.backend.createWriter(project,
+ (List<ICompilerProblem>) errors, unit,
+ false);
+ }
+ else
+ {
+ writer = JSSharedData.backend.createMXMLWriter(
+ project, (List<ICompilerProblem>) errors,
+ unit, false);
+ }
+ problems.addAll(errors);
+ zipOutputStream.putNextEntry(new ZipEntry(outputClassFile));
+ writer.writeTo(zipOutputStream);
+ zipOutputStream.closeEntry();
+ writer.close();
+ fileList.append(" <file path=\"" + outputClassFile + "\" mod=\"" + System.currentTimeMillis() + "\"/>\n");
+ }
}
}
-
+ if (packingSWC)
+ {
+ zipFile.close();
+ int libraryIndex = catalog.indexOf("</libraries>");
+ catalog = catalog.substring(0, libraryIndex + 13) +
+ " <files>\n" + fileList.toString() + " </files>" +
+ catalog.substring(libraryIndex + 13);
+ zipOutputStream.putNextEntry(new ZipEntry(SWCReader.CATALOG_XML));
+ zipOutputStream.write(catalog.getBytes());
+ zipOutputStream.closeEntry();
+ zipOutputStream.close();
+ swcFile.delete();
+ File newSWCFile = new File(outputFolderName + ".new");
+ newSWCFile.renameTo(swcFile);
+ }
compilationSuccess = true;
}
}
@@ -325,11 +441,6 @@ public class COMPJSC extends MXMLJSC
else
{
String outputFolderName = config.getOutput();
- if (outputFolderName.endsWith(".swc"))
- {
- File outputFolder = new File(outputFolderName);
- outputFolderName = outputFolder.getParent();
- }
return outputFolderName;
}
}
[9/9] git commit: [flex-falcon]
[refs/heads/feature-autobuild/maven-archetypes] - switch back from @expose to
@export
Posted by cd...@apache.org.
switch back from @expose to @export
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/506025f4
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/506025f4
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/506025f4
Branch: refs/heads/feature-autobuild/maven-archetypes
Commit: 506025f4db585ed665e2863f019fdf79b95ebba6
Parents: c11b36f
Author: Alex Harui <ah...@apache.org>
Authored: Fri Sep 30 23:21:43 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Sep 30 23:21:43 2016 -0700
----------------------------------------------------------------------
.../codegen/js/goog/JSGoogDocEmitter.java | 7 -------
.../codegen/js/flexjs/TestFlexJSClass.java | 4 ++--
.../js/flexjs/TestFlexJSExpressions.java | 10 +++++-----
.../js/flexjs/TestFlexJSFieldMembers.java | 20 ++++++++++----------
.../js/flexjs/TestFlexJSMethodMembers.java | 2 +-
.../codegen/js/flexjs/TestFlexJSPackage.java | 4 ++--
.../codegen/js/vf2js/TestVF2JSClass.java | 2 +-
7 files changed, 21 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/506025f4/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
index 7b70361..df762c5 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
@@ -337,13 +337,6 @@ public class JSGoogDocEmitter extends JSDocEmitter implements IJSGoogDocEmitter
@Override
public void emitPublic(IASNode node)
{
- if ((node instanceof IFunctionNode || node instanceof IVariableNode)
- && ((IDefinitionNode) node).hasModifier(ASModifier.STATIC))
- {
- //static methods and variables need "@expose" and not "@export" same as static accessors
- emitJSDocLine(JSGoogDocEmitterTokens.EXPOSE);
- }
- else
emitJSDocLine(JSGoogDocEmitterTokens.EXPORT);
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/506025f4/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
index af336a5..f03414d 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
@@ -234,7 +234,7 @@ public class TestFlexJSClass extends TestGoogClass
+ "private static const C:Number = 42;"
+ "foo_bar static const C:String = 'me' + 'you';");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};\n\n\n/**\n * @expose\n * @const\n * @type {number}\n */\norg.apache.flex.A.A = 42;\n\n\n/**\n * @protected\n * @const\n * @type {number}\n */\norg.apache.flex.A.B = 42;\n\n\n/**\n * @private\n * @const\n * @type {number}\n */\norg.apache.flex.A.C = 42;\n\n\n/**\n * @expose\n * @const\n * @type {string}\n */\norg.apache.flex.A.C = 'me' + 'you';");
+ assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};\n\n\n/**\n * @export\n * @const\n * @type {number}\n */\norg.apache.flex.A.A = 42;\n\n\n/**\n * @protected\n * @const\n * @type {number}\n */\norg.apache.flex.A.B = 42;\n\n\n/**\n * @private\n * @const\n * @type {number}\n */\norg.apache.flex.A.C = 42;\n\n\n/**\n * @export\n * @const\n * @type {string}\n */\norg.apache.flex.A.C = 'me' + 'you';");
}
@Override
@@ -288,7 +288,7 @@ public class TestFlexJSClass extends TestGoogClass
+ "public static function foo7(value:Object):void{}"
+ "flash_proxy static function foo7(value:Object):void{}" + "}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1 = function() {\n return null;\n};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1a = function() {\n return null;\n};\n\n\n/**\n * @export\n * @override\n */\norg.apache.flex.A.prototype.foo1b = function() {\n return org.apache.flex.A.base(this, 'foo1b');\n};\n\n\n/**\n * @protected\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo2 = function(value) {\n};\n\n\n/**\n * @private\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo3 = function(value) {\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo5 = function(value) {\n};\n\n\n/**\n * @export\n * @param {Object} value\n */\norg.apache.flex.A.prototype[\"http://www.adobe.com/2006/actionscript/flash/proxy::foo6\"] = function(value) {\n};\n\n\n/**\n * @expose\n * @param {Object} value\n
*/\norg.apache.flex.A.foo7 = function(value) {\n};\n\n\n/**\n * @expose\n * @param {Object} value\n */\norg.apache.flex.A[\"http://www.adobe.com/2006/actionscript/flash/proxy::foo7\"] = function(value) {\n};");
+ assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {\n};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1 = function() {\n return null;\n};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1a = function() {\n return null;\n};\n\n\n/**\n * @export\n * @override\n */\norg.apache.flex.A.prototype.foo1b = function() {\n return org.apache.flex.A.base(this, 'foo1b');\n};\n\n\n/**\n * @protected\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo2 = function(value) {\n};\n\n\n/**\n * @private\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo3 = function(value) {\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo5 = function(value) {\n};\n\n\n/**\n * @export\n * @param {Object} value\n */\norg.apache.flex.A.prototype[\"http://www.adobe.com/2006/actionscript/flash/proxy::foo6\"] = function(value) {\n};\n\n\n/**\n * @export\n * @param {Object} value\n
*/\norg.apache.flex.A.foo7 = function(value) {\n};\n\n\n/**\n * @export\n * @param {Object} value\n */\norg.apache.flex.A[\"http://www.adobe.com/2006/actionscript/flash/proxy::foo7\"] = function(value) {\n};");
}
@Test
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/506025f4/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
index e46d9ca..def28f7 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
@@ -719,7 +719,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {static public function b() { function c(f:Function):void {}; c(b); }}",
IFunctionNode.class, WRAP_LEVEL_PACKAGE, true);
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n */\nfoo.bar.B.b = function() {\n function c(f) {\n };\n c(foo.bar.B.b);\n}");
+ assertOut("/**\n * @export\n */\nfoo.bar.B.b = function() {\n function c(f) {\n };\n c(foo.bar.B.b);\n}");
}
@Test
@@ -759,7 +759,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {static public function b() { function c(f:Function):void {}; var f:Function = b; c(f); }}",
IFunctionNode.class, WRAP_LEVEL_PACKAGE, true);
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n */\nfoo.bar.B.b = function() {\n function c(f) {\n };\n var /** @type {Function} */ f = foo.bar.B.b;\n c(f);\n}");
+ assertOut("/**\n * @export\n */\nfoo.bar.B.b = function() {\n function c(f) {\n };\n var /** @type {Function} */ f = foo.bar.B.b;\n c(f);\n}");
}
@Test
@@ -769,7 +769,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {static public function b() { function c(f:Function):void {}; var f:Function = foo.bar.B.b; c(f); }}",
IFunctionNode.class, WRAP_LEVEL_PACKAGE, true);
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n */\nfoo.bar.B.b = function() {\n function c(f) {\n };\n var /** @type {Function} */ f = foo.bar.B.b;\n c(f);\n}");
+ assertOut("/**\n * @export\n */\nfoo.bar.B.b = function() {\n function c(f) {\n };\n var /** @type {Function} */ f = foo.bar.B.b;\n c(f);\n}");
}
@Test
@@ -789,7 +789,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {static public function b() { function c(f:Function):void {}; var f:Function; f = b; c(f); }}",
IFunctionNode.class, WRAP_LEVEL_PACKAGE, true);
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n */\nfoo.bar.B.b = function() {\n function c(f) {\n };\n var /** @type {Function} */ f;\n f = foo.bar.B.b;\n c(f);\n}");
+ assertOut("/**\n * @export\n */\nfoo.bar.B.b = function() {\n function c(f) {\n };\n var /** @type {Function} */ f;\n f = foo.bar.B.b;\n c(f);\n}");
}
@Test
@@ -809,7 +809,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {static public function b() { function c(f:Function):void {}; var f:Array = [b]; c(f); }}",
IFunctionNode.class, WRAP_LEVEL_PACKAGE, true);
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n */\nfoo.bar.B.b = function() {\n function c(f) {\n };\n var /** @type {Array} */ f = [foo.bar.B.b];\n c(f);\n}");
+ assertOut("/**\n * @export\n */\nfoo.bar.B.b = function() {\n function c(f) {\n };\n var /** @type {Array} */ f = [foo.bar.B.b];\n c(f);\n}");
}
@Test
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/506025f4/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
index 4725485..cee8429 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
@@ -142,7 +142,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("static var foo;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @type {*}\n */\nFalconTest_A.foo");
+ assertOut("/**\n * @export\n * @type {*}\n */\nFalconTest_A.foo");
}
@Test
@@ -150,7 +150,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("static var foo:int;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @type {number}\n */\nFalconTest_A.foo = 0");
+ assertOut("/**\n * @export\n * @type {number}\n */\nFalconTest_A.foo = 0");
}
@Test
@@ -158,7 +158,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("static var foo:int = 420;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @type {number}\n */\nFalconTest_A.foo = 420");
+ assertOut("/**\n * @export\n * @type {number}\n */\nFalconTest_A.foo = 420");
}
@Test
@@ -185,7 +185,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
IClassNode node = (IClassNode) getNode("import flash.utils.flash_proxy;use namespace flash_proxy;public static var foo:Object = initFoo(); flash_proxy static function initFoo():Object { return null; }",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n * @type {Object}\n */\nFalconTest_A.foo = FalconTest_A[\"http://www.adobe.com/2006/actionscript/flash/proxy::initFoo\"]();\n\n\n/**\n * @expose\n * @return {Object}\n */\nFalconTest_A[\"http://www.adobe.com/2006/actionscript/flash/proxy::initFoo\"] = function() {\n return null;\n};");
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @export\n * @type {Object}\n */\nFalconTest_A.foo = FalconTest_A[\"http://www.adobe.com/2006/actionscript/flash/proxy::initFoo\"]();\n\n\n/**\n * @export\n * @return {Object}\n */\nFalconTest_A[\"http://www.adobe.com/2006/actionscript/flash/proxy::initFoo\"] = function() {\n return null;\n};");
}
@Test
@@ -194,7 +194,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
IClassNode node = (IClassNode) getNode("static public var foo:Object = { 'foo': 'bar' }",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n * @type {Object}\n */\nFalconTest_A.foo = {'foo':'bar'};");
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @export\n * @type {Object}\n */\nFalconTest_A.foo = {'foo':'bar'};");
}
@Test
@@ -234,7 +234,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("static const foo;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @const\n * @type {*}\n */\nFalconTest_A.foo");
+ assertOut("/**\n * @export\n * @const\n * @type {*}\n */\nFalconTest_A.foo");
}
@Test
@@ -251,7 +251,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("static const foo:int;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @const\n * @type {number}\n */\nFalconTest_A.foo = 0");
+ assertOut("/**\n * @export\n * @const\n * @type {number}\n */\nFalconTest_A.foo = 0");
}
@Test
@@ -268,7 +268,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("static const foo:int = 420;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @const\n * @type {number}\n */\nFalconTest_A.foo = 420");
+ assertOut("/**\n * @export\n * @const\n * @type {number}\n */\nFalconTest_A.foo = 420");
}
@Test
@@ -276,7 +276,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("static const foo:Number = parseFloat('1E2');");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @const\n * @type {number}\n */\nFalconTest_A.foo = parseFloat('1E2')");
+ assertOut("/**\n * @export\n * @const\n * @type {number}\n */\nFalconTest_A.foo = parseFloat('1E2')");
}
@Test
@@ -338,7 +338,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
IVariableNode node = getField("mx_internal static const foo:int = 420;");
asBlockWalker.visitVariable(node);
// (erikdebruin) we ignore custom namespaces completely (are there side effects I'm missing?)
- assertOut("/**\n * @expose\n * @const\n * @type {number}\n */\nFalconTest_A.foo = 420");
+ assertOut("/**\n * @export\n * @const\n * @type {number}\n */\nFalconTest_A.foo = 420");
}
@Test
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/506025f4/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
index ffb9c54..56dcd46 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
@@ -169,7 +169,7 @@ public class TestFlexJSMethodMembers extends TestGoogMethodMembers
// (erikdebruin) here we actually DO want to declare the method
// directly on the 'class' constructor instead of the
// prototype!
- assertOut("/**\n * @expose\n * @param {string} bar\n * @param {number=} baz\n * @return {number}\n */\nFalconTest_A.foo = function(bar, baz) {\n baz = typeof baz !== 'undefined' ? baz : null;\n return -1;\n}");
+ assertOut("/**\n * @export\n * @param {string} bar\n * @param {number=} baz\n * @return {number}\n */\nFalconTest_A.foo = function(bar, baz) {\n baz = typeof baz !== 'undefined' ? baz : null;\n return -1;\n}");
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/506025f4/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
index 7448cb9..e1b8cad 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSPackage.java
@@ -671,14 +671,14 @@ public class TestFlexJSPackage extends TestGoogPackage
"\n" +
"\n" +
"/**\n" +
- " * @expose\n" +
+ " * @export\n" +
" * @type {string}\n" +
" */\n" +
"foo.bar.baz.A.InternalClass.someString = \"foo\";\n" +
"\n" +
"\n" +
"/**\n" +
- " * @expose\n" +
+ " * @export\n" +
" * @return {string}\n" +
" */\n" +
"foo.bar.baz.A.InternalClass.someStaticFunction = function() {\n" +
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/506025f4/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java
index 84bd4d2..b947740 100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java
@@ -329,7 +329,7 @@ public class TestVF2JSClass extends TestGoogClass
+ "public static function foo7(value:Object):void{}"
+ "foo_bar static function foo7(value:Object):void{}" + "}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1 = function() {\n return null;\n};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1a = function() {\n return null;\n};\n\n\n/**\n * @export\n * @return {Object}\n * @override\n */\norg.apache.flex.A.prototype.foo1b = function() {\n return org.apache.flex.A.base(this, 'foo1b');\n};\n\n\n/**\n * @protected\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo2 = function(value) {\n};\n\n\n/**\n * @private\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo3 = function(value) {\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo5 = function(value) {\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo6 = function(value) {\n};\n\n\n/**\n * @expose\n * @param {Object} value\n */\norg.apache.flex.A.foo7 = function(value) {\n};
\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.foo7 = function(value) {\n};");
+ assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1 = function() {\n return null;\n};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1a = function() {\n return null;\n};\n\n\n/**\n * @export\n * @return {Object}\n * @override\n */\norg.apache.flex.A.prototype.foo1b = function() {\n return org.apache.flex.A.base(this, 'foo1b');\n};\n\n\n/**\n * @protected\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo2 = function(value) {\n};\n\n\n/**\n * @private\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo3 = function(value) {\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo5 = function(value) {\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.foo6 = function(value) {\n};\n\n\n/**\n * @export\n * @param {Object} value\n */\norg.apache.flex.A.foo7 = function(value) {\n};
\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.foo7 = function(value) {\n};");
}
@Test