Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
67d59880
K
kotlin
项目概览
硅谷海盗
/
kotlin
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kotlin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
67d59880
编写于
9月 08, 2011
作者:
A
Andrey Breslav
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added getSuperclassType(), which is not used for now
上级
2c3076d1
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
109 addition
and
9 deletion
+109
-9
idea/src/org/jetbrains/jet/lang/ErrorHandler.java
idea/src/org/jetbrains/jet/lang/ErrorHandler.java
+20
-6
idea/src/org/jetbrains/jet/lang/descriptors/ClassDescriptor.java
...c/org/jetbrains/jet/lang/descriptors/ClassDescriptor.java
+6
-0
idea/src/org/jetbrains/jet/lang/descriptors/ClassDescriptorImpl.java
...g/jetbrains/jet/lang/descriptors/ClassDescriptorImpl.java
+32
-3
idea/src/org/jetbrains/jet/lang/descriptors/LazySubstitutingClassDescriptor.java
...jet/lang/descriptors/LazySubstitutingClassDescriptor.java
+10
-0
idea/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptor.java
...etbrains/jet/lang/descriptors/MutableClassDescriptor.java
+12
-0
idea/src/org/jetbrains/jet/lang/resolve/java/JavaClassDescriptor.java
.../jetbrains/jet/lang/resolve/java/JavaClassDescriptor.java
+12
-0
idea/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java
...tbrains/jet/lang/resolve/java/JavaDescriptorResolver.java
+11
-0
idea/src/org/jetbrains/jet/lang/types/JetStandardClasses.java
.../src/org/jetbrains/jet/lang/types/JetStandardClasses.java
+2
-0
idea/src/org/jetbrains/jet/plugin/annotations/JetPsiChecker.java
...c/org/jetbrains/jet/plugin/annotations/JetPsiChecker.java
+4
-0
未找到文件。
idea/src/org/jetbrains/jet/lang/ErrorHandler.java
浏览文件 @
67d59880
...
...
@@ -24,7 +24,7 @@ public class ErrorHandler {
@Override
public
void
genericError
(
@NotNull
ASTNode
node
,
@NotNull
String
errorMessage
)
{
throw
new
IllegalStateException
(
errorMessage
+
" at "
+
node
.
getText
());
throw
new
IllegalStateException
(
errorMessage
+
" at "
+
node
.
getText
()
+
atLocation
(
node
)
);
}
@Override
...
...
@@ -37,14 +37,28 @@ public class ErrorHandler {
throw
new
IllegalStateException
(
"Redeclaration: "
+
existingDescriptor
.
getName
());
}
};
public
static
String
atLocation
(
PsiElement
element
)
{
public
static
String
atLocation
(
@NotNull
PsiElement
element
)
{
return
atLocation
(
element
.
getNode
());
}
public
static
String
atLocation
(
@NotNull
ASTNode
node
)
{
while
(
node
.
getPsi
()
==
null
)
{
node
=
node
.
getTreeParent
();
}
PsiElement
element
=
node
.
getPsi
();
Document
document
=
PsiDocumentManager
.
getInstance
(
element
.
getProject
()).
getDocument
(
element
.
getContainingFile
());
int
offset
=
element
.
getTextRange
().
getStartOffset
();
int
lineNumber
=
document
.
getLineNumber
(
offset
);
int
lineStartOffset
=
document
.
getLineStartOffset
(
lineNumber
);
int
column
=
offset
-
lineStartOffset
;
if
(
document
!=
null
)
{
int
lineNumber
=
document
.
getLineNumber
(
offset
);
int
lineStartOffset
=
document
.
getLineStartOffset
(
lineNumber
);
int
column
=
offset
-
lineStartOffset
;
return
"' at line "
+
(
lineNumber
+
1
)
+
":"
+
column
;
return
"' at line "
+
(
lineNumber
+
1
)
+
":"
+
column
;
}
else
{
return
"' at offset "
+
offset
+
" (line unknown)"
;
}
}
...
...
idea/src/org/jetbrains/jet/lang/descriptors/ClassDescriptor.java
浏览文件 @
67d59880
...
...
@@ -17,6 +17,12 @@ public interface ClassDescriptor extends ClassifierDescriptor {
@NotNull
JetScope
getMemberScope
(
List
<
TypeProjection
>
typeArguments
);
/**
* @return the superclass for a class descriptor, and the required class fro a trait descriptor
*/
@NotNull
JetType
getSuperclassType
();
@NotNull
FunctionGroup
getConstructors
();
...
...
idea/src/org/jetbrains/jet/lang/descriptors/ClassDescriptorImpl.java
浏览文件 @
67d59880
...
...
@@ -20,6 +20,7 @@ public class ClassDescriptorImpl extends DeclarationDescriptorImpl implements Cl
private
JetScope
memberDeclarations
;
private
FunctionGroup
constructors
;
private
ConstructorDescriptor
primaryConstructor
;
private
JetType
superclassType
;
public
ClassDescriptorImpl
(
@NotNull
DeclarationDescriptor
containingDeclaration
,
...
...
@@ -28,20 +29,42 @@ public class ClassDescriptorImpl extends DeclarationDescriptorImpl implements Cl
super
(
containingDeclaration
,
annotations
,
name
);
}
public
final
ClassDescriptorImpl
initialize
(
boolean
sealed
,
@NotNull
List
<
TypeParameterDescriptor
>
typeParameters
,
@NotNull
Collection
<
JetType
>
supertypes
,
@NotNull
JetScope
memberDeclarations
,
@NotNull
FunctionGroup
constructors
,
@Nullable
ConstructorDescriptor
primaryConstructor
)
{
return
initialize
(
sealed
,
typeParameters
,
supertypes
,
memberDeclarations
,
constructors
,
primaryConstructor
,
getClassType
(
supertypes
));
}
public
final
ClassDescriptorImpl
initialize
(
boolean
sealed
,
@NotNull
List
<
TypeParameterDescriptor
>
typeParameters
,
@NotNull
Collection
<
JetType
>
super
class
es
,
@NotNull
Collection
<
JetType
>
super
typ
es
,
@NotNull
JetScope
memberDeclarations
,
@NotNull
FunctionGroup
constructors
,
@Nullable
ConstructorDescriptor
primaryConstructor
)
{
this
.
typeConstructor
=
new
TypeConstructorImpl
(
this
,
getAnnotations
(),
sealed
,
getName
(),
typeParameters
,
superclasses
);
@Nullable
ConstructorDescriptor
primaryConstructor
,
@Nullable
JetType
superclassType
)
{
this
.
typeConstructor
=
new
TypeConstructorImpl
(
this
,
getAnnotations
(),
sealed
,
getName
(),
typeParameters
,
supertypes
);
this
.
memberDeclarations
=
memberDeclarations
;
this
.
constructors
=
constructors
;
this
.
primaryConstructor
=
primaryConstructor
;
this
.
superclassType
=
superclassType
;
// assert !constructors.isEmpty() || primaryConstructor == null;
return
this
;
}
@NotNull
private
JetType
getClassType
(
@NotNull
Collection
<
JetType
>
types
)
{
for
(
JetType
type
:
types
)
{
ClassDescriptor
classDescriptor
=
TypeUtils
.
getClassDescriptor
(
type
);
if
(
classDescriptor
!=
null
)
{
return
type
;
}
}
return
JetStandardClasses
.
getAnyType
();
}
public
void
setPrimaryConstructor
(
@NotNull
ConstructorDescriptor
primaryConstructor
)
{
this
.
primaryConstructor
=
primaryConstructor
;
}
...
...
@@ -63,6 +86,12 @@ public class ClassDescriptorImpl extends DeclarationDescriptorImpl implements Cl
return
new
SubstitutingScope
(
memberDeclarations
,
TypeSubstitutor
.
create
(
substitutionContext
));
}
@NotNull
@Override
public
JetType
getSuperclassType
()
{
return
superclassType
;
}
@NotNull
@Override
public
JetType
getDefaultType
()
{
...
...
idea/src/org/jetbrains/jet/lang/descriptors/LazySubstitutingClassDescriptor.java
浏览文件 @
67d59880
...
...
@@ -20,6 +20,7 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
private
TypeSubstitutor
newSubstitutor
;
private
List
<
TypeParameterDescriptor
>
typeParameters
;
private
TypeConstructor
typeConstructor
;
private
JetType
superclassType
;
public
LazySubstitutingClassDescriptor
(
ClassDescriptor
descriptor
,
TypeSubstitutor
substitutor
)
{
this
.
original
=
descriptor
;
...
...
@@ -78,6 +79,15 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
return
new
SubstitutingScope
(
memberScope
,
getSubstitutor
());
}
@NotNull
@Override
public
JetType
getSuperclassType
()
{
if
(
superclassType
==
null
)
{
superclassType
=
getSubstitutor
().
substitute
(
original
.
getSuperclassType
(),
Variance
.
INVARIANT
);
}
return
superclassType
;
}
@NotNull
@Override
public
JetType
getDefaultType
()
{
...
...
idea/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptor.java
浏览文件 @
67d59880
...
...
@@ -32,6 +32,7 @@ public class MutableClassDescriptor extends MutableDeclarationDescriptor impleme
private
JetType
classObjectType
;
private
JetType
defaultType
;
private
final
boolean
isObject
;
private
JetType
superclassType
;
public
MutableClassDescriptor
(
@NotNull
BindingTrace
trace
,
@NotNull
DeclarationDescriptor
containingDeclaration
,
@NotNull
JetScope
outerScope
)
{
this
(
trace
,
containingDeclaration
,
outerScope
,
false
);
...
...
@@ -248,6 +249,17 @@ public class MutableClassDescriptor extends MutableDeclarationDescriptor impleme
return
isObject
;
}
@NotNull
@Override
public
JetType
getSuperclassType
()
{
return
superclassType
;
}
public
void
setSuperclassType
(
@NotNull
JetType
superclassType
)
{
this
.
superclassType
=
superclassType
;
}
public
void
setClassModifiers
(
ClassModifiers
classModifiers
)
{
this
.
classModifiers
=
classModifiers
;
}
...
...
idea/src/org/jetbrains/jet/lang/resolve/java/JavaClassDescriptor.java
浏览文件 @
67d59880
...
...
@@ -21,6 +21,8 @@ public class JavaClassDescriptor extends MutableDeclarationDescriptor implements
private
JetType
classObjectType
;
private
final
WritableFunctionGroup
constructors
=
new
WritableFunctionGroup
(
"<init>"
);
private
ClassModifiers
modifiers
;
private
JetType
superclassType
;
public
JavaClassDescriptor
(
DeclarationDescriptor
containingDeclaration
)
{
super
(
containingDeclaration
);
...
...
@@ -73,6 +75,16 @@ public class JavaClassDescriptor extends MutableDeclarationDescriptor implements
return
new
SubstitutingScope
(
unsubstitutedMemberScope
,
substitutor
);
}
@NotNull
@Override
public
JetType
getSuperclassType
()
{
return
superclassType
;
}
public
void
setSuperclassType
(
@NotNull
JetType
superclassType
)
{
this
.
superclassType
=
superclassType
;
}
@NotNull
@Override
public
FunctionGroup
getConstructors
()
{
...
...
idea/src/org/jetbrains/jet/lang/resolve/java/JavaDescriptorResolver.java
浏览文件 @
67d59880
...
...
@@ -117,6 +117,17 @@ public class JavaDescriptorResolver {
classDescriptor
.
setClassObjectMemberScope
(
new
JavaClassMembersScope
(
classDescriptor
,
psiClass
,
semanticServices
,
true
));
// UGLY HACK
supertypes
.
addAll
(
getSupertypes
(
psiClass
));
if
(
psiClass
.
isInterface
())
{
classDescriptor
.
setSuperclassType
(
JetStandardClasses
.
getAnyType
());
// TODO : Make it java.lang.Object
}
else
{
PsiClassType
[]
extendsListTypes
=
psiClass
.
getExtendsListTypes
();
assert
extendsListTypes
.
length
==
0
||
extendsListTypes
.
length
==
1
;
JetType
superclassType
=
extendsListTypes
.
length
==
0
?
JetStandardClasses
.
getAnyType
()
:
semanticServices
.
getTypeTransformer
().
transformToType
(
extendsListTypes
[
0
]);
classDescriptor
.
setSuperclassType
(
superclassType
);
}
PsiMethod
[]
psiConstructors
=
psiClass
.
getConstructors
();
...
...
idea/src/org/jetbrains/jet/lang/types/JetStandardClasses.java
浏览文件 @
67d59880
...
...
@@ -53,6 +53,7 @@ public class JetStandardClasses {
},
JetScope
.
EMPTY
,
FunctionGroup
.
EMPTY
,
null
,
null
);
...
...
@@ -75,6 +76,7 @@ public class JetStandardClasses {
Collections
.<
JetType
>
emptySet
(),
JetScope
.
EMPTY
,
FunctionGroup
.
EMPTY
,
null
,
null
);
...
...
idea/src/org/jetbrains/jet/plugin/annotations/JetPsiChecker.java
浏览文件 @
67d59880
...
...
@@ -54,10 +54,12 @@ public class JetPsiChecker implements Annotator {
if
(
reference
instanceof
MultiRangeReference
)
{
MultiRangeReference
mrr
=
(
MultiRangeReference
)
reference
;
for
(
TextRange
range
:
mrr
.
getRanges
())
{
System
.
out
.
println
(
"Unresolved1"
);
holder
.
createErrorAnnotation
(
range
.
shiftRight
(
referenceExpression
.
getTextOffset
()),
"Unresolved"
).
setHighlightType
(
ProblemHighlightType
.
LIKE_UNKNOWN_SYMBOL
);
}
}
else
{
System
.
out
.
println
(
"Unresolved2"
);
holder
.
createErrorAnnotation
(
referenceExpression
,
"Unresolved"
).
setHighlightType
(
ProblemHighlightType
.
LIKE_UNKNOWN_SYMBOL
);
}
}
...
...
@@ -98,6 +100,8 @@ public class JetPsiChecker implements Annotator {
};
if
(
errorReportingEnabled
)
{
System
.
out
.
println
(
"Checked: "
+
bindingContext
.
getDiagnostics
().
size
());
System
.
out
.
println
(
Thread
.
currentThread
().
getId
());
AnalyzingUtils
.
applyHandler
(
errorHandler
,
bindingContext
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录