Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: pkg/kernel/lib/analyzer/ast_from_analyzer.dart

Issue 2644513002: Revert "Fix some crashes in dartk." (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/kernel/lib/analyzer/loader.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/analyzer/ast_from_analyzer.dart
diff --git a/pkg/kernel/lib/analyzer/ast_from_analyzer.dart b/pkg/kernel/lib/analyzer/ast_from_analyzer.dart
index cbbf53ea29593bb3c3d1d3e6e6373d64d072a1db..7bf54a7f464d0e0edcb367f8c584c1554cf2a1a5 100644
--- a/pkg/kernel/lib/analyzer/ast_from_analyzer.dart
+++ b/pkg/kernel/lib/analyzer/ast_from_analyzer.dart
@@ -754,14 +754,11 @@ class ExpressionScope extends TypeScope {
return new ast.Throw(new ast.StringLiteral(message));
}
- ast.Expression buildThrowCompileTimeErrorFromCode(ErrorCode code,
- [List arguments]) {
- return buildThrowCompileTimeError(makeErrorMessage(code, arguments));
- }
-
static final RegExp _errorMessagePattern = new RegExp(r'\{(\d+)\}');
- String makeErrorMessage(ErrorCode error, [List arguments]) {
+ /// Throws an exception that will be caught at the function level, to replace
+ /// the entire function with a throw.
+ emitCompileTimeError(ErrorCode error, [List arguments]) {
String message = error.message;
if (arguments != null) {
message = message.replaceAllMapped(_errorMessagePattern, (m) {
@@ -770,13 +767,7 @@ class ExpressionScope extends TypeScope {
return arguments[index];
});
}
- return message;
- }
-
- /// Throws an exception that will be caught at the function level, to replace
- /// the entire function with a throw.
- emitCompileTimeError(ErrorCode error, [List arguments]) {
- throw new _CompilationError(makeErrorMessage(error, arguments));
+ throw new _CompilationError(message);
}
ast.Expression buildThrowAbstractClassInstantiationError(String name) {
@@ -1702,9 +1693,6 @@ class ExpressionBuilder
if (isTopLevelFunction(function)) {
return scope.staticAccess(node.name, function);
}
- if (function == function.library.loadLibraryFunction) {
- return scope.unsupportedFeature('Deferred loading');
- }
return new VariableAccessor(scope.getVariableReference(function));
case ElementKind.LOCAL_VARIABLE:
@@ -2749,18 +2737,9 @@ class MemberBodyBuilder extends GeneralizingAstVisitor<Null> {
}
for (var parameter in node.parameters.parameterElements) {
if (parameter is FieldFormalParameterElement) {
- ast.Initializer initializer;
- if (parameter.field == null) {
- initializer = new ast.LocalInitializer(
- new ast.VariableDeclaration.forValue(scope
- .buildThrowCompileTimeErrorFromCode(
- CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD,
- [parameter.name])));
- } else {
- initializer = new ast.FieldInitializer(
- scope.getMemberReference(parameter.field),
- new ast.VariableGet(scope.getVariableReference(parameter)));
- }
+ var initializer = new ast.FieldInitializer(
+ scope.getMemberReference(parameter.field),
+ new ast.VariableGet(scope.getVariableReference(parameter)));
constructor.initializers.add(initializer..parent = constructor);
}
}
« no previous file with comments | « no previous file | pkg/kernel/lib/analyzer/loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698