Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_nashorn
提交
7a21e153
D
dragonwell8_nashorn
项目概览
openanolis
/
dragonwell8_nashorn
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_nashorn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7a21e153
编写于
6月 05, 2013
作者:
A
attila
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8015955: ObjectNode.elements should be stronger typed
Reviewed-by: lagergren, sundar
上级
83f6b24f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
16 addition
and
23 deletion
+16
-23
src/jdk/nashorn/internal/codegen/CodeGenerator.java
src/jdk/nashorn/internal/codegen/CodeGenerator.java
+2
-4
src/jdk/nashorn/internal/ir/BlockLexicalContext.java
src/jdk/nashorn/internal/ir/BlockLexicalContext.java
+0
-1
src/jdk/nashorn/internal/ir/ObjectNode.java
src/jdk/nashorn/internal/ir/ObjectNode.java
+6
-7
src/jdk/nashorn/internal/parser/JSONParser.java
src/jdk/nashorn/internal/parser/JSONParser.java
+3
-3
src/jdk/nashorn/internal/parser/Parser.java
src/jdk/nashorn/internal/parser/Parser.java
+1
-2
src/jdk/nashorn/internal/runtime/JSONFunctions.java
src/jdk/nashorn/internal/runtime/JSONFunctions.java
+4
-6
未找到文件。
src/jdk/nashorn/internal/codegen/CodeGenerator.java
浏览文件 @
7a21e153
...
...
@@ -1326,8 +1326,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
@Override
public
boolean
enterObjectNode
(
final
ObjectNode
objectNode
)
{
final
List
<
Node
>
elements
=
objectNode
.
getElements
();
final
int
size
=
elements
.
size
();
final
List
<
PropertyNode
>
elements
=
objectNode
.
getElements
();
final
List
<
String
>
keys
=
new
ArrayList
<>();
final
List
<
Symbol
>
symbols
=
new
ArrayList
<>();
...
...
@@ -1335,8 +1334,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
boolean
hasGettersSetters
=
false
;
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
final
PropertyNode
propertyNode
=
(
PropertyNode
)
elements
.
get
(
i
);
for
(
PropertyNode
propertyNode:
elements
)
{
final
Node
value
=
propertyNode
.
getValue
();
final
String
key
=
propertyNode
.
getKeyName
();
final
Symbol
symbol
=
value
==
null
?
null
:
propertyNode
.
getSymbol
();
...
...
src/jdk/nashorn/internal/ir/BlockLexicalContext.java
浏览文件 @
7a21e153
...
...
@@ -63,7 +63,6 @@ public class BlockLexicalContext extends LexicalContext {
return
sstack
.
pop
();
}
@SuppressWarnings
(
"unchecked"
)
@Override
public
<
T
extends
LexicalContextNode
>
T
pop
(
final
T
node
)
{
T
expected
=
node
;
...
...
src/jdk/nashorn/internal/ir/ObjectNode.java
浏览文件 @
7a21e153
...
...
@@ -27,7 +27,6 @@ package jdk.nashorn.internal.ir;
import
java.util.Collections
;
import
java.util.List
;
import
jdk.nashorn.internal.ir.annotations.Immutable
;
import
jdk.nashorn.internal.ir.visitor.NodeVisitor
;
...
...
@@ -38,7 +37,7 @@ import jdk.nashorn.internal.ir.visitor.NodeVisitor;
public
final
class
ObjectNode
extends
Node
{
/** Literal elements. */
private
final
List
<
Node
>
elements
;
private
final
List
<
Property
Node
>
elements
;
/**
* Constructor
...
...
@@ -47,12 +46,12 @@ public final class ObjectNode extends Node {
* @param finish finish
* @param elements the elements used to initialize this ObjectNode
*/
public
ObjectNode
(
final
long
token
,
final
int
finish
,
final
List
<
Node
>
elements
)
{
public
ObjectNode
(
final
long
token
,
final
int
finish
,
final
List
<
Property
Node
>
elements
)
{
super
(
token
,
finish
);
this
.
elements
=
elements
;
}
private
ObjectNode
(
final
ObjectNode
objectNode
,
final
List
<
Node
>
elements
)
{
private
ObjectNode
(
final
ObjectNode
objectNode
,
final
List
<
Property
Node
>
elements
)
{
super
(
objectNode
);
this
.
elements
=
elements
;
}
...
...
@@ -60,7 +59,7 @@ public final class ObjectNode extends Node {
@Override
public
Node
accept
(
final
NodeVisitor
<?
extends
LexicalContext
>
visitor
)
{
if
(
visitor
.
enterObjectNode
(
this
))
{
return
visitor
.
leaveObjectNode
(
setElements
(
Node
.
accept
(
visitor
,
Node
.
class
,
elements
)));
return
visitor
.
leaveObjectNode
(
setElements
(
Node
.
accept
(
visitor
,
Property
Node
.
class
,
elements
)));
}
return
this
;
...
...
@@ -92,11 +91,11 @@ public final class ObjectNode extends Node {
* Get the elements of this literal node
* @return a list of elements
*/
public
List
<
Node
>
getElements
()
{
public
List
<
Property
Node
>
getElements
()
{
return
Collections
.
unmodifiableList
(
elements
);
}
private
ObjectNode
setElements
(
final
List
<
Node
>
elements
)
{
private
ObjectNode
setElements
(
final
List
<
Property
Node
>
elements
)
{
if
(
this
.
elements
==
elements
)
{
return
this
;
}
...
...
src/jdk/nashorn/internal/parser/JSONParser.java
浏览文件 @
7a21e153
...
...
@@ -282,7 +282,7 @@ loop:
next
();
// Prepare to accumulate elements.
final
List
<
Node
>
elements
=
new
ArrayList
<>();
final
List
<
Property
Node
>
elements
=
new
ArrayList
<>();
// Create a block for the object literal.
loop:
...
...
@@ -298,7 +298,7 @@ loop:
default
:
// Get and add the next property.
final
Node
property
=
propertyAssignment
();
final
Property
Node
property
=
propertyAssignment
();
elements
.
add
(
property
);
// Comma between property assigments is mandatory in JSON.
...
...
@@ -317,7 +317,7 @@ loop:
* Parse a property assignment from the token stream
* @return the property assignment as a Node
*/
private
Node
propertyAssignment
()
{
private
Property
Node
propertyAssignment
()
{
// Capture firstToken.
final
long
propertyToken
=
token
;
LiteralNode
<?>
name
=
null
;
...
...
src/jdk/nashorn/internal/parser/Parser.java
浏览文件 @
7a21e153
...
...
@@ -59,7 +59,6 @@ import java.util.Iterator;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
jdk.nashorn.internal.codegen.CompilerConstants
;
import
jdk.nashorn.internal.codegen.Namespace
;
import
jdk.nashorn.internal.ir.AccessNode
;
...
...
@@ -2028,7 +2027,7 @@ loop:
}
}
return
new
ObjectNode
(
objectToken
,
finish
,
new
ArrayList
<
Node
>(
map
.
values
()));
return
new
ObjectNode
(
objectToken
,
finish
,
new
ArrayList
<>(
map
.
values
()));
}
/**
...
...
src/jdk/nashorn/internal/runtime/JSONFunctions.java
浏览文件 @
7a21e153
...
...
@@ -25,9 +25,11 @@
package
jdk.nashorn.internal.runtime
;
import
static
jdk
.
nashorn
.
internal
.
runtime
.
arrays
.
ArrayIndex
.
getArrayIndexNoThrow
;
import
static
jdk
.
nashorn
.
internal
.
runtime
.
arrays
.
ArrayIndex
.
isValidArrayIndex
;
import
java.lang.invoke.MethodHandle
;
import
java.util.Iterator
;
import
java.util.List
;
import
jdk.nashorn.internal.ir.LiteralNode
;
import
jdk.nashorn.internal.ir.Node
;
import
jdk.nashorn.internal.ir.ObjectNode
;
...
...
@@ -36,8 +38,6 @@ import jdk.nashorn.internal.ir.UnaryNode;
import
jdk.nashorn.internal.parser.JSONParser
;
import
jdk.nashorn.internal.parser.TokenType
;
import
jdk.nashorn.internal.runtime.linker.Bootstrap
;
import
static
jdk
.
nashorn
.
internal
.
runtime
.
arrays
.
ArrayIndex
.
getArrayIndexNoThrow
;
import
static
jdk
.
nashorn
.
internal
.
runtime
.
arrays
.
ArrayIndex
.
isValidArrayIndex
;
/**
* Utilities used by "JSON" object implementation.
...
...
@@ -171,10 +171,8 @@ public final class JSONFunctions {
final
ObjectNode
objNode
=
(
ObjectNode
)
node
;
final
ScriptObject
object
=
((
GlobalObject
)
global
).
newObject
();
final
boolean
strict
=
global
.
isStrictContext
();
final
List
<
Node
>
elements
=
objNode
.
getElements
();
for
(
final
Node
elem
:
elements
)
{
final
PropertyNode
pNode
=
(
PropertyNode
)
elem
;
for
(
final
PropertyNode
pNode:
objNode
.
getElements
())
{
final
Node
valueNode
=
pNode
.
getValue
();
final
String
name
=
pNode
.
getKeyName
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录