You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2013/04/19 13:55:01 UTC
[02/10] git commit: [flex-falcon] - [FalconJX] rename and minor
addition
[FalconJX] rename and minor addition
Renamed from 'JSFlexJSGoogDocEmitter' to 'JSFlexJSDocEmitter'.
Created override of 'emitMethodDoc' to allow for a method access identifier (@expose, @protected etc.) for ALL members of a class.
Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/0a086355
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/0a086355
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/0a086355
Branch: refs/heads/develop
Commit: 0a086355e23d12b605e5a4800ee87f7efc669908
Parents: ae94d2b
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Fri Apr 19 12:59:49 2013 +0200
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Fri Apr 19 12:59:49 2013 +0200
----------------------------------------------------------------------
.../codegen/js/flexjs/JSFlexJSDocEmitter.java | 176 +++++++++++++++
.../codegen/js/flexjs/JSFlexJSGoogDocEmitter.java | 52 -----
2 files changed, 176 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0a086355/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
new file mode 100644
index 0000000..b052593
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSDocEmitter.java
@@ -0,0 +1,176 @@
+/*
+ *
+ * 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.js.flexjs;
+
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.common.ASModifier;
+import org.apache.flex.compiler.common.DependencyType;
+import org.apache.flex.compiler.constants.IASKeywordConstants;
+import org.apache.flex.compiler.constants.IASLanguageConstants;
+import org.apache.flex.compiler.definitions.IClassDefinition;
+import org.apache.flex.compiler.definitions.ITypeDefinition;
+import org.apache.flex.compiler.definitions.references.IReference;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogDocEmitter;
+import org.apache.flex.compiler.internal.scopes.ASScope;
+import org.apache.flex.compiler.projects.ICompilerProject;
+import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IParameterNode;
+
+public class JSFlexJSDocEmitter extends JSGoogDocEmitter
+{
+
+ public JSFlexJSDocEmitter(IJSEmitter emitter)
+ {
+ super(emitter);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void emitMethodDoc(IFunctionNode node, ICompilerProject project)
+ {
+ IClassDefinition classDefinition = resolveClassDefinition(node);
+
+ if (node instanceof IFunctionNode)
+ {
+ boolean hasDoc = false;
+
+ if (node.isConstructor())
+ {
+ begin();
+ hasDoc = true;
+
+ emitJSDocLine(JSEmitterTokens.CONSTRUCTOR);
+
+ IClassDefinition parent = (IClassDefinition) node
+ .getDefinition().getParent();
+ IClassDefinition superClass = parent.resolveBaseClass(project);
+ String qname = superClass.getQualifiedName();
+
+ if (superClass != null
+ && !qname.equals(IASLanguageConstants.Object))
+ emitExtends(superClass, superClass.getPackageName());
+
+ IReference[] references = classDefinition
+ .getImplementedInterfaceReferences();
+ for (IReference iReference : references)
+ {
+ ITypeDefinition type = (ITypeDefinition) iReference
+ .resolve(project, (ASScope) classDefinition
+ .getContainingScope(),
+ DependencyType.INHERITANCE, true);
+ emitImplements(type, type.getPackageName());
+ }
+ }
+ else
+ {
+ String ns = node.getNamespace();
+ if (ns != null)
+ {
+ begin();
+ emitMethodAccess(node);
+ hasDoc = true;
+ }
+
+ // @this
+ if (containsThisReference(node))
+ {
+ if (!hasDoc)
+ {
+ begin();
+ emitMethodAccess(node);
+ hasDoc = true;
+ }
+
+ emitThis(classDefinition, classDefinition.getPackageName());
+ }
+ }
+
+ // @param
+ IParameterNode[] parameters = node.getParameterNodes();
+ for (IParameterNode pnode : parameters)
+ {
+ if (!hasDoc)
+ {
+ begin();
+ emitMethodAccess(node);
+ hasDoc = true;
+ }
+
+ IExpressionNode enode = pnode.getNameExpressionNode();
+ emitParam(pnode, enode.resolveType(project).getPackageName());
+ }
+
+ if (!node.isConstructor())
+ {
+ // @return
+ String returnType = node.getReturnType();
+ if (returnType != ""
+ && returnType != ASEmitterTokens.VOID.getToken())
+ {
+ if (!hasDoc)
+ {
+ begin();
+ emitMethodAccess(node);
+ hasDoc = true;
+ }
+
+ emitReturn(node, node.getPackageName());
+ }
+
+ // @override
+ Boolean override = node.hasModifier(ASModifier.OVERRIDE);
+ if (override)
+ {
+ if (!hasDoc)
+ {
+ begin();
+ emitMethodAccess(node);
+ hasDoc = true;
+ }
+
+ emitOverride(node);
+ }
+ }
+
+ if (hasDoc)
+ end();
+ }
+ }
+
+ @Override
+ public void emitMethodAccess(IFunctionNode node)
+ {
+ String ns = node.getNamespace();
+ if (ns == IASKeywordConstants.PRIVATE)
+ {
+ emitPrivate(node);
+ }
+ else if (ns == IASKeywordConstants.PROTECTED)
+ {
+ emitProtected(node);
+ }
+ else if (ns == IASKeywordConstants.PUBLIC)
+ {
+ emitPublic(node);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0a086355/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSGoogDocEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSGoogDocEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSGoogDocEmitter.java
deleted file mode 100644
index 249086a..0000000
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSGoogDocEmitter.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *
- * 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.js.flexjs;
-
-import org.apache.flex.compiler.codegen.js.IJSEmitter;
-import org.apache.flex.compiler.constants.IASKeywordConstants;
-import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogDocEmitter;
-import org.apache.flex.compiler.tree.as.IFunctionNode;
-
-public class JSFlexJSGoogDocEmitter extends JSGoogDocEmitter
-{
-
- public JSFlexJSGoogDocEmitter(IJSEmitter emitter)
- {
- super(emitter);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public void emitMethodAccess(IFunctionNode node)
- {
- String ns = node.getNamespace();
- if (ns == IASKeywordConstants.PRIVATE)
- {
- emitPrivate(node);
- }
- else if (ns == IASKeywordConstants.PROTECTED)
- {
- emitProtected(node);
- }
- else if (ns == IASKeywordConstants.PUBLIC)
- {
- emitPublic(node);
- }
- }
-}