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

Side by Side Diff: lib/src/barback/dependency_computer.dart

Issue 1229303004: Fix a stack overflow when loading transformers. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | test/dependency_computer/cycle_test.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 pub.barback.dependency_computer; 5 library pub.barback.dependency_computer;
6 6
7 import 'package:barback/barback.dart'; 7 import 'package:barback/barback.dart';
8 import 'package:path/path.dart' as p; 8 import 'package:path/path.dart' as p;
9 9
10 import '../dart.dart'; 10 import '../dart.dart';
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // Probe [id]'s transformer dependencies to ensure that it doesn't 280 // Probe [id]'s transformer dependencies to ensure that it doesn't
281 // depend on this package. If it does, a CycleError will be thrown. 281 // depend on this package. If it does, a CycleError will be thrown.
282 _dependencyComputer._transformersNeededByTransformer(id); 282 _dependencyComputer._transformersNeededByTransformer(id);
283 } else { 283 } else {
284 // Store the transformers needed specifically with the current set 284 // Store the transformers needed specifically with the current set
285 // of [_applicableTransformers]. When reporting this transformer's 285 // of [_applicableTransformers]. When reporting this transformer's
286 // dependencies, [computeTransformersNeededByTransformers] will use 286 // dependencies, [computeTransformersNeededByTransformers] will use
287 // this stored set of dependencies rather than the potentially wider 287 // this stored set of dependencies rather than the potentially wider
288 // set that would be recomputed if [transformersNeededByLibrary] 288 // set that would be recomputed if [transformersNeededByLibrary]
289 // were called anew. 289 // were called anew.
290 _transformersNeededByTransformers[id] = 290 _transformersNeededByTransformers.putIfAbsent(id, () =>
291 transformersNeededByLibrary(_package.transformerPath(id)); 291 transformersNeededByLibrary(_package.transformerPath(id)));
292 } 292 }
293 } on CycleException catch (error) { 293 } on CycleException catch (error) {
294 throw error.prependStep("$packageName is transformed by $id"); 294 throw error.prependStep("$packageName is transformed by $id");
295 } 295 }
296 296
297 return true; 297 return true;
298 })); 298 }));
299 299
300 // Clear the cached imports and exports because the new transformers may 300 // Clear the cached imports and exports because the new transformers may
301 // start transforming a library whose directives were previously 301 // start transforming a library whose directives were previously
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 return null; 444 return null;
445 } 445 }
446 446
447 _directives[libraryUri] = 447 _directives[libraryUri] =
448 parseImportsAndExports(readTextFile(library), name: library) 448 parseImportsAndExports(readTextFile(library), name: library)
449 .map((directive) => Uri.parse(directive.uri.stringValue)) 449 .map((directive) => Uri.parse(directive.uri.stringValue))
450 .toSet(); 450 .toSet();
451 return _directives[libraryUri]; 451 return _directives[libraryUri];
452 } 452 }
453 } 453 }
OLDNEW
« no previous file with comments | « no previous file | test/dependency_computer/cycle_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698