Skip to content

Commit 49f3a22

Browse files
committed
Small tidy up.
1 parent 43309fb commit 49f3a22

File tree

6 files changed

+2
-36
lines changed

6 files changed

+2
-36
lines changed

rhino/src/main/java/org/mozilla/javascript/ES6Generator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ static ES6Generator init(TopLevel scope, boolean sealed) {
5050
// approach instead.
5151
if (scope != null) {
5252
scope.associateValue(GENERATOR_TAG, prototype);
53-
scope.getGlobalThis().associateValue(GENERATOR_TAG, prototype);
5453
}
5554

5655
return prototype;

rhino/src/main/java/org/mozilla/javascript/ES6Iterator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ protected static void init(
2727
// approach instead.
2828
if (scope != null) {
2929
scope.associateValue(tag, prototype);
30-
scope.getGlobalThis().associateValue(tag, prototype);
3130
}
3231
}
3332

rhino/src/main/java/org/mozilla/javascript/NativeGenerator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ static NativeGenerator init(TopLevel scope, boolean sealed) {
3838
// approach instead.
3939
if (scope != null) {
4040
scope.associateValue(GENERATOR_TAG, prototype);
41-
scope.getGlobalThis().associateValue(GENERATOR_TAG, prototype);
4241
}
4342

4443
return prototype;

rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ public static TopLevel initSafeStandardObjects(Context cx, TopLevel scope, boole
190190
scope.clearCache();
191191

192192
scope.associateValue(LIBRARY_SCOPE_KEY, scope);
193-
scope.getGlobalThis().associateValue(LIBRARY_SCOPE_KEY, scope);
194193

195194
new ClassCache().associate(scope);
196195
new ConcurrentFactory().associate(scope);

rhino/src/main/java/org/mozilla/javascript/ScriptableObject.java

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2974,35 +2974,7 @@ protected void copyAssociatedValue(ScriptableObject other) {
29742974
*/
29752975
public static Object getTopScopeValue(Scriptable scope, Object key) {
29762976
var topScope = ScriptableObject.getTopLevelScope(scope);
2977-
Object value = topScope.getAssociatedValue(key);
2978-
if (value != null) {
2979-
return value;
2980-
}
2981-
return null;
2982-
}
2983-
2984-
public static Object getTopScopeValueOrElse(Scriptable scope, Object key, Object elseValue) {
2985-
TopLevel topScope;
2986-
Scriptable obj = scope;
2987-
for (; ; ) {
2988-
Scriptable parent = obj.getParentScope();
2989-
if (parent == null) {
2990-
if (obj instanceof TopLevel) {
2991-
topScope = (TopLevel) obj;
2992-
} else {
2993-
topScope = null;
2994-
}
2995-
break;
2996-
}
2997-
obj = parent;
2998-
}
2999-
if (topScope != null) {
3000-
Object value = topScope.getAssociatedValue(key);
3001-
if (value != null) {
3002-
return value;
3003-
}
3004-
}
3005-
return elseValue;
2977+
return topScope.getAssociatedValue(key);
30062978
}
30072979

30082980
/**

rhino/src/main/java/org/mozilla/javascript/lc/type/TypeInfoFactory.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,7 @@ static TypeInfoFactory get(Scriptable scope) {
396396
* @see #associate(ScriptableObject topScope)
397397
*/
398398
static TypeInfoFactory getOrElse(Scriptable scope, TypeInfoFactory fallback) {
399-
var got =
400-
(TypeInfoFactory)
401-
ScriptableObject.getTopScopeValueOrElse(scope, "TypeInfoFactory", fallback);
399+
var got = (TypeInfoFactory) ScriptableObject.getTopScopeValue(scope, "TypeInfoFactory");
402400
if (got == null) {
403401
return fallback;
404402
}

0 commit comments

Comments
 (0)