Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
b47d3709
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,发现更多精彩内容 >>
提交
b47d3709
编写于
4月 19, 2012
作者:
S
Stepan Koltsov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
properly report exception if analyze failed
#KT-1831 Fixed
上级
aa4e4623
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
51 addition
and
10 deletion
+51
-10
compiler/cli/src/org/jetbrains/jet/compiler/KotlinToJVMBytecodeCompiler.java
...g/jetbrains/jet/compiler/KotlinToJVMBytecodeCompiler.java
+2
-0
compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/AnalyzerFacadeForJVM.java
...jetbrains/jet/lang/resolve/java/AnalyzerFacadeForJVM.java
+2
-1
compiler/frontend/src/org/jetbrains/jet/analyzer/AnalyzeExhaust.java
...ontend/src/org/jetbrains/jet/analyzer/AnalyzeExhaust.java
+28
-3
compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetLightClass.java
....java.psi/src/org/jetbrains/jet/asJava/JetLightClass.java
+4
-0
compiler/tests/org/jetbrains/jet/codegen/CodegenTestCase.java
...iler/tests/org/jetbrains/jet/codegen/CodegenTestCase.java
+1
-0
compiler/tests/org/jetbrains/jet/codegen/GenerationUtils.java
...iler/tests/org/jetbrains/jet/codegen/GenerationUtils.java
+1
-0
idea/src/org/jetbrains/jet/plugin/debugger/JetPositionManager.java
...org/jetbrains/jet/plugin/debugger/JetPositionManager.java
+1
-0
idea/src/org/jetbrains/jet/plugin/internal/codewindow/BytecodeToolwindow.java
...ns/jet/plugin/internal/codewindow/BytecodeToolwindow.java
+9
-3
idea/src/org/jetbrains/jet/plugin/project/AnalyzerFacadeWithCache.java
...jetbrains/jet/plugin/project/AnalyzerFacadeWithCache.java
+1
-1
idea/src/org/jetbrains/jet/plugin/project/JSAnalyzerFacadeForIDEA.java
...jetbrains/jet/plugin/project/JSAnalyzerFacadeForIDEA.java
+2
-2
未找到文件。
compiler/cli/src/org/jetbrains/jet/compiler/KotlinToJVMBytecodeCompiler.java
浏览文件 @
b47d3709
...
...
@@ -71,6 +71,8 @@ public class KotlinToJVMBytecodeCompiler {
return
null
;
}
exhaust
.
throwIfError
();
return
generate
(
environment
,
dependencies
,
messageCollector
,
exhaust
,
stubs
);
}
...
...
compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/AnalyzerFacadeForJVM.java
浏览文件 @
b47d3709
...
...
@@ -96,7 +96,8 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
injector
.
getTopDownAnalyzer
().
analyzeFiles
(
files
);
return
new
AnalyzeExhaust
(
bindingTraceContext
.
getBindingContext
(),
JetStandardLibrary
.
getInstance
());
return
AnalyzeExhaust
.
success
(
bindingTraceContext
.
getBindingContext
(),
JetStandardLibrary
.
getInstance
());
}
public
static
AnalyzeExhaust
shallowAnalyzeFiles
(
Collection
<
JetFile
>
files
,
...
...
compiler/frontend/src/org/jetbrains/jet/analyzer/AnalyzeExhaust.java
浏览文件 @
b47d3709
...
...
@@ -27,12 +27,22 @@ import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
public
class
AnalyzeExhaust
{
@NotNull
private
final
BindingContext
bindingContext
;
@Nullable
private
final
JetStandardLibrary
standardLibrary
;
private
final
Throwable
error
;
public
AnalyzeExhaust
(
@NotNull
BindingContext
bindingContext
,
@Nullable
JetStandardLibrary
standardLibrary
)
{
private
AnalyzeExhaust
(
@NotNull
BindingContext
bindingContext
,
@Nullable
JetStandardLibrary
standardLibrary
,
@Nullable
Throwable
error
)
{
this
.
bindingContext
=
bindingContext
;
this
.
standardLibrary
=
standardLibrary
;
this
.
error
=
error
;
}
public
static
AnalyzeExhaust
success
(
@NotNull
BindingContext
bindingContext
,
@NotNull
JetStandardLibrary
standardLibrary
)
{
return
new
AnalyzeExhaust
(
bindingContext
,
standardLibrary
,
null
);
}
public
static
AnalyzeExhaust
error
(
@NotNull
BindingContext
bindingContext
,
@NotNull
Throwable
error
)
{
return
new
AnalyzeExhaust
(
bindingContext
,
null
,
error
);
}
@NotNull
...
...
@@ -40,8 +50,23 @@ public class AnalyzeExhaust {
return
bindingContext
;
}
@N
ullable
@N
otNull
public
JetStandardLibrary
getStandardLibrary
()
{
return
standardLibrary
;
}
@NotNull
public
Throwable
getError
()
{
return
error
;
}
public
boolean
isError
()
{
return
error
!=
null
;
}
public
void
throwIfError
()
{
if
(
isError
())
{
throw
new
IllegalStateException
(
"failed to analyze: "
+
error
,
error
);
}
}
}
compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/JetLightClass.java
浏览文件 @
b47d3709
...
...
@@ -165,6 +165,10 @@ public class JetLightClass extends AbstractLightClass implements JetJavaMirrorMa
// TODO: wrong environment // stepan.koltsov@ 2012-04-09
CompilerSpecialMode
.
REGULAR
,
CompilerDependencies
.
compilerDependenciesForProduction
(
CompilerSpecialMode
.
REGULAR
));
if
(
context
.
isError
())
{
throw
new
IllegalStateException
(
"failed to analyze: "
+
context
.
getError
(),
context
.
getError
());
}
final
GenerationState
state
=
new
GenerationState
(
project
,
builderFactory
,
context
,
Collections
.
singletonList
(
file
))
{
@Override
protected
void
generateNamespace
(
JetFile
namespace
)
{
...
...
compiler/tests/org/jetbrains/jet/codegen/CodegenTestCase.java
浏览文件 @
b47d3709
...
...
@@ -128,6 +128,7 @@ public abstract class CodegenTestCase extends JetLiteFixture {
final
AnalyzeExhaust
analyzeExhaust
=
AnalyzerFacadeForJVM
.
analyzeOneFileWithJavaIntegrationAndCheckForErrors
(
myFile
,
JetControlFlowDataTraceFactory
.
EMPTY
,
CompileCompilerDependenciesTest
.
compilerDependenciesForTests
(
CompilerSpecialMode
.
REGULAR
));
analyzeExhaust
.
throwIfError
();
GenerationState
state
=
new
GenerationState
(
getProject
(),
classBuilderFactory
,
analyzeExhaust
,
Collections
.
singletonList
(
myFile
));
state
.
compileCorrectFiles
(
CompilationErrorHandler
.
THROW_EXCEPTION
);
return
state
;
...
...
compiler/tests/org/jetbrains/jet/codegen/GenerationUtils.java
浏览文件 @
b47d3709
...
...
@@ -39,6 +39,7 @@ public class GenerationUtils {
final
AnalyzeExhaust
analyzeExhaust
=
AnalyzerFacadeForJVM
.
analyzeOneFileWithJavaIntegrationAndCheckForErrors
(
psiFile
,
JetControlFlowDataTraceFactory
.
EMPTY
,
CompileCompilerDependenciesTest
.
compilerDependenciesForTests
(
compilerSpecialMode
));
analyzeExhaust
.
throwIfError
();
GenerationState
state
=
new
GenerationState
(
psiFile
.
getProject
(),
ClassBuilderFactories
.
binaries
(
false
),
analyzeExhaust
,
Collections
.
singletonList
(
psiFile
));
state
.
compileCorrectFiles
(
CompilationErrorHandler
.
THROW_EXCEPTION
);
return
state
;
...
...
idea/src/org/jetbrains/jet/plugin/debugger/JetPositionManager.java
浏览文件 @
b47d3709
...
...
@@ -155,6 +155,7 @@ public class JetPositionManager implements PositionManager {
return
mapper
;
}
final
AnalyzeExhaust
analyzeExhaust
=
WholeProjectAnalyzerFacade
.
analyzeProjectWithCacheOnAFile
(
file
);
analyzeExhaust
.
throwIfError
();
JetTypeMapper
typeMapper
=
new
InjectorForJetTypeMapper
(
analyzeExhaust
.
getStandardLibrary
(),
analyzeExhaust
.
getBindingContext
(),
Collections
.
singletonList
(
file
)).
getJetTypeMapper
();
myTypeMappers
.
put
(
file
,
typeMapper
);
...
...
idea/src/org/jetbrains/jet/plugin/internal/codewindow/BytecodeToolwindow.java
浏览文件 @
b47d3709
...
...
@@ -206,13 +206,14 @@ public class BytecodeToolwindow extends JPanel implements Disposable {
try
{
AnalyzeExhaust
binding
=
WholeProjectAnalyzerFacade
.
analyzeProjectWithCacheOnAFile
(
file
);
// AnalyzingUtils.throwExceptionOnErrors(binding);
if
(
binding
.
isError
())
{
return
printStackTraceToString
(
binding
.
getError
());
}
state
=
new
GenerationState
(
myProject
,
ClassBuilderFactories
.
TEXT
,
binding
,
Collections
.
singletonList
(
file
));
state
.
compileCorrectFiles
(
CompilationErrorHandler
.
THROW_EXCEPTION
);
}
catch
(
Exception
e
)
{
StringWriter
out
=
new
StringWriter
(
1024
);
e
.
printStackTrace
(
new
PrintWriter
(
out
));
return
out
.
toString
().
replaceAll
(
"\r"
,
""
);
return
printStackTraceToString
(
e
);
}
...
...
@@ -229,6 +230,11 @@ public class BytecodeToolwindow extends JPanel implements Disposable {
return
answer
.
toString
();
}
private
static
String
printStackTraceToString
(
Throwable
e
)
{
StringWriter
out
=
new
StringWriter
(
1024
);
e
.
printStackTrace
(
new
PrintWriter
(
out
));
return
out
.
toString
().
replaceAll
(
"\r"
,
""
);
}
@Override
public
void
dispose
()
{
EditorFactory
.
getInstance
().
releaseEditor
(
myEditor
);
...
...
idea/src/org/jetbrains/jet/plugin/project/AnalyzerFacadeWithCache.java
浏览文件 @
b47d3709
...
...
@@ -96,7 +96,7 @@ public final class AnalyzerFacadeWithCache {
private
Result
<
AnalyzeExhaust
>
emptyExhaustWithDiagnosticOnFile
(
Throwable
e
)
{
BindingTraceContext
bindingTraceContext
=
new
BindingTraceContext
();
bindingTraceContext
.
report
(
Errors
.
EXCEPTION_WHILE_ANALYZING
.
on
(
file
,
e
));
AnalyzeExhaust
analyzeExhaust
=
new
AnalyzeExhaust
(
bindingTraceContext
.
getBindingContext
(),
null
);
AnalyzeExhaust
analyzeExhaust
=
AnalyzeExhaust
.
error
(
bindingTraceContext
.
getBindingContext
(),
e
);
return
new
Result
<
AnalyzeExhaust
>(
analyzeExhaust
,
PsiModificationTracker
.
MODIFICATION_COUNT
);
}
},
false
);
...
...
idea/src/org/jetbrains/jet/plugin/project/JSAnalyzerFacadeForIDEA.java
浏览文件 @
b47d3709
...
...
@@ -47,6 +47,6 @@ public enum JSAnalyzerFacadeForIDEA implements AnalyzerFacade {
@NotNull
Predicate
<
PsiFile
>
filesToAnalyzeCompletely
,
@NotNull
JetControlFlowDataTraceFactory
flowDataTraceFactory
)
{
BindingContext
context
=
AnalyzerFacadeForJS
.
analyzeFiles
(
files
,
new
IDEAConfig
(
project
));
return
new
AnalyzeExhaust
(
context
,
JetStandardLibrary
.
getInstance
());
return
AnalyzeExhaust
.
success
(
context
,
JetStandardLibrary
.
getInstance
());
}
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录