This is an automated email from the ASF dual-hosted git repository. joshtynjala pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit 8f20e7d28733070148b1d4fe4f75cca40d55dc98 Author: Josh Tynjala <[email protected]> AuthorDate: Tue Oct 20 14:33:33 2020 -0700 AccessorEmitter, BindableEmitter: clean up jsdoc formatting to better match other jsdoc emitted by the compiler --- .../internal/codegen/js/jx/AccessorEmitter.java | 32 +++++++-------- .../internal/codegen/js/jx/BindableEmitter.java | 16 +++++--- .../js/royale/TestRoyaleAccessorMembers.java | 28 +++++++------- .../codegen/js/royale/TestRoyaleAccessors.java | 25 ++++++------ .../codegen/js/royale/TestRoyaleClass.java | 45 +++++++++++++--------- .../codegen/js/royale/TestRoyaleExpressions.java | 2 +- .../codegen/js/royale/TestRoyalePackage.java | 6 ++- .../resources/royale/files/MyInitialView_result.js | 12 ++++-- .../royale/files/models/MyModel_result.js | 9 +++-- .../resources/royale/projects/super/Base_result.js | 3 +- .../royale/projects/super/Super_result.js | 3 +- 11 files changed, 100 insertions(+), 81 deletions(-) diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/AccessorEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/AccessorEmitter.java index 2eb426e..f4064aa 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/AccessorEmitter.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/AccessorEmitter.java @@ -105,11 +105,10 @@ public class AccessorEmitter extends JSSubEmitter implements writeNewline(); writeNewline("/**"); if (emitExports) - writeNewline(" * @export"); + writeNewline(" * @export"); if (p.type != null) - writeNewline(" * @type {"+ JSGoogDocEmitter.convertASTypeToJSType(p.type.getBaseName(), p.type.getPackageName()) + "} */"); - else - writeNewline(" */"); + writeNewline(" * @type {"+ JSGoogDocEmitter.convertASTypeToJSType(p.type.getBaseName(), p.type.getPackageName()) + "}"); + writeNewline(" */"); write(getEmitter().formatQualifiedName(qname)); write(ASEmitterTokens.MEMBER_ACCESS); write(JSEmitterTokens.PROTOTYPE); @@ -325,10 +324,9 @@ public class AccessorEmitter extends JSSubEmitter implements String typeName = p.type.getBaseName(); if (getModel().isInternalClass(typeName)) typeName = getModel().getInternalClasses().get(typeName); - writeNewline(" * @type {" + JSGoogDocEmitter.convertASTypeToJSType(typeName, p.type.getPackageName()) + "} */"); + writeNewline(" * @type {" + JSGoogDocEmitter.convertASTypeToJSType(typeName, p.type.getPackageName()) + "}"); } - else - writeNewline(" */"); + writeNewline(" */"); FunctionNode fnNode = getterNode != null ? (FunctionNode) getterNode : (FunctionNode) setterNode; if (p.uri != null) { @@ -487,11 +485,10 @@ public class AccessorEmitter extends JSSubEmitter implements writeNewline(); writeNewline("/**"); if (emitExports) - writeNewline(" * @export"); + writeNewline(" * @export"); if (p.type != null) - writeNewline(" * @type {" + JSGoogDocEmitter.convertASTypeToJSType(p.type.getBaseName(), p.type.getPackageName()) + "} */"); - else - writeNewline(" */"); + writeNewline(" * @type {" + JSGoogDocEmitter.convertASTypeToJSType(p.type.getBaseName(), p.type.getPackageName()) + "}"); + writeNewline(" */"); write(getEmitter().formatQualifiedName(qname)); if (p.uri != null) { @@ -525,12 +522,12 @@ public class AccessorEmitter extends JSSubEmitter implements writeNewline(); writeNewline("/**"); if (p.preventRename) - writeNewline(" * @nocollapse"); + writeNewline(" * @nocollapse"); if (p.resolvedExport && !p.suppressExport) - writeNewline(" * @export"); + writeNewline(" * @export"); if (p.type != null) - writeNewline(" * @type {" + JSGoogDocEmitter.convertASTypeToJSType(p.type.getBaseName(), p.type.getPackageName()) + "}"); - writeNewline(" */"); + writeNewline(" * @type {" + JSGoogDocEmitter.convertASTypeToJSType(p.type.getBaseName(), p.type.getPackageName()) + "}"); + writeNewline(" */"); write(getEmitter().formatQualifiedName(qname)); write(ASEmitterTokens.MEMBER_ACCESS); if (p.uri != null) @@ -641,9 +638,8 @@ public class AccessorEmitter extends JSSubEmitter implements String baseName = p.name; writeNewline("/**"); if (p.type != null) - writeNewline(" * @type {" + JSGoogDocEmitter.convertASTypeToJSType(p.type.getBaseName(), p.type.getPackageName()) + "} */"); - else - writeNewline(" */"); + writeNewline(" * @type {" + JSGoogDocEmitter.convertASTypeToJSType(p.type.getBaseName(), p.type.getPackageName()) + "}"); + writeNewline(" */"); FunctionNode fnNode = getterNode != null ? (FunctionNode) getterNode : (FunctionNode) setterNode; if (p.uri != null) { diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/BindableEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/BindableEmitter.java index a692a29..d88c04d 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/BindableEmitter.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/BindableEmitter.java @@ -288,8 +288,10 @@ public class BindableEmitter extends JSSubEmitter implements // export above did not work in the release build for the static getter/setter bindables, // solution below: //Commented by JT, in AccessorEmitter: - writeNewline("/** @export"); - writeNewline(" * @type {"+DISPATCHER_CLASS_QNAME+"} */"); + writeNewline("/**"); + writeNewline(" * @export"); + writeNewline(" * @type {"+DISPATCHER_CLASS_QNAME+"}"); + writeNewline(" */"); write(STATIC_DISPATCHER_GETTER); write(ASEmitterTokens.COLON); write(ASEmitterTokens.SPACE); @@ -368,10 +370,11 @@ public class BindableEmitter extends JSSubEmitter implements writeNewline("/**"); if (info.namespace != "public") { - writeNewline(" * @private"); + writeNewline(" * @private"); } - writeNewline(" * @type {"+convertASTypeToJS(info.type)+"} */"); + writeNewline(" * @type {" + convertASTypeToJS(info.type) + "}"); + writeNewline(" */"); write(name); write(ASEmitterTokens.COLON); write(ASEmitterTokens.SPACE); @@ -443,9 +446,10 @@ public class BindableEmitter extends JSSubEmitter implements String qname = (info.namespace.equals("private") && getProject().getAllowPrivateNameConflicts()) ? fjs.formatPrivateName(cdef.getQualifiedName(), name) : name; writeNewline("/**"); if (info.namespace != "public") { - writeNewline(" * @private"); + writeNewline(" * @private"); } - writeNewline(" * @type {"+convertASTypeToJS(info.type)+"} */"); + writeNewline(" * @type {" + convertASTypeToJS(info.type) + "}"); + writeNewline(" */"); // 'PropName': { writeNewline(qname + ASEmitterTokens.COLON.getToken() + ASEmitterTokens.SPACE.getToken() diff --git a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleAccessorMembers.java b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleAccessorMembers.java index 011d4b4..e88faee 100644 --- a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleAccessorMembers.java +++ b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleAccessorMembers.java @@ -39,7 +39,7 @@ public class TestRoyaleAccessorMembers extends TestGoogAccessorMembers asBlockWalker.visitClass(node); assertOut("/**\n * @constructor\n */\nRoyaleTest_A = function() {\n};\n\n\n" + "RoyaleTest_A.prototype.get__foo = function() {\n};\n\n\n" + - "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {number} */\nfoo: {\nget: RoyaleTest_A.prototype.get__foo}}\n);"); + "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {number}\n */\nfoo: {\nget: RoyaleTest_A.prototype.get__foo}}\n);"); } @Override @@ -51,7 +51,7 @@ public class TestRoyaleAccessorMembers extends TestGoogAccessorMembers asBlockWalker.visitClass(node); assertOut("/**\n * @constructor\n */\nRoyaleTest_A = function() {\n};\n\n\n" + "RoyaleTest_A.prototype.get__foo = function() {\n return -1;\n};\n\n\n" + - "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {number} */\nfoo: {\nget: RoyaleTest_A.prototype.get__foo}}\n);"); + "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {number}\n */\nfoo: {\nget: RoyaleTest_A.prototype.get__foo}}\n);"); } @Override @@ -63,7 +63,7 @@ public class TestRoyaleAccessorMembers extends TestGoogAccessorMembers asBlockWalker.visitClass(node); assertOut("/**\n * @constructor\n */\nRoyaleTest_A = function() {\n};\n\n\n" + "RoyaleTest_A.prototype.get__foo = function() {\n return -1;\n};\n\n\n" + - "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {number} */\nfoo: {\nget: RoyaleTest_A.prototype.get__foo}}\n);"); + "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {number}\n */\nfoo: {\nget: RoyaleTest_A.prototype.get__foo}}\n);"); } @Override @@ -75,7 +75,7 @@ public class TestRoyaleAccessorMembers extends TestGoogAccessorMembers asBlockWalker.visitClass(node); assertOut("/**\n * @constructor\n * @extends {A}\n */\nB = function() {\n B.base(this, 'constructor');\n};\ngoog.inherits(B, A);\n\n\n" + "B.prototype.get__foo = function() {\n return B.superClass_.get__foo.apply(this);\n};\n\n\n" + - "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {number} */\nfoo: {\nget: B.prototype.get__foo}}\n);"); + "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {number}\n */\nfoo: {\nget: B.prototype.get__foo}}\n);"); } @Test @@ -86,7 +86,7 @@ public class TestRoyaleAccessorMembers extends TestGoogAccessorMembers asBlockWalker.visitClass(node); assertOut("/**\n * @constructor\n * @extends {A}\n */\nB = function() {\n B.base(this, 'constructor');\n};\ngoog.inherits(B, A);\n\n\n" + "B.prototype.get__foo = function() {\n return B.superClass_.get__foo.apply(this);\n};\n\n\n" + - "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {number} */\nfoo: {\nget: B.prototype.get__foo,\nset: A.prototype.set__foo}}\n);"); + "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {number}\n */\nfoo: {\nget: B.prototype.get__foo,\nset: A.prototype.set__foo}}\n);"); } @Override @@ -97,9 +97,9 @@ public class TestRoyaleAccessorMembers extends TestGoogAccessorMembers IClassNode.class, WRAP_LEVEL_CLASS); asBlockWalker.visitClass(node); assertOut("/**\n * @constructor\n */\nRoyaleTest_A = function() {\n};\n\n\n" + - "/**\n * @nocollapse\n * @export\n * @type {number}\n */\nRoyaleTest_A.foo;\n\n\n" + + "/**\n * @nocollapse\n * @export\n * @type {number}\n */\nRoyaleTest_A.foo;\n\n\n" + "RoyaleTest_A.get__foo = function() {\n return -1;\n};\n\n\n" + - "Object.defineProperties(RoyaleTest_A, /** @lends {RoyaleTest_A} */ {\n/**\n * @type {number} */\nfoo: {\nget: RoyaleTest_A.get__foo}}\n);"); + "Object.defineProperties(RoyaleTest_A, /** @lends {RoyaleTest_A} */ {\n/**\n * @type {number}\n */\nfoo: {\nget: RoyaleTest_A.get__foo}}\n);"); } @Override @@ -111,7 +111,7 @@ public class TestRoyaleAccessorMembers extends TestGoogAccessorMembers asBlockWalker.visitClass(node); assertOut("/**\n * @constructor\n */\nRoyaleTest_A = function() {\n};\n\n\n" + "RoyaleTest_A.prototype.set__foo = function(value) {\n};\n\n\n" + - "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {number} */\nfoo: {\nset: RoyaleTest_A.prototype.set__foo}}\n);"); + "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {number}\n */\nfoo: {\nset: RoyaleTest_A.prototype.set__foo}}\n);"); } @Override @@ -123,7 +123,7 @@ public class TestRoyaleAccessorMembers extends TestGoogAccessorMembers asBlockWalker.visitClass(node); assertOut("/**\n * @constructor\n */\nRoyaleTest_A = function() {\n};\n\n\n" + "RoyaleTest_A.prototype.set__foo = function(value) {\n fetch('haai');\n};\n\n\n" + - "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {number} */\nfoo: {\nset: RoyaleTest_A.prototype.set__foo}}\n);"); + "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {number}\n */\nfoo: {\nset: RoyaleTest_A.prototype.set__foo}}\n);"); } @Override @@ -135,7 +135,7 @@ public class TestRoyaleAccessorMembers extends TestGoogAccessorMembers asBlockWalker.visitClass(node); assertOut("/**\n * @constructor\n */\nRoyaleTest_A = function() {\n};\n\n\n" + "RoyaleTest_A.prototype.set__foo = function(value) {\n};\n\n\n" + - "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {number} */\nfoo: {\nset: RoyaleTest_A.prototype.set__foo}}\n);"); + "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {number}\n */\nfoo: {\nset: RoyaleTest_A.prototype.set__foo}}\n);"); } @Override @@ -147,7 +147,7 @@ public class TestRoyaleAccessorMembers extends TestGoogAccessorMembers asBlockWalker.visitClass(node); assertOut("/**\n * @constructor\n * @extends {A}\n */\nB = function() {\n B.base(this, 'constructor');\n};\ngoog.inherits(B, A);\n\n\n" + "B.prototype.set__foo = function(value) {\n B.superClass_.set__foo.apply(this, [ value] );\n};\n\n\n" + - "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {number} */\nfoo: {\nset: B.prototype.set__foo}}\n);"); + "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {number}\n */\nfoo: {\nset: B.prototype.set__foo}}\n);"); } @Override @@ -158,9 +158,9 @@ public class TestRoyaleAccessorMembers extends TestGoogAccessorMembers IClassNode.class, WRAP_LEVEL_CLASS); asBlockWalker.visitClass(node); assertOut("/**\n * @constructor\n */\nRoyaleTest_A = function() {\n};\n\n\n" + - "/**\n * @export\n * @type {number}\n */\nRoyaleTest_A.foo;\n\n\n" + + "/**\n * @export\n * @type {number}\n */\nRoyaleTest_A.foo;\n\n\n" + "RoyaleTest_A.set__foo = function(value) {\n};\n\n\n" + - "Object.defineProperties(RoyaleTest_A, /** @lends {RoyaleTest_A} */ {\n/**\n * @type {number} */\nfoo: {\nset: RoyaleTest_A.set__foo}}\n);"); + "Object.defineProperties(RoyaleTest_A, /** @lends {RoyaleTest_A} */ {\n/**\n * @type {number}\n */\nfoo: {\nset: RoyaleTest_A.set__foo}}\n);"); } @Test @@ -171,7 +171,7 @@ public class TestRoyaleAccessorMembers extends TestGoogAccessorMembers asBlockWalker.visitClass(node); assertOut("/**\n * @constructor\n * @extends {A}\n */\nB = function() {\n B.base(this, 'constructor');\n};\ngoog.inherits(B, A);\n\n\n" + "B.prototype.set__foo = function(value) {\n B.superClass_.set__foo.apply(this, [ value] );\n};\n\n\n" + - "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {number} */\nfoo: {\nget: A.prototype.get__foo,\nset: B.prototype.set__foo}}\n);"); + "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {number}\n */\nfoo: {\nget: A.prototype.get__foo,\nset: B.prototype.set__foo}}\n);"); } @Override diff --git a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleAccessors.java b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleAccessors.java index 3f49465..8cd7047 100644 --- a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleAccessors.java +++ b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleAccessors.java @@ -49,7 +49,7 @@ public class TestRoyaleAccessors extends ASTestBase String expected = "/**\n * @constructor\n */\nRoyaleTest_A = function() {\n};\n\n\n/**\n */\nRoyaleTest_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 */\nRoyaleTest_A.prototype._label = null;\n\n\n" + "RoyaleTest_A.prototype.get__label = function() {\n return this._label;\n};\n\n\n" + "RoyaleTest_A.prototype.set__label = function(value) {\n this._label = value;\n};\n\n\n" + - "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {string} */\n" + + "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {string}\n */\n" + "label: {\nget: RoyaleTest_A.prototype.get__label,\nset: RoyaleTest_A.prototype.set__label}}\n);"; assertOut(expected); } @@ -64,7 +64,7 @@ public class TestRoyaleAccessors extends ASTestBase String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\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 = null;\n\n\n" + "B.prototype.get__label = function() {\n return this._label;\n};\n\n\n" + "B.prototype.set__label = function(value) {\n this._label = value;\n};\n\n\n" + - "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {string} */\nlabel: {\n" + + "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {string}\n */\nlabel: {\n" + "get: B.prototype.get__label,\nset: B.prototype.set__label}}\n);"; assertOut(expected); } @@ -79,7 +79,7 @@ public class TestRoyaleAccessors extends ASTestBase String expected = "/**\n * @constructor\n */\nRoyaleTest_A = function() {\n};\n\n\n/**\n */\nRoyaleTest_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 */\nRoyaleTest_A.prototype._label = null;\n\n\n" + "RoyaleTest_A.prototype.get__label = function() {\n return this._label;\n};\n\n\n" + "RoyaleTest_A.prototype.set__label = function(value) {\n this._label = value;\n};\n\n\n" + - "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {string} */\nlabel: {\n" + + "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {string}\n */\nlabel: {\n" + "get: RoyaleTest_A.prototype.get__label,\nset: RoyaleTest_A.prototype.set__label}}\n);"; assertOut(expected); } @@ -94,7 +94,7 @@ public class TestRoyaleAccessors extends ASTestBase String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\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 = null;\n\n\n" + "B.prototype.get__label = function() {\n return this._label;\n};\n\n\n" + "B.prototype.set__label = function(value) {\n this._label = value;\n};\n\n\n" + - "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {string} */\nlabel: {\n" + + "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {string}\n */\nlabel: {\n" + "get: B.prototype.get__label,\nset: B.prototype.set__label}}\n);"; assertOut(expected); } @@ -109,7 +109,7 @@ public class TestRoyaleAccessors extends ASTestBase String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n */\nB.prototype.doStuff = function() {\n var /** @type {string} */ theLabel = this.http_$$ns_apache_org$2017$custom$namespace__label;\n this.http_$$ns_apache_org$2017$custom$namespace__label = theLabel;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB.prototype._label = null;\n\n\n" + "B.prototype.http_$$ns_apache_org$2017$custom$namespace__get__label = function() {\n return this._label;\n};\n\n\n" + "B.prototype.http_$$ns_apache_org$2017$custom$namespace__set__label = function(value) {\n this._label = value;\n};\n\n\n" + - "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {string} */\nhttp_$$ns_apache_org$2017$custom$namespace__label: {\nget: B.prototype.http_$$ns_apache_org$2017$custom$namespace__get__label,\nset: B.prototype.http_$$ns_apache_org$2017$custom$namespace__set__label}}\n);"; + "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {string}\n */\nhttp_$$ns_apache_org$2017$custom$namespace__label: {\nget: B.prototype.http_$$ns_apache_org$2017$custom$namespace__get__label,\nset: B.prototype.http_$$ns_apache_org$2017$custom$namespace__set__label}}\n);"; assertOut(expected); } @@ -123,7 +123,7 @@ public class TestRoyaleAccessors extends ASTestBase String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n */\nB.prototype.doStuff = function() {\n var /** @type {string} */ theLabel = this.http_$$ns_apache_org$2017$custom$namespace__label;\n this.http_$$ns_apache_org$2017$custom$namespace__label = theLabel;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB.prototype._label = null;\n\n\n" + "B.prototype.http_$$ns_apache_org$2017$custom$namespace__get__label = function() {\n return this._label;\n};\n\n\n" + "B.prototype.http_$$ns_apache_org$2017$custom$namespace__set__label = function(value) {\n this._label = value;\n};\n\n\n" + - "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {string} */\nhttp_$$ns_apache_org$2017$custom$namespace__label: {\nget: B.prototype.http_$$ns_apache_org$2017$custom$namespace__get__label,\nset: B.prototype.http_$$ns_apache_org$2017$custom$namespace__set__label}}\n);"; + "Object.defineProperties(B.prototype, /** @lends {B.prototype} */ {\n/**\n * @type {string}\n */\nhttp_$$ns_apache_org$2017$custom$namespace__label: {\nget: B.prototype.http_$$ns_apache_org$2017$custom$namespace__get__label,\nset: B.prototype.http_$$ns_apache_org$2017$custom$namespace__set__label}}\n);"; assertOut(expected); } @@ -135,10 +135,10 @@ public class TestRoyaleAccessors extends ASTestBase IClassNode.class, WRAP_LEVEL_PACKAGE); asBlockWalker.visitClass(node); String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n */\nB.prototype.doStuff = function() {\n var /** @type {string} */ theLabel = B.http_$$ns_apache_org$2017$custom$namespace__label;\n B.http_$$ns_apache_org$2017$custom$namespace__label = theLabel;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB._label = null;\n\n\n" + - "/**\n * @nocollapse\n * @export\n * @type {string}\n */\nB.http_$$ns_apache_org$2017$custom$namespace__label;\n\n\n" + + "/**\n * @nocollapse\n * @export\n * @type {string}\n */\nB.http_$$ns_apache_org$2017$custom$namespace__label;\n\n\n" + "B.http_$$ns_apache_org$2017$custom$namespace__get__label = function() {\n return B._label;\n};\n\n\n" + "B.http_$$ns_apache_org$2017$custom$namespace__set__label = function(value) {\n B._label = value;\n};\n\n\n" + - "Object.defineProperties(B, /** @lends {B} */ {\n/**\n * @type {string} */\nhttp_$$ns_apache_org$2017$custom$namespace__label: {\nget: B.http_$$ns_apache_org$2017$custom$namespace__get__label,\nset: B.http_$$ns_apache_org$2017$custom$namespace__set__label}}\n);"; + "Object.defineProperties(B, /** @lends {B} */ {\n/**\n * @type {string}\n */\nhttp_$$ns_apache_org$2017$custom$namespace__label: {\nget: B.http_$$ns_apache_org$2017$custom$namespace__get__label,\nset: B.http_$$ns_apache_org$2017$custom$namespace__set__label}}\n);"; assertOut(expected); } @@ -150,10 +150,10 @@ public class TestRoyaleAccessors extends ASTestBase IClassNode.class, WRAP_LEVEL_PACKAGE); asBlockWalker.visitClass(node); String expected = "/**\n * @constructor\n */\nB = function() {\n};\n\n\n/**\n */\nB.prototype.doStuff = function() {\n var /** @type {string} */ theLabel = B.http_$$ns_apache_org$2017$custom$namespace__label;\n B.http_$$ns_apache_org$2017$custom$namespace__label = theLabel;\n};\n\n\n/**\n * @private\n * @type {string}\n */\nB._label = null;\n\n\n" + - "/**\n * @nocollapse\n * @export\n * @type {string}\n */\nB.http_$$ns_apache_org$2017$custom$namespace__label;\n\n\n" + + "/**\n * @nocollapse\n * @export\n * @type {string}\n */\nB.http_$$ns_apache_org$2017$custom$namespace__label;\n\n\n" + "B.http_$$ns_apache_org$2017$custom$namespace__get__label = function() {\n return B._label;\n};\n\n\n" + "B.http_$$ns_apache_org$2017$custom$namespace__set__label = function(value) {\n B._label = value;\n};\n\n\n" + - "Object.defineProperties(B, /** @lends {B} */ {\n/**\n * @type {string} */\nhttp_$$ns_apache_org$2017$custom$namespace__label: {\nget: B.http_$$ns_apache_org$2017$custom$namespace__get__label,\nset: B.http_$$ns_apache_org$2017$custom$namespace__set__label}}\n);"; + "Object.defineProperties(B, /** @lends {B} */ {\n/**\n * @type {string}\n */\nhttp_$$ns_apache_org$2017$custom$namespace__label: {\nget: B.http_$$ns_apache_org$2017$custom$namespace__get__label,\nset: B.http_$$ns_apache_org$2017$custom$namespace__set__label}}\n);"; assertOut(expected); } @@ -178,7 +178,8 @@ public class TestRoyaleAccessors extends ASTestBase "}\n};\n\n\n" + "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n" + "/**\n" + - " * @type {string} */\n" + + " * @type {string}\n" + + " */\n" + "label: {\n" + "get: RoyaleTest_A.prototype.get__label,\n" + "set: RoyaleTest_A.prototype.set__label}}\n" + @@ -196,7 +197,7 @@ public class TestRoyaleAccessors extends ASTestBase String expected = "/**\n * @constructor\n */\nRoyaleTest_A = function() {\n};\n\n\n/**\n */\nRoyaleTest_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 */\nRoyaleTest_A.prototype._label = null;\n\n\n" + "RoyaleTest_A.prototype.get__label = function() {\n return this._label;\n};\n\n\n" + "RoyaleTest_A.prototype.set__label = function(value) {\n this._label = value;\n};\n\n\n" + - "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {string} */\n" + + "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n/**\n * @type {string}\n */\n" + "label: {\nget: RoyaleTest_A.prototype.get__label,\nset: RoyaleTest_A.prototype.set__label}}\n);"; assertOut(expected); } diff --git a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleClass.java b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleClass.java index c995ea5..b8f50e1 100644 --- a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleClass.java +++ b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleClass.java @@ -261,7 +261,7 @@ public class TestRoyaleClass 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.royale.B = function() {\n};\n\n\norg.apache.royale.B.prototype.set__baz = function(value) {\n};\n\n\norg.apache.royale.B.prototype.set__foo = function(value) {\n this.baz = value;\n};\n\n\nObject.defineProperties(org.apache.royale.B.prototype, /** @lends {org.apache.royale.B.prototype} */ {\n/**\n * @type {Object} */\nbaz: {\nset: org.apache.royale.B.prototype.set__baz},\n/**\n * @type {Object} */\nfoo: {\nset: org.apach [...] + String expected = "/**\n * @constructor\n */\norg.apache.royale.B = function() {\n};\n\n\norg.apache.royale.B.prototype.set__baz = function(value) {\n};\n\n\norg.apache.royale.B.prototype.set__foo = function(value) {\n this.baz = value;\n};\n\n\nObject.defineProperties(org.apache.royale.B.prototype, /** @lends {org.apache.royale.B.prototype} */ {\n/**\n * @type {Object}\n */\nbaz: {\nset: org.apache.royale.B.prototype.set__baz},\n/**\n * @type {Object}\n */\nfoo: {\nset: org.apa [...] assertOut(expected); } @@ -270,7 +270,7 @@ public class TestRoyaleClass extends TestGoogClass { IClassNode node = getClassNode("public class B extends A {public function B() {}; override public function set foo(value:Object):void {super.foo = value;};} class A {public function set foo(value:Object):void {}}"); asBlockWalker.visitClass(node); - String expected = "/**\n * @constructor\n * @extends {org.apache.royale.A}\n */\norg.apache.royale.B = function() {\n org.apache.royale.B.base(this, 'constructor');\n};\ngoog.inherits(org.apache.royale.B, org.apache.royale.A);\n\n\norg.apache.royale.B.prototype.set__foo = function(value) {\n org.apache.royale.B.superClass_.set__foo.apply(this, [ value] );\n};\n\n\nObject.defineProperties(org.apache.royale.B.prototype, /** @lends {org.apache.royale.B.prototype} */ {\n/**\n * @t [...] + String expected = "/**\n * @constructor\n * @extends {org.apache.royale.A}\n */\norg.apache.royale.B = function() {\n org.apache.royale.B.base(this, 'constructor');\n};\ngoog.inherits(org.apache.royale.B, org.apache.royale.A);\n\n\norg.apache.royale.B.prototype.set__foo = function(value) {\n org.apache.royale.B.superClass_.set__foo.apply(this, [ value] );\n};\n\n\nObject.defineProperties(org.apache.royale.B.prototype, /** @lends {org.apache.royale.B.prototype} */ {\n/**\n * @ty [...] assertOut(expected); } @@ -335,7 +335,7 @@ public class TestRoyaleClass extends TestGoogClass "\n" + "Object.defineProperties(org.apache.royale.B.A.prototype, /** @lends {org.apache.royale.B.A.prototype} */ {\n" + "/**\n" + - " * @type {org.apache.royale.B.A} */\n" + + " * @type {org.apache.royale.B.A}\n */\n" + "a: {\n" + "get: org.apache.royale.B.A.prototype.get__a}}\n" + ");\n" + @@ -426,7 +426,8 @@ public class TestRoyaleClass extends TestGoogClass " */\n" + "org.apache.royale.A.prototype.e = NaN;Object.defineProperties(org.apache.royale.A.prototype, /** @lends {org.apache.royale.A.prototype} */ {\n" + "/**\n" + - " * @type {Object} */\n" + + " * @type {Object}\n" + + " */\n" + "a: {\n" + "/** @this {org.apache.royale.A} */\n" + " get: function() {\n" + @@ -443,8 +444,9 @@ public class TestRoyaleClass extends TestGoogClass "}\n" + "}}," + "/**\n" + - " * @private\n" + - " * @type {string} */\n" + + " * @private\n" + + " * @type {string}\n" + + " */\n" + "b: {\n" + "/** @this {org.apache.royale.A} */\n" + " get: function() {\n" + @@ -460,8 +462,9 @@ public class TestRoyaleClass extends TestGoogClass " this, \"b\", oldValue, value));\n" + "}\n" + "}},/**\n" + - " * @private\n" + - " * @type {number} */\n" + + " * @private\n" + + " * @type {number}\n" + + " */\n" + "c: {\n" + "/** @this {org.apache.royale.A} */\n" + " get: function() {\n" + @@ -515,7 +518,8 @@ public class TestRoyaleClass extends TestGoogClass " */\n" + "org.apache.royale.A.prototype.e = NaN;Object.defineProperties(org.apache.royale.A.prototype, /** @lends {org.apache.royale.A.prototype} */ {\n" + "/**\n" + - " * @type {Object} */\n" + + " * @type {Object}\n" + + " */\n" + "a: {\n" + "/** @this {org.apache.royale.A} */\n" + " get: function() {\n" + @@ -532,8 +536,9 @@ public class TestRoyaleClass extends TestGoogClass "}\n" + "}}," + "/**\n" + - " * @private\n" + - " * @type {string} */\n" + + " * @private\n" + + " * @type {string}\n" + + " */\n" + "b: {\n" + "/** @this {org.apache.royale.A} */\n" + " get: function() {\n" + @@ -549,8 +554,9 @@ public class TestRoyaleClass extends TestGoogClass " this, \"b\", oldValue, value));\n" + "}\n" + "}},/**\n" + - " * @private\n" + - " * @type {number} */\n" + + " * @private\n" + + " * @type {number}\n" + + " */\n" + "c: {\n" + "/** @this {org.apache.royale.A} */\n" + " get: function() {\n" + @@ -603,7 +609,8 @@ public class TestRoyaleClass extends TestGoogClass " */\n" + "org.apache.royale.A.prototype.e = NaN;Object.defineProperties(org.apache.royale.A.prototype, /** @lends {org.apache.royale.A.prototype} */ {\n" + "/**\n" + - " * @type {Object} */\n" + + " * @type {Object}\n" + + " */\n" + "a: {\n" + "/** @this {org.apache.royale.A} */\n" + " get: function() {\n" + @@ -679,11 +686,11 @@ public class TestRoyaleClass extends TestGoogClass "org.apache.royale.A.prototype.set__foo5 = function(value) {\n};\n\n\n" + "org.apache.royale.A.prototype.http_$$ns_apache_org$2017$custom$namespace__get__foo6 = function() {\n return null;\n};\n\n\n" + "org.apache.royale.A.prototype.http_$$ns_apache_org$2017$custom$namespace__set__foo6 = function(value) {\n};\n\n\n" + - "Object.defineProperties(org.apache.royale.A.prototype, /** @lends {org.apache.royale.A.prototype} */ {\n/**\n * @type {Object} */\n" + - "foo1: {\nget: org.apache.royale.A.prototype.get__foo1,\nset: org.apache.royale.A.prototype.set__foo1},\n/**\n * @type {Object} */\n" + - "foo2: {\nget: org.apache.royale.A.prototype.get__foo2,\nset: org.apache.royale.A.prototype.set__foo2},\n/**\n * @type {Object} */\n" + - "foo3: {\nget: org.apache.royale.A.prototype.get__foo3,\nset: org.apache.royale.A.prototype.set__foo3},\n/**\n * @type {Object} */\n" + - "foo5: {\nget: org.apache.royale.A.prototype.get__foo5,\nset: org.apache.royale.A.prototype.set__foo5},\n/**\n * @type {Object} */\n" + + "Object.defineProperties(org.apache.royale.A.prototype, /** @lends {org.apache.royale.A.prototype} */ {\n/**\n * @type {Object}\n */\n" + + "foo1: {\nget: org.apache.royale.A.prototype.get__foo1,\nset: org.apache.royale.A.prototype.set__foo1},\n/**\n * @type {Object}\n */\n" + + "foo2: {\nget: org.apache.royale.A.prototype.get__foo2,\nset: org.apache.royale.A.prototype.set__foo2},\n/**\n * @type {Object}\n */\n" + + "foo3: {\nget: org.apache.royale.A.prototype.get__foo3,\nset: org.apache.royale.A.prototype.set__foo3},\n/**\n * @type {Object}\n */\n" + + "foo5: {\nget: org.apache.royale.A.prototype.get__foo5,\nset: org.apache.royale.A.prototype.set__foo5},\n/**\n * @type {Object}\n */\n" + "http_$$ns_apache_org$2017$custom$namespace__foo6: {\nget: org.apache.royale.A.prototype.http_$$ns_apache_org$2017$custom$namespace__get__foo6,\n" + "set: org.apache.royale.A.prototype.http_$$ns_apache_org$2017$custom$namespace__set__foo6}}\n);"); } diff --git a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleExpressions.java b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleExpressions.java index fd1fc04..6540ece 100644 --- a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleExpressions.java +++ b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleExpressions.java @@ -125,7 +125,7 @@ public class TestRoyaleExpressions extends TestGoogExpressions " return RoyaleTest_A.superClass_.isDefaultPrevented.apply(this);\n" + "};\n\n\n" + "Object.defineProperties(RoyaleTest_A.prototype, /** @lends {RoyaleTest_A.prototype} */ {\n" + - "/**\n * @type {Object} */\n" + + "/**\n * @type {Object}\n */\n" + "defaultPrevented: {\nget: RoyaleTest_A.prototype.get__defaultPrevented}}\n);"); } diff --git a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyalePackage.java b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyalePackage.java index fba15ec..a24a6b0 100644 --- a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyalePackage.java +++ b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyalePackage.java @@ -838,7 +838,8 @@ public class TestRoyalePackage extends TestGoogPackage "\n" + "Object.defineProperties(foo.bar.baz.A.prototype, /** @lends {foo.bar.baz.A.prototype} */ {\n" + "/**\n" + - " * @type {string} */\n" + + " * @type {string}\n" + + " */\n" + "myString: {\n" + "get: foo.bar.baz.A.prototype.get__myString,\n" + "set: foo.bar.baz.A.prototype.set__myString}}\n" + @@ -899,7 +900,8 @@ public class TestRoyalePackage extends TestGoogPackage "\n" + "Object.defineProperties(foo.bar.baz.A.InternalClass.prototype, /** @lends {foo.bar.baz.A.InternalClass.prototype} */ {\n" + "/**\n" + - " * @type {string} */\n" + + " * @type {string}\n" + + " */\n" + "someString: {\n" + "get: foo.bar.baz.A.InternalClass.prototype.get__someString,\n" + "set: foo.bar.baz.A.InternalClass.prototype.set__someString}}\n" + diff --git a/compiler-jx/src/test/resources/royale/files/MyInitialView_result.js b/compiler-jx/src/test/resources/royale/files/MyInitialView_result.js index 14b46ec..1b42281 100644 --- a/compiler-jx/src/test/resources/royale/files/MyInitialView_result.js +++ b/compiler-jx/src/test/resources/royale/files/MyInitialView_result.js @@ -263,19 +263,23 @@ MyInitialView.prototype.get__comboBoxValue = function() { Object.defineProperties(MyInitialView.prototype, /** @lends {MyInitialView.prototype} */ { /** - * @type {string} */ + * @type {string} + */ symbol: { get: MyInitialView.prototype.get__symbol}, /** - * @type {string} */ + * @type {string} + */ city: { get: MyInitialView.prototype.get__city}, /** - * @type {string} */ + * @type {string} + */ inputText: { get: MyInitialView.prototype.get__inputText}, /** - * @type {string} */ + * @type {string} + */ comboBoxValue: { get: MyInitialView.prototype.get__comboBoxValue}} );/** diff --git a/compiler-jx/src/test/resources/royale/files/models/MyModel_result.js b/compiler-jx/src/test/resources/royale/files/models/MyModel_result.js index fb24481..5be3502 100644 --- a/compiler-jx/src/test/resources/royale/files/models/MyModel_result.js +++ b/compiler-jx/src/test/resources/royale/files/models/MyModel_result.js @@ -85,16 +85,19 @@ models.MyModel.prototype.get__cities = function() { Object.defineProperties(models.MyModel.prototype, /** @lends {models.MyModel.prototype} */ { /** - * @type {string} */ + * @type {string} + */ labelText: { get: models.MyModel.prototype.get__labelText, set: models.MyModel.prototype.set__labelText}, /** - * @type {Array} */ + * @type {Array} + */ strings: { get: models.MyModel.prototype.get__strings}, /** - * @type {Array} */ + * @type {Array} + */ cities: { get: models.MyModel.prototype.get__cities}} ); diff --git a/compiler-jx/src/test/resources/royale/projects/super/Base_result.js b/compiler-jx/src/test/resources/royale/projects/super/Base_result.js index 7596b54..fcaa48c 100644 --- a/compiler-jx/src/test/resources/royale/projects/super/Base_result.js +++ b/compiler-jx/src/test/resources/royale/projects/super/Base_result.js @@ -49,7 +49,8 @@ Base.prototype.set__text = function(value) { Object.defineProperties(Base.prototype, /** @lends {Base.prototype} */ { /** - * @type {string} */ + * @type {string} + */ text: { get: Base.prototype.get__text, set: Base.prototype.set__text}} diff --git a/compiler-jx/src/test/resources/royale/projects/super/Super_result.js b/compiler-jx/src/test/resources/royale/projects/super/Super_result.js index 002c1ad..6991be4 100644 --- a/compiler-jx/src/test/resources/royale/projects/super/Super_result.js +++ b/compiler-jx/src/test/resources/royale/projects/super/Super_result.js @@ -51,7 +51,8 @@ Super.prototype.set__text = function(value) { Object.defineProperties(Super.prototype, /** @lends {Super.prototype} */ { /** - * @type {string} */ + * @type {string} + */ text: { get: Super.prototype.get__text, set: Super.prototype.set__text}}
