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

Side by Side Diff: lib/compiler/implementation/typechecker.dart

Issue 10834243: Reduce usage of .enclosingElement to get enclosing class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class TypeCheckerTask extends CompilerTask { 5 class TypeCheckerTask extends CompilerTask {
6 TypeCheckerTask(Compiler compiler) : super(compiler); 6 TypeCheckerTask(Compiler compiler) : super(compiler);
7 String get name() => "Type checker"; 7 String get name() => "Type checker";
8 8
9 static final bool LOG_FAILURES = false; 9 static final bool LOG_FAILURES = false;
10 10
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 element.kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { 332 element.kind === ElementKind.GENERATIVE_CONSTRUCTOR_BODY) {
333 type = types.dynamicType; 333 type = types.dynamicType;
334 returnType = types.voidType; 334 returnType = types.voidType;
335 } else { 335 } else {
336 FunctionType functionType = computeType(element); 336 FunctionType functionType = computeType(element);
337 returnType = functionType.returnType; 337 returnType = functionType.returnType;
338 type = functionType; 338 type = functionType;
339 } 339 }
340 Type previous = expectedReturnType; 340 Type previous = expectedReturnType;
341 expectedReturnType = returnType; 341 expectedReturnType = returnType;
342 if (element.isMember()) currentClass = element.enclosingElement; 342 if (element.isMember()) currentClass = element.getEnclosingClass();
343 StatementType bodyType = analyze(node.body); 343 StatementType bodyType = analyze(node.body);
344 if (returnType != types.voidType && returnType != types.dynamicType 344 if (returnType != types.voidType && returnType != types.dynamicType
345 && bodyType != StatementType.RETURNING) { 345 && bodyType != StatementType.RETURNING) {
346 MessageKind kind; 346 MessageKind kind;
347 if (bodyType == StatementType.MAYBE_RETURNING) { 347 if (bodyType == StatementType.MAYBE_RETURNING) {
348 kind = MessageKind.MAYBE_MISSING_RETURN; 348 kind = MessageKind.MAYBE_MISSING_RETURN;
349 } else { 349 } else {
350 kind = MessageKind.MISSING_RETURN; 350 kind = MessageKind.MISSING_RETURN;
351 } 351 }
352 reportTypeWarning(node.name, kind); 352 reportTypeWarning(node.name, kind);
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 } 774 }
775 775
776 visitCatchBlock(CatchBlock node) { 776 visitCatchBlock(CatchBlock node) {
777 return unhandledStatement(); 777 return unhandledStatement();
778 } 778 }
779 779
780 visitTypedef(Typedef node) { 780 visitTypedef(Typedef node) {
781 return unhandledStatement(); 781 return unhandledStatement();
782 } 782 }
783 } 783 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698