You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ft...@apache.org on 2015/07/07 20:18:13 UTC
[1/9] git commit: [flex-falcon] [refs/heads/add-CollectImportPass] -
switch from @expose to @export
Repository: flex-falcon
Updated Branches:
refs/heads/add-CollectImportPass af4ae9176 -> c55587ceb (forced update)
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js b/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js
index 128b5e6..6fa4967 100644
--- a/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/controllers/MyController_result.js
@@ -129,7 +129,7 @@ controllers_MyController.prototype.comboBoxChangeHandler = function(event) {
/**
- * @expose
+ * @export
* @param {Object} document
* @param {string=} id
*/
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js b/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js
index 6f2c3de..26f369b 100644
--- a/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/models/MyModel_result.js
@@ -55,7 +55,7 @@ models_MyModel.prototype._cities = ["London", "Miami", "Paris", "Sydney", "Tokyo
Object.defineProperties(models_MyModel.prototype, /** @lends {models_MyModel.prototype} */ {
-/** @expose */
+/** @export */
labelText: {
get: /** @this {models_MyModel} */ function() {
return this._labelText;
@@ -66,12 +66,12 @@ set: /** @this {models_MyModel} */ function(value) {
this.dispatchEvent(new org_apache_flex_events_Event("labelTextChanged"));
}
}},
-/** @expose */
+/** @export */
cities: {
get: /** @this {models_MyModel} */ function() {
return this._cities;
}},
-/** @expose */
+/** @export */
strings: {
get: /** @this {models_MyModel} */ function() {
return this._strings;
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js b/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js
index a740c06..bfacef0 100644
--- a/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js
+++ b/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js
@@ -43,7 +43,7 @@ goog.inherits(Test, classes_A);
/**
- * @expose
+ * @export
* @param {interfaces_IC} ic
* @return {interfaces_IC}
*/
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js b/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js
index 78e3f86..4508147 100644
--- a/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js
+++ b/compiler.jx.tests/test-files/flexjs/projects/interfaces/interfaces/IE_result.js
@@ -38,4 +38,4 @@ interfaces_IE.prototype.myProp;
*
* @type {Object.<string, Array.<Object>>}
*/
-interfaces_IE.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'IE', qName: 'interfaces_IE'}] };
\ No newline at end of file
+interfaces_IE.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'IE', qName: 'interfaces_IE'}] };
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js b/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
index ddbe449..d4c9341 100644
--- a/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
+++ b/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
@@ -37,7 +37,7 @@ goog.inherits(Base, Super);
Object.defineProperties(Base.prototype, /** @lends {Base.prototype} */ {
-/** @expose */
+/** @export */
text: {
get: /** @this {Base} */ function() {
return "A" + org_apache_flex_utils_Language.superGetter(Base, this, 'text');
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js b/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js
index 9ccdb57..f58d693 100644
--- a/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js
+++ b/compiler.jx.tests/test-files/flexjs/projects/super/Super_result.js
@@ -38,7 +38,7 @@ Super.prototype._text = '';
Object.defineProperties(Super.prototype, /** @lends {Super.prototype} */ {
-/** @expose */
+/** @export */
text: {
get: /** @this {Super} */ function() {
return this._text;
@@ -56,4 +56,4 @@ set: /** @this {Super} */ function(value) {
*
* @type {Object.<string, Array.<Object>>}
*/
-Super.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Super', qName: 'Super'}] };
\ No newline at end of file
+Super.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Super', qName: 'Super'}] };
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/goog/files/call-super_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/goog/files/call-super_result.js b/compiler.jx.tests/test-files/goog/files/call-super_result.js
index d877c86..e2bdfc8 100644
--- a/compiler.jx.tests/test-files/goog/files/call-super_result.js
+++ b/compiler.jx.tests/test-files/goog/files/call-super_result.js
@@ -38,4 +38,4 @@ org.apache.flex.A.prototype.hasSuperCall = function(a, b) {
org.apache.flex.A.base(this, 'hasSuperCall', a, b, 100);
var /** @type {string} */ result = myRegularFunctionCall(-1);
return result;
-};
\ No newline at end of file
+};
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/vf2js/files/SimpleMXML_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/vf2js/files/SimpleMXML_result.js b/compiler.jx.tests/test-files/vf2js/files/SimpleMXML_result.js
index a5f84b7..0beed58 100644
--- a/compiler.jx.tests/test-files/vf2js/files/SimpleMXML_result.js
+++ b/compiler.jx.tests/test-files/vf2js/files/SimpleMXML_result.js
@@ -60,7 +60,7 @@ SimpleMXML.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'SimpleMXML', qName:
/**
* start
*
- * @expose
+ * @export
*/
SimpleMXML.prototype.start = function () {
};
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/vf2js/projects/interfaces/Test_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/vf2js/projects/interfaces/Test_result.js b/compiler.jx.tests/test-files/vf2js/projects/interfaces/Test_result.js
index 522524e..ca0b28f 100644
--- a/compiler.jx.tests/test-files/vf2js/projects/interfaces/Test_result.js
+++ b/compiler.jx.tests/test-files/vf2js/projects/interfaces/Test_result.js
@@ -43,7 +43,7 @@ goog.inherits(Test, classes.A);
/**
- * @expose
+ * @export
* @param {interfaces.IC} ic
* @return {interfaces.IC}
*/
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/vf2js/projects/interfaces/classes/A_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/vf2js/projects/interfaces/classes/A_result.js b/compiler.jx.tests/test-files/vf2js/projects/interfaces/classes/A_result.js
index 5c7fe66..ad6f1a6 100644
--- a/compiler.jx.tests/test-files/vf2js/projects/interfaces/classes/A_result.js
+++ b/compiler.jx.tests/test-files/vf2js/projects/interfaces/classes/A_result.js
@@ -36,7 +36,7 @@ goog.inherits(classes.A, classes.C);
/**
- * @expose
+ * @export
*/
classes.A.prototype.doStuff = function() {
org_apache_flex_utils_Language.trace("STUFF!!!");
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/vf2js/projects/sdk/SomeSDKClass_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/vf2js/projects/sdk/SomeSDKClass_result.js b/compiler.jx.tests/test-files/vf2js/projects/sdk/SomeSDKClass_result.js
index 5ce8532..4270158 100644
--- a/compiler.jx.tests/test-files/vf2js/projects/sdk/SomeSDKClass_result.js
+++ b/compiler.jx.tests/test-files/vf2js/projects/sdk/SomeSDKClass_result.js
@@ -45,7 +45,7 @@ SomeSDKClass.prototype.number;
/**
- * @expose
+ * @export
* @return {string}
*/
SomeSDKClass.prototype.getString = function() {
@@ -54,7 +54,7 @@ SomeSDKClass.prototype.getString = function() {
/**
- * @expose
+ * @export
* @return {string}
*/
SomeSDKClass.prototype.someFunction = function() {
@@ -90,7 +90,7 @@ goog.inherits(Helper, bases.HelperBaseClass);
/**
- * @expose
+ * @export
* @return {string}
*/
Helper.helperFunction = function() {
@@ -106,7 +106,7 @@ Helper.prototype.url_;
/**
- * @expose
+ * @export
* @return {string}
*/
Helper.prototype.get_url = function() {
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/vf2js/projects/sdk/bases/HelperBaseClass_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/vf2js/projects/sdk/bases/HelperBaseClass_result.js b/compiler.jx.tests/test-files/vf2js/projects/sdk/bases/HelperBaseClass_result.js
index e8a198a..2460bb0 100644
--- a/compiler.jx.tests/test-files/vf2js/projects/sdk/bases/HelperBaseClass_result.js
+++ b/compiler.jx.tests/test-files/vf2js/projects/sdk/bases/HelperBaseClass_result.js
@@ -30,7 +30,7 @@ bases.HelperBaseClass = function() {};
/**
- * @expose
+ * @export
* @return {string}
*/
bases.HelperBaseClass.prototype.doSomething = function() {
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/vf2js/projects/simpleMXML/src/SimpleMXML_Project_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/vf2js/projects/simpleMXML/src/SimpleMXML_Project_result.js b/compiler.jx.tests/test-files/vf2js/projects/simpleMXML/src/SimpleMXML_Project_result.js
index e34f12d..a190eb6 100644
--- a/compiler.jx.tests/test-files/vf2js/projects/simpleMXML/src/SimpleMXML_Project_result.js
+++ b/compiler.jx.tests/test-files/vf2js/projects/simpleMXML/src/SimpleMXML_Project_result.js
@@ -62,7 +62,7 @@ SimpleMXML_Project.prototype.myComponent;
/**
* start
*
- * @expose
+ * @export
*/
SimpleMXML_Project.prototype.start = function () {
};
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/vf2js/projects/super/Base_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/vf2js/projects/super/Base_result.js b/compiler.jx.tests/test-files/vf2js/projects/super/Base_result.js
index 72c0ab9..5136b64 100644
--- a/compiler.jx.tests/test-files/vf2js/projects/super/Base_result.js
+++ b/compiler.jx.tests/test-files/vf2js/projects/super/Base_result.js
@@ -72,7 +72,7 @@ Base.prototype.newTextAgain;
/**
- * @expose
+ * @export
* @return {string}
* @override
*/
@@ -82,7 +82,7 @@ Base.prototype.get_text = function() {
/**
- * @expose
+ * @export
* @param {string} value
* @override
*/
@@ -94,7 +94,7 @@ Base.prototype.set_text = function(value) {
/**
- * @expose
+ * @export
*/
Base.prototype.getNumber = function() {
alert(this.superClass_.doStuff.call(this));
@@ -103,7 +103,7 @@ Base.prototype.getNumber = function() {
/**
- * @expose
+ * @export
* @return {number}
* @override
*/
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/vf2js/projects/super/Super_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/vf2js/projects/super/Super_result.js b/compiler.jx.tests/test-files/vf2js/projects/super/Super_result.js
index 0ad1a30..d8bfa78 100644
--- a/compiler.jx.tests/test-files/vf2js/projects/super/Super_result.js
+++ b/compiler.jx.tests/test-files/vf2js/projects/super/Super_result.js
@@ -37,7 +37,7 @@ Super.prototype._text = '';
/**
- * @expose
+ * @export
* @return {string}
*/
Super.prototype.get_text = function() {
@@ -46,7 +46,7 @@ Super.prototype.get_text = function() {
/**
- * @expose
+ * @export
* @param {string} value
*/
Super.prototype.set_text = function(value) {
@@ -64,7 +64,7 @@ Super.prototype._x = 5;
/**
- * @expose
+ * @export
* @return {number}
*/
Super.prototype.get_x = function() {
@@ -73,7 +73,7 @@ Super.prototype.get_x = function() {
/**
- * @expose
+ * @export
* @return {number}
*/
Super.prototype.doStuff = function() {
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java b/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java
index 6903da8..f0c8817 100644
--- a/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/codegen/js/goog/IJSGoogDocEmitter.java
@@ -71,8 +71,8 @@ public interface IJSGoogDocEmitter extends IJSDocEmitter
*- @enum - Specifies the type of an enum. An enum is an object whose properties constitute a
* set of related constants. The @enum tag must be followed by a type expression.
*
- * @expose - Declares an exposed property. Exposed properties will not be removed, or renamed,
- * or collapsed, or optimized in any way by the compiler.
+ * @export - Declares an exported property. Exported properties will have an alias set up so
+ * they can be accessed via [] syntax.
*
*- @extends - Marks a class or interface as inheriting from another class. A class marked
* with @extends must also be marked with either @constructor or @interface.
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
index e402ac9..18b0c1d 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitter.java
@@ -339,7 +339,7 @@ public class JSGoogDocEmitter extends JSDocEmitter implements IJSGoogDocEmitter
@Override
public void emitPublic(IASNode node)
{
- emitJSDocLine(JSGoogDocEmitterTokens.EXPOSE);
+ emitJSDocLine(JSGoogDocEmitterTokens.EXPORT);
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitterTokens.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitterTokens.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitterTokens.java
index bfff957..9578726 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitterTokens.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogDocEmitterTokens.java
@@ -22,7 +22,7 @@ import org.apache.flex.compiler.codegen.IEmitterTokens;
public enum JSGoogDocEmitterTokens implements IEmitterTokens
{
- PARAM("param"), STAR("*"), TYPE("type"), EXPOSE("expose");
+ PARAM("param"), STAR("*"), TYPE("type"), EXPOSE("expose"), EXPORT("export");
private String token;
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
index d6311f0..f75ce4d 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
@@ -101,7 +101,7 @@ public class AccessorEmitter extends JSSubEmitter implements
writeNewline(ASEmitterTokens.COMMA);
PropertyNodes p = getModel().getPropertyMap().get(propName);
- writeNewline("/** @expose */");
+ writeNewline("/** @export */");
write(propName);
write(ASEmitterTokens.COLON);
write(ASEmitterTokens.SPACE);
@@ -183,7 +183,7 @@ public class AccessorEmitter extends JSSubEmitter implements
PropertyNodes p = getModel().getStaticPropertyMap().get(
propName);
- writeNewline("/** @expose */");
+ writeNewline("/** @export */");
write(propName);
write(ASEmitterTokens.COLON);
write(ASEmitterTokens.SPACE);
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BindableEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BindableEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BindableEmitter.java
index d2cd20c..09ae468 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BindableEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BindableEmitter.java
@@ -78,7 +78,7 @@ public class BindableEmitter extends JSSubEmitter implements
JSFlexJSEmitter fjs = (JSFlexJSEmitter) getEmitter();
// 'PropName': {
- writeNewline("/** @expose */");
+ writeNewline("/** @export */");
writeNewline(name + ASEmitterTokens.COLON.getToken()
+ ASEmitterTokens.SPACE.getToken()
+ ASEmitterTokens.BLOCK_OPEN.getToken());
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
index a25f98e..f6133dc 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
@@ -443,7 +443,7 @@ public class JSVF2JSEmitter extends JSGoogEmitter implements IJSVF2JSEmitter
writeNewline(ASEmitterTokens.SEMICOLON.getToken());
writeNewline();
writeNewline("/**");
- writeNewline("@expose");
+ writeNewline("@export");
writeNewline(" */");
writeNewline(parseQualifiedName(definition)
+ ASEmitterTokens.MEMBER_ACCESS.getToken() + root + "get_"
@@ -464,7 +464,7 @@ public class JSVF2JSEmitter extends JSGoogEmitter implements IJSVF2JSEmitter
+ ASEmitterTokens.SEMICOLON.getToken());
writeNewline();
writeNewline("/**");
- writeNewline("@expose");
+ writeNewline("@export");
writeNewline(" */");
writeNewline(parseQualifiedName(definition)
+ ASEmitterTokens.MEMBER_ACCESS.getToken() + root + "set_"
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 6647000..186bf56 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -367,7 +367,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
root.isTopNode = true;
writeNewline("/**");
- writeNewline(" * @private");
+ writeNewline(" * @export");
writeNewline(" * @type {Array}");
writeNewline(" */");
writeNewline("this.mxmlsd = " + ASEmitterTokens.SQUARE_OPEN.getToken());
@@ -478,7 +478,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
.getASEmitter();
writeNewline("/**");
- writeNewline(" * @expose");
+ writeNewline(" * @export");
writeNewline(" */");
writeNewline(formatQualifiedName(cname)
+ ".prototype._bindings = [");
@@ -821,7 +821,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
for (MXMLEventSpecifier event : events)
{
writeNewline("/**");
- writeNewline(" * @expose");
+ writeNewline(" * @export");
writeNewline(" * @param {" + formatQualifiedName(event.type) + "} event");
writeNewline(" */");
writeNewline(formatQualifiedName(cname)
@@ -867,7 +867,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
.getToken()))
{
indentPush();
- writeNewline("/** @expose */");
+ writeNewline("/** @export */");
writeNewline(instance.id + ": {");
writeNewline("/** @this {" + formattedCName + "} */");
indentPush();
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSEmitter.java
index 5c2aae0..6e2dfba 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSEmitter.java
@@ -370,7 +370,7 @@ public class MXMLVF2JSEmitter extends MXMLEmitter implements
.getASEmitter();
writeNewline("/**");
- writeNewline(" * @expose");
+ writeNewline(" * @export");
writeNewline(" */");
writeNewline(cname
+ ".prototype._bindings = [");
@@ -664,7 +664,7 @@ public class MXMLVF2JSEmitter extends MXMLEmitter implements
for (MXMLEventSpecifier event : events)
{
writeNewline("/**");
- writeNewline(" * @expose");
+ writeNewline(" * @export");
writeNewline(" * @param {" + event.type + "} event");
writeNewline(" */");
writeNewline(cname
@@ -691,7 +691,7 @@ public class MXMLVF2JSEmitter extends MXMLEmitter implements
.getToken()))
{
writeNewline("/**");
- writeNewline(" * @expose");
+ writeNewline(" * @export");
writeNewline(" * @return {" + instance.name + "}");
writeNewline(" */");
writeNewline(cname
@@ -704,7 +704,7 @@ public class MXMLVF2JSEmitter extends MXMLEmitter implements
writeNewline();
writeNewline();
writeNewline("/**");
- writeNewline(" * @expose");
+ writeNewline(" * @export");
writeNewline(" * @param {" + instance.name + "} value");
writeNewline(" */");
writeNewline(cname
@@ -746,7 +746,7 @@ public class MXMLVF2JSEmitter extends MXMLEmitter implements
writeNewline("/**");
writeNewline(" * start");
writeNewline(" *");
- writeNewline(" * @expose");
+ writeNewline(" * @export");
writeNewline(" */");
writeNewline(cname + ".prototype.start = function () {");
//writeNewline(root.output(true));
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java b/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
index b4c7d5e..f77e774 100644
--- a/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
+++ b/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
@@ -173,7 +173,7 @@ public class JSClosureCompilerWrapper
options_.setCheckMissingReturn(CheckLevel.WARNING);
options_.setExtractPrototypeMemberDeclarations(true);
options_.setRemoveUnusedPrototypeProperties(true);
- options_.setRemoveUnusedPrototypePropertiesInExterns(true);
+ options_.setRemoveUnusedPrototypePropertiesInExterns(false);
options_.setRemoveUnusedClassProperties(true);
options_.setRemoveUnusedVars(true);
options_.setRemoveUnusedLocalVars(true);
@@ -187,6 +187,8 @@ public class JSClosureCompilerWrapper
options_.setOptimizeReturns(true);
options_.setOptimizeCalls(true);
options_.setOptimizeArgumentsArray(true);
+ options_.setGenerateExports(true);
+ options_.setExportLocalPropertyDefinitions(true);
DependencyOptions dopts = new DependencyOptions();
ArrayList<String> entryPoints = new ArrayList<String>();
[2/9] git commit: [flex-falcon] [refs/heads/add-CollectImportPass] -
switch from @expose to @export
Posted by ft...@apache.org.
switch 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/5307227d
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/5307227d
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/5307227d
Branch: refs/heads/add-CollectImportPass
Commit: 5307227d55a0ef91ae60999a93e483706443377f
Parents: 70bc7d8
Author: Alex Harui <ah...@apache.org>
Authored: Sun Jul 5 21:37:10 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Jul 5 21:37:10 2015 -0700
----------------------------------------------------------------------
.../js/flexjs/TestFlexJSAccessorMembers.java | 20 +++++-----
.../codegen/js/flexjs/TestFlexJSAccessors.java | 8 ++--
.../codegen/js/flexjs/TestFlexJSClass.java | 30 +++++++-------
.../codegen/js/flexjs/TestFlexJSEmiter.java | 2 +-
.../js/flexjs/TestFlexJSExpressions.java | 18 ++++-----
.../js/flexjs/TestFlexJSFieldMembers.java | 26 ++++++------
.../js/flexjs/TestFlexJSGlobalConstants.java | 8 ++--
.../js/flexjs/TestFlexJSMethodMembers.java | 8 ++--
.../codegen/js/vf2js/TestVF2JSClass.java | 26 ++++++------
.../codegen/js/vf2js/TestVF2JSExpressions.java | 2 +-
.../mxml/flexjs/TestFlexJSMXMLScript.java | 2 +-
.../externals_unit_tests/constructor_params.js | 2 +-
.../externals_unit_tests/package_namespace.js | 2 +-
.../flexjs/files/FlexJSTest_again_result.js | 6 +--
.../flexjs/files/LocalFunction_result.js | 2 +-
.../flexjs/files/MyInitialView_result.js | 42 ++++++++++----------
.../flexjs/files/StockDataJSONItemConverter.js | 2 +-
.../files/controllers/MyController_result.js | 2 +-
.../flexjs/files/models/MyModel_result.js | 6 +--
.../flexjs/projects/interfaces/Test_result.js | 2 +-
.../projects/interfaces/interfaces/IE_result.js | 2 +-
.../flexjs/projects/super/Base_result.js | 2 +-
.../flexjs/projects/super/Super_result.js | 4 +-
.../test-files/goog/files/call-super_result.js | 2 +-
.../test-files/vf2js/files/SimpleMXML_result.js | 2 +-
.../vf2js/projects/interfaces/Test_result.js | 2 +-
.../projects/interfaces/classes/A_result.js | 2 +-
.../vf2js/projects/sdk/SomeSDKClass_result.js | 8 ++--
.../sdk/bases/HelperBaseClass_result.js | 2 +-
.../simpleMXML/src/SimpleMXML_Project_result.js | 2 +-
.../vf2js/projects/super/Base_result.js | 8 ++--
.../vf2js/projects/super/Super_result.js | 8 ++--
.../codegen/js/goog/IJSGoogDocEmitter.java | 4 +-
.../codegen/js/goog/JSGoogDocEmitter.java | 2 +-
.../codegen/js/goog/JSGoogDocEmitterTokens.java | 2 +-
.../internal/codegen/js/jx/AccessorEmitter.java | 4 +-
.../internal/codegen/js/jx/BindableEmitter.java | 2 +-
.../codegen/js/vf2js/JSVF2JSEmitter.java | 4 +-
.../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 8 ++--
.../codegen/mxml/vf2js/MXMLVF2JSEmitter.java | 10 ++---
.../utils/JSClosureCompilerWrapper.java | 4 +-
41 files changed, 151 insertions(+), 149 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java
index d1d35a5..53ecd66 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessorMembers.java
@@ -37,7 +37,7 @@ public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers
IClassNode node = (IClassNode) getNode("function get foo():int{}",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nget: /** @this {FalconTest_A} */ function() {\n}}}\n);");
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @export */\nfoo: {\nget: /** @this {FalconTest_A} */ function() {\n}}}\n);");
}
@Override
@@ -47,7 +47,7 @@ public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers
IClassNode node = (IClassNode) getNode("function get foo():int{return -1;}",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nget: /** @this {FalconTest_A} */ function() {\n return -1;\n}}}\n);");
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @export */\nfoo: {\nget: /** @this {FalconTest_A} */ function() {\n return -1;\n}}}\n);");
}
@Override
@@ -57,7 +57,7 @@ public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers
IClassNode node = (IClassNode) getNode("public function get foo():int{return -1;}",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nget: /** @this {FalconTest_A} */ function() {\n return -1;\n}}}\n);");
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @export */\nfoo: {\nget: /** @this {FalconTest_A} */ function() {\n return -1;\n}}}\n);");
}
@Override
@@ -67,7 +67,7 @@ public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers
IClassNode node = (IClassNode) getNode("public override function get foo():int{super.foo(); return -1;}",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nget: /** @this {FalconTest_A} */ function() {\n org_apache_flex_utils_Language.superGetter(FalconTest_A, this, 'foo');\n return -1;\n}}}\n);");
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @export */\nfoo: {\nget: /** @this {FalconTest_A} */ function() {\n org_apache_flex_utils_Language.superGetter(FalconTest_A, this, 'foo');\n return -1;\n}}}\n);");
}
@Override
@@ -77,7 +77,7 @@ public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers
IClassNode node = (IClassNode) getNode("public static function get foo():int{return -1;}",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ {\n/** @expose */\nfoo: {\nget: function() {\n return -1;\n}}}\n);");
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ {\n/** @export */\nfoo: {\nget: function() {\n return -1;\n}}}\n);");
}
@Override
@@ -87,7 +87,7 @@ public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers
IClassNode node = (IClassNode) getNode("function set foo(value:int):void{}",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nset: /** @this {FalconTest_A} */ function(value) {\n}}}\n);");
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @export */\nfoo: {\nset: /** @this {FalconTest_A} */ function(value) {\n}}}\n);");
}
@Override
@@ -97,7 +97,7 @@ public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers
IClassNode node = (IClassNode) getNode("function set foo(value:int):void{fetch('haai');}",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nset: /** @this {FalconTest_A} */ function(value) {\n fetch('haai');\n}}}\n);");
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @export */\nfoo: {\nset: /** @this {FalconTest_A} */ function(value) {\n fetch('haai');\n}}}\n);");
}
@Override
@@ -107,7 +107,7 @@ public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers
IClassNode node = (IClassNode) getNode("public function set foo(value:int):void{}",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nfoo: {\nset: /** @this {FalconTest_A} */ function(value) {\n}}}\n);");
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @export */\nfoo: {\nset: /** @this {FalconTest_A} */ function(value) {\n}}}\n);");
}
@Override
@@ -117,7 +117,7 @@ public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers
IClassNode node = (IClassNode) getNode("public class B extends A { public override function set foo(value:int):void {super.foo = value;} }; public class A extends B { public override set foo(value:int):void{}}",
IClassNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n * @extends {A}\n */\nB = function() {\n B.base(this, 'constructor');\n};\ngoog.inherits(B, A);\n\n\nObject.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/** @expose */\nfoo: {\nset: /** @this {B} */ function(value) {\n org_apache_flex_utils_Language.superSetter(B, this, 'foo', value);\n}}}\n);");
+ assertOut("/**\n * @constructor\n * @extends {A}\n */\nB = function() {\n B.base(this, 'constructor');\n};\ngoog.inherits(B, A);\n\n\nObject.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/** @export */\nfoo: {\nset: /** @this {B} */ function(value) {\n org_apache_flex_utils_Language.superSetter(B, this, 'foo', value);\n}}}\n);");
}
@Override
@@ -127,7 +127,7 @@ public class TestFlexJSAccessorMembers extends TestGoogAccessorMembers
IClassNode node = (IClassNode) getNode("public static function set foo(value:int):void{}",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ {\n/** @expose */\nfoo: {\nset: function(value) {\n}}}\n);");
+ assertOut("/**\n * @constructor\n */\nFalconTest_A = function() {\n};Object.defineProperties(FalconTest_A, /** @lends {FalconTest_A} */ {\n/** @export */\nfoo: {\nset: function(value) {\n}}}\n);");
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java
index 77d5a24..7083e3a 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSAccessors.java
@@ -38,7 +38,7 @@ public class TestFlexJSAccessors extends ASTestBase
"public function doStuff():void {label = 'hello, bye'; var theLabel:String = label;}; private var _label:String; public function get label():String {return _label}; public function set label(value:String):void {_label = value}; ",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n */\nFalconTest_A.prototype.doStuff = function() {\n this.label = 'hello, bye';\n var /** @type {string} */ theLabel = this.label;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nFalconTest_A.prototype._label;\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nlabel: {\nget: /** @this {FalconTest_A} */ function() {\n return this._label;\n},\nset: /** @this {FalconTest_A} */ function(value) {\n this._label = value;\n}}}\n);";
+ String expected = "/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @export\n */\nFalconTest_A.prototype.doStuff = function() {\n this.label = 'hello, bye';\n var /** @type {string} */ theLabel = this.label;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nFalconTest_A.prototype._label;\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @export */\nlabel: {\nget: /** @this {FalconTest_A} */ function() {\n return this._label;\n},\nset: /** @this {FalconTest_A} */ function(value) {\n this._label = value;\n}}}\n);";
assertOut(expected);
}
@@ -49,7 +49,7 @@ public class TestFlexJSAccessors extends ASTestBase
"public class B { public function B() {}; public function doStuff():void {this.label = label + 'bye'; var theLabel:String = label;}; private var _label:String; public function get label():String {return _label}; public function set label(value:String):void {_label = value};}",
IClassNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n * @expose\n */\nB.prototype.doStuff = function() {\n this.label = this.label + 'bye';\n var /** @type {string} */ theLabel = this.label;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB.prototype._label;\n\n\nObject.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/** @expose */\nlabel: {\nget: /** @this {B} */ function() {\n return this._label;\n},\nset: /** @this {B} */ function(value) {\n this._label = value;\n}}}\n);";
+ String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n * @export\n */\nB.prototype.doStuff = function() {\n this.label = this.label + 'bye';\n var /** @type {string} */ theLabel = this.label;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB.prototype._label;\n\n\nObject.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/** @export */\nlabel: {\nget: /** @this {B} */ function() {\n return this._label;\n},\nset: /** @this {B} */ function(value) {\n this._label = value;\n}}}\n);";
assertOut(expected);
}
@@ -60,7 +60,7 @@ public class TestFlexJSAccessors extends ASTestBase
"public function doStuff():void {label = label + 'bye'; var theLabel:String = label;}; private var _label:String; public function get label():String {return _label}; public function set label(value:String):void {_label = value}; ",
IClassNode.class, WRAP_LEVEL_CLASS);
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @expose\n */\nFalconTest_A.prototype.doStuff = function() {\n this.label = this.label + 'bye';\n var /** @type {string} */ theLabel = this.label;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nFalconTest_A.prototype._label;\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @expose */\nlabel: {\nget: /** @this {FalconTest_A} */ function() {\n return this._label;\n},\nset: /** @this {FalconTest_A} */ function(value) {\n this._label = value;\n}}}\n);";
+ String expected = "/**\n * @constructor\n */\nFalconTest_A = function() {\n};\n\n\n/**\n * @export\n */\nFalconTest_A.prototype.doStuff = function() {\n this.label = this.label + 'bye';\n var /** @type {string} */ theLabel = this.label;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nFalconTest_A.prototype._label;\n\n\nObject.defineProperties(FalconTest_A.prototype, /** @lends {FalconTest_A.prototype} */ {\n/** @export */\nlabel: {\nget: /** @this {FalconTest_A} */ function() {\n return this._label;\n},\nset: /** @this {FalconTest_A} */ function(value) {\n this._label = value;\n}}}\n);";
assertOut(expected);
}
@@ -71,7 +71,7 @@ public class TestFlexJSAccessors extends ASTestBase
"public class B { public function B() {}; public function doStuff():void {label = this.label; var theLabel:String = label;}; private var _label:String; public function get label():String {return _label}; public function set label(value:String):void {_label = value};}",
IClassNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n * @expose\n */\nB.prototype.doStuff = function() {\n this.label = this.label;\n var /** @type {string} */ theLabel = this.label;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB.prototype._label;\n\n\nObject.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/** @expose */\nlabel: {\nget: /** @this {B} */ function() {\n return this._label;\n},\nset: /** @this {B} */ function(value) {\n this._label = value;\n}}}\n);";
+ String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n * @export\n */\nB.prototype.doStuff = function() {\n this.label = this.label;\n var /** @type {string} */ theLabel = this.label;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB.prototype._label;\n\n\nObject.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/** @export */\nlabel: {\nget: /** @this {B} */ function() {\n return this._label;\n},\nset: /** @this {B} */ function(value) {\n this._label = value;\n}}}\n);";
assertOut(expected);
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
index c2ece93..2c1b273 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSClass.java
@@ -99,7 +99,7 @@ public class TestFlexJSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B(arg1:String) {this.arg1 = arg1}; public var arg1:String;}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n * @param {string} arg1\n */\norg_apache_flex_B = function(arg1) {\n this.arg1 = arg1;\n};\n\n\n/**\n * @expose\n * @type {string}\n */\norg_apache_flex_B.prototype.arg1;";
+ String expected = "/**\n * @constructor\n * @param {string} arg1\n */\norg_apache_flex_B = function(arg1) {\n this.arg1 = arg1;\n};\n\n\n/**\n * @export\n * @type {string}\n */\norg_apache_flex_B.prototype.arg1;";
assertOut(expected);
}
@@ -108,7 +108,7 @@ public class TestFlexJSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; public var button:Button = new Button(); public function foo():String {return button.label;};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n * @type {spark_components_Button}\n */\norg_apache_flex_B.prototype.button = new spark_components_Button();\n\n\n/**\n * @expose\n * @return {string}\n */\norg_apache_flex_B.prototype.foo = function() {\n return this.button.label;\n};";
+ String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @export\n * @type {spark_components_Button}\n */\norg_apache_flex_B.prototype.button = new spark_components_Button();\n\n\n/**\n * @export\n * @return {string}\n */\norg_apache_flex_B.prototype.foo = function() {\n return this.button.label;\n};";
assertOut(expected);
}
@@ -117,7 +117,7 @@ public class TestFlexJSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; public function foo():void {};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n */\norg_apache_flex_B.prototype.foo = function() {\n};";
+ String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @export\n */\norg_apache_flex_B.prototype.foo = function() {\n};";
assertOut(expected);
}
@@ -126,7 +126,7 @@ public class TestFlexJSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; override public function foo():void {};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n * @override\n */\norg_apache_flex_B.prototype.foo = function() {\n};";
+ String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @export\n * @override\n */\norg_apache_flex_B.prototype.foo = function() {\n};";
assertOut(expected);
}
@@ -135,7 +135,7 @@ public class TestFlexJSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; override public function foo(value:Object):void {baz = ''};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n * @param {Object} value\n * @override\n */\norg_apache_flex_B.prototype.foo = function(value) {\n baz = '';\n};";
+ String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @export\n * @param {Object} value\n * @override\n */\norg_apache_flex_B.prototype.foo = function(value) {\n baz = '';\n};";
assertOut(expected);
}
@@ -144,7 +144,7 @@ public class TestFlexJSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; override public function foo():void {super.foo();};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n * @override\n */\norg_apache_flex_B.prototype.foo = function() {\n org_apache_flex_B.base(this, 'foo');\n};";
+ String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @export\n * @override\n */\norg_apache_flex_B.prototype.foo = function() {\n org_apache_flex_B.base(this, 'foo');\n};";
assertOut(expected);
}
@@ -153,7 +153,7 @@ public class TestFlexJSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; public function set baz(value:Object):void {}; public function set foo(value:Object):void {baz = value;};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\nObject.defineProperties(org_apache_flex_B.prototype, /** @lends {org_apache_flex_B.prototype} */ {\n/** @expose */\nbaz: {\nset: /** @this {org_apache_flex_B} */ function(value) {\n}},\n/** @expose */\nfoo: {\nset: /** @this {org_apache_flex_B} */ function(value) {\n this.baz = value;\n}}}\n);";
+ String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\nObject.defineProperties(org_apache_flex_B.prototype, /** @lends {org_apache_flex_B.prototype} */ {\n/** @export */\nbaz: {\nset: /** @this {org_apache_flex_B} */ function(value) {\n}},\n/** @export */\nfoo: {\nset: /** @this {org_apache_flex_B} */ function(value) {\n this.baz = value;\n}}}\n);";
assertOut(expected);
}
@@ -162,7 +162,7 @@ public class TestFlexJSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; override public function set foo(value:Object):void {super.foo = value;};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\nObject.defineProperties(org_apache_flex_B.prototype, /** @lends {org_apache_flex_B.prototype} */ {\n/** @expose */\nfoo: {\nset: /** @this {org_apache_flex_B} */ function(value) {\n foo = value;\n}}}\n);";
+ String expected = "/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\nObject.defineProperties(org_apache_flex_B.prototype, /** @lends {org_apache_flex_B.prototype} */ {\n/** @export */\nfoo: {\nset: /** @this {org_apache_flex_B} */ function(value) {\n foo = value;\n}}}\n);";
assertOut(expected);
}
@@ -182,7 +182,7 @@ public class TestFlexJSClass extends TestGoogClass
IClassNode node = getClassNode("public class A {public var a:Object;protected var b:String; "
+ "private var c:int; internal var d:uint; var e:Number}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg_apache_flex_A = function() {\n};\n\n\n/**\n * @expose\n * @type {Object}\n */\norg_apache_flex_A.prototype.a;\n\n\n/**\n * @protected\n * @type {string}\n */\norg_apache_flex_A.prototype.b;\n\n\n/**\n * @private\n * @type {number}\n */\norg_apache_flex_A.prototype.c;\n\n\n/**\n * @expose\n * @type {number}\n */\norg_apache_flex_A.prototype.d;\n\n\n/**\n * @expose\n * @type {number}\n */\norg_apache_flex_A.prototype.e;");
+ assertOut("/**\n * @constructor\n */\norg_apache_flex_A = function() {\n};\n\n\n/**\n * @export\n * @type {Object}\n */\norg_apache_flex_A.prototype.a;\n\n\n/**\n * @protected\n * @type {string}\n */\norg_apache_flex_A.prototype.b;\n\n\n/**\n * @private\n * @type {number}\n */\norg_apache_flex_A.prototype.c;\n\n\n/**\n * @export\n * @type {number}\n */\norg_apache_flex_A.prototype.d;\n\n\n/**\n * @export\n * @type {number}\n */\norg_apache_flex_A.prototype.e;");
}
@Override
@@ -195,7 +195,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
@@ -214,7 +214,7 @@ public class TestFlexJSClass extends TestGoogClass
+ "foo_bar function get foo6():Object{return null;}"
+ "foo_bar function set foo6(value:Object):void{}" + "}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg_apache_flex_A = function() {\n};\n\n\nObject.defineProperties(org_apache_flex_A.prototype, /** @lends {org_apache_flex_A.prototype} */ {\n/** @expose */\nfoo5: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}},\n/** @expose */\nfoo3: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}},\n/** @expose */\nfoo2: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}},\n/** @expose */\nfoo1: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}},\n/** @expose */\nfoo6: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}}}\n);");
+ assertOut("/**\n * @constructor\n */\norg_apache_flex_A = function() {\n};\n\n\nObject.defineProperties(org_apache_flex_A.prototype, /** @lends {org_apache_flex_A.prototype} */ {\n/** @export */\nfoo5: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}},\n/** @export */\nfoo3: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}},\n/** @export */\nfoo2: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}},\n/** @export */\nfoo1: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}},\n/** @export */\nfoo6: {\nget: /** @this {org_apache_flex_A} */ function() {\n return null;\n},\nset: /** @this {org_apache_flex_A} */ function(value) {\n}}}\n);");
}
@Override
@@ -232,7 +232,7 @@ public class TestFlexJSClass 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/**\n * @expose\n * @return {Object}\n */\norg_apache_flex_A.prototype.foo1 = function() {\n return null;\n};\n\n\n/**\n * @expose\n * @return {Object}\n */\norg_apache_flex_A.prototype.foo1a = function() {\n return null;\n};\n\n\n/**\n * @expose\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/**\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
@@ -243,7 +243,7 @@ public class TestFlexJSClass extends TestGoogClass
+ "public function foo2():Object{function bar2(param1:Object):Object {return null;}; return bar2('foo');}"
+ "}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n * @return {Object}\n */\norg_apache_flex_B.prototype.foo1 = function() {\n function bar1() {\n return null;\n };\n return goog.bind(bar1, this)();\n};\n\n\n/**\n * @expose\n * @return {Object}\n */\norg_apache_flex_B.prototype.foo2 = function() {\n function bar2(param1) {\n return null;\n };\n return goog.bind(bar2, this)('foo');\n};");
+ assertOut("/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @export\n * @return {Object}\n */\norg_apache_flex_B.prototype.foo1 = function() {\n function bar1() {\n return null;\n };\n return goog.bind(bar1, this)();\n};\n\n\n/**\n * @export\n * @return {Object}\n */\norg_apache_flex_B.prototype.foo2 = function() {\n function bar2(param1) {\n return null;\n };\n return goog.bind(bar2, this)('foo');\n};");
}
@Test
@@ -255,7 +255,7 @@ public class TestFlexJSClass extends TestGoogClass
+ "public function foo2():String{function bar2(param1:String):String {return param1 + baz1;}; return bar2('foo');}"
+ "}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n * @type {string}\n */\norg_apache_flex_B.prototype.baz1;\n\n\n/**\n * @expose\n * @return {string}\n */\norg_apache_flex_B.prototype.foo1 = function() {\n function bar1() {\n return this.baz1;\n };\n return goog.bind(bar1, this)();\n};\n\n\n/**\n * @expose\n * @return {string}\n */\norg_apache_flex_B.prototype.foo2 = function() {\n function bar2(param1) {\n return param1 + this.baz1;\n };\n return goog.bind(bar2, this)('foo');\n};");
+ assertOut("/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @export\n * @type {string}\n */\norg_apache_flex_B.prototype.baz1;\n\n\n/**\n * @export\n * @return {string}\n */\norg_apache_flex_B.prototype.foo1 = function() {\n function bar1() {\n return this.baz1;\n };\n return goog.bind(bar1, this)();\n};\n\n\n/**\n * @export\n * @return {string}\n */\norg_apache_flex_B.prototype.foo2 = function() {\n function bar2(param1) {\n return param1 + this.baz1;\n };\n return goog.bind(bar2, this)('foo');\n};");
}
@Test
@@ -275,7 +275,7 @@ public class TestFlexJSClass extends TestGoogClass
+ "public function clone():B { return new B() }"
+ "}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @expose\n * @return {org_apache_flex_B}\n */\norg_apache_flex_B.prototype.clone = function() {\n return new org_apache_flex_B();\n};");
+ assertOut("/**\n * @constructor\n */\norg_apache_flex_B = function() {\n};\n\n\n/**\n * @export\n * @return {org_apache_flex_B}\n */\norg_apache_flex_B.prototype.clone = function() {\n return new org_apache_flex_B();\n};");
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
index fa8c339..3e7f6d7 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSEmiter.java
@@ -54,7 +54,7 @@ public class TestFlexJSEmiter extends TestGoogEmiter
+ "return \"Don't \" + _privateVar + value; }";
IFileNode node = compileAS(code);
asBlockWalker.visitFile(node);
- assertOut("/**\n * com.example.components.MyTextButton\n *\n * @fileoverview\n *\n * @suppress {checkTypes}\n */\n\ngoog.provide('com_example_components_MyTextButton');\n\n\n\n/**\n * @constructor\n * @extends {spark_components_Button}\n */\ncom_example_components_MyTextButton = function() {\n com_example_components_MyTextButton.base(this, 'constructor');\n if (foo() != 42) {\n bar();\n }\n};\ngoog.inherits(com_example_components_MyTextButton, spark_components_Button);\n\n\n/**\n * @private\n * @type {string}\n */\ncom_example_components_MyTextButton.prototype._privateVar = \"do \";\n\n\n/**\n * @expose\n * @type {number}\n */\ncom_example_components_MyTextButton.prototype.publicProperty = 100;\n\n\n/**\n * @expose\n * @param {string} value\n * @return {string}\n */\ncom_example_components_MyTextButton.prototype.myFunction = function(value) {\n return \"Don't \" + this._privateVar + value;\n};\n\n\n/**\n * Metadata\n *\n * @type {Object.<string, Array.<Object>>}\n */\
ncom_example_components_MyTextButton.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'MyTextButton', qName: 'com_example_components_MyTextButton'}] };\n");
+ assertOut("/**\n * com.example.components.MyTextButton\n *\n * @fileoverview\n *\n * @suppress {checkTypes}\n */\n\ngoog.provide('com_example_components_MyTextButton');\n\n\n\n/**\n * @constructor\n * @extends {spark_components_Button}\n */\ncom_example_components_MyTextButton = function() {\n com_example_components_MyTextButton.base(this, 'constructor');\n if (foo() != 42) {\n bar();\n }\n};\ngoog.inherits(com_example_components_MyTextButton, spark_components_Button);\n\n\n/**\n * @private\n * @type {string}\n */\ncom_example_components_MyTextButton.prototype._privateVar = \"do \";\n\n\n/**\n * @export\n * @type {number}\n */\ncom_example_components_MyTextButton.prototype.publicProperty = 100;\n\n\n/**\n * @export\n * @param {string} value\n * @return {string}\n */\ncom_example_components_MyTextButton.prototype.myFunction = function(value) {\n return \"Don't \" + this._privateVar + value;\n};\n\n\n/**\n * Metadata\n *\n * @type {Object.<string, Array.<Object>>}\n */\
ncom_example_components_MyTextButton.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'MyTextButton', qName: 'com_example_components_MyTextButton'}] };\n");
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
index 99fc70f..9cd4eb6 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSExpressions.java
@@ -552,7 +552,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {public function b() { function c(f:Function):void {}; function d():void {}; c(d); }}",
IFunctionNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n */\nB.prototype.b = function() {\n function c(f) {\n };\n function d() {\n };\n goog.bind(c, this)(goog.bind(d, this));\n}");
+ assertOut("/**\n * @export\n */\nB.prototype.b = function() {\n function c(f) {\n };\n function d() {\n };\n goog.bind(c, this)(goog.bind(d, this));\n}");
}
@Test
@@ -562,7 +562,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {public function b() { function c(s:String, f:Function):void {}; function d():void {}; c('foo', d); }}",
IFunctionNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n */\nB.prototype.b = function() {\n function c(s, f) {\n };\n function d() {\n };\n goog.bind(c, this)('foo', goog.bind(d, this));\n}");
+ assertOut("/**\n * @export\n */\nB.prototype.b = function() {\n function c(s, f) {\n };\n function d() {\n };\n goog.bind(c, this)('foo', goog.bind(d, this));\n}");
}
@Test
@@ -572,7 +572,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {public function b() { c('foo', d); function c(s:String, f:Function):void {}; function d():void {};}}",
IFunctionNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n */\nB.prototype.b = function() {\n goog.bind(c, this)('foo', goog.bind(d, this));\n function c(s, f) {\n };\n function d() {\n };\n}");
+ assertOut("/**\n * @export\n */\nB.prototype.b = function() {\n goog.bind(c, this)('foo', goog.bind(d, this));\n function c(s, f) {\n };\n function d() {\n };\n}");
}
@Test
@@ -582,7 +582,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {public function b() { function d():void {}; c('foo', d); } public function c(s:String, f:Function):void {};}",
IFunctionNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n */\nB.prototype.b = function() {\n function d() {\n };\n this.c('foo', goog.bind(d, this));\n}");
+ assertOut("/**\n * @export\n */\nB.prototype.b = function() {\n function d() {\n };\n this.c('foo', goog.bind(d, this));\n}");
}
@Test
@@ -592,7 +592,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {public function b() { function c(f:Function):void {}; c(b); }}",
IFunctionNode.class, WRAP_LEVEL_PACKAGE);
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n */\nB.prototype.b = function() {\n function c(f) {\n };\n goog.bind(c, this)(goog.bind(this.b, this));\n}");
+ assertOut("/**\n * @export\n */\nB.prototype.b = function() {\n function c(f) {\n };\n goog.bind(c, this)(goog.bind(this.b, this));\n}");
}
@Test
@@ -602,7 +602,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 goog.bind(c, this)(foo_bar_B.b);\n}");
+ assertOut("/**\n * @export\n */\nfoo_bar_B.b = function() {\n function c(f) {\n };\n goog.bind(c, this)(foo_bar_B.b);\n}");
}
@Test
@@ -613,7 +613,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
IFunctionNode.class, WRAP_LEVEL_PACKAGE, true);
asBlockWalker.visitFunction(node);
// String.length is a getter but is a property in JS, so don't generate set_length() call.
- assertOut("/**\n * @expose\n * @return {number}\n */\nfoo_bar_B.prototype.b = function() {\n var /** @type {string} */ s;\n return s.length;\n}");
+ assertOut("/**\n * @export\n * @return {number}\n */\nfoo_bar_B.prototype.b = function() {\n var /** @type {string} */ s;\n return s.length;\n}");
}
@Test
@@ -624,7 +624,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
IFunctionNode.class, WRAP_LEVEL_PACKAGE, true);
asBlockWalker.visitFunction(node);
// String.length is a getter but is a property in JS, so don't generate set_length() call.
- assertOut("/**\n * @expose\n * @return {number}\n */\nfoo_bar_B.prototype.b = function() {\n var /** @type {Vector.<string>} */ a;\n return a.length;\n}");
+ assertOut("/**\n * @export\n * @return {number}\n */\nfoo_bar_B.prototype.b = function() {\n var /** @type {Vector.<string>} */ a;\n return a.length;\n}");
}
//----------------------------------
@@ -701,7 +701,7 @@ public class TestFlexJSExpressions extends TestGoogExpressions
"public class B {public function b(o:Object):int { var a:B; a = o as B; }}",
IFunctionNode.class, WRAP_LEVEL_PACKAGE, true);
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n * @param {Object} o\n * @return {number}\n */\nfoo_bar_B.prototype.b = function(o) {\n var /** @type {foo_bar_B} */ a;\n a = org_apache_flex_utils_Language.as(o, foo_bar_B);\n}");
+ assertOut("/**\n * @export\n * @param {Object} o\n * @return {number}\n */\nfoo_bar_B.prototype.b = function(o) {\n var /** @type {foo_bar_B} */ a;\n a = org_apache_flex_utils_Language.as(o, foo_bar_B);\n}");
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
index ca79089..c2a076f 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSFieldMembers.java
@@ -43,7 +43,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("var foo;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @type {*}\n */\nFalconTest_A.prototype.foo");
+ assertOut("/**\n * @export\n * @type {*}\n */\nFalconTest_A.prototype.foo");
}
@Override
@@ -52,7 +52,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("var foo:int;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.foo");
+ assertOut("/**\n * @export\n * @type {number}\n */\nFalconTest_A.prototype.foo");
}
@Override
@@ -61,7 +61,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("var foo:int = 420;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.foo = 420");
+ assertOut("/**\n * @export\n * @type {number}\n */\nFalconTest_A.prototype.foo = 420");
}
@Test
@@ -69,7 +69,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("var foo:int = -420;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.foo = -420");
+ assertOut("/**\n * @export\n * @type {number}\n */\nFalconTest_A.prototype.foo = -420");
}
@Override
@@ -88,7 +88,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
IVariableNode node = getField("mx_internal var foo:int = 420;");
asBlockWalker.visitVariable(node);
// (erikdebruin) we ignore custom namespaces completely (are there side effects I'm missing?)
- assertOut("/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.foo = 420");
+ assertOut("/**\n * @export\n * @type {number}\n */\nFalconTest_A.prototype.foo = 420");
}
@Override
@@ -137,7 +137,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
@@ -145,7 +145,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("const foo;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @const\n * @type {*}\n */\nFalconTest_A.prototype.foo");
+ assertOut("/**\n * @export\n * @const\n * @type {*}\n */\nFalconTest_A.prototype.foo");
}
@Override
@@ -154,7 +154,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");
+ assertOut("/**\n * @export\n * @const\n * @type {number}\n */\nFalconTest_A.foo");
}
@Test
@@ -162,7 +162,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("const foo:int;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @const\n * @type {number}\n */\nFalconTest_A.prototype.foo");
+ assertOut("/**\n * @export\n * @const\n * @type {number}\n */\nFalconTest_A.prototype.foo");
}
@Override
@@ -171,7 +171,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
@@ -179,7 +179,7 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
{
IVariableNode node = getField("const foo:int = 420;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @const\n * @type {number}\n */\nFalconTest_A.prototype.foo = 420");
+ assertOut("/**\n * @export\n * @const\n * @type {number}\n */\nFalconTest_A.prototype.foo = 420");
}
@Override
@@ -206,7 +206,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
@@ -215,6 +215,6 @@ public class TestFlexJSFieldMembers extends TestGoogFieldMembers
IVariableNode node = getField("mx_internal 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.prototype.foo = 420");
+ assertOut("/**\n * @export\n * @const\n * @type {number}\n */\nFalconTest_A.prototype.foo = 420");
}
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalConstants.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalConstants.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalConstants.java
index e8971e2..78e93cc 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalConstants.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalConstants.java
@@ -43,7 +43,7 @@ public class TestFlexJSGlobalConstants extends TestGoogGlobalConstants
{
IVariableNode node = getField("var a:Number = Infinity;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.a = Infinity");
+ assertOut("/**\n * @export\n * @type {number}\n */\nFalconTest_A.prototype.a = Infinity");
}
@Override
@@ -52,7 +52,7 @@ public class TestFlexJSGlobalConstants extends TestGoogGlobalConstants
{
IVariableNode node = getField("var a:Number = -Infinity;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.a = -Infinity");
+ assertOut("/**\n * @export\n * @type {number}\n */\nFalconTest_A.prototype.a = -Infinity");
}
@Override
@@ -61,7 +61,7 @@ public class TestFlexJSGlobalConstants extends TestGoogGlobalConstants
{
IVariableNode node = getField("var a:Number = NaN;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @type {number}\n */\nFalconTest_A.prototype.a = NaN");
+ assertOut("/**\n * @export\n * @type {number}\n */\nFalconTest_A.prototype.a = NaN");
}
@Override
@@ -70,6 +70,6 @@ public class TestFlexJSGlobalConstants extends TestGoogGlobalConstants
{
IVariableNode node = getField("var a:* = undefined;");
asBlockWalker.visitVariable(node);
- assertOut("/**\n * @expose\n * @type {*}\n */\nFalconTest_A.prototype.a = undefined");
+ assertOut("/**\n * @export\n * @type {*}\n */\nFalconTest_A.prototype.a = undefined");
}
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
index a11ea8d..b983329 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
@@ -157,7 +157,7 @@ public class TestFlexJSMethodMembers extends TestGoogMethodMembers
IFunctionNode node = getMethod("public function foo(bar:String, baz:int = null):int{ return -1;}");
asBlockWalker.visitFunction(node);
// we ignore the 'public' namespace completely
- assertOut("/**\n * @expose\n * @param {string} bar\n * @param {number=} baz\n * @return {number}\n */\nFalconTest_A.prototype.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.prototype.foo = function(bar, baz) {\n baz = typeof baz !== 'undefined' ? baz : null;\n return -1;\n}");
}
@Override
@@ -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
@@ -178,7 +178,7 @@ public class TestFlexJSMethodMembers extends TestGoogMethodMembers
{
IFunctionNode node = getMethod("public override function foo(bar:String, baz:int = null):int{ return -1;}");
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n * @param {string} bar\n * @param {number=} baz\n * @return {number}\n * @override\n */\nFalconTest_A.prototype.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 * @override\n */\nFalconTest_A.prototype.foo = function(bar, baz) {\n baz = typeof baz !== 'undefined' ? baz : null;\n return -1;\n}");
}
@Override
@@ -187,7 +187,7 @@ public class TestFlexJSMethodMembers extends TestGoogMethodMembers
{
IFunctionNode node = getMethod("override public function foo(bar:String, baz:int = null):int{return -1;}");
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n * @param {string} bar\n * @param {number=} baz\n * @return {number}\n * @override\n */\nFalconTest_A.prototype.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 * @override\n */\nFalconTest_A.prototype.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/5307227d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java
index 1e6b546..b84647d 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSClass.java
@@ -185,7 +185,7 @@ public class TestVF2JSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; public var button:Button = new Button(); public function foo():String {return button.label;};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {\n this.button = new spark.components.Button();\n};\n\n\n/**\n * @type {spark.components.Button}\n */\norg.apache.flex.B.prototype.button;\n\n\n/**\n * @expose\n * @return {string}\n */\norg.apache.flex.B.prototype.foo = function() {\n return this.button.get_label();\n};";
+ String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {\n this.button = new spark.components.Button();\n};\n\n\n/**\n * @type {spark.components.Button}\n */\norg.apache.flex.B.prototype.button;\n\n\n/**\n * @export\n * @return {string}\n */\norg.apache.flex.B.prototype.foo = function() {\n return this.button.get_label();\n};";
assertOut(expected);
}
@@ -194,7 +194,7 @@ public class TestVF2JSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; public function foo():void {};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @expose\n */\norg.apache.flex.B.prototype.foo = function() {\n};";
+ String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n */\norg.apache.flex.B.prototype.foo = function() {\n};";
assertOut(expected);
}
@@ -203,7 +203,7 @@ public class TestVF2JSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; override public function foo():void {};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @expose\n * @override\n */\norg.apache.flex.B.prototype.foo = function() {\n};";
+ String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @override\n */\norg.apache.flex.B.prototype.foo = function() {\n};";
assertOut(expected);
}
@@ -212,7 +212,7 @@ public class TestVF2JSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; override public function foo(value:Object):void {baz = ''};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @expose\n * @param {Object} value\n * @override\n */\norg.apache.flex.B.prototype.foo = function(value) {\n baz = '';\n};";
+ String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @param {Object} value\n * @override\n */\norg.apache.flex.B.prototype.foo = function(value) {\n baz = '';\n};";
assertOut(expected);
}
@@ -221,7 +221,7 @@ public class TestVF2JSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; override public function foo():void {super.foo();};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @expose\n * @override\n */\norg.apache.flex.B.prototype.foo = function() {\n org.apache.flex.B.base(this, 'foo');\n};";
+ String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @override\n */\norg.apache.flex.B.prototype.foo = function() {\n org.apache.flex.B.base(this, 'foo');\n};";
assertOut(expected);
}
@@ -230,7 +230,7 @@ public class TestVF2JSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; public function set baz(value:Object):void {}; public function set foo(value:Object):void {baz = value;};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @expose\n * @param {Object} value\n */\norg.apache.flex.B.prototype.set_baz = function(value) {\n};\n\n\n/**\n * @expose\n * @param {Object} value\n */\norg.apache.flex.B.prototype.set_foo = function(value) {\n this.set_baz(value);\n};";
+ String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @param {Object} value\n */\norg.apache.flex.B.prototype.set_baz = function(value) {\n};\n\n\n/**\n * @export\n * @param {Object} value\n */\norg.apache.flex.B.prototype.set_foo = function(value) {\n this.set_baz(value);\n};";
assertOut(expected);
}
@@ -239,7 +239,7 @@ public class TestVF2JSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class B {public function B() {}; override public function set foo(value:Object):void {super.foo = value;};}");
asBlockWalker.visitClass(node);
- String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @expose\n * @param {Object} value\n * @override\n */\norg.apache.flex.B.prototype.set_foo = function(value) {\n org.apache.flex.B.base(this, 'set_foo', value);\n};";
+ String expected = "/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @param {Object} value\n * @override\n */\norg.apache.flex.B.prototype.set_foo = function(value) {\n org.apache.flex.B.base(this, 'set_foo', value);\n};";
assertOut(expected);
}
@@ -275,7 +275,7 @@ public class TestVF2JSClass extends TestGoogClass
{
IClassNode node = getClassNode("public class A {private var controlBarGroupProperties:Object = { visible: true }; private var _visible:Boolean; public function get visible():Boolean { return _visible; }; public function set visible(value:Boolean):void { _visible = value; };}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};\n\n\n/**\n * @private\n * @type {Object}\n */\norg.apache.flex.A.prototype.controlBarGroupProperties = {visible:true};\n\n\n/**\n * @private\n * @type {boolean}\n */\norg.apache.flex.A.prototype._visible;\n\n\n/**\n * @expose\n * @return {boolean}\n */\norg.apache.flex.A.prototype.get_visible = function() {\n return this._visible;\n};\n\n\n/**\n * @expose\n * @param {boolean} value\n */\norg.apache.flex.A.prototype.set_visible = function(value) {\n this._visible = value;\n};");
+ assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};\n\n\n/**\n * @private\n * @type {Object}\n */\norg.apache.flex.A.prototype.controlBarGroupProperties = {visible:true};\n\n\n/**\n * @private\n * @type {boolean}\n */\norg.apache.flex.A.prototype._visible;\n\n\n/**\n * @export\n * @return {boolean}\n */\norg.apache.flex.A.prototype.get_visible = function() {\n return this._visible;\n};\n\n\n/**\n * @export\n * @param {boolean} value\n */\norg.apache.flex.A.prototype.set_visible = function(value) {\n this._visible = value;\n};");
}
@Override
@@ -307,7 +307,7 @@ public class TestVF2JSClass extends TestGoogClass
+ "foo_bar function get foo6():Object{return null;}"
+ "foo_bar function set foo6(value:Object):void{}" + "}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg.apache.flex.A = function() {};\n\n\n/**\n * @expose\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo1 = function() {\n return null;\n};\n\n\n/**\n * @expose\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo1 = function(value) {\n};\n\n\n/**\n * @protected\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo2 = function() {\n return null;\n};\n\n\n/**\n * @protected\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo2 = function(value) {\n};\n\n\n/**\n * @private\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo3 = function() {\n return null;\n};\n\n\n/**\n * @private\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo3 = function(value) {\n};\n\n\n/**\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo5 = function() {\n return null;\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo5 = function(value) {\
n};\n\n\n/**\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo6 = function() {\n return null;\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo6 = 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.get_foo1 = function() {\n return null;\n};\n\n\n/**\n * @export\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo1 = function(value) {\n};\n\n\n/**\n * @protected\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo2 = function() {\n return null;\n};\n\n\n/**\n * @protected\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo2 = function(value) {\n};\n\n\n/**\n * @private\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo3 = function() {\n return null;\n};\n\n\n/**\n * @private\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo3 = function(value) {\n};\n\n\n/**\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo5 = function() {\n return null;\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo5 = function(value) {\
n};\n\n\n/**\n * @return {Object}\n */\norg.apache.flex.A.prototype.get_foo6 = function() {\n return null;\n};\n\n\n/**\n * @param {Object} value\n */\norg.apache.flex.A.prototype.set_foo6 = function(value) {\n};");
}
@Override
@@ -325,7 +325,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 * @expose\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1 = function() {\n return null;\n};\n\n\n/**\n * @expose\n * @return {Object}\n */\norg.apache.flex.A.prototype.foo1a = function() {\n return null;\n};\n\n\n/**\n * @expose\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
@@ -336,7 +336,7 @@ public class TestVF2JSClass extends TestGoogClass
+ "public function foo2():Object{function bar2(param1:Object):Object {return null;}; return bar2('foo');}"
+ "}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @expose\n * @return {Object}\n */\norg.apache.flex.B.prototype.foo1 = function() {\n function bar1() {\n return null;\n };\n return goog.bind(bar1, this)();\n};\n\n\n/**\n * @expose\n * @return {Object}\n */\norg.apache.flex.B.prototype.foo2 = function() {\n function bar2(param1) {\n return null;\n };\n return goog.bind(bar2, this)('foo');\n};");
+ assertOut("/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.B.prototype.foo1 = function() {\n function bar1() {\n return null;\n };\n return goog.bind(bar1, this)();\n};\n\n\n/**\n * @export\n * @return {Object}\n */\norg.apache.flex.B.prototype.foo2 = function() {\n function bar2(param1) {\n return null;\n };\n return goog.bind(bar2, this)('foo');\n};");
}
@Test
@@ -348,7 +348,7 @@ public class TestVF2JSClass extends TestGoogClass
+ "public function foo2():String{function bar2(param1:String):String {return param1 + baz1;}; return bar2('foo');}"
+ "}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @type {string}\n */\norg.apache.flex.B.prototype.baz1;\n\n\n/**\n * @expose\n * @return {string}\n */\norg.apache.flex.B.prototype.foo1 = function() {\n function bar1() {\n return this.baz1;\n };\n return goog.bind(bar1, this)();\n};\n\n\n/**\n * @expose\n * @return {string}\n */\norg.apache.flex.B.prototype.foo2 = function() {\n function bar2(param1) {\n return param1 + this.baz1;\n };\n return goog.bind(bar2, this)('foo');\n};");
+ assertOut("/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @type {string}\n */\norg.apache.flex.B.prototype.baz1;\n\n\n/**\n * @export\n * @return {string}\n */\norg.apache.flex.B.prototype.foo1 = function() {\n function bar1() {\n return this.baz1;\n };\n return goog.bind(bar1, this)();\n};\n\n\n/**\n * @export\n * @return {string}\n */\norg.apache.flex.B.prototype.foo2 = function() {\n function bar2(param1) {\n return param1 + this.baz1;\n };\n return goog.bind(bar2, this)('foo');\n};");
}
@Test
@@ -368,7 +368,7 @@ public class TestVF2JSClass extends TestGoogClass
+ "public function clone():B { return new B() }"
+ "}");
asBlockWalker.visitClass(node);
- assertOut("/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @expose\n * @return {org.apache.flex.B}\n */\norg.apache.flex.B.prototype.clone = function() {\n return new org.apache.flex.B();\n};");
+ assertOut("/**\n * @constructor\n */\norg.apache.flex.B = function() {};\n\n\n/**\n * @export\n * @return {org.apache.flex.B}\n */\norg.apache.flex.B.prototype.clone = function() {\n return new org.apache.flex.B();\n};");
}
protected IBackend createBackend()
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java
index 1abf203..f04e28e 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/vf2js/TestVF2JSExpressions.java
@@ -104,7 +104,7 @@ public class TestVF2JSExpressions extends TestGoogExpressions
"public class B {public function b(o:Object):int { var a:B; a = o as B; }}",
IFunctionNode.class, WRAP_LEVEL_PACKAGE, true);
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n * @param {Object} o\n * @return {number}\n */\nfoo.bar.B.prototype.b = function(o) {\n var /** @type {foo.bar.B} */ a;\n a = org_apache_flex_utils_Language.as(o, foo.bar.B);\n}");
+ assertOut("/**\n * @export\n * @param {Object} o\n * @return {number}\n */\nfoo.bar.B.prototype.b = function(o) {\n var /** @type {foo.bar.B} */ a;\n a = org_apache_flex_utils_Language.as(o, foo.bar.B);\n}");
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLScript.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLScript.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLScript.java
index 6d79603..8b3708a 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLScript.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLScript.java
@@ -43,7 +43,7 @@ public class TestFlexJSMXMLScript extends FlexJSTestBase
((JSFlexJSEmitter)(mxmlBlockWalker.getASEmitter())).getModel().setCurrentClass(dnode.getDefinition());
mxmlBlockWalker.visitDocument(dnode);
String appName = dnode.getQualifiedName();
- String outTemplate = "/**\n * AppName\n *\n * @fileoverview\n *\n * @suppress {checkTypes}\n */\n\ngoog.provide('AppName');\n\ngoog.require('org_apache_flex_core_Application');\n\n\n\n\n/**\n * @constructor\n * @extends {org_apache_flex_core_Application}\n */\nAppName = function() {\n AppName.base(this, 'constructor');\n \n /**\n * @private\n * @type {Array}\n */\n this.mxmldd;\n \n /**\n * @private\n * @type {Array}\n */\n this.mxmldp;\n};\ngoog.inherits(AppName, org_apache_flex_core_Application);\n\n\n/**\n * Metadata\n *\n * @type {Object.<string, Array.<Object>>}\n */\nAppName.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'AppName', qName: 'AppName' }] };\n\n\n/**\n * @expose\n * @override\n */\nAppName.prototype.addedToParent = function() {\n AppName.base(this, 'addedToParent');\n};\n\n\n";
+ String outTemplate = "/**\n * AppName\n *\n * @fileoverview\n *\n * @suppress {checkTypes}\n */\n\ngoog.provide('AppName');\n\ngoog.require('org_apache_flex_core_Application');\n\n\n\n\n/**\n * @constructor\n * @extends {org_apache_flex_core_Application}\n */\nAppName = function() {\n AppName.base(this, 'constructor');\n \n /**\n * @private\n * @type {Array}\n */\n this.mxmldd;\n \n /**\n * @private\n * @type {Array}\n */\n this.mxmldp;\n};\ngoog.inherits(AppName, org_apache_flex_core_Application);\n\n\n/**\n * Metadata\n *\n * @type {Object.<string, Array.<Object>>}\n */\nAppName.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'AppName', qName: 'AppName' }] };\n\n\n/**\n * @export\n * @override\n */\nAppName.prototype.addedToParent = function() {\n AppName.base(this, 'addedToParent');\n};\n\n\n";
assertOut(outTemplate.replaceAll("AppName", appName));
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/externals_unit_tests/constructor_params.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/externals_unit_tests/constructor_params.js b/compiler.jx.tests/test-files/externals_unit_tests/constructor_params.js
index 1029bdb..2e8d7eb 100644
--- a/compiler.jx.tests/test-files/externals_unit_tests/constructor_params.js
+++ b/compiler.jx.tests/test-files/externals_unit_tests/constructor_params.js
@@ -78,4 +78,4 @@ var FinalClass = {};
/**
* A static method.
*/
-FinalClass.bar = function () {};
\ No newline at end of file
+FinalClass.bar = function () {};
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/externals_unit_tests/package_namespace.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/externals_unit_tests/package_namespace.js b/compiler.jx.tests/test-files/externals_unit_tests/package_namespace.js
index e4048e9..3ea2fbf 100644
--- a/compiler.jx.tests/test-files/externals_unit_tests/package_namespace.js
+++ b/compiler.jx.tests/test-files/externals_unit_tests/package_namespace.js
@@ -45,4 +45,4 @@ function Goo () {}
/**
* @typedef {Foo}
*/
-var ATypeDef;
\ No newline at end of file
+var ATypeDef;
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js b/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js
index 8334fea..7171859 100644
--- a/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/FlexJSTest_again_result.js
@@ -137,7 +137,7 @@ FlexJSTest_again.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'FlexJSTest_aga
/**
- * @expose
+ * @export
* @param {org_apache_flex_events_Event} event
*/
FlexJSTest_again.prototype.$EH0 = function(event)
@@ -147,7 +147,7 @@ FlexJSTest_again.prototype.$EH0 = function(event)
Object.defineProperties(FlexJSTest_again.prototype, /** @lends {FlexJSTest_again.prototype} */ {
-/** @expose */
+/** @export */
service: {
/** @this {FlexJSTest_again} */
get: function() {
@@ -161,7 +161,7 @@ Object.defineProperties(FlexJSTest_again.prototype, /** @lends {FlexJSTest_again
}
}
},
- /** @expose */
+ /** @export */
collection: {
/** @this {FlexJSTest_again} */
get: function() {
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/flexjs/files/LocalFunction_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/LocalFunction_result.js b/compiler.jx.tests/test-files/flexjs/files/LocalFunction_result.js
index 8fbc116..e757c3e 100644
--- a/compiler.jx.tests/test-files/flexjs/files/LocalFunction_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/LocalFunction_result.js
@@ -50,7 +50,7 @@ LocalFunction.prototype.myMemberMethod = function(value) {
/**
- * @expose
+ * @export
*/
LocalFunction.prototype.doIt = function() {
this.myMemberMethod(624);
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js b/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
index f86853f..50eee15 100644
--- a/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
+++ b/compiler.jx.tests/test-files/flexjs/files/MyInitialView_result.js
@@ -228,7 +228,7 @@ MyInitialView.prototype.timer;
/**
- * @expose
+ * @export
* @param {org_apache_flex_events_Event} event
*/
MyInitialView.prototype.startTimer = function(event) {
@@ -239,7 +239,7 @@ MyInitialView.prototype.startTimer = function(event) {
/**
- * @expose
+ * @export
* @param {org_apache_flex_events_Event} event
*/
MyInitialView.prototype.timerHandler = function(event) {
@@ -251,28 +251,28 @@ MyInitialView.prototype.timerHandler = function(event) {
Object.defineProperties(MyInitialView.prototype, /** @lends {MyInitialView.prototype} */ {
-/** @expose */
+/** @export */
comboBoxValue: {
get: /** @this {MyInitialView} */ function() {
return String(this.comboBox.selectedItem);
}},
-/** @expose */
+/** @export */
inputText: {
get: /** @this {MyInitialView} */ function() {
return this.input.text;
}},
-/** @expose */
+/** @export */
symbol: {
get: /** @this {MyInitialView} */ function() {
return org_apache_flex_utils_Language.as(this.list.selectedItem, String);
}},
-/** @expose */
+/** @export */
city: {
get: /** @this {MyInitialView} */ function() {
return org_apache_flex_utils_Language.as(this.cityList.selectedItem, String);
}}}
);/**
- * @expose
+ * @export
* @param {org_apache_flex_events_Event} event
*/
MyInitialView.prototype.$EH0 = function(event)
@@ -282,7 +282,7 @@ MyInitialView.prototype.$EH0 = function(event)
/**
- * @expose
+ * @export
* @param {org_apache_flex_events_Event} event
*/
MyInitialView.prototype.$EH1 = function(event)
@@ -293,7 +293,7 @@ MyInitialView.prototype.$EH1 = function(event)
/**
- * @expose
+ * @export
* @param {org_apache_flex_events_Event} event
*/
MyInitialView.prototype.$EH2 = function(event)
@@ -303,7 +303,7 @@ MyInitialView.prototype.$EH2 = function(event)
/**
- * @expose
+ * @export
* @param {org_apache_flex_events_Event} event
*/
MyInitialView.prototype.$EH3 = function(event)
@@ -313,7 +313,7 @@ MyInitialView.prototype.$EH3 = function(event)
/**
- * @expose
+ * @export
* @param {org_apache_flex_events_Event} event
*/
MyInitialView.prototype.$EH4 = function(event)
@@ -323,7 +323,7 @@ MyInitialView.prototype.$EH4 = function(event)
/**
- * @expose
+ * @export
* @param {org_apache_flex_events_Event} event
*/
MyInitialView.prototype.$EH5 = function(event)
@@ -333,7 +333,7 @@ MyInitialView.prototype.$EH5 = function(event)
/**
- * @expose
+ * @export
* @param {org_apache_flex_events_Event} event
*/
MyInitialView.prototype.$EH6 = function(event)
@@ -343,7 +343,7 @@ MyInitialView.prototype.$EH6 = function(event)
Object.defineProperties(MyInitialView.prototype, /** @lends {MyInitialView.prototype} */ {
-/** @expose */
+/** @export */
lbl: {
/** @this {MyInitialView} */
get: function() {
@@ -357,7 +357,7 @@ Object.defineProperties(MyInitialView.prototype, /** @lends {MyInitialView.proto
}
}
},
- /** @expose */
+ /** @export */
timerLabel: {
/** @this {MyInitialView} */
get: function() {
@@ -371,7 +371,7 @@ Object.defineProperties(MyInitialView.prototype, /** @lends {MyInitialView.proto
}
}
},
- /** @expose */
+ /** @export */
cityList: {
/** @this {MyInitialView} */
get: function() {
@@ -385,7 +385,7 @@ Object.defineProperties(MyInitialView.prototype, /** @lends {MyInitialView.proto
}
}
},
- /** @expose */
+ /** @export */
input: {
/** @this {MyInitialView} */
get: function() {
@@ -399,7 +399,7 @@ Object.defineProperties(MyInitialView.prototype, /** @lends {MyInitialView.proto
}
}
},
- /** @expose */
+ /** @export */
checkbox: {
/** @this {MyInitialView} */
get: function() {
@@ -413,7 +413,7 @@ Object.defineProperties(MyInitialView.prototype, /** @lends {MyInitialView.proto
}
}
},
- /** @expose */
+ /** @export */
list: {
/** @this {MyInitialView} */
get: function() {
@@ -427,7 +427,7 @@ Object.defineProperties(MyInitialView.prototype, /** @lends {MyInitialView.proto
}
}
},
- /** @expose */
+ /** @export */
comboBox: {
/** @this {MyInitialView} */
get: function() {
@@ -835,4 +835,4 @@ null
}
}
});
-
\ No newline at end of file
+
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5307227d/compiler.jx.tests/test-files/flexjs/files/StockDataJSONItemConverter.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/files/StockDataJSONItemConverter.js b/compiler.jx.tests/test-files/flexjs/files/StockDataJSONItemConverter.js
index c010141..da79aa8 100644
--- a/compiler.jx.tests/test-files/flexjs/files/StockDataJSONItemConverter.js
+++ b/compiler.jx.tests/test-files/flexjs/files/StockDataJSONItemConverter.js
@@ -25,7 +25,7 @@ StockDataJSONItemConverter = function() {
goog.inherits(StockDataJSONItemConverter, org_apache_flex_net_JSONItemConverter);
/**
- * @expose
+ * @export
* @param {string} data
* @return {Object}
* @override
[5/9] git commit: [flex-falcon] [refs/heads/add-CollectImportPass] -
Build JS test files based on the Test Method Name
Posted by ft...@apache.org.
Build JS test files based on the Test Method Name
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/72fe8eaf
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/72fe8eaf
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/72fe8eaf
Branch: refs/heads/add-CollectImportPass
Commit: 72fe8eaf12382752d468c4c1af1bae7d414f4377
Parents: 0a63b49
Author: Frédéric THOMAS <we...@gmail.com>
Authored: Tue Jul 7 18:30:45 2015 +0100
Committer: Frédéric THOMAS <we...@gmail.com>
Committed: Tue Jul 7 19:15:39 2015 +0100
----------------------------------------------------------------------
.../codegen/externals/ExternalsTestBase.java | 29 ++++++++++++++++----
1 file changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/72fe8eaf/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java
index b4b8789..cfb088f 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/ExternalsTestBase.java
@@ -19,6 +19,8 @@
package org.apache.flex.compiler.internal.codegen.externals;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import java.io.IOException;
@@ -36,8 +38,7 @@ import com.google.javascript.rhino.jstype.JSType;
public abstract class ExternalsTestBase
{
- private static File unitTestBaseDir = new File(
- FilenameNormalization.normalize("test-files/externals_unit_tests"));
+ private static File unitTestBaseDir = new File(FilenameNormalization.normalize("test-files/externals_unit_tests"));
// Only used for testing, all configuration must happen in configure()
protected ExternCConfiguration config;
@@ -53,8 +54,7 @@ public abstract class ExternalsTestBase
model = client.getModel();
}
- protected abstract void configure(ExternCConfiguration config)
- throws IOException;
+ protected abstract void configure(ExternCConfiguration config) throws IOException;
@After
public void tearDown()
@@ -82,9 +82,26 @@ public abstract class ExternalsTestBase
protected JSType evaluateParam(MethodReference method, String paramName)
{
- JSType jsType = method.getComment().getParameterType(paramName).evaluate(
- null, client.getCompiler().getJSCompiler().getTypeRegistry());
+ JSType jsType = method.getComment().getParameterType(paramName).evaluate(null,
+ client.getCompiler().getJSCompiler().getTypeRegistry());
return jsType;
}
+ /**
+ * Clean, compile a js file based on the test method name.
+ *
+ * @param relativeTestDir unitTestBaseDir relative base test directory.
+ * @throws IOException
+ */
+ protected void assertCompileTestFileSuccess(String relativeTestDir) throws IOException
+ {
+ if (config.getAsRoot() != null)
+ {
+ client.cleanOutput();
+ }
+ final StackTraceElement[] ste = Thread.currentThread().getStackTrace();
+ final String methodName = ste[2].getMethodName();
+ Result result = compile(relativeTestDir + methodName + ".js");
+ assertTrue(result.success);
+ }
}
[9/9] git commit: [flex-falcon] [refs/heads/add-CollectImportPass] -
Adding the collect of imports pass
Posted by ft...@apache.org.
Adding the collect of imports pass
Replacing the last fix
Fix bugs
Cleanup and format
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/c55587ce
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/c55587ce
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/c55587ce
Branch: refs/heads/add-CollectImportPass
Commit: c55587ceb2cb8439b884c1c3c09367056ca52975
Parents: 69f0a8b
Author: Frédéric THOMAS <we...@gmail.com>
Authored: Tue Jul 7 19:12:53 2015 +0100
Committer: Frédéric THOMAS <we...@gmail.com>
Committed: Tue Jul 7 19:15:53 2015 +0100
----------------------------------------------------------------------
.../externals/pass/CollectImportsPass.java | 164 ++++++++++++++++
.../externals/pass/ReferenceCompiler.java | 23 +--
.../externals/reference/BaseReference.java | 36 ++--
.../externals/reference/ClassReference.java | 196 ++++++++-----------
.../externals/reference/FieldReference.java | 24 +--
.../externals/reference/MethodReference.java | 71 +++++--
.../externals/reference/ReferenceModel.java | 38 ++--
.../codegen/externals/utils/FunctionUtils.java | 71 ++++---
.../codegen/externals/utils/JSTypeUtils.java | 20 +-
9 files changed, 414 insertions(+), 229 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c55587ce/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectImportsPass.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectImportsPass.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectImportsPass.java
new file mode 100644
index 0000000..28815f9
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/CollectImportsPass.java
@@ -0,0 +1,164 @@
+package org.apache.flex.compiler.internal.codegen.externals.pass;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.flex.compiler.internal.codegen.externals.reference.*;
+
+import com.google.javascript.jscomp.AbstractCompiler;
+import com.google.javascript.jscomp.NodeTraversal;
+import com.google.javascript.rhino.Node;
+
+/**
+ * @author: Frederic Thomas Date: 05/07/2015 Time: 18:16
+ */
+public class CollectImportsPass extends AbstractCompilerPass
+{
+ public CollectImportsPass(final ReferenceModel model, AbstractCompiler compiler)
+ {
+ super(model, compiler);
+ }
+
+ @Override
+ public boolean shouldTraverse(final NodeTraversal nodeTraversal, final Node n, final Node parent)
+ {
+ for (ClassReference reference : model.getClasses())
+ {
+ collectClassImports(reference);
+ }
+
+ for (FunctionReference reference : model.getFunctions())
+ {
+ collectFunctionImports(reference);
+ }
+
+ return false;
+ }
+
+ private void collectClassImports(ClassReference reference)
+ {
+ final MethodReference constructor = reference.getConstructor();
+ final List<ClassReference> superClasses = reference.getSuperClasses();
+ final List<ClassReference> interfaces = reference.getInterfaces();
+ final List<ClassReference> extendedInterfaces = reference.getExtendedInterfaces();
+ final Map<String, FieldReference> fields = reference.getFields();
+ final Map<String, MethodReference> methods = reference.getMethods();
+
+ for (ClassReference superClass : superClasses)
+ {
+ if (model.isExcludedClass(superClass) == null)
+ {
+ addClassImport(reference, superClass);
+ }
+ }
+
+ for (ClassReference _interface : interfaces)
+ {
+ if (model.isExcludedClass(_interface) == null)
+ {
+ addClassImport(reference, _interface);
+ }
+ }
+
+ for (ClassReference _interface : extendedInterfaces)
+ {
+ if (model.isExcludedClass(_interface) == null)
+ {
+ addClassImport(reference, _interface);
+ }
+ }
+
+ for (FieldReference field : fields.values())
+ {
+ if (field.isExcluded() == null)
+ {
+ addClassImport(reference, getType(field));
+ }
+ }
+
+ for (ParameterReference parameterReference : constructor.getParameters())
+ {
+ addClassImport(reference, getType(parameterReference));
+ }
+
+ for (MethodReference method : methods.values())
+ {
+ if (method.isExcluded() == null)
+ {
+ addClassImport(reference, getReturnType(method));
+
+ for (ParameterReference parameterReference : method.getParameters())
+ {
+ addClassImport(reference, getType(parameterReference));
+ }
+ }
+ }
+ }
+
+ private void addClassImport(final ClassReference thisReference, final ClassReference referenceToImport)
+ {
+ if (canImport(referenceToImport))
+ {
+ final String thisPackageName = thisReference.getPackageName();
+ final String importPackageName = referenceToImport.getPackageName();
+
+ if (!importPackageName.equals(thisPackageName))
+ {
+ thisReference.addImport(referenceToImport);
+ }
+ }
+ }
+
+ private void collectFunctionImports(final FunctionReference function)
+ {
+ if (function.isExcluded() == null)
+ {
+ ClassReference returnType = getReturnType(function);
+
+ if (canImport(returnType))
+ {
+ function.addImport(returnType);
+ }
+
+ for (ParameterReference parameterReference : function.getParameters())
+ {
+ ClassReference type = getType(parameterReference);
+
+ if (canImport(type))
+ {
+ function.addImport(type);
+ }
+ }
+ }
+ }
+
+ private ClassReference getType(final FieldReference field)
+ {
+ return model.getClassReference(field.toTypeString());
+ }
+
+ private ClassReference getReturnType(final MethodReference method)
+ {
+ return model.getClassReference(method.transformReturnString());
+ }
+
+ private ClassReference getReturnType(final FunctionReference function)
+ {
+ return model.getClassReference(function.transformReturnString());
+ }
+
+ private ClassReference getType(final ParameterReference parameter)
+ {
+ return model.getClassReference(parameter.getQualifiedName());
+ }
+
+ private boolean canImport(ClassReference reference)
+ {
+ return reference != null && reference.isQualifiedName() && model.isExcludedClass(reference) == null;
+ }
+
+ @Override
+ public void visit(final NodeTraversal t, final Node n, final Node parent)
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c55587ce/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java
index ab47767..e5ac6c8 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ReferenceCompiler.java
@@ -29,16 +29,12 @@ import org.apache.commons.io.FilenameUtils;
import org.apache.flex.compiler.internal.codegen.externals.reference.ReferenceModel;
import com.google.common.collect.ImmutableList;
+import com.google.javascript.jscomp.*;
import com.google.javascript.jscomp.Compiler;
-import com.google.javascript.jscomp.CustomPassExecutionTime;
-import com.google.javascript.jscomp.JXCompilerOptions;
-import com.google.javascript.jscomp.Result;
-import com.google.javascript.jscomp.SourceFile;
public class ReferenceCompiler
{
- private static final List<SourceFile> EMPTY_EXTERNS = ImmutableList.of(SourceFile.fromCode(
- "externs", ""));
+ private static final List<SourceFile> EMPTY_EXTERNS = ImmutableList.of(SourceFile.fromCode("externs", ""));
private ReferenceModel model;
@@ -72,15 +68,14 @@ public class ReferenceCompiler
options.setParseJsDocDocumentation(true);
options.setExternExports(false);
- options.addCustomPass(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS,
- new NamespaceResolutionPass(model, jscompiler));
- options.addCustomPass(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS,
- new ResolvePackagesPass(model, jscompiler));
+ options.addCustomPass(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS, new NamespaceResolutionPass(model,
+ jscompiler));
+ options.addCustomPass(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS, new ResolvePackagesPass(model, jscompiler));
- options.addCustomPass(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS,
- new CollectTypesPass(model, jscompiler));
- options.addCustomPass(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS,
- new AddMemberPass(model, jscompiler));
+ options.addCustomPass(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS, new CollectTypesPass(model, jscompiler));
+ options.addCustomPass(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS, new AddMemberPass(model, jscompiler));
+
+ options.addCustomPass(CustomPassExecutionTime.BEFORE_OPTIMIZATIONS, new CollectImportsPass(model, jscompiler));
//compiler.setErrorManager(testErrorManager);
jscompiler.initOptions(options);
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c55587ce/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
index ea29a2f..cb3ef49 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/BaseReference.java
@@ -33,7 +33,7 @@ import com.google.javascript.rhino.Node;
public abstract class BaseReference
{
- private String qualfiedName;
+ private String qualifiedName;
protected JSDocInfo comment;
@@ -57,25 +57,25 @@ public abstract class BaseReference
public String getBaseName()
{
- return qualfiedName.substring(qualfiedName.lastIndexOf('.') + 1);
+ return qualifiedName.substring(qualifiedName.lastIndexOf('.') + 1);
}
public String getPackageName()
{
- int end = qualfiedName.lastIndexOf('.');
+ int end = qualifiedName.lastIndexOf('.');
if (end == -1)
return "";
- return qualfiedName.substring(0, end);
+ return qualifiedName.substring(0, end);
}
public String getQualifiedName()
{
- return qualfiedName;
+ return qualifiedName;
}
public final boolean isQualifiedName()
{
- return qualfiedName.indexOf('.') != -1;
+ return qualifiedName.indexOf('.') != -1;
}
public Node getNode()
@@ -103,12 +103,11 @@ public abstract class BaseReference
return model;
}
- public BaseReference(ReferenceModel model, Node node, String qualfiedName,
- JSDocInfo comment)
+ public BaseReference(ReferenceModel model, Node node, String qualifiedName, JSDocInfo comment)
{
this.model = model;
this.node = node;
- this.qualfiedName = qualfiedName;
+ this.qualifiedName = qualifiedName;
this.comment = comment;
}
@@ -143,7 +142,7 @@ public abstract class BaseReference
sb.append(indent);
sb.append(" * ");
sb.append(blockDescription.replaceAll("\\n", "\n" + indent + " * "));
- sb.append("\n " + indent + "*\n");
+ sb.append("\n ").append(indent).append("*\n");
}
}
@@ -161,11 +160,8 @@ public abstract class BaseReference
if (!name.getItem().equals("see"))
continue;
- if (name != null)
- {
- desc.append(name.getItem());
- desc.append(" ");
- }
+ desc.append(name.getItem());
+ desc.append(" ");
if (typePosition != null)
{
@@ -180,14 +176,14 @@ public abstract class BaseReference
}
sb.append(indent);
- sb.append(" * @" + desc.toString() + "\n");
+ sb.append(" * @").append(desc.toString()).append("\n");
}
}
protected void emitSeeSourceFileName(StringBuilder sb)
{
sb.append(indent);
- sb.append(" * @see " + getNode().getSourceFileName() + "\n");
+ sb.append(" * @see ").append(getNode().getSourceFileName()).append("\n");
}
protected void emitFunctionCommentBody(StringBuilder sb)
@@ -204,10 +200,8 @@ public abstract class BaseReference
Set<String> parameterNames = getComment().getParameterNames();
for (String paramName : parameterNames)
{
- JSTypeExpression parameterType = getComment().getParameterType(
- paramName);
- String description = getComment().getDescriptionForParameter(
- paramName);
+ JSTypeExpression parameterType = getComment().getParameterType(paramName);
+ String description = getComment().getDescriptionForParameter(paramName);
sb.append(indent);
sb.append(" * @param ");
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c55587ce/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
index d2b1cc8..ae533d2 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ClassReference.java
@@ -19,18 +19,18 @@
package org.apache.flex.compiler.internal.codegen.externals.reference;
+import java.io.File;
+import java.util.*;
+import java.util.Map.Entry;
+
+import org.apache.flex.compiler.internal.codegen.externals.utils.DebugLogUtils;
+import org.apache.flex.compiler.internal.codegen.externals.utils.JSTypeUtils;
+
import com.google.javascript.rhino.JSDocInfo;
import com.google.javascript.rhino.JSDocInfoBuilder;
import com.google.javascript.rhino.JSTypeExpression;
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.jstype.JSType;
-import org.apache.flex.compiler.internal.codegen.externals.utils.DebugLogUtils;
-import org.apache.flex.compiler.internal.codegen.externals.utils.FunctionUtils;
-import org.apache.flex.compiler.internal.codegen.externals.utils.JSTypeUtils;
-
-import java.io.File;
-import java.util.*;
-import java.util.Map.Entry;
public class ClassReference extends BaseReference
{
@@ -114,13 +114,12 @@ public class ClassReference extends BaseReference
/**
*
* @param model
- * @param node (FUNCTION [NAME, PARAM_LIST, BLOCK]), or (ASSIGN [FUNCTION
- * [NAME, PARAM_LIST, BLOCK]])
- * @param qualfiedName
+ * @param node (FUNCTION [NAME, PARAM_LIST, BLOCK]), or (ASSIGN [FUNCTION [NAME, PARAM_LIST, BLOCK]])
+ * @param qualifiedName
*/
- public ClassReference(ReferenceModel model, Node node, String qualfiedName)
+ public ClassReference(ReferenceModel model, Node node, String qualifiedName)
{
- super(model, node, qualfiedName, node.getJSDocInfo());
+ super(model, node, qualifiedName, node.getJSDocInfo());
indent = "";
@@ -165,20 +164,22 @@ public class ClassReference extends BaseReference
objLit = node.getLastChild();
}
- for (Node stringKey : objLit.children())
+ if (objLit != null)
{
- if (stringKey.isStringKey())
+ for (Node stringKey : objLit.children())
{
- Node valueNode = stringKey.getFirstChild();
-
- JSDocInfoBuilder b = new JSDocInfoBuilder(true);
- JSDocInfo fieldComment = b.build();
- String fieldName = stringKey.getString();
- FieldReference field = addField(stringKey, fieldName,
- fieldComment, true);
- field.setConst(true);
- field.setOverrideStringType(overrideStringType);
- field.setConstantValueNode(valueNode);
+ if (stringKey.isStringKey())
+ {
+ Node valueNode = stringKey.getFirstChild();
+
+ JSDocInfoBuilder b = new JSDocInfoBuilder(true);
+ JSDocInfo fieldComment = b.build();
+ String fieldName = stringKey.getString();
+ FieldReference field = addField(stringKey, fieldName, fieldComment, true);
+ field.setConst(true);
+ field.setOverrideStringType(overrideStringType);
+ field.setConstantValueNode(valueNode);
+ }
}
}
}
@@ -197,8 +198,7 @@ public class ClassReference extends BaseReference
NAME Math
OBJECTLIT
*/
- constructor = new NullConstructorReference(model, this, node,
- getBaseName(), comment);
+ constructor = new NullConstructorReference(model, this, node, getBaseName(), comment);
}
else if (node.isFunction())
{
@@ -255,8 +255,7 @@ public class ClassReference extends BaseReference
if (functionNode != null)
{
- constructor = new MethodReference(model, this, functionNode,
- getBaseName(), comment, false);
+ constructor = new MethodReference(model, this, functionNode, getBaseName(), comment, false);
}
}
@@ -270,7 +269,7 @@ public class ClassReference extends BaseReference
sb.append("package ");
if (!packageName.equals(""))
- sb.append(packageName + " ");
+ sb.append(packageName).append(" ");
sb.append("{\n");
sb.append("\n");
@@ -364,8 +363,7 @@ public class ClassReference extends BaseReference
for (JSTypeExpression jsTypeExpression : getComment().getImplementedInterfaces())
{
String interfaceName = getModel().evaluate(jsTypeExpression).getDisplayName();
- ClassReference classReference = getModel().getClassReference(
- interfaceName);
+ ClassReference classReference = getModel().getClassReference(interfaceName);
if (classReference != null)
result.add(classReference);
}
@@ -379,8 +377,20 @@ public class ClassReference extends BaseReference
for (JSTypeExpression jsTypeExpression : getComment().getImplementedInterfaces())
{
String interfaceName = getModel().evaluate(jsTypeExpression).toAnnotationString();
- ClassReference reference = getModel().getClassReference(
- interfaceName);
+ ClassReference reference = getModel().getClassReference(interfaceName);
+ if (reference != null)
+ result.add(reference);
+ }
+ return result;
+ }
+
+ public List<ClassReference> getExtendedInterfaces()
+ {
+ ArrayList<ClassReference> result = new ArrayList<ClassReference>();
+ for (JSTypeExpression jsTypeExpression : getComment().getExtendedInterfaces())
+ {
+ String interfaceName = getModel().evaluate(jsTypeExpression).toAnnotationString();
+ ClassReference reference = getModel().getClassReference(interfaceName);
if (reference != null)
result.add(reference);
}
@@ -422,18 +432,12 @@ public class ClassReference extends BaseReference
public boolean hasInstanceField(String fieldName)
{
- if (!fields.containsKey(fieldName))
- return false;
-
- return !fields.get(fieldName).isStatic();
+ return fields.containsKey(fieldName) && !fields.get(fieldName).isStatic();
}
public boolean hasStaticField(String fieldName)
{
- if (!fields.containsKey(fieldName))
- return false;
-
- return fields.get(fieldName).isStatic();
+ return fields.containsKey(fieldName) && fields.get(fieldName).isStatic();
}
public boolean hasMethod(String methodName)
@@ -443,22 +447,15 @@ public class ClassReference extends BaseReference
public boolean hasInstanceMethod(String fieldName)
{
- if (!methods.containsKey(fieldName))
- return false;
-
- return !methods.get(fieldName).isStatic();
+ return methods.containsKey(fieldName) && !methods.get(fieldName).isStatic();
}
public boolean hasStaticMethod(String fieldName)
{
- if (!methods.containsKey(fieldName))
- return false;
-
- return methods.get(fieldName).isStatic();
+ return methods.containsKey(fieldName) && methods.get(fieldName).isStatic();
}
- public FieldReference addField(Node node, String fieldName,
- JSDocInfo comment, boolean isStatic)
+ public FieldReference addField(Node node, String fieldName, JSDocInfo comment, boolean isStatic)
{
if (hasField(fieldName))
{
@@ -471,88 +468,62 @@ public class ClassReference extends BaseReference
if (comment == null)
{
- DebugLogUtils.err("Field comment null for; "
- + node.getQualifiedName());
+ DebugLogUtils.err("Field comment null for; " + node.getQualifiedName());
//DebugLogUtils.err(node);
JSDocInfoBuilder b = new JSDocInfoBuilder(true);
b.recordBlockDescription("Generated doc for missing field JSDoc.");
comment = b.build();
}
- FieldReference field = new FieldReference(getModel(), this, node,
- fieldName, comment, isStatic);
+ FieldReference field = new FieldReference(getModel(), this, node, fieldName, comment, isStatic);
fields.put(fieldName, field);
return field;
}
- public MethodReference addMethod(Node node, String functionName,
- JSDocInfo comment, boolean isStatic)
+ public MethodReference addMethod(Node node, String functionName, JSDocInfo comment, boolean isStatic)
{
if (isNamespace)
isStatic = false;
if (comment == null)
{
- DebugLogUtils.err("Method comment null for; "
- + node.getQualifiedName());
+ DebugLogUtils.err("Method comment null for; " + node.getQualifiedName());
//DebugLogUtils.err(node);
JSDocInfoBuilder b = new JSDocInfoBuilder(true);
b.recordBlockDescription("Generated doc for missing method JSDoc.");
comment = b.build();
}
- MethodReference method = new MethodReference(getModel(), this, node,
- functionName, comment, isStatic);
-
- final String returnType = getReturnTypeToImport(method);
- if (returnType != null)
- {
- addImport(returnType);
- }
+ MethodReference method = new MethodReference(getModel(), this, node, functionName, comment, isStatic);
methods.put(functionName, method);
return method;
}
- private String getReturnTypeToImport(final MethodReference method) {
- String returnType = null;
-
- final JSDocInfo comment = method.getComment();
- if (method.isExcluded() == null && comment != null && comment.hasReturnType())
- {
- try {
- final Node firstChild = comment.getReturnType().getRoot().getFirstChild();
- returnType = firstChild.getString();
- } catch (Exception e) {
- returnType = null;
- }
- }
-
- final boolean canBeImported = FunctionUtils.canBeImported(getModel(), getNode(), returnType, getPackageName());
-
- return canBeImported ? returnType : null;
- }
-
public boolean isMethodOverrideFromInterface(MethodReference reference)
{
- if (!hasImplementations())
- return false;
+ boolean isMethodOverrideFromInterface = false;
- List<JSTypeExpression> implementedInterfaces = getComment().getImplementedInterfaces();
- for (JSTypeExpression jsTypeExpression : implementedInterfaces)
+ if (!hasImplementations())
{
- String interfaceName = getModel().evaluate(jsTypeExpression).getDisplayName();
- ClassReference classReference = getModel().getClassReference(
- interfaceName);
- return classReference.hasSuperMethod(reference.getQualifiedName());
+ List<JSTypeExpression> implementedInterfaces = getComment().getImplementedInterfaces();
+ for (JSTypeExpression jsTypeExpression : implementedInterfaces)
+ {
+ String interfaceName = getModel().evaluate(jsTypeExpression).getDisplayName();
+ ClassReference classReference = getModel().getClassReference(interfaceName);
+ if (classReference.hasSuperMethod(reference.getQualifiedName()))
+ {
+ isMethodOverrideFromInterface = true;
+ break;
+ }
+ }
}
- return false;
+ return isMethodOverrideFromInterface;
}
- public MethodReference getMethodOverrideFromInterface(
- MethodReference reference)
+ public MethodReference getMethodOverrideFromInterface(MethodReference reference)
{
// get all super classes, reverse and search top down
List<ClassReference> superClasses = getSuperClasses();
@@ -630,9 +601,12 @@ public class ClassReference extends BaseReference
return fields.containsKey(fieldName);
}
- public void addImport(String qualifiedName)
+ public void addImport(ClassReference reference)
{
- imports.add(qualifiedName);
+ if (reference != null)
+ {
+ imports.add(reference.getQualifiedName());
+ }
}
public boolean hasImport(String qualifiedName)
@@ -647,12 +621,14 @@ public class ClassReference extends BaseReference
private void emitImports(StringBuilder sb)
{
- sb.append("\n");
- for (String imp : imports)
+ if (imports.size() > 0)
{
- sb.append("import " + imp + ";\n");
+ for (String anImport : imports)
+ {
+ sb.append("import ").append(anImport).append(";\n");
+ }
+ sb.append("\n");
}
- sb.append("\n");
}
private void emitClass(StringBuilder sb)
@@ -671,7 +647,7 @@ public class ClassReference extends BaseReference
}
sb.append("class ");
- sb.append(getBaseName() + " ");
+ sb.append(getBaseName()).append(" ");
if (getComment().hasBaseType())
{
@@ -694,11 +670,10 @@ public class ClassReference extends BaseReference
{
sb.append("public interface ");
- sb.append(getBaseName() + " ");
+ sb.append(getBaseName()).append(" ");
List<JSTypeExpression> extendedInterfaces = getComment().getExtendedInterfaces();
int len = extendedInterfaces.size();
- int i = 0;
if (len > 0)
{
sb.append("extends ");
@@ -706,7 +681,7 @@ public class ClassReference extends BaseReference
{
String value = getModel().evaluate(jsTypeExpression).toAnnotationString();
sb.append(value);
- if (i < len - 1)
+ if (--len > 0)
sb.append(", ");
}
sb.append(" ");
@@ -771,8 +746,7 @@ public class ClassReference extends BaseReference
public File getFile(File asSourceRoot)
{
String packagePath = toPackagePath();
- return new File(asSourceRoot, packagePath + File.separator
- + getBaseName() + ".as");
+ return new File(asSourceRoot, packagePath + File.separator + getBaseName() + ".as");
}
private String toPackagePath()
@@ -783,9 +757,9 @@ public class ClassReference extends BaseReference
String sdirPath = "";
if (cname.length > 0)
{
- for (int i = 0; i < cname.length; i++)
+ for (final String aCname : cname)
{
- sdirPath += cname[i] + File.separator;
+ sdirPath += aCname + File.separator;
}
return sdirPath;
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c55587ce/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
index 9cb6f09..ae39de9 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FieldReference.java
@@ -67,12 +67,16 @@ public class FieldReference extends MemberReference
public String toTypeAnnotationString()
{
- JSType jsType = getModel().evaluate(getComment().getType());
- return jsType.toAnnotationString();
+ JSType jsType = null;
+ if (getComment() != null && getComment().getReturnType() != null)
+ {
+ jsType = getModel().evaluate(getComment().getType());
+ }
+ return jsType != null ? jsType.toAnnotationString() : "Object";
}
- public FieldReference(ReferenceModel model, ClassReference classReference,
- Node node, String name, JSDocInfo comment, boolean isStatic)
+ public FieldReference(ReferenceModel model, ClassReference classReference, Node node, String name,
+ JSDocInfo comment, boolean isStatic)
{
super(model, classReference, node, name, comment);
this.isStatic = isStatic;
@@ -101,10 +105,8 @@ public class FieldReference extends MemberReference
return; // XXX (mschmalle) accessors are not treated right, need to exclude get/set
}
- if (!getClassReference().isInterface()
- && !getComment().isOverride()
- && !getClassReference().isPropertyInterfaceImplementation(
- getBaseName()))
+ if (!getClassReference().isInterface() && !getComment().isOverride()
+ && !getClassReference().isPropertyInterfaceImplementation(getBaseName()))
{
emitVar(sb);
}
@@ -124,7 +126,7 @@ public class FieldReference extends MemberReference
String setBody = isInterface ? "" : "{}";
String type = toTypeString();
- if (type.indexOf("|") != -1 || type.indexOf("?") != -1)
+ if (type.contains("|") || type.contains("?"))
type = "*";
// getter
@@ -157,7 +159,7 @@ public class FieldReference extends MemberReference
String constVarValue = (isConst) ? "const " : "var ";
String type = toTypeString();
- if (type.indexOf("|") != -1 || type.indexOf("?") != -1)
+ if (type.contains("|") || type.contains("?"))
type = "*";
sb.append(indent);
@@ -189,7 +191,7 @@ public class FieldReference extends MemberReference
return "undefined /* TODO type not set */";
}
- private String toTypeString()
+ public String toTypeString()
{
if (overrideStringType != null)
return overrideStringType;
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c55587ce/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
index d031945..b37677b 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java
@@ -19,11 +19,14 @@
package org.apache.flex.compiler.internal.codegen.externals.reference;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
import org.apache.flex.compiler.clients.ExternCConfiguration.ExcludedMember;
import org.apache.flex.compiler.internal.codegen.externals.utils.FunctionUtils;
+import com.google.common.collect.Lists;
import com.google.javascript.rhino.JSDocInfo;
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.jstype.JSType;
@@ -35,6 +38,8 @@ public class MethodReference extends MemberReference
private MethodReference override;
private Node paramNode;
+ private List<ParameterReference> parameters;
+
private MethodReference getContext()
{
return override == null ? this : override;
@@ -50,6 +55,11 @@ public class MethodReference extends MemberReference
this.isStatic = isStatic;
}
+ public List<ParameterReference> getParameters()
+ {
+ return parameters;
+ }
+
public Set<String> getParameterNames()
{
return getComment().getParameterNames();
@@ -61,8 +71,8 @@ public class MethodReference extends MemberReference
return jsType.toAnnotationString();
}
- public MethodReference(ReferenceModel model, ClassReference classReference,
- Node node, String name, JSDocInfo comment, boolean isStatic)
+ public MethodReference(ReferenceModel model, ClassReference classReference, Node node, String name,
+ JSDocInfo comment, boolean isStatic)
{
super(model, classReference, node, name, comment);
this.isStatic = isStatic;
@@ -75,14 +85,50 @@ public class MethodReference extends MemberReference
{
this.paramNode = node.getLastChild().getChildAtIndex(1);
}
+
+ addParameterReferences();
+ }
+
+ private void addParameterReferences()
+ {
+
+ parameters = new ArrayList<ParameterReference>();
+
+ if (paramNode != null)
+ {
+
+ final boolean isDocumented = comment.getParameterCount() > 0;
+ List<String> parameterNames = null;
+
+ if (isDocumented)
+ {
+ parameterNames = Lists.newArrayList(comment.getParameterNames());
+ }
+
+ for (Node param : paramNode.children())
+ {
+ ParameterReference parameterReference;
+
+ if (isDocumented && parameterNames.contains(param.getString()))
+ {
+ final String qualifiedName = FunctionUtils.toParameterType(this, param.getString());
+ parameterReference = new ParameterReference(getModel(), param, qualifiedName);
+ }
+ else
+ {
+ parameterReference = new ParameterReference(getModel(), param);
+ }
+
+ parameters.add(parameterReference);
+ }
+ }
}
@Override
public void emit(StringBuilder sb)
{
// XXX HACK TEMP!
- if (getComment().isConstructor()
- && !getBaseName().equals(getClassReference().getBaseName()))
+ if (getComment().isConstructor() && !getBaseName().equals(getClassReference().getBaseName()))
return;
if (isConstructor())
@@ -117,8 +163,7 @@ public class MethodReference extends MemberReference
if (!getClassReference().isInterface())
{
- MethodReference overrideFromInterface = getClassReference().getMethodOverrideFromInterface(
- this);
+ MethodReference overrideFromInterface = getClassReference().getMethodOverrideFromInterface(this);
if (/*isOverride() && */overrideFromInterface != null)
{
override = overrideFromInterface;
@@ -146,7 +191,7 @@ public class MethodReference extends MemberReference
sb.append(staticValue);
sb.append("function ");
sb.append(getQualifiedName());
- sb.append(toPrameterString());
+ sb.append(toParameterString());
sb.append(":");
sb.append(transformReturnString());
sb.append(braces);
@@ -162,7 +207,7 @@ public class MethodReference extends MemberReference
sb.append(getBaseName());
if (!getBaseName().equals("Object"))
{
- sb.append(toPrameterString());
+ sb.append(toParameterString());
sb.append(" {\n");
sb.append(indent);
emitSuperCall(sb);
@@ -205,16 +250,14 @@ public class MethodReference extends MemberReference
return getComment().isConstructor();
}
- private String transformReturnString()
+ public String transformReturnString()
{
- return FunctionUtils.toReturnString(getContext(),
- getContext().getComment());
+ return FunctionUtils.toReturnString(getContext());
}
- private String toPrameterString()
+ private String toParameterString()
{
- return FunctionUtils.toPrameterString(getContext(),
- getContext().getComment(), paramNode);
+ return FunctionUtils.toParameterString(getContext(), getContext().getComment(), paramNode);
}
public boolean isOverride()
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c55587ce/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
index adfa8c9..872bcd1 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ReferenceModel.java
@@ -208,8 +208,7 @@ public class ReferenceModel
log("Model.addFunction(" + qualifiedName + ")");
- FunctionReference reference = new FunctionReference(this, node,
- qualifiedName, node.getJSDocInfo());
+ FunctionReference reference = new FunctionReference(this, node, qualifiedName, node.getJSDocInfo());
functions.put(qualifiedName, reference);
}
@@ -233,8 +232,7 @@ public class ReferenceModel
log("Model.addConstant(" + qualifiedName + ")");
- ConstantReference reference = new ConstantReference(this, node,
- qualifiedName, node.getJSDocInfo());
+ ConstantReference reference = new ConstantReference(this, node, qualifiedName, node.getJSDocInfo());
constants.put(qualifiedName, reference);
}
@@ -248,8 +246,7 @@ public class ReferenceModel
log("Model.addConstantType(" + qualifiedName + ")");
- ConstantReference reference = new ConstantReference(this, node,
- qualifiedName, node.getJSDocInfo(), type);
+ ConstantReference reference = new ConstantReference(this, node, qualifiedName, node.getJSDocInfo(), type);
constants.put(qualifiedName, reference);
}
@@ -257,8 +254,7 @@ public class ReferenceModel
{
ClassReference classReference = getClassReference(className);
if (classReference != null)
- classReference.addField(node, memberName, node.getJSDocInfo(),
- false);
+ classReference.addField(node, memberName, node.getJSDocInfo(), false);
}
public void addStaticField(Node node, String className, String memberName)
@@ -273,8 +269,7 @@ public class ReferenceModel
}
else
{
- err(">>>> {ReferenceModel} Class [" + className + "] not found in "
- + node.getSourceFileName());
+ err(">>>> {ReferenceModel} Class [" + className + "] not found in " + node.getSourceFileName());
}
}
@@ -298,14 +293,25 @@ public class ReferenceModel
}
else
{
- err(">>>> {ReferenceModel} Class [" + className + "] not found in "
- + node.getSourceFileName());
+ err(">>>> {ReferenceModel} Class [" + className + "] not found in " + node.getSourceFileName());
}
}
public final JSType evaluate(JSTypeExpression expression)
{
- JSType jsType = expression.evaluate(null, jscompiler.getTypeRegistry());
+ JSType jsType = null;
+
+ if (expression != null)
+ {
+ try
+ {
+ jsType = expression.evaluate(null, jscompiler.getTypeRegistry());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
return jsType;
}
@@ -316,11 +322,9 @@ public class ReferenceModel
return getConfiguration().isExcludedClass(classReference);
}
- public ExcludedMember isExcludedMember(ClassReference classReference,
- MemberReference memberReference)
+ public ExcludedMember isExcludedMember(ClassReference classReference, MemberReference memberReference)
{
- return getConfiguration().isExcludedMember(classReference,
- memberReference);
+ return getConfiguration().isExcludedMember(classReference, memberReference);
}
//--------------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c55587ce/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/FunctionUtils.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/FunctionUtils.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/FunctionUtils.java
index 561fddb..6bf3ac5 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/FunctionUtils.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/FunctionUtils.java
@@ -19,23 +19,45 @@
package org.apache.flex.compiler.internal.codegen.externals.utils;
-import com.google.common.base.Strings;
import org.apache.flex.compiler.internal.codegen.externals.reference.BaseReference;
+import org.apache.flex.compiler.internal.codegen.externals.reference.ClassReference;
+import org.apache.flex.compiler.internal.codegen.externals.reference.ReferenceModel;
+import com.google.common.base.Strings;
import com.google.javascript.rhino.JSDocInfo;
import com.google.javascript.rhino.JSTypeExpression;
import com.google.javascript.rhino.Node;
-import org.apache.flex.compiler.internal.codegen.externals.reference.ClassReference;
-import org.apache.flex.compiler.internal.codegen.externals.reference.ReferenceModel;
public class FunctionUtils
{
- public static String toReturnString(BaseReference reference,
- JSDocInfo comment)
+ /**
+ * Compute the type of a function or method parameter.
+ *
+ * @param reference The FunctionReference or MethodReference the parameter belongs to
+ * @param name The name of the parameter
+ * @return the type of a function or method parameter
+ */
+ public static String toParameterType(final BaseReference reference, final String name)
+ {
+
+ String parameterType;
+ if (FunctionUtils.hasTemplate(reference))
+ {
+ parameterType = "Object";
+ }
+ else
+ {
+ parameterType = JSTypeUtils.toParamTypeString(reference, name);
+ }
+
+ return parameterType;
+ }
+
+ public static String toReturnString(BaseReference reference)
{
final StringBuilder sb = new StringBuilder();
- String returnType = null;
+ String returnType;
if (hasTemplate(reference))
{
@@ -51,8 +73,7 @@ public class FunctionUtils
return sb.toString();
}
- public static String toPrameterString(BaseReference reference,
- JSDocInfo comment, Node paramNode)
+ public static String toParameterString(BaseReference reference, JSDocInfo comment, Node paramNode)
{
final StringBuilder sb = new StringBuilder();
@@ -71,7 +92,7 @@ public class FunctionUtils
{
for (Node param : paramNode.children())
{
- sb.append(param.getString() + ":Object");
+ sb.append(param.getString()).append(":Object");
if (index < len - 1)
sb.append(", ");
index++;
@@ -82,8 +103,7 @@ public class FunctionUtils
{
for (String paramName : comment.getParameterNames())
{
- sb.append(toParameter(reference, comment, paramName,
- comment.getParameterType(paramName)));
+ sb.append(toParameter(reference, comment, paramName, comment.getParameterType(paramName)));
if (index < len - 1)
sb.append(", ");
@@ -104,10 +124,11 @@ public class FunctionUtils
* @param model The containing reference model
* @param node The containing node
* @param typeName The type we want check
- * @param currentPackage The current package
+ * @param packageName The current package
* @return true if we can import the given type into the given package
*/
- public static boolean canBeImported(final ReferenceModel model, final Node node, final String typeName, final String currentPackage)
+ public static boolean canBeImported(final ReferenceModel model, final Node node, final String typeName,
+ final String packageName)
{
boolean canImport = false;
@@ -116,33 +137,27 @@ public class FunctionUtils
final ClassReference reference = new ClassReference(null, node, typeName);
final int lastDotPosition = typeName.lastIndexOf(".");
- // Can import when the type to import does not belong the current package.
- canImport = lastDotPosition > -1 && !typeName.substring(0, lastDotPosition).equals(currentPackage);
+
+ // Can import when the type to import does not belong to the current package.
+ canImport = lastDotPosition > -1 && !typeName.substring(0, lastDotPosition).equals(packageName);
+
// And is not excluded.
canImport &= model.isExcludedClass(reference) == null;
-
- // TODO:
- /*
- Manage the case where a custom class belongs
- to the top level package and needs to be imported
- in a sub-package as I don't know how to deal with
- builtin classes.
- */
}
return canImport;
}
- private static String toParameter(BaseReference reference,
- JSDocInfo comment, String paramName, JSTypeExpression parameterType)
+ private static String toParameter(BaseReference reference, JSDocInfo comment, String paramName,
+ JSTypeExpression parameterType)
{
final StringBuilder sb = new StringBuilder();
- String paramType = null;
+ String paramType;
if (parameterType.isVarArgs())
{
- sb.append("..." + paramName);
+ sb.append("...").append(paramName);
}
else
{
@@ -182,7 +197,7 @@ public class FunctionUtils
return "null";
}
- private static boolean hasTemplate(BaseReference reference)
+ public static boolean hasTemplate(BaseReference reference)
{
return reference.getComment().getTemplateTypeNames().size() > 0;
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c55587ce/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/JSTypeUtils.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/JSTypeUtils.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/JSTypeUtils.java
index 3b4ae40..c14ddb8 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/JSTypeUtils.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/utils/JSTypeUtils.java
@@ -34,16 +34,13 @@ public class JSTypeUtils
{
public static String toClassTypeString(ClassReference reference)
{
- String type = getJsType(reference.getModel(),
- reference.getComment().getBaseType()).toString();
+ String type = getJsType(reference.getModel(), reference.getComment().getBaseType()).toString();
return type;
}
- public static String toParamTypeString(BaseReference reference,
- String paramName)
+ public static String toParamTypeString(BaseReference reference, String paramName)
{
- JSTypeExpression expression = reference.getComment().getParameterType(
- paramName);
+ JSTypeExpression expression = reference.getComment().getParameterType(paramName);
if (expression == null)
return "Object";
@@ -80,8 +77,7 @@ public class JSTypeUtils
public static String toEnumTypeString(BaseReference reference)
{
JSTypeExpression enumParameterType = reference.getComment().getEnumParameterType();
- String overrideStringType = transformType(reference.getModel().evaluate(
- enumParameterType).toAnnotationString());
+ String overrideStringType = transformType(reference.getModel().evaluate(enumParameterType).toAnnotationString());
return overrideStringType;
}
@@ -100,7 +96,7 @@ public class JSTypeUtils
//--------------------------------------------------------------------------
- private static String transformType(String type)
+ public static String transformType(String type)
{
// XXX This is an error but, needs to be reduced in @param union
if (type.indexOf("|") != -1)
@@ -121,8 +117,7 @@ public class JSTypeUtils
return type;
}
- private static String toTypeExpressionString(BaseReference reference,
- JSTypeExpression expression)
+ private static String toTypeExpressionString(BaseReference reference, JSTypeExpression expression)
{
JSType jsType = getJsType(reference.getModel(), expression);
String type = toTypeString(jsType);
@@ -156,8 +151,7 @@ public class JSTypeUtils
return type;
}
- private static JSType getJsType(ReferenceModel model,
- JSTypeExpression typeExpression)
+ private static JSType getJsType(ReferenceModel model, JSTypeExpression typeExpression)
{
JSType jsType = model.evaluate(typeExpression);
[7/9] git commit: [flex-falcon] [refs/heads/add-CollectImportPass] -
Add tests for the collect of the imports
Posted by ft...@apache.org.
Add tests for the collect of the imports
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/298cc732
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/298cc732
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/298cc732
Branch: refs/heads/add-CollectImportPass
Commit: 298cc732e3abc6078459ff433b6b00101a92377f
Parents: afc574a
Author: Frédéric THOMAS <we...@gmail.com>
Authored: Tue Jul 7 19:05:00 2015 +0100
Committer: Frédéric THOMAS <we...@gmail.com>
Committed: Tue Jul 7 19:15:46 2015 +0100
----------------------------------------------------------------------
.../codegen/externals/TestCollectImports.java | 221 +++++++++++++++++++
.../imports/import_constructor_signatures.js | 43 ++++
.../imports/import_functions.js | 47 ++++
.../imports/import_interfaces.js | 49 ++++
.../imports/import_method_signatures.js | 71 ++++++
.../imports/import_superclasses.js | 46 ++++
6 files changed, 477 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/298cc732/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestCollectImports.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestCollectImports.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestCollectImports.java
new file mode 100644
index 0000000..ad025c3
--- /dev/null
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/externals/TestCollectImports.java
@@ -0,0 +1,221 @@
+/*
+ *
+ * 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.internal.codegen.externals;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.flex.compiler.clients.ExternCConfiguration;
+import org.apache.flex.compiler.internal.codegen.externals.reference.ClassReference;
+import org.apache.flex.compiler.internal.codegen.externals.reference.FunctionReference;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+@RunWith(Parameterized.class)
+public class TestCollectImports extends ExternalsTestBase
+{
+ private static final String IMPORTS_TEST_DIR = "imports/";
+
+ private Boolean excludeClass;
+
+ @Parameterized.Parameters
+ public static Collection<Object[]> excludeClassYesNo()
+ {
+ return Arrays.asList(new Object[][] { { true }, { false } });
+ }
+
+ public TestCollectImports(final Boolean excludeClass)
+ {
+ this.excludeClass = excludeClass;
+ }
+
+ @Test
+ public void import_constructor_signatures() throws Exception
+ {
+ if (excludeClass)
+ {
+ config.addClassExclude("foo.Baz");
+ }
+
+ assertCompileTestFileSuccess(IMPORTS_TEST_DIR);
+
+ //client.emit();
+
+ ClassReference importConstructorSignature = model.getClassReference("ImportConstructorSignature");
+ assertNotNull(importConstructorSignature);
+
+ assertFalse(importConstructorSignature.hasImport("Number"));
+ assertFalse(importConstructorSignature.hasImport("foo.Qux"));
+
+ assertTrue(importConstructorSignature.hasImport("foo.Bar"));
+
+ if (excludeClass)
+ {
+ assertFalse(importConstructorSignature.hasImport("foo.Baz"));
+ }
+ else
+ {
+ assertTrue(importConstructorSignature.hasImport("foo.Baz"));
+ }
+ }
+
+ @Test
+ public void import_method_signatures() throws Exception
+ {
+ if (excludeClass)
+ {
+ config.addClassExclude("foo.Qux");
+ }
+
+ assertCompileTestFileSuccess(IMPORTS_TEST_DIR);
+
+ //client.emit();
+
+ ClassReference importMethodSignature = model.getClassReference("ImportMethodSignature");
+ assertNotNull(importMethodSignature);
+
+ assertFalse(importMethodSignature.hasImport("Number"));
+ assertFalse(importMethodSignature.hasImport("foo.Quux"));
+ assertFalse(importMethodSignature.hasImport("foo.Quuux"));
+
+ assertTrue(importMethodSignature.hasImport("foo.Bar"));
+ assertTrue(importMethodSignature.hasImport("foo.Baz"));
+
+ if (excludeClass)
+ {
+ assertFalse(importMethodSignature.hasImport("foo.Qux"));
+ }
+ else
+ {
+ assertTrue(importMethodSignature.hasImport("foo.Qux"));
+ }
+ }
+
+ @Test
+ public void import_interfaces() throws Exception
+ {
+ if (excludeClass)
+ {
+ config.addClassExclude("API.foo.Baz");
+ }
+
+ assertCompileTestFileSuccess(IMPORTS_TEST_DIR);
+
+ //client.emit();
+
+ ClassReference importInterfaces = model.getClassReference("ImportInterfaces");
+ assertNotNull(importInterfaces);
+
+ assertFalse(importInterfaces.hasImport("qux"));
+ assertTrue(importInterfaces.hasImport("API.Foo"));
+
+ ClassReference apiFoo = model.getClassReference("API.Foo");
+ assertNotNull(apiFoo);
+
+ assertFalse(apiFoo.hasImport("qux"));
+ assertFalse(apiFoo.hasImport("API.Bar"));
+
+ if (excludeClass)
+ {
+ assertFalse(apiFoo.hasImport("API.foo.Baz"));
+ }
+ else
+ {
+ assertTrue(apiFoo.hasImport("API.foo.Baz"));
+ }
+ }
+
+ @Test
+ public void import_superclasses() throws Exception
+ {
+ if (excludeClass)
+ {
+ config.addClassExclude("BASE.Foo");
+ }
+
+ assertCompileTestFileSuccess(IMPORTS_TEST_DIR);
+
+ //client.emit();
+
+ ClassReference importSuperClass1 = model.getClassReference("ImportSuperClass1");
+ assertNotNull(importSuperClass1);
+
+ assertFalse(importSuperClass1.hasImport("qux"));
+
+ ClassReference importSuperClass2 = model.getClassReference("ImportSuperClass2");
+ assertNotNull(importSuperClass2);
+
+ if (excludeClass)
+ {
+ assertFalse(importSuperClass2.hasImport("BASE.Foo"));
+ }
+ else
+ {
+ assertTrue(importSuperClass2.hasImport("BASE.Foo"));
+ }
+
+ ClassReference foo = model.getClassReference("BASE.Foo");
+ assertNotNull(foo);
+
+ assertFalse(foo.hasImport("BASE.Bar"));
+ }
+
+ @Test
+ public void import_functions() throws Exception
+ {
+ if (excludeClass)
+ {
+ config.addClassExclude("foo.Qux");
+ }
+
+ assertCompileTestFileSuccess(IMPORTS_TEST_DIR);
+
+ client.emit();
+
+ FunctionReference importFunction = (FunctionReference) model.getFunctions().toArray()[0];
+ assertNotNull(importFunction);
+ assertTrue(importFunction.getQualifiedName().equals("ImportFunction"));
+
+ assertFalse(importFunction.hasImport("Quux"));
+
+ assertTrue(importFunction.hasImport("foo.Bar"));
+ assertTrue(importFunction.hasImport("foo.Baz"));
+
+ if (excludeClass)
+ {
+ assertFalse(importFunction.hasImport("foo.Qux"));
+ }
+ else
+ {
+ assertTrue(importFunction.hasImport("foo.Qux"));
+ }
+ }
+
+ @Override
+ protected void configure(ExternCConfiguration config) throws IOException
+ {
+ config.setASRoot(ExternalsTestUtils.AS_ROOT_DIR);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/298cc732/compiler.jx.tests/test-files/externals_unit_tests/imports/import_constructor_signatures.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/externals_unit_tests/imports/import_constructor_signatures.js b/compiler.jx.tests/test-files/externals_unit_tests/imports/import_constructor_signatures.js
new file mode 100644
index 0000000..9f80e7e
--- /dev/null
+++ b/compiler.jx.tests/test-files/externals_unit_tests/imports/import_constructor_signatures.js
@@ -0,0 +1,43 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+
+/**
+ * @constructor
+ * @param {foo.Qux|foo.Bar} qux
+ * @param {foo.Bar} bar
+ * @param {number} value
+ * @param {foo.Baz?} baz
+ */
+ImportConstructorSignature = function(qux, bar, value, baz) {};
+
+/**
+ * @constructor
+ */
+foo.Bar = function() {};
+
+/**
+ * @constructor
+ */
+foo.Baz = function() {};
+
+/**
+ * @constructor
+ */
+foo.Qux = function() {};
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/298cc732/compiler.jx.tests/test-files/externals_unit_tests/imports/import_functions.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/externals_unit_tests/imports/import_functions.js b/compiler.jx.tests/test-files/externals_unit_tests/imports/import_functions.js
new file mode 100644
index 0000000..b6c170b
--- /dev/null
+++ b/compiler.jx.tests/test-files/externals_unit_tests/imports/import_functions.js
@@ -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.
+ *
+ */
+
+
+/**
+ * @param {foo.Bar} bar
+ * @param {foo.Baz} baz
+ * @param {Quux} quux
+ * @return {!foo.Qux}
+ */
+function ImportFunction(bar, baz, quux) {}
+
+/**
+ * @constructor
+ */
+Quux = function() {};
+
+/**
+ * @constructor
+ */
+foo.Bar = function() {};
+
+/**
+ * @constructor
+ */
+foo.Baz = function() {};
+
+/**
+ * @constructor
+ */
+foo.Qux = function() {};
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/298cc732/compiler.jx.tests/test-files/externals_unit_tests/imports/import_interfaces.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/externals_unit_tests/imports/import_interfaces.js b/compiler.jx.tests/test-files/externals_unit_tests/imports/import_interfaces.js
new file mode 100644
index 0000000..97a711f
--- /dev/null
+++ b/compiler.jx.tests/test-files/externals_unit_tests/imports/import_interfaces.js
@@ -0,0 +1,49 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+/**
+ * @constructor
+ * @implements {Qux}
+ * @implements {API.Foo}
+ */
+ImportInterfaces = function() {};
+
+
+/**
+ * @interface
+ */
+Qux = function() {};
+
+/**
+ * @interface
+ * @extends {Qux}
+ * @extends {API.Bar}
+ * @extends {API.foo.Baz}
+ */
+API.Foo = function() {};
+
+/**
+ * @interface
+ */
+API.Bar = function() {};
+
+/**
+ * @interface
+ */
+API.foo.Baz = function() {};
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/298cc732/compiler.jx.tests/test-files/externals_unit_tests/imports/import_method_signatures.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/externals_unit_tests/imports/import_method_signatures.js b/compiler.jx.tests/test-files/externals_unit_tests/imports/import_method_signatures.js
new file mode 100644
index 0000000..6524dc5
--- /dev/null
+++ b/compiler.jx.tests/test-files/externals_unit_tests/imports/import_method_signatures.js
@@ -0,0 +1,71 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+/**
+ * @constructor
+ */
+ImportMethodSignature = function() {};
+
+/**
+ * @param {foo.Quux|foo.Bar} bar
+ * @param {number} value
+ * @param {foo.Baz?} baz
+ */
+ImportMethodSignature.myMethod = function(bar, value, baz) {};
+
+/**
+ * @param {foo.Bar} bar
+ * @param {number} value
+ * @param {foo.Baz?} baz
+ * @return {foo.Qux}
+ */
+ImportMethodSignature.prototype.myMethodWithReturnType = function(bar, value, baz) {};
+
+/**
+ * @param {foo.Bar} bar
+ * @param {number} value
+ * @param {foo.Baz?} baz
+ * @return {foo.Quuux|foo.Bar}
+ */
+ImportMethodSignature.myMethodWithUnionReturnType = function(bar, value, baz) {};
+
+/**
+ * @constructor
+ */
+foo.Bar = function() {};
+
+/**
+ * @constructor
+ */
+foo.Baz = function() {};
+
+/**
+ * @constructor
+ */
+foo.Qux = function() {};
+
+/**
+ * @constructor
+ */
+foo.Quux = function() {};
+
+/**
+ * @constructor
+ */
+foo.Quuux = function() {};
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/298cc732/compiler.jx.tests/test-files/externals_unit_tests/imports/import_superclasses.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/externals_unit_tests/imports/import_superclasses.js b/compiler.jx.tests/test-files/externals_unit_tests/imports/import_superclasses.js
new file mode 100644
index 0000000..1a549d7
--- /dev/null
+++ b/compiler.jx.tests/test-files/externals_unit_tests/imports/import_superclasses.js
@@ -0,0 +1,46 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+/**
+ * @constructor
+ * @extends {Qux}
+ */
+ImportSuperClass1 = function() {};
+
+/**
+ * @constructor
+ * @extends {BASE.Foo}
+ */
+ImportSuperClass2 = function() {};
+
+/**
+ * @constructor
+ */
+Qux = function() {};
+
+/**
+ * @constructor
+ * @extends {BASE.Bar}
+ */
+BASE.Foo = function() {};
+
+/**
+ * @constructor
+ */
+BASE.Bar = function() {};
[8/9] git commit: [flex-falcon] [refs/heads/add-CollectImportPass] -
Remove collect of imports from ResolvePackagesPass
Posted by ft...@apache.org.
Remove collect of imports from ResolvePackagesPass
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/69f0a8b4
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/69f0a8b4
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/69f0a8b4
Branch: refs/heads/add-CollectImportPass
Commit: 69f0a8b4633ce6a9f5e86d87636f8e3b03000b64
Parents: 298cc73
Author: Frédéric THOMAS <we...@gmail.com>
Authored: Tue Jul 7 19:06:34 2015 +0100
Committer: Frédéric THOMAS <we...@gmail.com>
Committed: Tue Jul 7 19:15:49 2015 +0100
----------------------------------------------------------------------
.../codegen/externals/pass/ResolvePackagesPass.java | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/69f0a8b4/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ResolvePackagesPass.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ResolvePackagesPass.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ResolvePackagesPass.java
index d4664d7..b446d8c 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ResolvePackagesPass.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ResolvePackagesPass.java
@@ -68,22 +68,19 @@ public class ResolvePackagesPass extends AbstractCompilerPass
String testName = qualifiedName + "." + baseName;
if (testName.equals(child.getQualifiedName()))
{
- FieldReference field = null;
+ FieldReference field;
if (!reference.isQualifiedName())
{
log(" Add field: public static var " + baseName);
- field = reference.addField(child.getNode(), baseName,
- child.getNode().getJSDocInfo(), true);
+ field = reference.addField(child.getNode(), baseName, child.getNode().getJSDocInfo(), true);
}
else
{
log(" Add field: public var " + baseName);
- field = reference.addField(child.getNode(), baseName,
- child.getNode().getJSDocInfo(), false);
+ field = reference.addField(child.getNode(), baseName, child.getNode().getJSDocInfo(), false);
}
field.setOverrideStringType(child.getQualifiedName());
- reference.addImport(child.getQualifiedName());
}
}
[6/9] git commit: [flex-falcon] [refs/heads/add-CollectImportPass] -
Introduce ParameterReference and hasImport()
Posted by ft...@apache.org.
Introduce ParameterReference and hasImport()
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/afc574a6
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/afc574a6
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/afc574a6
Branch: refs/heads/add-CollectImportPass
Commit: afc574a695251ebcfd6dd4a1483ae4e8d624c369
Parents: 72fe8ea
Author: Frédéric THOMAS <we...@gmail.com>
Authored: Tue Jul 7 19:03:27 2015 +0100
Committer: Frédéric THOMAS <we...@gmail.com>
Committed: Tue Jul 7 19:15:43 2015 +0100
----------------------------------------------------------------------
.../externals/reference/FunctionReference.java | 126 ++++++++++++-------
.../externals/reference/ParameterReference.java | 34 +++++
2 files changed, 114 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/afc574a6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java
index e47cb83..1fbc944 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java
@@ -19,38 +19,40 @@
package org.apache.flex.compiler.internal.codegen.externals.reference;
-import com.google.javascript.rhino.JSDocInfo;
-import com.google.javascript.rhino.Node;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import org.apache.flex.compiler.clients.ExternCConfiguration.ExcludedMember;
import org.apache.flex.compiler.internal.codegen.externals.utils.FunctionUtils;
-import java.io.File;
+import com.google.common.collect.Lists;
+import com.google.javascript.rhino.JSDocInfo;
+import com.google.javascript.rhino.Node;
-public class FunctionReference extends BaseReference
-{
+public class FunctionReference extends BaseReference {
private boolean isStatic;
- private FunctionReference override;
private Node paramNode;
+ private Set<String> imports = new HashSet<String>();
+ private List<ParameterReference> parameters;
- public File getFile(File asSourceRoot)
- {
+ public File getFile(File asSourceRoot) {
String packageName = "";
return new File(asSourceRoot, packageName + File.separator + getQualifiedName() + ".as");
}
- private FunctionReference getContext()
- {
- return override == null ? this : override;
+ private FunctionReference getContext() {
+ return this;
}
- public boolean isStatic()
- {
+ public boolean isStatic() {
return isStatic;
}
- public void setStatic(boolean isStatic)
- {
+ public void setStatic(boolean isStatic) {
this.isStatic = isStatic;
}
@@ -63,19 +65,47 @@ public class FunctionReference extends BaseReference
BLOCK
*/
- public FunctionReference(ReferenceModel model, Node node, String qualifiedName, JSDocInfo comment)
- {
+ public FunctionReference(ReferenceModel model, Node node, String qualifiedName, JSDocInfo comment) {
super(model, node, qualifiedName, comment);
this.paramNode = node.getChildAtIndex(1);
+
+ addParameterReferences();
+ }
+
+ private void addParameterReferences() {
+
+ parameters = new ArrayList<ParameterReference>();
+
+ if (paramNode != null) {
+
+ final boolean isDocumented = comment.getParameterCount() > 0;
+ List<String> parameterNames = null;
+
+ if (isDocumented) {
+ parameterNames = Lists.newArrayList(comment.getParameterNames());
+ }
+
+ for (Node param : paramNode.children()) {
+ ParameterReference parameterReference;
+
+ if (isDocumented && parameterNames.contains(param.getString())) {
+ final String qualifiedName = FunctionUtils.toParameterType(this, param.getString());
+ parameterReference = new ParameterReference(getModel(), param, qualifiedName);
+ } else {
+ parameterReference = new ParameterReference(getModel(), param);
+ }
+
+ parameters.add(parameterReference);
+ }
+ }
}
@Override
- public void emit(StringBuilder sb)
- {
+ public void emit(StringBuilder sb) {
String packageName = "";
sb.append("package ");
- sb.append(packageName + " ");
+ sb.append(packageName).append(" ");
sb.append("{\n");
sb.append("\n");
@@ -84,19 +114,17 @@ public class FunctionReference extends BaseReference
emitComment(sb);
ExcludedMember excluded = isExcluded();
- if (excluded != null)
- {
+ if (excluded != null) {
excluded.print(sb);
}
String staticValue = (isStatic) ? "static " : "";
String publicModifier = "public ";
- String braces = "";
+ String braces;
String returns = "";
- if (!transformReturnString().equals("void"))
- {
+ if (!transformReturnString().equals("void")) {
returns = " return null;";
}
@@ -107,7 +135,7 @@ public class FunctionReference extends BaseReference
sb.append(staticValue);
sb.append("function ");
sb.append(getQualifiedName());
- sb.append(toPrameterString());
+ sb.append(toParameterString());
sb.append(":");
sb.append(transformReturnString());
sb.append(braces);
@@ -116,37 +144,43 @@ public class FunctionReference extends BaseReference
sb.append("}\n"); // package
}
- private void printImports(final StringBuilder sb)
- {
- String returnType = transformReturnString();
-
- final boolean canBeImported = FunctionUtils.canBeImported(getModel(), getNode(), returnType, getPackageName());
-
- if (canBeImported)
- {
- sb.append("import ").append(returnType).append(";\n\n");
+ private void printImports(final StringBuilder sb) {
+ if (imports.size() > 0) {
+ for (String anImport : imports) {
+ sb.append("import ").append(anImport).append(";\n");
+ }
+ sb.append("\n");
}
-
}
- private String transformReturnString()
- {
- return FunctionUtils.toReturnString(getContext(), getComment());
+ public String transformReturnString() {
+ return FunctionUtils.toReturnString(getContext());
}
- private String toPrameterString()
- {
- return FunctionUtils.toPrameterString(getContext(), getComment(), paramNode);
+ private String toParameterString() {
+ return FunctionUtils.toParameterString(getContext(), getComment(), paramNode);
}
- public boolean isOverride()
- {
+ public boolean isOverride() {
return getComment().isOverride();
}
@Override
- protected void emitCommentBody(StringBuilder sb)
- {
+ protected void emitCommentBody(StringBuilder sb) {
emitFunctionCommentBody(sb);
}
+
+ public void addImport(ClassReference reference) {
+ if (reference != null) {
+ imports.add(reference.getQualifiedName());
+ }
+ }
+
+ public List<ParameterReference> getParameters() {
+ return parameters;
+ }
+
+ public boolean hasImport(String qualifiedName) {
+ return imports.contains(qualifiedName);
+ }
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/afc574a6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ParameterReference.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ParameterReference.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ParameterReference.java
new file mode 100644
index 0000000..171835f
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/reference/ParameterReference.java
@@ -0,0 +1,34 @@
+package org.apache.flex.compiler.internal.codegen.externals.reference;
+
+import com.google.javascript.rhino.Node;
+
+/**
+ * @author: Frederic Thomas Date: 05/07/2015 Time: 19:34
+ */
+public class ParameterReference extends BaseReference
+{
+
+ private String name;
+
+ public ParameterReference(final ReferenceModel model, final Node node, final String qualifiedName)
+ {
+ super(model, node, qualifiedName, null);
+ name = node.getString();
+ }
+
+ public ParameterReference(final ReferenceModel model, final Node parameterNode)
+ {
+ this(model, parameterNode, "Object");
+ }
+
+ @Override
+ public void emit(final StringBuilder sb)
+ {
+ // Emitted by the Method / Function reference.
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
[3/9] git commit: [flex-falcon] [refs/heads/add-CollectImportPass] -
Merge branch 'noexpose' into develop
Posted by ft...@apache.org.
Merge branch 'noexpose' into develop
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/2951d1a7
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/2951d1a7
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/2951d1a7
Branch: refs/heads/add-CollectImportPass
Commit: 2951d1a71240fb6a1060b566fdafc3ddcf683162
Parents: d30b0c4 5307227
Author: Alex Harui <ah...@apache.org>
Authored: Sun Jul 5 21:38:16 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Jul 5 21:38:16 2015 -0700
----------------------------------------------------------------------
.../js/flexjs/TestFlexJSAccessorMembers.java | 20 +++++-----
.../codegen/js/flexjs/TestFlexJSAccessors.java | 8 ++--
.../codegen/js/flexjs/TestFlexJSClass.java | 30 +++++++-------
.../codegen/js/flexjs/TestFlexJSEmiter.java | 2 +-
.../js/flexjs/TestFlexJSExpressions.java | 18 ++++-----
.../js/flexjs/TestFlexJSFieldMembers.java | 26 ++++++------
.../js/flexjs/TestFlexJSGlobalConstants.java | 8 ++--
.../js/flexjs/TestFlexJSMethodMembers.java | 8 ++--
.../codegen/js/vf2js/TestVF2JSClass.java | 26 ++++++------
.../codegen/js/vf2js/TestVF2JSExpressions.java | 2 +-
.../mxml/flexjs/TestFlexJSMXMLScript.java | 2 +-
.../externals_unit_tests/constructor_params.js | 2 +-
.../externals_unit_tests/package_namespace.js | 2 +-
.../flexjs/files/FlexJSTest_again_result.js | 6 +--
.../flexjs/files/LocalFunction_result.js | 2 +-
.../flexjs/files/MyInitialView_result.js | 42 ++++++++++----------
.../flexjs/files/StockDataJSONItemConverter.js | 2 +-
.../files/controllers/MyController_result.js | 2 +-
.../flexjs/files/models/MyModel_result.js | 6 +--
.../flexjs/projects/interfaces/Test_result.js | 2 +-
.../projects/interfaces/interfaces/IE_result.js | 2 +-
.../flexjs/projects/super/Base_result.js | 2 +-
.../flexjs/projects/super/Super_result.js | 4 +-
.../test-files/goog/files/call-super_result.js | 2 +-
.../test-files/vf2js/files/SimpleMXML_result.js | 2 +-
.../vf2js/projects/interfaces/Test_result.js | 2 +-
.../projects/interfaces/classes/A_result.js | 2 +-
.../vf2js/projects/sdk/SomeSDKClass_result.js | 8 ++--
.../sdk/bases/HelperBaseClass_result.js | 2 +-
.../simpleMXML/src/SimpleMXML_Project_result.js | 2 +-
.../vf2js/projects/super/Base_result.js | 8 ++--
.../vf2js/projects/super/Super_result.js | 8 ++--
.../codegen/js/goog/IJSGoogDocEmitter.java | 4 +-
.../codegen/js/goog/JSGoogDocEmitter.java | 2 +-
.../codegen/js/goog/JSGoogDocEmitterTokens.java | 2 +-
.../internal/codegen/js/jx/AccessorEmitter.java | 4 +-
.../internal/codegen/js/jx/BindableEmitter.java | 2 +-
.../codegen/js/vf2js/JSVF2JSEmitter.java | 4 +-
.../codegen/mxml/flexjs/MXMLFlexJSEmitter.java | 8 ++--
.../codegen/mxml/vf2js/MXMLVF2JSEmitter.java | 10 ++---
.../utils/JSClosureCompilerWrapper.java | 4 +-
41 files changed, 151 insertions(+), 149 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2951d1a7/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
----------------------------------------------------------------------
diff --cc compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
index 0ede063,b983329..e0aab7c
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
@@@ -187,17 -187,9 +187,17 @@@ public class TestFlexJSMethodMembers ex
{
IFunctionNode node = getMethod("override public function foo(bar:String, baz:int = null):int{return -1;}");
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n * @param {string} bar\n * @param {number=} baz\n * @return {number}\n * @override\n */\nFalconTest_A.prototype.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 * @override\n */\nFalconTest_A.prototype.foo = function(bar, baz) {\n baz = typeof baz !== 'undefined' ? baz : null;\n return -1;\n}");
}
+ @Test
+ public void testMethod_withConstDeclaration()
+ {
+ IFunctionNode node = getMethod("public function foo():String{const A:String = 'Hello World'; return A;}");
+ asBlockWalker.visitFunction(node);
+ assertOut("/**\n * @expose\n * @return {string}\n */\nFalconTest_A.prototype.foo = function() {\n \n/**\n * @const\n * @type {string}\n */\nvar A = 'Hello World';\n return A;\n}");
+ }
+
@Override
protected IBackend createBackend()
{
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2951d1a7/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java
----------------------------------------------------------------------
[4/9] git commit: [flex-falcon] [refs/heads/add-CollectImportPass] -
fix build
Posted by ft...@apache.org.
fix build
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/0a63b497
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/0a63b497
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/0a63b497
Branch: refs/heads/add-CollectImportPass
Commit: 0a63b49746b9ad0aa513bdf09707dede38dca33a
Parents: 2951d1a
Author: Alex Harui <ah...@apache.org>
Authored: Sun Jul 5 22:31:56 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Jul 5 22:31:56 2015 -0700
----------------------------------------------------------------------
.../internal/codegen/js/flexjs/TestFlexJSMethodMembers.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0a63b497/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
index e0aab7c..33ffae0 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSMethodMembers.java
@@ -195,7 +195,7 @@ public class TestFlexJSMethodMembers extends TestGoogMethodMembers
{
IFunctionNode node = getMethod("public function foo():String{const A:String = 'Hello World'; return A;}");
asBlockWalker.visitFunction(node);
- assertOut("/**\n * @expose\n * @return {string}\n */\nFalconTest_A.prototype.foo = function() {\n \n/**\n * @const\n * @type {string}\n */\nvar A = 'Hello World';\n return A;\n}");
+ assertOut("/**\n * @export\n * @return {string}\n */\nFalconTest_A.prototype.foo = function() {\n \n/**\n * @const\n * @type {string}\n */\nvar A = 'Hello World';\n return A;\n}");
}
@Override