| OLD | NEW |
| 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.all_the_rest_test; | 8 library engine.all_the_rest_test; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 import 'package:analyzer/src/generated/resolver.dart'; | 24 import 'package:analyzer/src/generated/resolver.dart'; |
| 25 import 'package:analyzer/src/generated/scanner.dart'; | 25 import 'package:analyzer/src/generated/scanner.dart'; |
| 26 import 'package:analyzer/src/generated/sdk.dart'; | 26 import 'package:analyzer/src/generated/sdk.dart'; |
| 27 import 'package:analyzer/src/generated/sdk_io.dart'; | 27 import 'package:analyzer/src/generated/sdk_io.dart'; |
| 28 import 'package:analyzer/src/generated/source.dart'; | 28 import 'package:analyzer/src/generated/source.dart'; |
| 29 import 'package:analyzer/src/generated/source_io.dart'; | 29 import 'package:analyzer/src/generated/source_io.dart'; |
| 30 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 30 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 31 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 31 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
| 32 import 'package:analyzer/src/generated/testing/html_factory.dart'; | 32 import 'package:analyzer/src/generated/testing/html_factory.dart'; |
| 33 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; | 33 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; |
| 34 import 'package:analyzer/src/generated/testing/token_factory.dart'; |
| 34 import 'package:analyzer/src/generated/utilities_collection.dart'; | 35 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| 35 import 'package:analyzer/src/generated/utilities_dart.dart'; | 36 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 36 import 'package:analyzer/src/task/dart.dart'; | 37 import 'package:analyzer/src/task/dart.dart'; |
| 37 import 'package:path/path.dart'; | 38 import 'package:path/path.dart'; |
| 38 import 'package:unittest/unittest.dart'; | 39 import 'package:unittest/unittest.dart'; |
| 39 | 40 |
| 40 import '../reflective_tests.dart'; | 41 import '../reflective_tests.dart'; |
| 41 import 'engine_test.dart'; | 42 import 'engine_test.dart'; |
| 42 import 'parser_test.dart'; | 43 import 'parser_test.dart'; |
| 43 import 'resolver_test.dart'; | 44 import 'resolver_test.dart'; |
| (...skipping 5103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5147 AstFactory.typeParameterList(['T']), null, | 5148 AstFactory.typeParameterList(['T']), null, |
| 5148 AstFactory.typeName(classB, []), withClause, null); | 5149 AstFactory.typeName(classB, []), withClause, null); |
| 5149 classCAst.accept(builder); | 5150 classCAst.accept(builder); |
| 5150 List<ClassElement> types = holder.types; | 5151 List<ClassElement> types = holder.types; |
| 5151 expect(types, hasLength(1)); | 5152 expect(types, hasLength(1)); |
| 5152 ClassElement type = types[0]; | 5153 ClassElement type = types[0]; |
| 5153 expect(type.typeParameters, hasLength(1)); | 5154 expect(type.typeParameters, hasLength(1)); |
| 5154 expect(type.typeParameters[0].name, equals('T')); | 5155 expect(type.typeParameters[0].name, equals('T')); |
| 5155 } | 5156 } |
| 5156 | 5157 |
| 5158 void test_visitConstructorDeclaration_external() { |
| 5159 ElementHolder holder = new ElementHolder(); |
| 5160 ElementBuilder builder = new ElementBuilder(holder); |
| 5161 String className = "A"; |
| 5162 ConstructorDeclaration constructorDeclaration = AstFactory |
| 5163 .constructorDeclaration2(null, null, AstFactory.identifier3(className), |
| 5164 null, AstFactory.formalParameterList(), null, |
| 5165 AstFactory.blockFunctionBody2()); |
| 5166 constructorDeclaration.externalKeyword = |
| 5167 TokenFactory.tokenFromKeyword(Keyword.EXTERNAL); |
| 5168 constructorDeclaration.accept(builder); |
| 5169 List<ConstructorElement> constructors = holder.constructors; |
| 5170 expect(constructors, hasLength(1)); |
| 5171 ConstructorElement constructor = constructors[0]; |
| 5172 expect(constructor, isNotNull); |
| 5173 expect(constructor.isExternal, isTrue); |
| 5174 expect(constructor.isFactory, isFalse); |
| 5175 expect(constructor.name, ""); |
| 5176 expect(constructor.functions, hasLength(0)); |
| 5177 expect(constructor.labels, hasLength(0)); |
| 5178 expect(constructor.localVariables, hasLength(0)); |
| 5179 expect(constructor.parameters, hasLength(0)); |
| 5180 } |
| 5181 |
| 5157 void test_visitConstructorDeclaration_factory() { | 5182 void test_visitConstructorDeclaration_factory() { |
| 5158 ElementHolder holder = new ElementHolder(); | 5183 ElementHolder holder = new ElementHolder(); |
| 5159 ElementBuilder builder = new ElementBuilder(holder); | 5184 ElementBuilder builder = new ElementBuilder(holder); |
| 5160 String className = "A"; | 5185 String className = "A"; |
| 5161 ConstructorDeclaration constructorDeclaration = AstFactory | 5186 ConstructorDeclaration constructorDeclaration = AstFactory |
| 5162 .constructorDeclaration2(null, Keyword.FACTORY, | 5187 .constructorDeclaration2(null, Keyword.FACTORY, |
| 5163 AstFactory.identifier3(className), null, | 5188 AstFactory.identifier3(className), null, |
| 5164 AstFactory.formalParameterList(), null, | 5189 AstFactory.formalParameterList(), null, |
| 5165 AstFactory.blockFunctionBody2()); | 5190 AstFactory.blockFunctionBody2()); |
| 5166 constructorDeclaration.accept(builder); | 5191 constructorDeclaration.accept(builder); |
| 5167 List<ConstructorElement> constructors = holder.constructors; | 5192 List<ConstructorElement> constructors = holder.constructors; |
| 5168 expect(constructors, hasLength(1)); | 5193 expect(constructors, hasLength(1)); |
| 5169 ConstructorElement constructor = constructors[0]; | 5194 ConstructorElement constructor = constructors[0]; |
| 5170 expect(constructor, isNotNull); | 5195 expect(constructor, isNotNull); |
| 5196 expect(constructor.isExternal, isFalse); |
| 5171 expect(constructor.isFactory, isTrue); | 5197 expect(constructor.isFactory, isTrue); |
| 5172 expect(constructor.name, ""); | 5198 expect(constructor.name, ""); |
| 5173 expect(constructor.functions, hasLength(0)); | 5199 expect(constructor.functions, hasLength(0)); |
| 5174 expect(constructor.labels, hasLength(0)); | 5200 expect(constructor.labels, hasLength(0)); |
| 5175 expect(constructor.localVariables, hasLength(0)); | 5201 expect(constructor.localVariables, hasLength(0)); |
| 5176 expect(constructor.parameters, hasLength(0)); | 5202 expect(constructor.parameters, hasLength(0)); |
| 5177 } | 5203 } |
| 5178 | 5204 |
| 5179 void test_visitConstructorDeclaration_minimal() { | 5205 void test_visitConstructorDeclaration_minimal() { |
| 5180 ElementHolder holder = new ElementHolder(); | 5206 ElementHolder holder = new ElementHolder(); |
| 5181 ElementBuilder builder = new ElementBuilder(holder); | 5207 ElementBuilder builder = new ElementBuilder(holder); |
| 5182 String className = "A"; | 5208 String className = "A"; |
| 5183 ConstructorDeclaration constructorDeclaration = AstFactory | 5209 ConstructorDeclaration constructorDeclaration = AstFactory |
| 5184 .constructorDeclaration2(null, null, AstFactory.identifier3(className), | 5210 .constructorDeclaration2(null, null, AstFactory.identifier3(className), |
| 5185 null, AstFactory.formalParameterList(), null, | 5211 null, AstFactory.formalParameterList(), null, |
| 5186 AstFactory.blockFunctionBody2()); | 5212 AstFactory.blockFunctionBody2()); |
| 5187 constructorDeclaration.accept(builder); | 5213 constructorDeclaration.accept(builder); |
| 5188 List<ConstructorElement> constructors = holder.constructors; | 5214 List<ConstructorElement> constructors = holder.constructors; |
| 5189 expect(constructors, hasLength(1)); | 5215 expect(constructors, hasLength(1)); |
| 5190 ConstructorElement constructor = constructors[0]; | 5216 ConstructorElement constructor = constructors[0]; |
| 5191 expect(constructor, isNotNull); | 5217 expect(constructor, isNotNull); |
| 5218 expect(constructor.isExternal, isFalse); |
| 5192 expect(constructor.isFactory, isFalse); | 5219 expect(constructor.isFactory, isFalse); |
| 5193 expect(constructor.name, ""); | 5220 expect(constructor.name, ""); |
| 5194 expect(constructor.functions, hasLength(0)); | 5221 expect(constructor.functions, hasLength(0)); |
| 5195 expect(constructor.labels, hasLength(0)); | 5222 expect(constructor.labels, hasLength(0)); |
| 5196 expect(constructor.localVariables, hasLength(0)); | 5223 expect(constructor.localVariables, hasLength(0)); |
| 5197 expect(constructor.parameters, hasLength(0)); | 5224 expect(constructor.parameters, hasLength(0)); |
| 5198 } | 5225 } |
| 5199 | 5226 |
| 5200 void test_visitConstructorDeclaration_named() { | 5227 void test_visitConstructorDeclaration_named() { |
| 5201 ElementHolder holder = new ElementHolder(); | 5228 ElementHolder holder = new ElementHolder(); |
| 5202 ElementBuilder builder = new ElementBuilder(holder); | 5229 ElementBuilder builder = new ElementBuilder(holder); |
| 5203 String className = "A"; | 5230 String className = "A"; |
| 5204 String constructorName = "c"; | 5231 String constructorName = "c"; |
| 5205 ConstructorDeclaration constructorDeclaration = AstFactory | 5232 ConstructorDeclaration constructorDeclaration = AstFactory |
| 5206 .constructorDeclaration2(null, null, AstFactory.identifier3(className), | 5233 .constructorDeclaration2(null, null, AstFactory.identifier3(className), |
| 5207 constructorName, AstFactory.formalParameterList(), null, | 5234 constructorName, AstFactory.formalParameterList(), null, |
| 5208 AstFactory.blockFunctionBody2()); | 5235 AstFactory.blockFunctionBody2()); |
| 5209 constructorDeclaration.accept(builder); | 5236 constructorDeclaration.accept(builder); |
| 5210 List<ConstructorElement> constructors = holder.constructors; | 5237 List<ConstructorElement> constructors = holder.constructors; |
| 5211 expect(constructors, hasLength(1)); | 5238 expect(constructors, hasLength(1)); |
| 5212 ConstructorElement constructor = constructors[0]; | 5239 ConstructorElement constructor = constructors[0]; |
| 5213 expect(constructor, isNotNull); | 5240 expect(constructor, isNotNull); |
| 5241 expect(constructor.isExternal, isFalse); |
| 5214 expect(constructor.isFactory, isFalse); | 5242 expect(constructor.isFactory, isFalse); |
| 5215 expect(constructor.name, constructorName); | 5243 expect(constructor.name, constructorName); |
| 5216 expect(constructor.functions, hasLength(0)); | 5244 expect(constructor.functions, hasLength(0)); |
| 5217 expect(constructor.labels, hasLength(0)); | 5245 expect(constructor.labels, hasLength(0)); |
| 5218 expect(constructor.localVariables, hasLength(0)); | 5246 expect(constructor.localVariables, hasLength(0)); |
| 5219 expect(constructor.parameters, hasLength(0)); | 5247 expect(constructor.parameters, hasLength(0)); |
| 5220 expect(constructorDeclaration.name.staticElement, same(constructor)); | 5248 expect(constructorDeclaration.name.staticElement, same(constructor)); |
| 5221 expect(constructorDeclaration.element, same(constructor)); | 5249 expect(constructorDeclaration.element, same(constructor)); |
| 5222 } | 5250 } |
| 5223 | 5251 |
| 5224 void test_visitConstructorDeclaration_unnamed() { | 5252 void test_visitConstructorDeclaration_unnamed() { |
| 5225 ElementHolder holder = new ElementHolder(); | 5253 ElementHolder holder = new ElementHolder(); |
| 5226 ElementBuilder builder = new ElementBuilder(holder); | 5254 ElementBuilder builder = new ElementBuilder(holder); |
| 5227 String className = "A"; | 5255 String className = "A"; |
| 5228 ConstructorDeclaration constructorDeclaration = AstFactory | 5256 ConstructorDeclaration constructorDeclaration = AstFactory |
| 5229 .constructorDeclaration2(null, null, AstFactory.identifier3(className), | 5257 .constructorDeclaration2(null, null, AstFactory.identifier3(className), |
| 5230 null, AstFactory.formalParameterList(), null, | 5258 null, AstFactory.formalParameterList(), null, |
| 5231 AstFactory.blockFunctionBody2()); | 5259 AstFactory.blockFunctionBody2()); |
| 5232 constructorDeclaration.accept(builder); | 5260 constructorDeclaration.accept(builder); |
| 5233 List<ConstructorElement> constructors = holder.constructors; | 5261 List<ConstructorElement> constructors = holder.constructors; |
| 5234 expect(constructors, hasLength(1)); | 5262 expect(constructors, hasLength(1)); |
| 5235 ConstructorElement constructor = constructors[0]; | 5263 ConstructorElement constructor = constructors[0]; |
| 5236 expect(constructor, isNotNull); | 5264 expect(constructor, isNotNull); |
| 5265 expect(constructor.isExternal, isFalse); |
| 5237 expect(constructor.isFactory, isFalse); | 5266 expect(constructor.isFactory, isFalse); |
| 5238 expect(constructor.name, ""); | 5267 expect(constructor.name, ""); |
| 5239 expect(constructor.functions, hasLength(0)); | 5268 expect(constructor.functions, hasLength(0)); |
| 5240 expect(constructor.labels, hasLength(0)); | 5269 expect(constructor.labels, hasLength(0)); |
| 5241 expect(constructor.localVariables, hasLength(0)); | 5270 expect(constructor.localVariables, hasLength(0)); |
| 5242 expect(constructor.parameters, hasLength(0)); | 5271 expect(constructor.parameters, hasLength(0)); |
| 5243 expect(constructorDeclaration.element, same(constructor)); | 5272 expect(constructorDeclaration.element, same(constructor)); |
| 5244 } | 5273 } |
| 5245 | 5274 |
| 5246 void test_visitEnumDeclaration() { | 5275 void test_visitEnumDeclaration() { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5336 AstFactory.simpleFormalParameter3(firstParameterName), | 5365 AstFactory.simpleFormalParameter3(firstParameterName), |
| 5337 AstFactory.simpleFormalParameter3(secondParameterName) | 5366 AstFactory.simpleFormalParameter3(secondParameterName) |
| 5338 ]); | 5367 ]); |
| 5339 parameterList.accept(builder); | 5368 parameterList.accept(builder); |
| 5340 List<ParameterElement> parameters = holder.parameters; | 5369 List<ParameterElement> parameters = holder.parameters; |
| 5341 expect(parameters, hasLength(2)); | 5370 expect(parameters, hasLength(2)); |
| 5342 expect(parameters[0].name, firstParameterName); | 5371 expect(parameters[0].name, firstParameterName); |
| 5343 expect(parameters[1].name, secondParameterName); | 5372 expect(parameters[1].name, secondParameterName); |
| 5344 } | 5373 } |
| 5345 | 5374 |
| 5375 void test_visitFunctionDeclaration_external() { |
| 5376 ElementHolder holder = new ElementHolder(); |
| 5377 ElementBuilder builder = new ElementBuilder(holder); |
| 5378 String functionName = "f"; |
| 5379 FunctionDeclaration declaration = AstFactory.functionDeclaration(null, null, |
| 5380 functionName, AstFactory.functionExpression2( |
| 5381 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); |
| 5382 declaration.externalKeyword = |
| 5383 TokenFactory.tokenFromKeyword(Keyword.EXTERNAL); |
| 5384 declaration.accept(builder); |
| 5385 List<FunctionElement> functions = holder.functions; |
| 5386 expect(functions, hasLength(1)); |
| 5387 FunctionElement function = functions[0]; |
| 5388 expect(function, isNotNull); |
| 5389 expect(function.name, functionName); |
| 5390 expect(declaration.element, same(function)); |
| 5391 expect(declaration.functionExpression.element, same(function)); |
| 5392 expect(function.isExternal, isTrue); |
| 5393 expect(function.isSynthetic, isFalse); |
| 5394 } |
| 5395 |
| 5346 void test_visitFunctionDeclaration_getter() { | 5396 void test_visitFunctionDeclaration_getter() { |
| 5347 ElementHolder holder = new ElementHolder(); | 5397 ElementHolder holder = new ElementHolder(); |
| 5348 ElementBuilder builder = new ElementBuilder(holder); | 5398 ElementBuilder builder = new ElementBuilder(holder); |
| 5349 String functionName = "f"; | 5399 String functionName = "f"; |
| 5350 FunctionDeclaration declaration = AstFactory.functionDeclaration(null, | 5400 FunctionDeclaration declaration = AstFactory.functionDeclaration(null, |
| 5351 Keyword.GET, functionName, AstFactory.functionExpression2( | 5401 Keyword.GET, functionName, AstFactory.functionExpression2( |
| 5352 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); | 5402 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); |
| 5353 declaration.accept(builder); | 5403 declaration.accept(builder); |
| 5354 List<PropertyAccessorElement> accessors = holder.accessors; | 5404 List<PropertyAccessorElement> accessors = holder.accessors; |
| 5355 expect(accessors, hasLength(1)); | 5405 expect(accessors, hasLength(1)); |
| 5356 PropertyAccessorElement accessor = accessors[0]; | 5406 PropertyAccessorElement accessor = accessors[0]; |
| 5357 expect(accessor, isNotNull); | 5407 expect(accessor, isNotNull); |
| 5358 expect(accessor.name, functionName); | 5408 expect(accessor.name, functionName); |
| 5359 expect(declaration.element, same(accessor)); | 5409 expect(declaration.element, same(accessor)); |
| 5360 expect(declaration.functionExpression.element, same(accessor)); | 5410 expect(declaration.functionExpression.element, same(accessor)); |
| 5361 expect(accessor.isGetter, isTrue); | 5411 expect(accessor.isGetter, isTrue); |
| 5412 expect(accessor.isExternal, isFalse); |
| 5362 expect(accessor.isSetter, isFalse); | 5413 expect(accessor.isSetter, isFalse); |
| 5363 expect(accessor.isSynthetic, isFalse); | 5414 expect(accessor.isSynthetic, isFalse); |
| 5364 PropertyInducingElement variable = accessor.variable; | 5415 PropertyInducingElement variable = accessor.variable; |
| 5365 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableElement, | 5416 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableElement, |
| 5366 TopLevelVariableElement, variable); | 5417 TopLevelVariableElement, variable); |
| 5367 expect(variable.isSynthetic, isTrue); | 5418 expect(variable.isSynthetic, isTrue); |
| 5368 } | 5419 } |
| 5369 | 5420 |
| 5370 void test_visitFunctionDeclaration_plain() { | 5421 void test_visitFunctionDeclaration_plain() { |
| 5371 ElementHolder holder = new ElementHolder(); | 5422 ElementHolder holder = new ElementHolder(); |
| 5372 ElementBuilder builder = new ElementBuilder(holder); | 5423 ElementBuilder builder = new ElementBuilder(holder); |
| 5373 String functionName = "f"; | 5424 String functionName = "f"; |
| 5374 FunctionDeclaration declaration = AstFactory.functionDeclaration(null, null, | 5425 FunctionDeclaration declaration = AstFactory.functionDeclaration(null, null, |
| 5375 functionName, AstFactory.functionExpression2( | 5426 functionName, AstFactory.functionExpression2( |
| 5376 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); | 5427 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); |
| 5377 declaration.accept(builder); | 5428 declaration.accept(builder); |
| 5378 List<FunctionElement> functions = holder.functions; | 5429 List<FunctionElement> functions = holder.functions; |
| 5379 expect(functions, hasLength(1)); | 5430 expect(functions, hasLength(1)); |
| 5380 FunctionElement function = functions[0]; | 5431 FunctionElement function = functions[0]; |
| 5381 expect(function, isNotNull); | 5432 expect(function, isNotNull); |
| 5382 expect(function.name, functionName); | 5433 expect(function.name, functionName); |
| 5383 expect(declaration.element, same(function)); | 5434 expect(declaration.element, same(function)); |
| 5384 expect(declaration.functionExpression.element, same(function)); | 5435 expect(declaration.functionExpression.element, same(function)); |
| 5436 expect(function.isExternal, isFalse); |
| 5385 expect(function.isSynthetic, isFalse); | 5437 expect(function.isSynthetic, isFalse); |
| 5386 } | 5438 } |
| 5387 | 5439 |
| 5388 void test_visitFunctionDeclaration_setter() { | 5440 void test_visitFunctionDeclaration_setter() { |
| 5389 ElementHolder holder = new ElementHolder(); | 5441 ElementHolder holder = new ElementHolder(); |
| 5390 ElementBuilder builder = new ElementBuilder(holder); | 5442 ElementBuilder builder = new ElementBuilder(holder); |
| 5391 String functionName = "f"; | 5443 String functionName = "f"; |
| 5392 FunctionDeclaration declaration = AstFactory.functionDeclaration(null, | 5444 FunctionDeclaration declaration = AstFactory.functionDeclaration(null, |
| 5393 Keyword.SET, functionName, AstFactory.functionExpression2( | 5445 Keyword.SET, functionName, AstFactory.functionExpression2( |
| 5394 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); | 5446 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2())); |
| 5395 declaration.accept(builder); | 5447 declaration.accept(builder); |
| 5396 List<PropertyAccessorElement> accessors = holder.accessors; | 5448 List<PropertyAccessorElement> accessors = holder.accessors; |
| 5397 expect(accessors, hasLength(1)); | 5449 expect(accessors, hasLength(1)); |
| 5398 PropertyAccessorElement accessor = accessors[0]; | 5450 PropertyAccessorElement accessor = accessors[0]; |
| 5399 expect(accessor, isNotNull); | 5451 expect(accessor, isNotNull); |
| 5400 expect(accessor.name, "$functionName="); | 5452 expect(accessor.name, "$functionName="); |
| 5401 expect(declaration.element, same(accessor)); | 5453 expect(declaration.element, same(accessor)); |
| 5402 expect(declaration.functionExpression.element, same(accessor)); | 5454 expect(declaration.functionExpression.element, same(accessor)); |
| 5403 expect(accessor.isGetter, isFalse); | 5455 expect(accessor.isGetter, isFalse); |
| 5456 expect(accessor.isExternal, isFalse); |
| 5404 expect(accessor.isSetter, isTrue); | 5457 expect(accessor.isSetter, isTrue); |
| 5405 expect(accessor.isSynthetic, isFalse); | 5458 expect(accessor.isSynthetic, isFalse); |
| 5406 PropertyInducingElement variable = accessor.variable; | 5459 PropertyInducingElement variable = accessor.variable; |
| 5407 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableElement, | 5460 EngineTestCase.assertInstanceOf((obj) => obj is TopLevelVariableElement, |
| 5408 TopLevelVariableElement, variable); | 5461 TopLevelVariableElement, variable); |
| 5409 expect(variable.isSynthetic, isTrue); | 5462 expect(variable.isSynthetic, isTrue); |
| 5410 } | 5463 } |
| 5411 | 5464 |
| 5412 void test_visitFunctionExpression() { | 5465 void test_visitFunctionExpression() { |
| 5413 ElementHolder holder = new ElementHolder(); | 5466 ElementHolder holder = new ElementHolder(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5495 List<MethodElement> methods = holder.methods; | 5548 List<MethodElement> methods = holder.methods; |
| 5496 expect(methods, hasLength(1)); | 5549 expect(methods, hasLength(1)); |
| 5497 MethodElement method = methods[0]; | 5550 MethodElement method = methods[0]; |
| 5498 expect(method, isNotNull); | 5551 expect(method, isNotNull); |
| 5499 expect(method.name, methodName); | 5552 expect(method.name, methodName); |
| 5500 expect(method.functions, hasLength(0)); | 5553 expect(method.functions, hasLength(0)); |
| 5501 expect(method.labels, hasLength(0)); | 5554 expect(method.labels, hasLength(0)); |
| 5502 expect(method.localVariables, hasLength(0)); | 5555 expect(method.localVariables, hasLength(0)); |
| 5503 expect(method.parameters, hasLength(0)); | 5556 expect(method.parameters, hasLength(0)); |
| 5504 expect(method.isAbstract, isTrue); | 5557 expect(method.isAbstract, isTrue); |
| 5558 expect(method.isExternal, isFalse); |
| 5505 expect(method.isStatic, isFalse); | 5559 expect(method.isStatic, isFalse); |
| 5506 expect(method.isSynthetic, isFalse); | 5560 expect(method.isSynthetic, isFalse); |
| 5507 } | 5561 } |
| 5562 |
| 5563 void test_visitMethodDeclaration_external() { |
| 5564 ElementHolder holder = new ElementHolder(); |
| 5565 ElementBuilder builder = new ElementBuilder(holder); |
| 5566 String methodName = "m"; |
| 5567 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, |
| 5568 null, null, null, AstFactory.identifier3(methodName), |
| 5569 AstFactory.formalParameterList(), AstFactory.emptyFunctionBody()); |
| 5570 methodDeclaration.externalKeyword = |
| 5571 TokenFactory.tokenFromKeyword(Keyword.EXTERNAL); |
| 5572 methodDeclaration.accept(builder); |
| 5573 List<MethodElement> methods = holder.methods; |
| 5574 expect(methods, hasLength(1)); |
| 5575 MethodElement method = methods[0]; |
| 5576 expect(method, isNotNull); |
| 5577 expect(method.name, methodName); |
| 5578 expect(method.functions, hasLength(0)); |
| 5579 expect(method.labels, hasLength(0)); |
| 5580 expect(method.localVariables, hasLength(0)); |
| 5581 expect(method.parameters, hasLength(0)); |
| 5582 expect(method.isAbstract, isFalse); |
| 5583 expect(method.isExternal, isTrue); |
| 5584 expect(method.isStatic, isFalse); |
| 5585 expect(method.isSynthetic, isFalse); |
| 5586 } |
| 5508 | 5587 |
| 5509 void test_visitMethodDeclaration_getter() { | 5588 void test_visitMethodDeclaration_getter() { |
| 5510 ElementHolder holder = new ElementHolder(); | 5589 ElementHolder holder = new ElementHolder(); |
| 5511 ElementBuilder builder = new ElementBuilder(holder); | 5590 ElementBuilder builder = new ElementBuilder(holder); |
| 5512 String methodName = "m"; | 5591 String methodName = "m"; |
| 5513 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, | 5592 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, |
| 5514 null, Keyword.GET, null, AstFactory.identifier3(methodName), | 5593 null, Keyword.GET, null, AstFactory.identifier3(methodName), |
| 5515 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); | 5594 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); |
| 5516 methodDeclaration.accept(builder); | 5595 methodDeclaration.accept(builder); |
| 5517 List<FieldElement> fields = holder.fields; | 5596 List<FieldElement> fields = holder.fields; |
| 5518 expect(fields, hasLength(1)); | 5597 expect(fields, hasLength(1)); |
| 5519 FieldElement field = fields[0]; | 5598 FieldElement field = fields[0]; |
| 5520 expect(field, isNotNull); | 5599 expect(field, isNotNull); |
| 5521 expect(field.name, methodName); | 5600 expect(field.name, methodName); |
| 5522 expect(field.isSynthetic, isTrue); | 5601 expect(field.isSynthetic, isTrue); |
| 5523 expect(field.setter, isNull); | 5602 expect(field.setter, isNull); |
| 5524 PropertyAccessorElement getter = field.getter; | 5603 PropertyAccessorElement getter = field.getter; |
| 5525 expect(getter, isNotNull); | 5604 expect(getter, isNotNull); |
| 5526 expect(getter.isAbstract, isFalse); | 5605 expect(getter.isAbstract, isFalse); |
| 5606 expect(getter.isExternal, isFalse); |
| 5527 expect(getter.isGetter, isTrue); | 5607 expect(getter.isGetter, isTrue); |
| 5528 expect(getter.isSynthetic, isFalse); | 5608 expect(getter.isSynthetic, isFalse); |
| 5529 expect(getter.name, methodName); | 5609 expect(getter.name, methodName); |
| 5530 expect(getter.variable, field); | 5610 expect(getter.variable, field); |
| 5531 expect(getter.functions, hasLength(0)); | 5611 expect(getter.functions, hasLength(0)); |
| 5532 expect(getter.labels, hasLength(0)); | 5612 expect(getter.labels, hasLength(0)); |
| 5533 expect(getter.localVariables, hasLength(0)); | 5613 expect(getter.localVariables, hasLength(0)); |
| 5534 expect(getter.parameters, hasLength(0)); | 5614 expect(getter.parameters, hasLength(0)); |
| 5535 } | 5615 } |
| 5536 | 5616 |
| 5537 void test_visitMethodDeclaration_getter_abstract() { | 5617 void test_visitMethodDeclaration_getter_abstract() { |
| 5538 ElementHolder holder = new ElementHolder(); | 5618 ElementHolder holder = new ElementHolder(); |
| 5539 ElementBuilder builder = new ElementBuilder(holder); | 5619 ElementBuilder builder = new ElementBuilder(holder); |
| 5540 String methodName = "m"; | 5620 String methodName = "m"; |
| 5541 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, | 5621 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, |
| 5542 null, Keyword.GET, null, AstFactory.identifier3(methodName), | 5622 null, Keyword.GET, null, AstFactory.identifier3(methodName), |
| 5543 AstFactory.formalParameterList(), AstFactory.emptyFunctionBody()); | 5623 AstFactory.formalParameterList(), AstFactory.emptyFunctionBody()); |
| 5544 methodDeclaration.accept(builder); | 5624 methodDeclaration.accept(builder); |
| 5545 List<FieldElement> fields = holder.fields; | 5625 List<FieldElement> fields = holder.fields; |
| 5546 expect(fields, hasLength(1)); | 5626 expect(fields, hasLength(1)); |
| 5547 FieldElement field = fields[0]; | 5627 FieldElement field = fields[0]; |
| 5548 expect(field, isNotNull); | 5628 expect(field, isNotNull); |
| 5549 expect(field.name, methodName); | 5629 expect(field.name, methodName); |
| 5550 expect(field.isSynthetic, isTrue); | 5630 expect(field.isSynthetic, isTrue); |
| 5551 expect(field.setter, isNull); | 5631 expect(field.setter, isNull); |
| 5552 PropertyAccessorElement getter = field.getter; | 5632 PropertyAccessorElement getter = field.getter; |
| 5553 expect(getter, isNotNull); | 5633 expect(getter, isNotNull); |
| 5554 expect(getter.isAbstract, isTrue); | 5634 expect(getter.isAbstract, isTrue); |
| 5635 expect(getter.isExternal, isFalse); |
| 5555 expect(getter.isGetter, isTrue); | 5636 expect(getter.isGetter, isTrue); |
| 5556 expect(getter.isSynthetic, isFalse); | 5637 expect(getter.isSynthetic, isFalse); |
| 5557 expect(getter.name, methodName); | 5638 expect(getter.name, methodName); |
| 5558 expect(getter.variable, field); | 5639 expect(getter.variable, field); |
| 5559 expect(getter.functions, hasLength(0)); | 5640 expect(getter.functions, hasLength(0)); |
| 5560 expect(getter.labels, hasLength(0)); | 5641 expect(getter.labels, hasLength(0)); |
| 5561 expect(getter.localVariables, hasLength(0)); | 5642 expect(getter.localVariables, hasLength(0)); |
| 5562 expect(getter.parameters, hasLength(0)); | 5643 expect(getter.parameters, hasLength(0)); |
| 5563 } | 5644 } |
| 5564 | 5645 |
| 5565 void test_visitMethodDeclaration_getter_external() { | 5646 void test_visitMethodDeclaration_getter_external() { |
| 5566 ElementHolder holder = new ElementHolder(); | 5647 ElementHolder holder = new ElementHolder(); |
| 5567 ElementBuilder builder = new ElementBuilder(holder); | 5648 ElementBuilder builder = new ElementBuilder(holder); |
| 5568 String methodName = "m"; | 5649 String methodName = "m"; |
| 5569 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration(null, | 5650 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration(null, |
| 5570 null, Keyword.GET, null, AstFactory.identifier3(methodName), | 5651 null, Keyword.GET, null, AstFactory.identifier3(methodName), |
| 5571 AstFactory.formalParameterList()); | 5652 AstFactory.formalParameterList()); |
| 5653 methodDeclaration.externalKeyword = |
| 5654 TokenFactory.tokenFromKeyword(Keyword.EXTERNAL); |
| 5572 methodDeclaration.accept(builder); | 5655 methodDeclaration.accept(builder); |
| 5573 List<FieldElement> fields = holder.fields; | 5656 List<FieldElement> fields = holder.fields; |
| 5574 expect(fields, hasLength(1)); | 5657 expect(fields, hasLength(1)); |
| 5575 FieldElement field = fields[0]; | 5658 FieldElement field = fields[0]; |
| 5576 expect(field, isNotNull); | 5659 expect(field, isNotNull); |
| 5577 expect(field.name, methodName); | 5660 expect(field.name, methodName); |
| 5578 expect(field.isSynthetic, isTrue); | 5661 expect(field.isSynthetic, isTrue); |
| 5579 expect(field.setter, isNull); | 5662 expect(field.setter, isNull); |
| 5580 PropertyAccessorElement getter = field.getter; | 5663 PropertyAccessorElement getter = field.getter; |
| 5581 expect(getter, isNotNull); | 5664 expect(getter, isNotNull); |
| 5582 expect(getter.isAbstract, isFalse); | 5665 expect(getter.isAbstract, isFalse); |
| 5666 expect(getter.isExternal, isTrue); |
| 5583 expect(getter.isGetter, isTrue); | 5667 expect(getter.isGetter, isTrue); |
| 5584 expect(getter.isSynthetic, isFalse); | 5668 expect(getter.isSynthetic, isFalse); |
| 5585 expect(getter.name, methodName); | 5669 expect(getter.name, methodName); |
| 5586 expect(getter.variable, field); | 5670 expect(getter.variable, field); |
| 5587 expect(getter.functions, hasLength(0)); | 5671 expect(getter.functions, hasLength(0)); |
| 5588 expect(getter.labels, hasLength(0)); | 5672 expect(getter.labels, hasLength(0)); |
| 5589 expect(getter.localVariables, hasLength(0)); | 5673 expect(getter.localVariables, hasLength(0)); |
| 5590 expect(getter.parameters, hasLength(0)); | 5674 expect(getter.parameters, hasLength(0)); |
| 5591 } | 5675 } |
| 5592 | 5676 |
| 5593 void test_visitMethodDeclaration_minimal() { | 5677 void test_visitMethodDeclaration_minimal() { |
| 5594 ElementHolder holder = new ElementHolder(); | 5678 ElementHolder holder = new ElementHolder(); |
| 5595 ElementBuilder builder = new ElementBuilder(holder); | 5679 ElementBuilder builder = new ElementBuilder(holder); |
| 5596 String methodName = "m"; | 5680 String methodName = "m"; |
| 5597 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, | 5681 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, |
| 5598 null, null, null, AstFactory.identifier3(methodName), | 5682 null, null, null, AstFactory.identifier3(methodName), |
| 5599 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); | 5683 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); |
| 5600 methodDeclaration.accept(builder); | 5684 methodDeclaration.accept(builder); |
| 5601 List<MethodElement> methods = holder.methods; | 5685 List<MethodElement> methods = holder.methods; |
| 5602 expect(methods, hasLength(1)); | 5686 expect(methods, hasLength(1)); |
| 5603 MethodElement method = methods[0]; | 5687 MethodElement method = methods[0]; |
| 5604 expect(method, isNotNull); | 5688 expect(method, isNotNull); |
| 5605 expect(method.name, methodName); | 5689 expect(method.name, methodName); |
| 5606 expect(method.functions, hasLength(0)); | 5690 expect(method.functions, hasLength(0)); |
| 5607 expect(method.labels, hasLength(0)); | 5691 expect(method.labels, hasLength(0)); |
| 5608 expect(method.localVariables, hasLength(0)); | 5692 expect(method.localVariables, hasLength(0)); |
| 5609 expect(method.parameters, hasLength(0)); | 5693 expect(method.parameters, hasLength(0)); |
| 5610 expect(method.isAbstract, isFalse); | 5694 expect(method.isAbstract, isFalse); |
| 5695 expect(method.isExternal, isFalse); |
| 5611 expect(method.isStatic, isFalse); | 5696 expect(method.isStatic, isFalse); |
| 5612 expect(method.isSynthetic, isFalse); | 5697 expect(method.isSynthetic, isFalse); |
| 5613 } | 5698 } |
| 5614 | 5699 |
| 5615 void test_visitMethodDeclaration_operator() { | 5700 void test_visitMethodDeclaration_operator() { |
| 5616 ElementHolder holder = new ElementHolder(); | 5701 ElementHolder holder = new ElementHolder(); |
| 5617 ElementBuilder builder = new ElementBuilder(holder); | 5702 ElementBuilder builder = new ElementBuilder(holder); |
| 5618 String methodName = "+"; | 5703 String methodName = "+"; |
| 5619 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, | 5704 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, |
| 5620 null, null, Keyword.OPERATOR, AstFactory.identifier3(methodName), | 5705 null, null, Keyword.OPERATOR, AstFactory.identifier3(methodName), |
| 5621 AstFactory | 5706 AstFactory |
| 5622 .formalParameterList([AstFactory.simpleFormalParameter3("addend")]), | 5707 .formalParameterList([AstFactory.simpleFormalParameter3("addend")]), |
| 5623 AstFactory.blockFunctionBody2()); | 5708 AstFactory.blockFunctionBody2()); |
| 5624 methodDeclaration.accept(builder); | 5709 methodDeclaration.accept(builder); |
| 5625 List<MethodElement> methods = holder.methods; | 5710 List<MethodElement> methods = holder.methods; |
| 5626 expect(methods, hasLength(1)); | 5711 expect(methods, hasLength(1)); |
| 5627 MethodElement method = methods[0]; | 5712 MethodElement method = methods[0]; |
| 5628 expect(method, isNotNull); | 5713 expect(method, isNotNull); |
| 5629 expect(method.name, methodName); | 5714 expect(method.name, methodName); |
| 5630 expect(method.functions, hasLength(0)); | 5715 expect(method.functions, hasLength(0)); |
| 5631 expect(method.labels, hasLength(0)); | 5716 expect(method.labels, hasLength(0)); |
| 5632 expect(method.localVariables, hasLength(0)); | 5717 expect(method.localVariables, hasLength(0)); |
| 5633 expect(method.parameters, hasLength(1)); | 5718 expect(method.parameters, hasLength(1)); |
| 5634 expect(method.isAbstract, isFalse); | 5719 expect(method.isAbstract, isFalse); |
| 5720 expect(method.isExternal, isFalse); |
| 5635 expect(method.isStatic, isFalse); | 5721 expect(method.isStatic, isFalse); |
| 5636 expect(method.isSynthetic, isFalse); | 5722 expect(method.isSynthetic, isFalse); |
| 5637 } | 5723 } |
| 5638 | 5724 |
| 5639 void test_visitMethodDeclaration_setter() { | 5725 void test_visitMethodDeclaration_setter() { |
| 5640 ElementHolder holder = new ElementHolder(); | 5726 ElementHolder holder = new ElementHolder(); |
| 5641 ElementBuilder builder = new ElementBuilder(holder); | 5727 ElementBuilder builder = new ElementBuilder(holder); |
| 5642 String methodName = "m"; | 5728 String methodName = "m"; |
| 5643 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, | 5729 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, |
| 5644 null, Keyword.SET, null, AstFactory.identifier3(methodName), | 5730 null, Keyword.SET, null, AstFactory.identifier3(methodName), |
| 5645 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); | 5731 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); |
| 5646 methodDeclaration.accept(builder); | 5732 methodDeclaration.accept(builder); |
| 5647 List<FieldElement> fields = holder.fields; | 5733 List<FieldElement> fields = holder.fields; |
| 5648 expect(fields, hasLength(1)); | 5734 expect(fields, hasLength(1)); |
| 5649 FieldElement field = fields[0]; | 5735 FieldElement field = fields[0]; |
| 5650 expect(field, isNotNull); | 5736 expect(field, isNotNull); |
| 5651 expect(field.name, methodName); | 5737 expect(field.name, methodName); |
| 5652 expect(field.isSynthetic, isTrue); | 5738 expect(field.isSynthetic, isTrue); |
| 5653 expect(field.getter, isNull); | 5739 expect(field.getter, isNull); |
| 5654 PropertyAccessorElement setter = field.setter; | 5740 PropertyAccessorElement setter = field.setter; |
| 5655 expect(setter, isNotNull); | 5741 expect(setter, isNotNull); |
| 5656 expect(setter.isAbstract, isFalse); | 5742 expect(setter.isAbstract, isFalse); |
| 5743 expect(setter.isExternal, isFalse); |
| 5657 expect(setter.isSetter, isTrue); | 5744 expect(setter.isSetter, isTrue); |
| 5658 expect(setter.isSynthetic, isFalse); | 5745 expect(setter.isSynthetic, isFalse); |
| 5659 expect(setter.name, "$methodName="); | 5746 expect(setter.name, "$methodName="); |
| 5660 expect(setter.displayName, methodName); | 5747 expect(setter.displayName, methodName); |
| 5661 expect(setter.variable, field); | 5748 expect(setter.variable, field); |
| 5662 expect(setter.functions, hasLength(0)); | 5749 expect(setter.functions, hasLength(0)); |
| 5663 expect(setter.labels, hasLength(0)); | 5750 expect(setter.labels, hasLength(0)); |
| 5664 expect(setter.localVariables, hasLength(0)); | 5751 expect(setter.localVariables, hasLength(0)); |
| 5665 expect(setter.parameters, hasLength(0)); | 5752 expect(setter.parameters, hasLength(0)); |
| 5666 } | 5753 } |
| 5667 | 5754 |
| 5668 void test_visitMethodDeclaration_setter_abstract() { | 5755 void test_visitMethodDeclaration_setter_abstract() { |
| 5669 ElementHolder holder = new ElementHolder(); | 5756 ElementHolder holder = new ElementHolder(); |
| 5670 ElementBuilder builder = new ElementBuilder(holder); | 5757 ElementBuilder builder = new ElementBuilder(holder); |
| 5671 String methodName = "m"; | 5758 String methodName = "m"; |
| 5672 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, | 5759 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2(null, |
| 5673 null, Keyword.SET, null, AstFactory.identifier3(methodName), | 5760 null, Keyword.SET, null, AstFactory.identifier3(methodName), |
| 5674 AstFactory.formalParameterList(), AstFactory.emptyFunctionBody()); | 5761 AstFactory.formalParameterList(), AstFactory.emptyFunctionBody()); |
| 5675 methodDeclaration.accept(builder); | 5762 methodDeclaration.accept(builder); |
| 5676 List<FieldElement> fields = holder.fields; | 5763 List<FieldElement> fields = holder.fields; |
| 5677 expect(fields, hasLength(1)); | 5764 expect(fields, hasLength(1)); |
| 5678 FieldElement field = fields[0]; | 5765 FieldElement field = fields[0]; |
| 5679 expect(field, isNotNull); | 5766 expect(field, isNotNull); |
| 5680 expect(field.name, methodName); | 5767 expect(field.name, methodName); |
| 5681 expect(field.isSynthetic, isTrue); | 5768 expect(field.isSynthetic, isTrue); |
| 5682 expect(field.getter, isNull); | 5769 expect(field.getter, isNull); |
| 5683 PropertyAccessorElement setter = field.setter; | 5770 PropertyAccessorElement setter = field.setter; |
| 5684 expect(setter, isNotNull); | 5771 expect(setter, isNotNull); |
| 5685 expect(setter.isAbstract, isTrue); | 5772 expect(setter.isAbstract, isTrue); |
| 5773 expect(setter.isExternal, isFalse); |
| 5686 expect(setter.isSetter, isTrue); | 5774 expect(setter.isSetter, isTrue); |
| 5687 expect(setter.isSynthetic, isFalse); | 5775 expect(setter.isSynthetic, isFalse); |
| 5688 expect(setter.name, "$methodName="); | 5776 expect(setter.name, "$methodName="); |
| 5689 expect(setter.displayName, methodName); | 5777 expect(setter.displayName, methodName); |
| 5690 expect(setter.variable, field); | 5778 expect(setter.variable, field); |
| 5691 expect(setter.functions, hasLength(0)); | 5779 expect(setter.functions, hasLength(0)); |
| 5692 expect(setter.labels, hasLength(0)); | 5780 expect(setter.labels, hasLength(0)); |
| 5693 expect(setter.localVariables, hasLength(0)); | 5781 expect(setter.localVariables, hasLength(0)); |
| 5694 expect(setter.parameters, hasLength(0)); | 5782 expect(setter.parameters, hasLength(0)); |
| 5695 } | 5783 } |
| 5696 | 5784 |
| 5697 void test_visitMethodDeclaration_setter_external() { | 5785 void test_visitMethodDeclaration_setter_external() { |
| 5698 ElementHolder holder = new ElementHolder(); | 5786 ElementHolder holder = new ElementHolder(); |
| 5699 ElementBuilder builder = new ElementBuilder(holder); | 5787 ElementBuilder builder = new ElementBuilder(holder); |
| 5700 String methodName = "m"; | 5788 String methodName = "m"; |
| 5701 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration(null, | 5789 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration(null, |
| 5702 null, Keyword.SET, null, AstFactory.identifier3(methodName), | 5790 null, Keyword.SET, null, AstFactory.identifier3(methodName), |
| 5703 AstFactory.formalParameterList()); | 5791 AstFactory.formalParameterList()); |
| 5792 methodDeclaration.externalKeyword = |
| 5793 TokenFactory.tokenFromKeyword(Keyword.EXTERNAL); |
| 5704 methodDeclaration.accept(builder); | 5794 methodDeclaration.accept(builder); |
| 5705 List<FieldElement> fields = holder.fields; | 5795 List<FieldElement> fields = holder.fields; |
| 5706 expect(fields, hasLength(1)); | 5796 expect(fields, hasLength(1)); |
| 5707 FieldElement field = fields[0]; | 5797 FieldElement field = fields[0]; |
| 5708 expect(field, isNotNull); | 5798 expect(field, isNotNull); |
| 5709 expect(field.name, methodName); | 5799 expect(field.name, methodName); |
| 5710 expect(field.isSynthetic, isTrue); | 5800 expect(field.isSynthetic, isTrue); |
| 5711 expect(field.getter, isNull); | 5801 expect(field.getter, isNull); |
| 5712 PropertyAccessorElement setter = field.setter; | 5802 PropertyAccessorElement setter = field.setter; |
| 5713 expect(setter, isNotNull); | 5803 expect(setter, isNotNull); |
| 5714 expect(setter.isAbstract, isFalse); | 5804 expect(setter.isAbstract, isFalse); |
| 5805 expect(setter.isExternal, isTrue); |
| 5715 expect(setter.isSetter, isTrue); | 5806 expect(setter.isSetter, isTrue); |
| 5716 expect(setter.isSynthetic, isFalse); | 5807 expect(setter.isSynthetic, isFalse); |
| 5717 expect(setter.name, "$methodName="); | 5808 expect(setter.name, "$methodName="); |
| 5718 expect(setter.displayName, methodName); | 5809 expect(setter.displayName, methodName); |
| 5719 expect(setter.variable, field); | 5810 expect(setter.variable, field); |
| 5720 expect(setter.functions, hasLength(0)); | 5811 expect(setter.functions, hasLength(0)); |
| 5721 expect(setter.labels, hasLength(0)); | 5812 expect(setter.labels, hasLength(0)); |
| 5722 expect(setter.localVariables, hasLength(0)); | 5813 expect(setter.localVariables, hasLength(0)); |
| 5723 expect(setter.parameters, hasLength(0)); | 5814 expect(setter.parameters, hasLength(0)); |
| 5724 } | 5815 } |
| 5725 | 5816 |
| 5726 void test_visitMethodDeclaration_static() { | 5817 void test_visitMethodDeclaration_static() { |
| 5727 ElementHolder holder = new ElementHolder(); | 5818 ElementHolder holder = new ElementHolder(); |
| 5728 ElementBuilder builder = new ElementBuilder(holder); | 5819 ElementBuilder builder = new ElementBuilder(holder); |
| 5729 String methodName = "m"; | 5820 String methodName = "m"; |
| 5730 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( | 5821 MethodDeclaration methodDeclaration = AstFactory.methodDeclaration2( |
| 5731 Keyword.STATIC, null, null, null, AstFactory.identifier3(methodName), | 5822 Keyword.STATIC, null, null, null, AstFactory.identifier3(methodName), |
| 5732 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); | 5823 AstFactory.formalParameterList(), AstFactory.blockFunctionBody2()); |
| 5733 methodDeclaration.accept(builder); | 5824 methodDeclaration.accept(builder); |
| 5734 List<MethodElement> methods = holder.methods; | 5825 List<MethodElement> methods = holder.methods; |
| 5735 expect(methods, hasLength(1)); | 5826 expect(methods, hasLength(1)); |
| 5736 MethodElement method = methods[0]; | 5827 MethodElement method = methods[0]; |
| 5737 expect(method, isNotNull); | 5828 expect(method, isNotNull); |
| 5738 expect(method.name, methodName); | 5829 expect(method.name, methodName); |
| 5739 expect(method.functions, hasLength(0)); | 5830 expect(method.functions, hasLength(0)); |
| 5740 expect(method.labels, hasLength(0)); | 5831 expect(method.labels, hasLength(0)); |
| 5741 expect(method.localVariables, hasLength(0)); | 5832 expect(method.localVariables, hasLength(0)); |
| 5742 expect(method.parameters, hasLength(0)); | 5833 expect(method.parameters, hasLength(0)); |
| 5743 expect(method.isAbstract, isFalse); | 5834 expect(method.isAbstract, isFalse); |
| 5835 expect(method.isExternal, isFalse); |
| 5744 expect(method.isStatic, isTrue); | 5836 expect(method.isStatic, isTrue); |
| 5745 expect(method.isSynthetic, isFalse); | 5837 expect(method.isSynthetic, isFalse); |
| 5746 } | 5838 } |
| 5747 | 5839 |
| 5748 void test_visitMethodDeclaration_withMembers() { | 5840 void test_visitMethodDeclaration_withMembers() { |
| 5749 ElementHolder holder = new ElementHolder(); | 5841 ElementHolder holder = new ElementHolder(); |
| 5750 ElementBuilder builder = new ElementBuilder(holder); | 5842 ElementBuilder builder = new ElementBuilder(holder); |
| 5751 String methodName = "m"; | 5843 String methodName = "m"; |
| 5752 String parameterName = "p"; | 5844 String parameterName = "p"; |
| 5753 String localVariableName = "v"; | 5845 String localVariableName = "v"; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 5765 [AstFactory.label2(labelName)], AstFactory.returnStatement()) | 5857 [AstFactory.label2(labelName)], AstFactory.returnStatement()) |
| 5766 ]), [AstFactory.catchClause(exceptionParameterName)]) | 5858 ]), [AstFactory.catchClause(exceptionParameterName)]) |
| 5767 ])); | 5859 ])); |
| 5768 methodDeclaration.accept(builder); | 5860 methodDeclaration.accept(builder); |
| 5769 List<MethodElement> methods = holder.methods; | 5861 List<MethodElement> methods = holder.methods; |
| 5770 expect(methods, hasLength(1)); | 5862 expect(methods, hasLength(1)); |
| 5771 MethodElement method = methods[0]; | 5863 MethodElement method = methods[0]; |
| 5772 expect(method, isNotNull); | 5864 expect(method, isNotNull); |
| 5773 expect(method.name, methodName); | 5865 expect(method.name, methodName); |
| 5774 expect(method.isAbstract, isFalse); | 5866 expect(method.isAbstract, isFalse); |
| 5867 expect(method.isExternal, isFalse); |
| 5775 expect(method.isStatic, isFalse); | 5868 expect(method.isStatic, isFalse); |
| 5776 expect(method.isSynthetic, isFalse); | 5869 expect(method.isSynthetic, isFalse); |
| 5777 List<VariableElement> parameters = method.parameters; | 5870 List<VariableElement> parameters = method.parameters; |
| 5778 expect(parameters, hasLength(1)); | 5871 expect(parameters, hasLength(1)); |
| 5779 VariableElement parameter = parameters[0]; | 5872 VariableElement parameter = parameters[0]; |
| 5780 expect(parameter, isNotNull); | 5873 expect(parameter, isNotNull); |
| 5781 expect(parameter.name, parameterName); | 5874 expect(parameter.name, parameterName); |
| 5782 List<VariableElement> localVariables = method.localVariables; | 5875 List<VariableElement> localVariables = method.localVariables; |
| 5783 expect(localVariables, hasLength(2)); | 5876 expect(localVariables, hasLength(2)); |
| 5784 VariableElement firstVariable = localVariables[0]; | 5877 VariableElement firstVariable = localVariables[0]; |
| (...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8667 if (_expectedExternalScriptName == null) { | 8760 if (_expectedExternalScriptName == null) { |
| 8668 expect(scriptSource, isNull, reason: "script $scriptIndex"); | 8761 expect(scriptSource, isNull, reason: "script $scriptIndex"); |
| 8669 } else { | 8762 } else { |
| 8670 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); | 8763 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); |
| 8671 String actualExternalScriptName = scriptSource.shortName; | 8764 String actualExternalScriptName = scriptSource.shortName; |
| 8672 expect(actualExternalScriptName, _expectedExternalScriptName, | 8765 expect(actualExternalScriptName, _expectedExternalScriptName, |
| 8673 reason: "script $scriptIndex"); | 8766 reason: "script $scriptIndex"); |
| 8674 } | 8767 } |
| 8675 } | 8768 } |
| 8676 } | 8769 } |
| OLD | NEW |