Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_nashorn
提交
516d2c08
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,发现更多精彩内容 >>
提交
516d2c08
编写于
5月 31, 2013
作者:
A
attila
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8015693: reduce NodeLiteralNode to NullLiteralNode
Reviewed-by: jlaskey, lagergren
上级
e4b3dd28
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
53 deletion
+9
-53
src/jdk/nashorn/internal/ir/LiteralNode.java
src/jdk/nashorn/internal/ir/LiteralNode.java
+9
-53
未找到文件。
src/jdk/nashorn/internal/ir/LiteralNode.java
浏览文件 @
516d2c08
...
...
@@ -28,7 +28,6 @@ package jdk.nashorn.internal.ir;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
jdk.nashorn.internal.codegen.CompileUnit
;
import
jdk.nashorn.internal.codegen.types.Type
;
import
jdk.nashorn.internal.ir.annotations.Immutable
;
...
...
@@ -242,8 +241,8 @@ public abstract class LiteralNode<T> extends Node implements PropertyKey {
*
* @return the new literal node
*/
public
static
LiteralNode
<
Node
>
newInstance
(
final
long
token
,
final
int
finish
)
{
return
new
N
ode
LiteralNode
(
token
,
finish
);
public
static
LiteralNode
<
Object
>
newInstance
(
final
long
token
,
final
int
finish
)
{
return
new
N
ull
LiteralNode
(
token
,
finish
);
}
/**
...
...
@@ -253,8 +252,8 @@ public abstract class LiteralNode<T> extends Node implements PropertyKey {
*
* @return the new literal node
*/
public
static
LiteralNode
<
?
>
newInstance
(
final
Node
parent
)
{
return
new
N
ode
LiteralNode
(
parent
.
getToken
(),
parent
.
getFinish
());
public
static
LiteralNode
<
Object
>
newInstance
(
final
Node
parent
)
{
return
new
N
ull
LiteralNode
(
parent
.
getToken
(),
parent
.
getFinish
());
}
@Immutable
...
...
@@ -496,33 +495,15 @@ public abstract class LiteralNode<T> extends Node implements PropertyKey {
return
new
LexerTokenLiteralNode
(
parent
.
getToken
(),
parent
.
getFinish
(),
value
);
}
private
static
final
class
NodeLiteralNode
extends
LiteralNode
<
Node
>
{
private
NodeLiteralNode
(
final
long
token
,
final
int
finish
)
{
this
(
token
,
finish
,
null
);
}
private
NodeLiteralNode
(
final
long
token
,
final
int
finish
,
final
Node
value
)
{
super
(
Token
.
recast
(
token
,
TokenType
.
OBJECT
),
finish
,
value
);
}
private
NodeLiteralNode
(
final
LiteralNode
<
Node
>
literalNode
)
{
super
(
literalNode
);
}
private
static
final
class
NullLiteralNode
extends
LiteralNode
<
Object
>
{
private
N
odeLiteralNode
(
final
LiteralNode
<
Node
>
literalNode
,
final
Node
value
)
{
super
(
literalNode
,
value
);
private
N
ullLiteralNode
(
final
long
token
,
final
int
finish
)
{
super
(
Token
.
recast
(
token
,
TokenType
.
OBJECT
),
finish
,
null
);
}
@Override
public
Node
accept
(
final
NodeVisitor
<?
extends
LexicalContext
>
visitor
)
{
if
(
visitor
.
enterLiteralNode
(
this
))
{
if
(
value
!=
null
)
{
final
Node
newValue
=
value
.
accept
(
visitor
);
if
(
value
!=
newValue
)
{
return
visitor
.
leaveLiteralNode
(
new
NodeLiteralNode
(
this
,
newValue
));
}
}
return
visitor
.
leaveLiteralNode
(
this
);
}
...
...
@@ -531,38 +512,13 @@ public abstract class LiteralNode<T> extends Node implements PropertyKey {
@Override
public
Type
getType
()
{
return
value
==
null
?
Type
.
OBJECT
:
super
.
getType
()
;
return
Type
.
OBJECT
;
}
@Override
public
Type
getWidestOperationType
()
{
return
value
==
null
?
Type
.
OBJECT
:
value
.
getWidestOperationType
()
;
return
Type
.
OBJECT
;
}
}
/**
* Create a new node literal for an arbitrary node
*
* @param token token
* @param finish finish
* @param value the literal value node
*
* @return the new literal node
*/
public
static
LiteralNode
<
Node
>
newInstance
(
final
long
token
,
final
int
finish
,
final
Node
value
)
{
return
new
NodeLiteralNode
(
token
,
finish
,
value
);
}
/**
* Create a new node literal based on a parent node (source, token, finish)
*
* @param parent parent node
* @param value node value
*
* @return the new literal node
*/
public
static
LiteralNode
<?>
newInstance
(
final
Node
parent
,
final
Node
value
)
{
return
new
NodeLiteralNode
(
parent
.
getToken
(),
parent
.
getFinish
(),
value
);
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录