Skip to content

Commit b8bb2b1

Browse files
committed
Bump runtime dependency versions
1 parent f814f5e commit b8bb2b1

File tree

2 files changed

+85
-78
lines changed

2 files changed

+85
-78
lines changed

RSTALanguageSupport/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ plugins {
55
['java', 'distribution', 'maven-publish', 'signing'].each { apply plugin: it }
66

77
dependencies {
8-
api 'com.fifesoft:rsyntaxtextarea:3.6.0'
9-
api 'com.fifesoft:autocomplete:3.3.2'
10-
implementation 'org.mozilla:rhino-all:1.8.0'
8+
api 'com.fifesoft:rsyntaxtextarea:3.6.1'
9+
api 'com.fifesoft:autocomplete:3.3.3'
10+
implementation 'org.mozilla:rhino-all:1.9.0'
1111
}
1212

1313
base {

RSTALanguageSupport/src/main/java/org/fife/rsta/ac/js/tree/JavaScriptOutlineTreeGenerator.java

Lines changed: 82 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,7 @@
2020
import org.fife.rsta.ac.js.util.RhinoUtil;
2121
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
2222
import org.mozilla.javascript.Token;
23-
import org.mozilla.javascript.ast.Assignment;
24-
import org.mozilla.javascript.ast.AstNode;
25-
import org.mozilla.javascript.ast.AstRoot;
26-
import org.mozilla.javascript.ast.ExpressionStatement;
27-
import org.mozilla.javascript.ast.FunctionCall;
28-
import org.mozilla.javascript.ast.FunctionNode;
29-
import org.mozilla.javascript.ast.Name;
30-
import org.mozilla.javascript.ast.NodeVisitor;
31-
import org.mozilla.javascript.ast.ObjectLiteral;
32-
import org.mozilla.javascript.ast.ObjectProperty;
33-
import org.mozilla.javascript.ast.PropertyGet;
34-
import org.mozilla.javascript.ast.VariableDeclaration;
35-
import org.mozilla.javascript.ast.VariableInitializer;
23+
import org.mozilla.javascript.ast.*;
3624

3725

3826
/**
@@ -319,17 +307,21 @@ else if (rhs instanceof FunctionCall) {
319307
tn.setText(clazz + "()");
320308

321309
ObjectLiteral value = (ObjectLiteral)rhs;
322-
List<ObjectProperty> properties = value.getElements();
323-
for (ObjectProperty property : properties) {
324-
325-
AstNode propertyKey = property.getLeft();
326-
tn = createTreeNode(propertyKey);
327-
328-
String memberName = RhinoUtil.getPropertyName(propertyKey);
329-
AstNode propertyValue = property.getRight();
330-
visitPrototypeMember(tn, clazz,
331-
memberName, propertyValue);
310+
List<AbstractObjectProperty> properties = value.getElements();
311+
for (AbstractObjectProperty property : properties) {
312+
313+
if (property instanceof ObjectProperty) {
314+
ObjectProperty propObj = (ObjectProperty)property;
315+
AstNode propertyKey = propObj.getKey();
316+
tn = createTreeNode(propertyKey);
317+
318+
String memberName = RhinoUtil.getPropertyName(propertyKey);
319+
AstNode propertyValue = propObj.getValue();
320+
visitPrototypeMember(tn, clazz,
321+
memberName, propertyValue);
322+
}
332323

324+
// TODO: Also handle SpreadObjectProperty
333325
}
334326

335327
}
@@ -416,23 +408,27 @@ else if (rhs instanceof FunctionNode) {
416408
private void visitPropertyDescriptors(ObjectLiteral descriptorObjLit,
417409
String clazz) {
418410

419-
List<ObjectProperty> descriptors = descriptorObjLit.getElements();
420-
for (ObjectProperty prop : descriptors) {
411+
List<AbstractObjectProperty> descriptors = descriptorObjLit.getElements();
412+
for (AbstractObjectProperty prop : descriptors) {
421413

422-
AstNode propertyKey = prop.getLeft();
423-
AstNode propertyValue = prop.getRight();
414+
// TODO: Handle SpreadObjectPropertys, though they're not commonly used in
415+
// property descriptors
416+
if (prop instanceof ObjectProperty) {
417+
ObjectProperty propObj = (ObjectProperty)prop;
418+
AstNode propertyKey = propObj.getKey();
419+
AstNode propertyValue = propObj.getValue();
424420

425-
// Should always be true, as this should be a property descriptor
426-
if (propertyValue instanceof ObjectLiteral) {
421+
// Should always be true, as this should be a property descriptor
422+
if (propertyValue instanceof ObjectLiteral) {
427423

428-
JavaScriptTreeNode tn = createTreeNode(propertyKey);
424+
JavaScriptTreeNode tn = createTreeNode(propertyKey);
429425

430-
String memberName = RhinoUtil.getPropertyName(propertyKey);
431-
visitPropertyDescriptor(tn, clazz,
432-
memberName, (ObjectLiteral)propertyValue);
426+
String memberName = RhinoUtil.getPropertyName(propertyKey);
427+
visitPropertyDescriptor(tn, clazz,
428+
memberName, (ObjectLiteral) propertyValue);
433429

430+
}
434431
}
435-
436432
}
437433

438434
}
@@ -454,45 +450,50 @@ private void visitPropertyDescriptor(JavaScriptTreeNode tn, String clazz,
454450
// TODO: Glean more information than just the value, for a more
455451
// detailed icon.
456452

457-
List<ObjectProperty> propDescProperties = propDesc.getElements();
458-
for (ObjectProperty propDescProperty : propDescProperties) {
459-
460-
AstNode propertyKey = propDescProperty.getLeft();
461-
String propName = RhinoUtil.getPropertyName(propertyKey);
462-
if ("value".equals(propName)) {
453+
List<AbstractObjectProperty> propDescProperties = propDesc.getElements();
454+
for (AbstractObjectProperty propDescProperty : propDescProperties) {
455+
456+
// TODO: Decide if we can/should look through SpreadObjectPropertys
457+
if (propDescProperty instanceof ObjectProperty) {
458+
459+
ObjectProperty objectProp = (ObjectProperty) propDescProperty;
460+
AstNode propertyKey = objectProp.getKey();
461+
String propName = RhinoUtil.getPropertyName(propertyKey);
462+
if ("value".equals(propName)) {
463+
464+
AstNode propertyValue = objectProp.getValue();
465+
boolean isFunction = propertyValue instanceof FunctionNode;
466+
String text = memberName;
467+
if (isFunction) {
468+
FunctionNode func = (FunctionNode) propertyValue;
469+
text += RhinoUtil.getFunctionArgsString(func);
470+
tn.setIcon(IconFactory.getIcon(IconFactory.PUBLIC_METHOD_ICON));
471+
tn.setSortPriority(JavaScriptOutlineTree.PRIORITY_FUNCTION);
472+
}
473+
else {
474+
tn.setIcon(IconFactory.getIcon(IconFactory.PUBLIC_FIELD_ICON));
475+
tn.setSortPriority(JavaScriptOutlineTree.PRIORITY_VARIABLE);
476+
}
463477

464-
AstNode propertyValue = propDescProperty.getRight();
465-
boolean isFunction = propertyValue instanceof FunctionNode;
466-
String text = memberName;
467-
if (isFunction) {
468-
FunctionNode func = (FunctionNode)propertyValue;
469-
text += RhinoUtil.getFunctionArgsString(func);
470-
tn.setIcon(IconFactory.getIcon(IconFactory.PUBLIC_METHOD_ICON));
471-
tn.setSortPriority(JavaScriptOutlineTree.PRIORITY_FUNCTION);
472-
}
473-
else {
474-
tn.setIcon(IconFactory.getIcon(IconFactory.PUBLIC_FIELD_ICON));
475-
tn.setSortPriority(JavaScriptOutlineTree.PRIORITY_VARIABLE);
476-
}
478+
tn.setText(text);
479+
if (prototypeAdditions == null) {
480+
prototypeAdditions = new HashMap<>();
481+
}
482+
List<JavaScriptTreeNode> list = prototypeAdditions.computeIfAbsent(clazz, k -> new ArrayList<>());
477483

478-
tn.setText(text);
479-
if (prototypeAdditions==null) {
480-
prototypeAdditions = new HashMap<>();
481-
}
482-
List<JavaScriptTreeNode> list = prototypeAdditions.computeIfAbsent(clazz, k -> new ArrayList<>());
484+
list.add(tn);
483485

484-
list.add(tn);
486+
if (isFunction) {
487+
JavaScriptTreeNode prevScopeTreeNode = curScopeTreeNode;
488+
curScopeTreeNode = tn;
489+
FunctionNode func = (FunctionNode) propertyValue;
490+
func.getBody().visit(this);
491+
curScopeTreeNode = prevScopeTreeNode;
492+
}
485493

486-
if (isFunction) {
487-
JavaScriptTreeNode prevScopeTreeNode = curScopeTreeNode;
488-
curScopeTreeNode = tn;
489-
FunctionNode func = (FunctionNode)propertyValue;
490-
func.getBody().visit(this);
491-
curScopeTreeNode = prevScopeTreeNode;
492494
}
493495

494496
}
495-
496497
}
497498

498499
}
@@ -501,17 +502,23 @@ private void visitPropertyDescriptor(JavaScriptTreeNode tn, String clazz,
501502
private void visitPrototypeMembers(ObjectLiteral objLiteral,
502503
String clazz) {
503504

504-
List<ObjectProperty> properties = objLiteral.getElements();
505-
for (ObjectProperty property : properties) {
506-
507-
AstNode propertyKey = property.getLeft();
508-
JavaScriptTreeNode tn = createTreeNode(propertyKey);
505+
List<AbstractObjectProperty> properties = objLiteral.getElements();
506+
for (AbstractObjectProperty property : properties) {
509507

510-
String memberName = RhinoUtil.getPropertyName(propertyKey);
511-
AstNode propertyValue = property.getRight();
512-
visitPrototypeMember(tn, clazz,
513-
memberName, propertyValue);
508+
if (property instanceof ObjectProperty) {
509+
ObjectProperty objProperty = (ObjectProperty)property;
510+
AstNode propertyKey = objProperty.getKey();
511+
JavaScriptTreeNode tn = createTreeNode(propertyKey);
514512

513+
String memberName = RhinoUtil.getPropertyName(propertyKey);
514+
AstNode propertyValue = objProperty.getValue();
515+
visitPrototypeMember(tn, clazz,
516+
memberName, propertyValue);
517+
}
518+
else if (property instanceof SpreadObjectProperty) {
519+
// TODO: Implement me
520+
// SpreadObjectProperty sop = (SpreadObjectProperty)property;
521+
}
515522
}
516523

517524
}

0 commit comments

Comments
 (0)