You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ma...@apache.org on 2019/07/17 19:20:32 UTC
[netbeans] 02/04: Fix compile errors
This is an automated email from the ASF dual-hosted git repository.
matthiasblaesing pushed a commit to branch graaljs2
in repository https://gitbox.apache.org/repos/asf/netbeans.git
commit e24b95184fc5d7fee3964b5d4588819047ba582a
Author: Matthias Bläsing <mb...@doppel-helix.eu>
AuthorDate: Fri May 3 20:34:42 2019 +0200
Fix compile errors
---
.../editor/formatter/JsFormatVisitor.java | 2 +-
.../javascript2/editor/hints/Ecma6Rule.java | 9 +-
.../javascript2/editor/hints/Ecma7Rule.java | 2 +-
.../javascript2/editor/hints/JsConventionRule.java | 10 +--
.../javascript2/editor/hints/WeirdAssignment.java | 2 +-
.../javascript2/editor/parser/JsParser.java | 2 +-
.../javascript2/editor/parser/AstXmlVisitor.java | 6 +-
.../modules/javascript2/model/ModelVisitor.java | 95 +++++++++++-----------
.../javascript2/model/SemiTypeResolverVisitor.java | 26 +++---
9 files changed, 75 insertions(+), 79 deletions(-)
diff --git a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/formatter/JsFormatVisitor.java b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/formatter/JsFormatVisitor.java
index 1fcedd3..630ef37 100644
--- a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/formatter/JsFormatVisitor.java
+++ b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/formatter/JsFormatVisitor.java
@@ -1450,7 +1450,7 @@ public class JsFormatVisitor extends NodeVisitor implements JsxNodeVisitor {
}
private int getStart(BinaryNode node) {
- return getStart(node.lhs());
+ return getStart(node.getLhs());
}
private static int getFunctionStart(FunctionNode node) {
diff --git a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/Ecma6Rule.java b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/Ecma6Rule.java
index 290d1f6..281ad89 100644
--- a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/Ecma6Rule.java
+++ b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/Ecma6Rule.java
@@ -35,7 +35,6 @@ import com.oracle.js.parser.ir.Statement;
import com.oracle.js.parser.ir.TernaryNode;
import com.oracle.js.parser.ir.UnaryNode;
import com.oracle.js.parser.ir.VarNode;
-import com.sun.javafx.fxml.expression.BinaryExpression;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -169,17 +168,17 @@ public class Ecma6Rule extends EcmaLevelRule {
}
BinaryNode bn = (BinaryNode)tn.getTest();
if (!(
- (bn.lhs() instanceof ParameterNode) &&
- (bn.rhs() instanceof UnaryNode) &&
+ (bn.getLhs() instanceof ParameterNode) &&
+ (bn.getRhs() instanceof UnaryNode) &&
(bn.tokenType() == TokenType.EQ_STRICT) &&
- (bn.rhs().tokenType() == TokenType.VOID))) {
+ (bn.getRhs().tokenType() == TokenType.VOID))) {
return false;
}
if (!((tn.getTrueExpression() instanceof JoinPredecessorExpression) && (tn.getFalseExpression() instanceof JoinPredecessorExpression))) {
return false;
}
Expression e = ((JoinPredecessorExpression)tn.getFalseExpression()).getExpression();
- if (e != bn.lhs()) {
+ if (e != bn.getLhs()) {
return false;
}
return true;
diff --git a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/Ecma7Rule.java b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/Ecma7Rule.java
index 8d0356a..3bdc40d 100644
--- a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/Ecma7Rule.java
+++ b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/Ecma7Rule.java
@@ -185,7 +185,7 @@ public class Ecma7Rule extends EcmaLevelRule {
int position = Token.descPosition(token);
addHint(context, hints, new OffsetRange(position, position + Token.descLength(token)));
} else if (TokenType.COMMARIGHT == type) {
- Expression rhs = binaryNode.rhs();
+ Expression rhs = binaryNode.getRhs();
if (!rhs.isTokenType(TokenType.COMMARIGHT)) {
checkTrailingComma(rhs.getFinish());
}
diff --git a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/JsConventionRule.java b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/JsConventionRule.java
index ce9af1b..96d4910 100644
--- a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/JsConventionRule.java
+++ b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/JsConventionRule.java
@@ -301,11 +301,11 @@ public class JsConventionRule extends JsAstRule {
ModelUtils.documentOffsetRange(context.getJsParserResult(), condition.getStart(), condition.getFinish()), null, 500));
}
}
- if (binaryNode.lhs() instanceof BinaryNode) {
- checkAssignmentInCondition(binaryNode.lhs());
+ if (binaryNode.getLhs() instanceof BinaryNode) {
+ checkAssignmentInCondition(binaryNode.getLhs());
}
- if (binaryNode.rhs() instanceof BinaryNode) {
- checkAssignmentInCondition(binaryNode.rhs());
+ if (binaryNode.getRhs() instanceof BinaryNode) {
+ checkAssignmentInCondition(binaryNode.getRhs());
}
}
}
@@ -513,7 +513,7 @@ public class JsConventionRule extends JsAstRule {
if (arrayTrailingComma != null) {
if (literalNode.getValue() instanceof Node[]) {
Node previous = getPath().get(getPath().size() - 1);
- if (previous instanceof BinaryNode && ((BinaryNode) previous).lhs() == literalNode) {
+ if (previous instanceof BinaryNode && ((BinaryNode) previous).getLhs() == literalNode) {
// destructuring assignment
return super.enterLiteralNode(literalNode);
}
diff --git a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/WeirdAssignment.java b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/WeirdAssignment.java
index e39a45a..72142b3 100644
--- a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/WeirdAssignment.java
+++ b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/hints/WeirdAssignment.java
@@ -86,7 +86,7 @@ public class WeirdAssignment extends JsAstRule {
@Override
public boolean enterBinaryNode(BinaryNode binaryNode) {
- if (binaryNode.isTokenType(TokenType.ASSIGN) && binaryNode.lhs().toString().equals(binaryNode.rhs().toString())) {
+ if (binaryNode.isTokenType(TokenType.ASSIGN) && binaryNode.getLhs().toString().equals(binaryNode.getRhs().toString())) {
hints.add(new Hint(rule, Bundle.JsWeirdAssignmentDN(),
context.getJsParserResult().getSnapshot().getSource().getFileObject(),
ModelUtils.documentOffsetRange(context.getJsParserResult(), binaryNode.getStart(), binaryNode.getFinish()), null, 500));
diff --git a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/parser/JsParser.java b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/parser/JsParser.java
index 54b8360..5487856 100644
--- a/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/parser/JsParser.java
+++ b/webcommon/javascript2.editor/src/org/netbeans/modules/javascript2/editor/parser/JsParser.java
@@ -96,7 +96,7 @@ public class JsParser extends SanitizingParser<JsParserResult> {
ScriptEnvironment.Builder builder = ScriptEnvironment.builder();
Parser parser = new Parser(
- builder.emptyStatements(true).es6(true)/* .jsx (true) */.build(),
+ builder.emptyStatements(true).build(),
source,
errorManager);
FunctionNode node = null;
diff --git a/webcommon/javascript2.editor/test/unit/src/org/netbeans/modules/javascript2/editor/parser/AstXmlVisitor.java b/webcommon/javascript2.editor/test/unit/src/org/netbeans/modules/javascript2/editor/parser/AstXmlVisitor.java
index 262c9f7..daa7bdb 100644
--- a/webcommon/javascript2.editor/test/unit/src/org/netbeans/modules/javascript2/editor/parser/AstXmlVisitor.java
+++ b/webcommon/javascript2.editor/test/unit/src/org/netbeans/modules/javascript2/editor/parser/AstXmlVisitor.java
@@ -258,8 +258,8 @@ public class AstXmlVisitor extends NodeVisitor implements JsxNodeVisitor {
processAttribute(node.isSelfModifying(), "isSelfModifying");
// processWithComment(node.getAssignmentDest(), "BinaryNode AssignmentDest");
// processWithComment(node.getAssignmentSource(), "BinaryNode AssignmentSource");
- processWithComment(node.lhs(), "BinaryNode lhs");
- processWithComment(node.rhs(), "BinaryNode rhs");
+ processWithComment(node.getLhs(), "BinaryNode lhs");
+ processWithComment(node.getRhs(), "BinaryNode rhs");
createCloseTag(node);
return false;
}
@@ -329,7 +329,6 @@ public class AstXmlVisitor extends NodeVisitor implements JsxNodeVisitor {
processAttribute(node.isProgram(), "isProgram");
processAttribute(node.isNamedFunctionExpression(), "isNamedFunctionExpression");
processAttribute(node.isSubclassConstructor(), "isSubclassConstructor");
- processAttribute(node.isVarArg(), "isVarArg");
processAttribute(node.isAsync(), "isAsync");
processAttribute(node);
@@ -367,7 +366,6 @@ public class AstXmlVisitor extends NodeVisitor implements JsxNodeVisitor {
// processAttribute(node.isDestructuredParameter(), "isDestructuredParameter");
processAttribute(node.isDirectSuper(), "isDirectSuppert");
processAttribute(node.isFunction(), "isFunction");
- processAttribute(node.isFutureStrictName(), "isFutureStrictName");
processAttribute(node.isInitializedHere(), "isInitializedHere");
processAttribute(node.isInternal(), "isInternal");
processAttribute(node.isPropertyName(), "isPropertyName");
diff --git a/webcommon/javascript2.model/src/org/netbeans/modules/javascript2/model/ModelVisitor.java b/webcommon/javascript2.model/src/org/netbeans/modules/javascript2/model/ModelVisitor.java
index e82a52c..b01d439 100644
--- a/webcommon/javascript2.model/src/org/netbeans/modules/javascript2/model/ModelVisitor.java
+++ b/webcommon/javascript2.model/src/org/netbeans/modules/javascript2/model/ModelVisitor.java
@@ -254,8 +254,8 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
@Override
public boolean enterBinaryNode(BinaryNode binaryNode) {
- Node lhs = binaryNode.lhs();
- Node rhs = binaryNode.rhs();
+ Node lhs = binaryNode.getLhs();
+ Node rhs = binaryNode.getRhs();
if (lhs instanceof LiteralNode.ArrayLiteralNode && binaryNode.tokenType() == TokenType.ASSIGN) {
// case of destructuring assgnment like [a,b] = ....
LiteralNode.ArrayLiteralNode lan = (LiteralNode.ArrayLiteralNode)lhs;
@@ -320,9 +320,9 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
variableName = ((IdentNode)lPropertyNode.getValue()).getName();
} else if (lPropertyNode.getValue() instanceof BinaryNode) {
BinaryNode bNode = (BinaryNode)lPropertyNode.getValue();
- if (bNode.tokenType() == TokenType.ASSIGN && bNode.lhs() instanceof IdentNode) {
+ if (bNode.tokenType() == TokenType.ASSIGN && bNode.getLhs() instanceof IdentNode) {
// the default parameter {a=10, b=20} = ....
- variableName = ((IdentNode)bNode.lhs()).getName();
+ variableName = ((IdentNode)bNode.getLhs()).getName();
}
}
if (variableName != null) {
@@ -355,9 +355,9 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
return key.getName().equals(value.getName()) && key.getStart() == value.getStart();
}
if (pNode.getKey() instanceof IdentNode && pNode.getValue() instanceof BinaryNode
- && ((BinaryNode)pNode.getValue()).tokenType() == TokenType.ASSIGN && ((BinaryNode)pNode.getValue()).lhs() instanceof IdentNode) {
+ && ((BinaryNode)pNode.getValue()).tokenType() == TokenType.ASSIGN && ((BinaryNode)pNode.getValue()).getLhs() instanceof IdentNode) {
IdentNode key = (IdentNode)pNode.getKey();
- IdentNode value = (IdentNode)((BinaryNode)pNode.getValue()).lhs();
+ IdentNode value = (IdentNode)((BinaryNode)pNode.getValue()).getLhs();
return key.getName().equals(value.getName()) && key.getStart() == value.getStart();
}
return false;
@@ -493,10 +493,10 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
@Override
public Node leaveBinaryNode(BinaryNode binaryNode) {
- Node lhs = binaryNode.lhs();
- Node rhs = binaryNode.rhs();
+ Node lhs = binaryNode.getLhs();
+ Node rhs = binaryNode.getRhs();
if (lhs instanceof IdentNode && rhs instanceof BinaryNode) {
- Node rlhs = ((BinaryNode)rhs).lhs();
+ Node rlhs = ((BinaryNode)rhs).getLhs();
if (rlhs instanceof IdentNode) {
JsObject origFunction = modelBuilder.getCurrentDeclarationFunction().getProperty(((IdentNode)rlhs).getName());
if (origFunction != null && origFunction.getJSKind().isFunction()) {
@@ -1655,23 +1655,23 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
} else if (init instanceof BinaryNode) {
BinaryNode bNode = (BinaryNode) init;
if (bNode.isLogical()
- && ((bNode.rhs() instanceof JoinPredecessorExpression && ((JoinPredecessorExpression) bNode.rhs()).getExpression() instanceof FunctionNode)
- || (bNode.lhs() instanceof JoinPredecessorExpression && ((JoinPredecessorExpression) bNode.lhs()).getExpression() instanceof FunctionNode))) {
+ && ((bNode.getRhs() instanceof JoinPredecessorExpression && ((JoinPredecessorExpression) bNode.getRhs()).getExpression() instanceof FunctionNode)
+ || (bNode.getLhs() instanceof JoinPredecessorExpression && ((JoinPredecessorExpression) bNode.getLhs()).getExpression() instanceof FunctionNode))) {
// case: var f1 = xxx || function () {}
// the function here is already, need to be just fixed the name offsets
createVariable = false;
} else if (bNode.isAssignment()) {
createVariable = false;
if (parentFn.getProperty(varNode.getName().getName()) == null) {
- while (bNode.rhs() instanceof BinaryNode && bNode.rhs().isAssignment()) {
+ while (bNode.getRhs() instanceof BinaryNode && bNode.getRhs().isAssignment()) {
// the cycle is trying to find out a FunctionNode at the end of assignements
// case var f1 = f2 = f3 = f4 = function () {}
- bNode = (BinaryNode) bNode.rhs();
+ bNode = (BinaryNode) bNode.getRhs();
}
- if (bNode.rhs() instanceof FunctionNode) {
+ if (bNode.getRhs() instanceof FunctionNode) {
// case var f1 = f2 = function (){};
// -> the variable will be reference fo the function
- FunctionNode fNode = (FunctionNode) bNode.rhs();
+ FunctionNode fNode = (FunctionNode) bNode.getRhs();
JsObject original = parentFn.getProperty(modelBuilder.getFunctionName(fNode));
if (original != null) {
Identifier varName = new Identifier(varNode.getName().getName(), getOffsetRange(varNode.getName()));
@@ -1800,8 +1800,8 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
isDeclaredInParent = true;
} else if (lastVisited instanceof BinaryNode) {
BinaryNode binNode = (BinaryNode) lastVisited;
- if (binNode.lhs() instanceof IndexNode) {
- Node index = ((IndexNode)binNode.lhs()).getIndex();
+ if (binNode.getLhs() instanceof IndexNode) {
+ Node index = ((IndexNode)binNode.getLhs()).getIndex();
if (!(index instanceof LiteralNode && ((LiteralNode)index).isString())) {
treatAsAnonymous = true;
}
@@ -1811,10 +1811,10 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
lastVisited = getPath().get(getPath().size() - pathIndex - 1);
}
fqName = getName(binNode, parserResult);
- if ((binNode.lhs() instanceof IdentNode)
- || (binNode.lhs() instanceof AccessNode
- && ((AccessNode) binNode.lhs()).getBase() instanceof IdentNode
- && ((IdentNode) ((AccessNode) binNode.lhs()).getBase()).getName().equals(ModelUtils.THIS))) { //NOI18N
+ if ((binNode.getLhs() instanceof IdentNode)
+ || (binNode.getLhs() instanceof AccessNode
+ && ((AccessNode) binNode.getLhs()).getBase() instanceof IdentNode
+ && ((IdentNode) ((AccessNode) binNode.getLhs()).getBase()).getName().equals(ModelUtils.THIS))) { //NOI18N
if (lastVisited instanceof ExpressionStatement && !fqName.get(0).getName().equals(ModelUtils.THIS)) { //NOI18N
// try to catch the case: pool = [];
List<Identifier> objectName = fqName.size() > 1 ? fqName.subList(0, fqName.size() - 1) : fqName;
@@ -1825,7 +1825,7 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
}
} else {
isDeclaredInParent = true;
- if (!(binNode.lhs() instanceof IdentNode)) {
+ if (!(binNode.getLhs() instanceof IdentNode)) {
parent = resolveThis(modelBuilder.getCurrentObject());
}
}
@@ -1952,11 +1952,11 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
}
if (lastVisited instanceof BinaryNode) {
BinaryNode bNode = (BinaryNode)lastVisited;
- if (bNode.lhs().equals(objectNode)) {
+ if (bNode.getLhs().equals(objectNode)) {
// case of destructuring assignment { a, b} = ....
// we should not create object in the model.
return super.enterObjectNode(objectNode);
- } else if (bNode.lhs() instanceof ObjectNode && bNode.rhs().equals(objectNode)) {
+ } else if (bNode.getLhs() instanceof ObjectNode && bNode.getRhs().equals(objectNode)) {
// case of destructuring assignment {a, b} = {a:1, b:2}
// do nothing/ already processed in binary node.
return false;
@@ -1984,7 +1984,7 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
treatAsAnonymous = true;
} else if (lastVisited instanceof BinaryNode) {
BinaryNode binNode = (BinaryNode) lastVisited;
- Node binLhs = binNode.lhs();
+ Node binLhs = binNode.getLhs();
if (binLhs instanceof IndexNode) {
Node index = ((IndexNode)binLhs).getIndex();
if (!(index instanceof LiteralNode && ((LiteralNode)index).isString())) {
@@ -2083,7 +2083,7 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
if (lastVisited instanceof BinaryNode) {
BinaryNode bNode = (BinaryNode)lastVisited;
- if (bNode.lhs().equals(objectNode)) {
+ if (bNode.getLhs().equals(objectNode)) {
// case of destructuring assignment { a, b} = ....
// we dob't create object in the model, but process the property nodes -> skip reseting modelBuilder
return super.leaveObjectNode(objectNode);
@@ -2165,7 +2165,7 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
boolean isDestructiveParam = false;
if (node instanceof Block) {
Block block = (Block)node;
- if (block.isParameterBlock() && oNode != null && bNode != null && bNode.lhs().equals(oNode) ) {
+ if (block.isParameterBlock() && oNode != null && bNode != null && bNode.getLhs().equals(oNode) ) {
// we are in parameters defined via destructive assignment
JsFunction currentFnImpl = modelBuilder.getCurrentDeclarationFunction();
property = (JsObjectImpl)currentFnImpl.getParameter(name.getName());
@@ -2236,7 +2236,7 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
// Node lastNode = getPreviousFromPath(1);
// if (!((lastNode instanceof VarNode) && !reference.isAnonymous())) {
// if (lastNode instanceof BinaryNode && !reference.isAnonymous()) {
-// Node lhs = ((BinaryNode)lastNode).lhs();
+// Node lhs = ((BinaryNode)lastNode).getLhs();
// List<Identifier> nodeName = getNodeName(lhs, parserResult);
// if (nodeName != null && !nodeName.isEmpty()) {
// JsObject jsObject = null;
@@ -2350,11 +2350,11 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
// this should handle cases like
// var prom = another.prom = function prom() {}
BinaryNode bNode = (BinaryNode)init;
- while (bNode.rhs() instanceof BinaryNode ) {
- bNode = (BinaryNode)bNode.rhs();
+ while (bNode.getRhs() instanceof BinaryNode ) {
+ bNode = (BinaryNode)bNode.getRhs();
}
- if (bNode.rhs() instanceof FunctionNode) {
- rNode = (FunctionNode) bNode.rhs();
+ if (bNode.getRhs() instanceof FunctionNode) {
+ rNode = (FunctionNode) bNode.getRhs();
}
} else if (init instanceof UnaryNode && ((UnaryNode)init).getExpression() instanceof CallNode
&& ((CallNode)((UnaryNode)init).getExpression()).getFunction() instanceof FunctionNode) {
@@ -2533,14 +2533,14 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
// this should handle cases like
// var prom = another.prom = function prom() {}
BinaryNode bNode = (BinaryNode)init;
- while (bNode.rhs() instanceof BinaryNode ) {
- bNode = (BinaryNode)bNode.rhs();
+ while (bNode.getRhs() instanceof BinaryNode ) {
+ bNode = (BinaryNode)bNode.getRhs();
}
- if (bNode.rhs() instanceof FunctionNode) {
+ if (bNode.getRhs() instanceof FunctionNode) {
// this should handle cases like
// var prom = another.prom = function prom() {}
- rNode = (FunctionNode) bNode.rhs();
- List<Identifier> name = getNodeName(bNode.lhs(), parserResult);
+ rNode = (FunctionNode) bNode.getRhs();
+ List<Identifier> name = getNodeName(bNode.getLhs(), parserResult);
if (name != null && !name.isEmpty()) {
boolean isPriviliged = name.get(0).getName().equals(ModelUtils.THIS);
JsObject parent = isPriviliged ? resolveThis(modelBuilder.getCurrentObject()) : modelBuilder.getCurrentObject();
@@ -2564,8 +2564,8 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
}
}
-// if (bNode.rhs() instanceof ReferenceNode /*&& bNode.tokenType() == TokenType.ASSIGN*/) {
-// init = (ReferenceNode) bNode.rhs();
+// if (bNode.getRhs() instanceof ReferenceNode /*&& bNode.tokenType() == TokenType.ASSIGN*/) {
+// init = (ReferenceNode) bNode.getRhs();
// }
} else if (init instanceof FunctionNode) {
rNode = (FunctionNode)init;
@@ -2712,7 +2712,7 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
private static List<Identifier> getName(BinaryNode binaryNode, ParserResult parserResult) {
List<Identifier> name = new ArrayList();
- Node lhs = binaryNode.lhs();
+ Node lhs = binaryNode.getLhs();
if (lhs instanceof AccessNode) {
name = getName((AccessNode)lhs, parserResult);
} else if (lhs instanceof IdentNode) {
@@ -2779,7 +2779,7 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
} else if (base instanceof LiteralNode) {
// we fake Number object to handel mark occurrences
LiteralNode lNode= (LiteralNode) base;
- if (lNode.isNumeric()) {
+ if (lNode.getValue() instanceof Number) {
baseIdent = new Identifier("Number", OffsetRange.NONE); //NOI8N
}
}
@@ -2817,7 +2817,7 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
Node lastNode = getPreviousFromPath(2);
if (lastNode instanceof BinaryNode) {
BinaryNode bNode = (BinaryNode) lastNode;
- if (bNode.lhs().equals(accessNode)) {
+ if (bNode.getLhs().equals(accessNode)) {
object = (JsObjectImpl) variable;
}
}
@@ -2886,7 +2886,7 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
boolean onLeftSite = false;
if (lastVisited instanceof BinaryNode) {
BinaryNode bNode = (BinaryNode)lastVisited;
- onLeftSite = bNode.tokenType() == TokenType.ASSIGN && bNode.lhs().equals(accessNode);
+ onLeftSite = bNode.tokenType() == TokenType.ASSIGN && bNode.getLhs().equals(accessNode);
}
String propertyName = accessNode.getProperty();
// there is a problem in the parser. When there is a line comment after access node, then the finish of access node is finish of the line comment
@@ -3335,8 +3335,8 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
if (getPreviousFromPath(pathIndex + 3) instanceof BinaryNode) {
BinaryNode bNode = (BinaryNode) getPreviousFromPath(pathIndex + 3);
if (bNode.tokenType() == TokenType.ASSIGN) {
- if (bNode.lhs() instanceof AccessNode) {
- List<Identifier> identifier = getName((AccessNode) bNode.lhs(), parserResult);
+ if (bNode.getLhs() instanceof AccessNode) {
+ List<Identifier> identifier = getName((AccessNode) bNode.getLhs(), parserResult);
if (identifier != null) {
if (!identifier.isEmpty() && ModelUtils.THIS.equals(identifier.get(0).getName())) {
identifier.remove(0);
@@ -3352,8 +3352,8 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
simpleName = false;
}
}
- } else if (bNode.lhs() instanceof IdentNode) {
- name = ((IdentNode) bNode.lhs()).getName();
+ } else if (bNode.getLhs() instanceof IdentNode) {
+ name = ((IdentNode) bNode.getLhs()).getName();
}
}
} else if (getPreviousFromPath(pathIndex + 3) instanceof VarNode) {
@@ -3547,7 +3547,6 @@ public class ModelVisitor extends PathNodeVisitor implements ModelResolver {
if (fn.isDeclared()) sb.append(", isDeclared");
if (fn.isMethod()) sb.append(", isMethod");
if (fn.isNamedFunctionExpression()) sb.append(", isNamedFunctionExpression");
- if (fn.isVarArg()) sb.append(", isVarArg");
if (fn.getFlag(FunctionNode.HAS_FUNCTION_DECLARATIONS)) sb.append(", hasDeclaredFunctions");
if (fn.hasDirectSuper()) sb.append(", hasDirectSuper");
// if (fn.hasScopeBlock()) sb.append(", hasScoprBlock");
diff --git a/webcommon/javascript2.model/src/org/netbeans/modules/javascript2/model/SemiTypeResolverVisitor.java b/webcommon/javascript2.model/src/org/netbeans/modules/javascript2/model/SemiTypeResolverVisitor.java
index a4efcf2..5cb3a56 100644
--- a/webcommon/javascript2.model/src/org/netbeans/modules/javascript2/model/SemiTypeResolverVisitor.java
+++ b/webcommon/javascript2.model/src/org/netbeans/modules/javascript2/model/SemiTypeResolverVisitor.java
@@ -359,20 +359,20 @@ public class SemiTypeResolverVisitor extends PathNodeVisitor {
}
return false;
}
- binaryNode.lhs().accept(this);
- add(exp, offsetVisitor.findOffset(binaryNode.lhs()), false);
+ binaryNode.getLhs().accept(this);
+ add(exp, offsetVisitor.findOffset(binaryNode.getLhs()), false);
reset();
- binaryNode.rhs().accept(this);
- add(exp, offsetVisitor.findOffset(binaryNode.rhs()), false);
+ binaryNode.getRhs().accept(this);
+ add(exp, offsetVisitor.findOffset(binaryNode.getRhs()), false);
reset();
return false;
}
- if (binaryNode.rhs() instanceof FunctionNode) {
- binaryNode.lhs().accept(this);
+ if (binaryNode.getRhs() instanceof FunctionNode) {
+ binaryNode.getLhs().accept(this);
return false;
}
if (binaryNode.isAssignment()) {
- binaryNode.rhs().accept(this);
+ binaryNode.getRhs().accept(this);
return false;
}
return super.enterBinaryNode(binaryNode);
@@ -395,8 +395,8 @@ public class SemiTypeResolverVisitor extends PathNodeVisitor {
private boolean isResultString(BinaryNode binaryNode) {
boolean bResult = false;
TokenType tokenType = binaryNode.tokenType();
- Node lhs = binaryNode.lhs();
- Node rhs = binaryNode.rhs();
+ Node lhs = binaryNode.getLhs();
+ Node rhs = binaryNode.getRhs();
if (tokenType == TokenType.ADD
&& ((lhs instanceof LiteralNode && ((LiteralNode) lhs).isString())
|| (rhs instanceof LiteralNode && ((LiteralNode) rhs).isString()))) {
@@ -420,11 +420,11 @@ public class SemiTypeResolverVisitor extends PathNodeVisitor {
private boolean isResultNumber(BinaryNode binaryNode) {
boolean bResult = false;
TokenType tokenType = binaryNode.tokenType();
- Node lhs = binaryNode.lhs();
- Node rhs = binaryNode.rhs();
+ Node lhs = binaryNode.getLhs();
+ Node rhs = binaryNode.getRhs();
if ((tokenType == TokenType.BIT_OR || tokenType == TokenType.BIT_AND)
- && ((lhs instanceof LiteralNode && ((LiteralNode) lhs).isNumeric())
- || (rhs instanceof LiteralNode && ((LiteralNode) rhs).isNumeric()))) {
+ && ((lhs instanceof LiteralNode && ((LiteralNode) lhs).getValue() instanceof Number)
+ || (rhs instanceof LiteralNode && ((LiteralNode) rhs).getValue() instanceof Number))) {
bResult = true;
} else if (tokenType == TokenType.DIV || tokenType == TokenType.MUL
|| tokenType == TokenType.SUB ){
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists