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

Side by Side Diff: lib/compiler/implementation/js_backend/backend.dart

Issue 10914097: Fix type-annotation and add another tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | tests/language/lazy_static4_test.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 typedef void Recompile(Element element); 5 typedef void Recompile(Element element);
6 6
7 class ReturnInfo { 7 class ReturnInfo {
8 HType returnType; 8 HType returnType;
9 List<Element> compiledFunctions; 9 List<Element> compiledFunctions;
10 10
(...skipping 13 matching lines...) Expand all
24 compiledFunctions.clear(); 24 compiledFunctions.clear();
25 } 25 }
26 returnType = newType; 26 returnType = newType;
27 if (recompile != null) { 27 if (recompile != null) {
28 compiledFunctions.forEach(recompile); 28 compiledFunctions.forEach(recompile);
29 } 29 }
30 compiledFunctions.clear(); 30 compiledFunctions.clear();
31 } 31 }
32 } 32 }
33 33
34 addCompiledFunction(FunctionElement function) => 34 // Note that lazy initializers are treated like functions (but are not
35 compiledFunctions.add(function); 35 // of type [FunctionElement].
36 addCompiledFunction(Element function) => compiledFunctions.add(function);
36 } 37 }
37 38
38 class HTypeList { 39 class HTypeList {
39 final List<HType> types; 40 final List<HType> types;
40 41
41 HTypeList(int length) : types = new List<HType>(length); 42 HTypeList(int length) : types = new List<HType>(length);
42 const HTypeList.withAllUnknown() : types = null; 43 const HTypeList.withAllUnknown() : types = null;
43 44
44 factory HTypeList.fromInvocation(HInvoke node, HTypeMap types) { 45 factory HTypeList.fromInvocation(HInvoke node, HTypeMap types) {
45 bool allUnknown = true; 46 bool allUnknown = true;
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 } 546 }
546 547
547 /** 548 /**
548 * Retrieve the return type of the function [callee]. The type is optimistic 549 * Retrieve the return type of the function [callee]. The type is optimistic
549 * in the sense that is is based on the compilation of [callee]. If [callee] 550 * in the sense that is is based on the compilation of [callee]. If [callee]
550 * is recompiled the return type might change to someting broader. For that 551 * is recompiled the return type might change to someting broader. For that
551 * reason [caller] is registered for recompilation if this happens. If the 552 * reason [caller] is registered for recompilation if this happens. If the
552 * function [callee] has not yet been compiled the returned type is [null]. 553 * function [callee] has not yet been compiled the returned type is [null].
553 */ 554 */
554 HType optimisticReturnTypesWithRecompilationOnTypeChange( 555 HType optimisticReturnTypesWithRecompilationOnTypeChange(
555 FunctionElement caller, FunctionElement callee) { 556 Element caller, FunctionElement callee) {
556 returnInfo.putIfAbsent(callee, () => new ReturnInfo.unknownType()); 557 returnInfo.putIfAbsent(callee, () => new ReturnInfo.unknownType());
557 ReturnInfo info = returnInfo[callee]; 558 ReturnInfo info = returnInfo[callee];
558 if (info.returnType != HType.UNKNOWN && caller != null) { 559 if (info.returnType != HType.UNKNOWN && caller != null) {
559 info.addCompiledFunction(caller); 560 info.addCompiledFunction(caller);
560 } 561 }
561 return info.returnType; 562 return info.returnType;
562 } 563 }
563 564
564 SourceString getCheckedModeHelper(DartType type) { 565 SourceString getCheckedModeHelper(DartType type) {
565 Element element = type.element; 566 Element element = type.element;
(...skipping 27 matching lines...) Expand all
593 return const SourceString('listSuperTypeCheck'); 594 return const SourceString('listSuperTypeCheck');
594 } 595 }
595 } else if (nativeCheck) { 596 } else if (nativeCheck) {
596 return const SourceString('callTypeCheck'); 597 return const SourceString('callTypeCheck');
597 } else { 598 } else {
598 return const SourceString('propertyTypeCheck'); 599 return const SourceString('propertyTypeCheck');
599 } 600 }
600 } 601 }
601 } 602 }
602 } 603 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | tests/language/lazy_static4_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698