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

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

Issue 1605763007: Validate that int values that we write to summaries are >= 0. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/analyzer/lib/src/generated/testing/test_type_provider.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 analyzer.src.generated.testing.element_factory; 5 library analyzer.src.generated.testing.element_factory;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 static ConstLocalVariableElementImpl constLocalVariableElement(String name) => 93 static ConstLocalVariableElementImpl constLocalVariableElement(String name) =>
94 new ConstLocalVariableElementImpl(name, 0); 94 new ConstLocalVariableElementImpl(name, 0);
95 95
96 static ConstructorElementImpl constructorElement( 96 static ConstructorElementImpl constructorElement(
97 ClassElement definingClass, String name, bool isConst, 97 ClassElement definingClass, String name, bool isConst,
98 [List<DartType> argumentTypes]) { 98 [List<DartType> argumentTypes]) {
99 DartType type = definingClass.type; 99 DartType type = definingClass.type;
100 ConstructorElementImpl constructor = name == null 100 ConstructorElementImpl constructor = name == null
101 ? new ConstructorElementImpl("", -1) 101 ? new ConstructorElementImpl("", -1)
102 : new ConstructorElementImpl(name, 0); 102 : new ConstructorElementImpl(name, 0);
103 constructor.synthetic = name == null;
103 constructor.const2 = isConst; 104 constructor.const2 = isConst;
104 if (argumentTypes != null) { 105 if (argumentTypes != null) {
105 int count = argumentTypes.length; 106 int count = argumentTypes.length;
106 List<ParameterElement> parameters = new List<ParameterElement>(count); 107 List<ParameterElement> parameters = new List<ParameterElement>(count);
107 for (int i = 0; i < count; i++) { 108 for (int i = 0; i < count; i++) {
108 ParameterElementImpl parameter = new ParameterElementImpl("a$i", i); 109 ParameterElementImpl parameter = new ParameterElementImpl("a$i", i);
109 parameter.type = argumentTypes[i]; 110 parameter.type = argumentTypes[i];
110 parameter.parameterKind = ParameterKind.REQUIRED; 111 parameter.parameterKind = ParameterKind.REQUIRED;
111 parameters[i] = parameter; 112 parameters[i] = parameter;
112 } 113 }
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 399 }
399 400
400 static PropertyAccessorElementImpl getterElement( 401 static PropertyAccessorElementImpl getterElement(
401 String name, bool isStatic, DartType type) { 402 String name, bool isStatic, DartType type) {
402 FieldElementImpl field = new FieldElementImpl(name, -1); 403 FieldElementImpl field = new FieldElementImpl(name, -1);
403 field.static = isStatic; 404 field.static = isStatic;
404 field.synthetic = true; 405 field.synthetic = true;
405 field.type = type; 406 field.type = type;
406 field.final2 = true; 407 field.final2 = true;
407 PropertyAccessorElementImpl getter = 408 PropertyAccessorElementImpl getter =
408 new PropertyAccessorElementImpl.forVariable(field); 409 new PropertyAccessorElementImpl(name, 0);
409 getter.synthetic = false; 410 getter.synthetic = false;
410 getter.getter = true; 411 getter.getter = true;
411 getter.variable = field; 412 getter.variable = field;
412 getter.returnType = type; 413 getter.returnType = type;
414 getter.static = isStatic;
413 field.getter = getter; 415 field.getter = getter;
414 FunctionTypeImpl getterType = new FunctionTypeImpl(getter); 416 FunctionTypeImpl getterType = new FunctionTypeImpl(getter);
415 getter.type = getterType; 417 getter.type = getterType;
416 return getter; 418 return getter;
417 } 419 }
418 420
419 static ImportElementImpl importFor( 421 static ImportElementImpl importFor(
420 LibraryElement importedLibrary, PrefixElement prefix, 422 LibraryElement importedLibrary, PrefixElement prefix,
421 [List<NamespaceCombinator> combinators = 423 [List<NamespaceCombinator> combinators =
422 NamespaceCombinator.EMPTY_LIST]) { 424 NamespaceCombinator.EMPTY_LIST]) {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 } 621 }
620 622
621 static TypeParameterElementImpl typeParameterWithType(String name, 623 static TypeParameterElementImpl typeParameterWithType(String name,
622 [DartType bound]) { 624 [DartType bound]) {
623 TypeParameterElementImpl typeParameter = typeParameterElement(name); 625 TypeParameterElementImpl typeParameter = typeParameterElement(name);
624 typeParameter.type = new TypeParameterTypeImpl(typeParameter); 626 typeParameter.type = new TypeParameterTypeImpl(typeParameter);
625 typeParameter.bound = bound; 627 typeParameter.bound = bound;
626 return typeParameter; 628 return typeParameter;
627 } 629 }
628 } 630 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/testing/test_type_provider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698