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

Side by Side Diff: pkg/compiler/lib/src/mirrors/dart2js_mirrors.dart

Issue 1146943002: Change Link to List in FunctionSignature. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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
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 library dart2js.mirrors; 5 library dart2js.mirrors;
6 6
7 import 'dart:collection' show UnmodifiableListView, UnmodifiableMapView; 7 import 'dart:collection' show UnmodifiableListView, UnmodifiableMapView;
8 8
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../constants/values.dart'; 10 import '../constants/values.dart';
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 38
39 bool _isPrivate(String name) { 39 bool _isPrivate(String name) {
40 return name.startsWith('_'); 40 return name.startsWith('_');
41 } 41 }
42 42
43 List<ParameterMirror> _parametersFromFunctionSignature( 43 List<ParameterMirror> _parametersFromFunctionSignature(
44 Dart2JsDeclarationMirror owner, 44 Dart2JsDeclarationMirror owner,
45 FunctionSignature signature) { 45 FunctionSignature signature) {
46 var parameters = <ParameterMirror>[]; 46 var parameters = <ParameterMirror>[];
47 Link<Element> link = signature.requiredParameters; 47 signature.requiredParameters.forEach((FormalElement parameter) {
48 while (!link.isEmpty) {
49 parameters.add(new Dart2JsParameterMirror( 48 parameters.add(new Dart2JsParameterMirror(
50 owner, link.head, isOptional: false, isNamed: false)); 49 owner, parameter, isOptional: false, isNamed: false));
51 link = link.tail; 50 });
52 }
53 link = signature.optionalParameters;
54 bool isNamed = signature.optionalParametersAreNamed; 51 bool isNamed = signature.optionalParametersAreNamed;
55 while (!link.isEmpty) { 52 signature.optionalParameters.forEach((FormalElement parameter) {
56 parameters.add(new Dart2JsParameterMirror( 53 parameters.add(new Dart2JsParameterMirror(
57 owner, link.head, isOptional: true, isNamed: isNamed)); 54 owner, parameter, isOptional: true, isNamed: isNamed));
58 link = link.tail; 55 });
59 }
60 return parameters; 56 return parameters;
61 } 57 }
62 58
63 MethodMirror _convertElementMethodToMethodMirror( 59 MethodMirror _convertElementMethodToMethodMirror(
64 Dart2JsDeclarationMirror library, Element element) { 60 Dart2JsDeclarationMirror library, Element element) {
65 if (element is FunctionElement) { 61 if (element is FunctionElement) {
66 return new Dart2JsMethodMirror(library, element); 62 return new Dart2JsMethodMirror(library, element);
67 } else { 63 } else {
68 return null; 64 return null;
69 } 65 }
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 if (!parameter.hasDefaultValue) return null; 472 if (!parameter.hasDefaultValue) return null;
477 ParameterElement parameterElement = parameter._element; 473 ParameterElement parameterElement = parameter._element;
478 Compiler compiler = parameter.mirrorSystem.compiler; 474 Compiler compiler = parameter.mirrorSystem.compiler;
479 return compiler.constants.getConstantForVariable(parameterElement); 475 return compiler.constants.getConstantForVariable(parameterElement);
480 } 476 }
481 477
482 static Mirror getMirrorFromElement(Dart2JsMirror mirror, Element element) { 478 static Mirror getMirrorFromElement(Dart2JsMirror mirror, Element element) {
483 return _convertElementToDeclarationMirror(mirror.mirrorSystem, element); 479 return _convertElementToDeclarationMirror(mirror.mirrorSystem, element);
484 } 480 }
485 } 481 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/patch_resolver.dart ('k') | pkg/compiler/lib/src/resolution/enum_creator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698