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

Side by Side Diff: pkg/dev_compiler/lib/src/compiler/code_generator.dart

Issue 2815443003: Better DDC sourcemap generation for lambdas (Closed)
Patch Set: Added comments Created 3 years, 8 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 | pkg/dev_compiler/lib/src/compiler/source_map_printer.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 2
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 import 'dart:collection' show HashMap, HashSet; 6 import 'dart:collection' show HashMap, HashSet;
7 import 'dart:math' show min, max; 7 import 'dart:math' show min, max;
8 8
9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 3427 matching lines...) Expand 10 before | Expand all | Expand 10 after
3438 var body = js.call('# == null ? null : #', 3438 var body = js.call('# == null ? null : #',
3439 [_visit(left), _emitSet(_stripNullAwareOp(node, left), right)]); 3439 [_visit(left), _emitSet(_stripNullAwareOp(node, left), right)]);
3440 return new JS.MetaLet(vars, [body]); 3440 return new JS.MetaLet(vars, [body]);
3441 } 3441 }
3442 3442
3443 @override 3443 @override
3444 JS.Block visitExpressionFunctionBody(ExpressionFunctionBody node) { 3444 JS.Block visitExpressionFunctionBody(ExpressionFunctionBody node) {
3445 var savedFunction = _currentFunction; 3445 var savedFunction = _currentFunction;
3446 _currentFunction = node; 3446 _currentFunction = node;
3447 var initArgs = _emitArgumentInitializers(node.parent); 3447 var initArgs = _emitArgumentInitializers(node.parent);
3448 var ret = new JS.Return(_visit(node.expression)); 3448 var ret = annotate(new JS.Return(_visit(node.expression)), node.expression);
3449 _currentFunction = savedFunction; 3449 _currentFunction = savedFunction;
3450 return new JS.Block(initArgs != null ? [initArgs, ret] : [ret]); 3450 var _statements = initArgs != null ? [initArgs, ret] : [ret];
3451 var block = annotate(new JS.Block(_statements), node);
3452 return block;
3451 } 3453 }
3452 3454
3453 @override 3455 @override
3454 JS.Block visitEmptyFunctionBody(EmptyFunctionBody node) => new JS.Block([]); 3456 JS.Block visitEmptyFunctionBody(EmptyFunctionBody node) => new JS.Block([]);
3455 3457
3456 @override 3458 @override
3457 JS.Block visitBlockFunctionBody(BlockFunctionBody node) { 3459 JS.Block visitBlockFunctionBody(BlockFunctionBody node) {
3458 var savedFunction = _currentFunction; 3460 var savedFunction = _currentFunction;
3459 _currentFunction = node; 3461 _currentFunction = node;
3460 var initArgs = _emitArgumentInitializers(node.parent); 3462 var initArgs = _emitArgumentInitializers(node.parent);
(...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after
5948 if (targetIdentifier.staticElement is! PrefixElement) return false; 5950 if (targetIdentifier.staticElement is! PrefixElement) return false;
5949 var prefix = targetIdentifier.staticElement as PrefixElement; 5951 var prefix = targetIdentifier.staticElement as PrefixElement;
5950 5952
5951 // The library the prefix is referring to must come from a deferred import. 5953 // The library the prefix is referring to must come from a deferred import.
5952 var containingLibrary = resolutionMap 5954 var containingLibrary = resolutionMap
5953 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) 5955 .elementDeclaredByCompilationUnit(target.root as CompilationUnit)
5954 .library; 5956 .library;
5955 var imports = containingLibrary.getImportsWithPrefix(prefix); 5957 var imports = containingLibrary.getImportsWithPrefix(prefix);
5956 return imports.length == 1 && imports[0].isDeferred; 5958 return imports.length == 1 && imports[0].isDeferred;
5957 } 5959 }
OLDNEW
« no previous file with comments | « no previous file | pkg/dev_compiler/lib/src/compiler/source_map_printer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698