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

Side by Side Diff: pkg/analyzer/lib/src/generated/constant.dart

Issue 267293006: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.constant; 8 library engine.constant;
9 9
10 import 'java_core.dart'; 10 import 'java_core.dart';
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 Expression argument = arguments[i]; 549 Expression argument = arguments[i];
550 if (argument is NamedExpression) { 550 if (argument is NamedExpression) {
551 NamedExpression namedExpression = argument; 551 NamedExpression namedExpression = argument;
552 String name = namedExpression.name.label.name; 552 String name = namedExpression.name.label.name;
553 namedArgumentValues[name] = _valueOf(namedExpression.expression); 553 namedArgumentValues[name] = _valueOf(namedExpression.expression);
554 argumentValues[i] = null2; 554 argumentValues[i] = null2;
555 } else { 555 } else {
556 argumentValues[i] = _valueOf(argument); 556 argumentValues[i] = _valueOf(argument);
557 } 557 }
558 } 558 }
559 Set<ConstructorElement> constructorsVisited = new Set<ConstructorElement>( );
559 InterfaceType definingClass = constructor.returnType as InterfaceType; 560 InterfaceType definingClass = constructor.returnType as InterfaceType;
560 if (definingClass.element.library.isDartCore) { 561 while (constructor.isFactory) {
561 String className = definingClass.name; 562 if (definingClass.element.library.isDartCore) {
562 if (className == "Symbol" && argumentCount == 1) { 563 String className = definingClass.name;
563 String argumentValue = argumentValues[0].stringValue; 564 if (className == "Symbol" && argumentCount == 1) {
564 if (argumentValue != null) { 565 String argumentValue = argumentValues[0].stringValue;
565 return _valid(definingClass, new SymbolState(argumentValue)); 566 if (argumentValue != null) {
567 return _valid(definingClass, new SymbolState(argumentValue));
568 }
566 } 569 }
567 } 570 }
571 constructorsVisited.add(constructor);
572 ConstructorElement redirectedConstructor = constructor.redirectedConstru ctor;
573 if (redirectedConstructor == null) {
574 // This can happen if constructor is an external factory constructor. Since there is no
575 // constructor to delegate to, we currently can't evaluate the constan t.
576 // TODO(paulberry): if the constructor is one of {bool,int,String}.fro mEnvironment(),
577 // we may be able to infer the value based on -D flags provided to the analyzer (see
578 // dartbug.com/17234).
579 return _error(node, null);
580 }
581 if (!redirectedConstructor.isConst) {
582 // Delegating to a non-const constructor--this is not allowed (and
583 // is checked elsewhere--see [ErrorVerifier.checkForRedirectToNonConst Constructor()]).
584 // So if we encounter it just error out.
585 return _error(node, null);
586 }
587 if (constructorsVisited.contains(redirectedConstructor)) {
588 // Cycle in redirecting factory constructors--this is not allowed
589 // and is checked elsewhere--see [ErrorVerifier.checkForRecursiveFacto ryRedirect()]).
590 // So if we encounter it just error out.
591 return _error(node, null);
592 }
593 constructor = redirectedConstructor;
594 definingClass = constructor.returnType as InterfaceType;
568 } 595 }
569 Map<String, DartObjectImpl> fieldMap = new Map<String, DartObjectImpl>(); 596 Map<String, DartObjectImpl> fieldMap = new Map<String, DartObjectImpl>();
570 List<ParameterElement> parameters = constructor.parameters; 597 List<ParameterElement> parameters = constructor.parameters;
571 int parameterCount = parameters.length; 598 int parameterCount = parameters.length;
572 for (int i = 0; i < parameterCount; i++) { 599 for (int i = 0; i < parameterCount; i++) {
573 ParameterElement parameter = parameters[i]; 600 ParameterElement parameter = parameters[i];
574 if (parameter.isInitializingFormal) { 601 if (parameter.isInitializingFormal) {
575 FieldElement field = (parameter as FieldFormalParameterElement).field; 602 FieldElement field = (parameter as FieldFormalParameterElement).field;
576 if (field != null) { 603 if (field != null) {
577 String fieldName = field.name; 604 String fieldName = field.name;
(...skipping 3751 matching lines...) Expand 10 before | Expand all | Expand 10 after
4329 ErrorResult _error(AstNode node, ErrorCode code) => new ErrorResult.con1(node, code); 4356 ErrorResult _error(AstNode node, ErrorCode code) => new ErrorResult.con1(node, code);
4330 4357
4331 /** 4358 /**
4332 * Return a result object representing the given value. 4359 * Return a result object representing the given value.
4333 * 4360 *
4334 * @param value the value to be represented as a result object 4361 * @param value the value to be represented as a result object
4335 * @return a result object representing the given value 4362 * @return a result object representing the given value
4336 */ 4363 */
4337 ValidResult _valueOf(DartObjectImpl value) => new ValidResult(value); 4364 ValidResult _valueOf(DartObjectImpl value) => new ValidResult(value);
4338 } 4365 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698