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

Side by Side Diff: lib/src/codegen/reify_coercions.dart

Issue 1266483003: format with dart_style 0.2.0-rc.3 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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
« no previous file with comments | « lib/src/codegen/js_names.dart ('k') | lib/src/codegen/side_effect_analysis.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library dev_compiler.src.codegen.reify_coercions; 5 library dev_compiler.src.codegen.reify_coercions;
6 6
7 import 'package:analyzer/analyzer.dart' as analyzer; 7 import 'package:analyzer/analyzer.dart' as analyzer;
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/element.dart'; 9 import 'package:analyzer/src/generated/element.dart';
10 import 'package:logging/logging.dart' as logger; 10 import 'package:logging/logging.dart' as logger;
(...skipping 12 matching lines...) Expand all
23 final T1 e1; 23 final T1 e1;
24 Tuple2(this.e0, this.e1); 24 Tuple2(this.e0, this.e1);
25 } 25 }
26 26
27 typedef T Function1<S, T>(S _); 27 typedef T Function1<S, T>(S _);
28 28
29 class NewTypeIdDesc { 29 class NewTypeIdDesc {
30 /// If null, then this is not a library level identifier (i.e. it's 30 /// If null, then this is not a library level identifier (i.e. it's
31 /// a type parameter, or a special type like void, dynamic, etc) 31 /// a type parameter, or a special type like void, dynamic, etc)
32 LibraryElement importedFrom; 32 LibraryElement importedFrom;
33
33 /// True => use/def in same library 34 /// True => use/def in same library
34 bool fromCurrent; 35 bool fromCurrent;
36
35 /// True => not a source variable 37 /// True => not a source variable
36 bool synthetic; 38 bool synthetic;
37 NewTypeIdDesc({this.fromCurrent, this.importedFrom, this.synthetic}); 39 NewTypeIdDesc({this.fromCurrent, this.importedFrom, this.synthetic});
38 } 40 }
39 41
40 class _Inference extends DownwardsInference { 42 class _Inference extends DownwardsInference {
41 TypeManager _tm; 43 TypeManager _tm;
42 44
43 _Inference(TypeRules rules, this._tm) : super(rules); 45 _Inference(TypeRules rules, this._tm) : super(rules);
44 46
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 VariableManager _vm; 185 VariableManager _vm;
184 TypeManager _tm; 186 TypeManager _tm;
185 187
186 CoercionManager(this._vm, this._tm); 188 CoercionManager(this._vm, this._tm);
187 189
188 // Call on entry to and exit from a compilation unit in order to properly 190 // Call on entry to and exit from a compilation unit in order to properly
189 // discharge the accumulated wrappers. 191 // discharge the accumulated wrappers.
190 void enterCompilationUnit(CompilationUnit unit) { 192 void enterCompilationUnit(CompilationUnit unit) {
191 _tm.enterCompilationUnit(unit); 193 _tm.enterCompilationUnit(unit);
192 } 194 }
195
193 void exitCompilationUnit(CompilationUnit unit) { 196 void exitCompilationUnit(CompilationUnit unit) {
194 _tm.exitCompilationUnit(unit); 197 _tm.exitCompilationUnit(unit);
195 } 198 }
196 199
197 // The main entry point. Coerce e using c, returning a new expression, 200 // The main entry point. Coerce e using c, returning a new expression,
198 // possibly recording additional coercions functions and typedefs to 201 // possibly recording additional coercions functions and typedefs to
199 // be discharged at a higher level. 202 // be discharged at a higher level.
200 Expression coerceExpression(Expression e, Coercion c) { 203 Expression coerceExpression(Expression e, Coercion c) {
201 assert(c != null); 204 assert(c != null);
202 assert(c is! CoercionError); 205 assert(c is! CoercionError);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 var desc = new NewTypeIdDesc( 381 var desc = new NewTypeIdDesc(
379 fromCurrent: _currentLibrary == library, 382 fromCurrent: _currentLibrary == library,
380 importedFrom: library, 383 importedFrom: library,
381 synthetic: false); 384 synthetic: false);
382 addedTypes[id] = desc; 385 addedTypes[id] = desc;
383 return id; 386 return id;
384 } 387 }
385 388
386 FunctionTypeAlias _newResolvedTypedef( 389 FunctionTypeAlias _newResolvedTypedef(
387 FunctionType type, List<TypeParameterType> ftvs) { 390 FunctionType type, List<TypeParameterType> ftvs) {
388
389 // The name of the typedef (unresolved at this point) 391 // The name of the typedef (unresolved at this point)
390 // TODO(leafp): better naming. 392 // TODO(leafp): better naming.
391 SimpleIdentifier t = freshTypeDefVariable("CastType"); 393 SimpleIdentifier t = freshTypeDefVariable("CastType");
392 394
393 // The element for the new typedef 395 // The element for the new typedef
394 var element = new FunctionTypeAliasElementImpl(t.name, 0); 396 var element = new FunctionTypeAliasElementImpl(t.name, 0);
395 397
396 // Fresh type parameter identifiers for the free type variables 398 // Fresh type parameter identifiers for the free type variables
397 List<Identifier> tNames = 399 List<Identifier> tNames =
398 ftvs.map((x) => typeParameterFromString(x.name)).toList(); 400 ftvs.map((x) => typeParameterFromString(x.name)).toList();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 var t = _mkNewTypeName(dType, id, args); 494 var t = _mkNewTypeName(dType, id, args);
493 return t; 495 return t;
494 } 496 }
495 497
496 TypeName _mkNewTypeName(DartType type, Identifier id, List<TypeName> args) { 498 TypeName _mkNewTypeName(DartType type, Identifier id, List<TypeName> args) {
497 var t = AstBuilder.typeName(id, args); 499 var t = AstBuilder.typeName(id, args);
498 t.type = type; 500 t.type = type;
499 return t; 501 return t;
500 } 502 }
501 } 503 }
OLDNEW
« no previous file with comments | « lib/src/codegen/js_names.dart ('k') | lib/src/codegen/side_effect_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698