| OLD | NEW |
| 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 package com.google.dart.compiler.resolver; | 5 package com.google.dart.compiler.resolver; |
| 6 | 6 |
| 7 import com.google.common.annotations.VisibleForTesting; | 7 import com.google.common.annotations.VisibleForTesting; |
| 8 import com.google.common.base.Objects; | 8 import com.google.common.base.Objects; |
| 9 import com.google.common.collect.Lists; | 9 import com.google.common.collect.Lists; |
| 10 import com.google.dart.compiler.DartSource; | 10 import com.google.dart.compiler.DartSource; |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 public static boolean isNonFactoryConstructor(Element method) { | 334 public static boolean isNonFactoryConstructor(Element method) { |
| 335 return !method.getModifiers().isFactory() | 335 return !method.getModifiers().isFactory() |
| 336 && ElementKind.of(method).equals(ElementKind.CONSTRUCTOR); | 336 && ElementKind.of(method).equals(ElementKind.CONSTRUCTOR); |
| 337 } | 337 } |
| 338 | 338 |
| 339 public static boolean isTopLevel(Element element) { | 339 public static boolean isTopLevel(Element element) { |
| 340 return ElementKind.of(element.getEnclosingElement()).equals(ElementKind.LIBR
ARY); | 340 return ElementKind.of(element.getEnclosingElement()).equals(ElementKind.LIBR
ARY); |
| 341 } | 341 } |
| 342 | 342 |
| 343 static List<TypeVariable> makeTypeVariables(List<DartTypeParameter> parameterN
odes, | 343 static List<TypeVariable> makeTypeVariables(List<DartTypeParameter> parameterN
odes, |
| 344 EnclosingElement element) { | 344 EnclosingElement enclosingElement)
{ |
| 345 if (parameterNodes == null) { | 345 if (parameterNodes == null) { |
| 346 return Arrays.<TypeVariable>asList(); | 346 return Arrays.<TypeVariable>asList(); |
| 347 } | 347 } |
| 348 TypeVariable[] typeVariables = new TypeVariable[parameterNodes.size()]; | 348 TypeVariable[] typeVariables = new TypeVariable[parameterNodes.size()]; |
| 349 int i = 0; | 349 int i = 0; |
| 350 for (DartTypeParameter parameterNode : parameterNodes) { | 350 for (DartTypeParameter parameterNode : parameterNodes) { |
| 351 TypeVariable typeVariable = | 351 TypeVariable typeVariable = |
| 352 Elements.typeVariableFromNode(parameterNode, element).getTypeVariable(
); | 352 Elements.typeVariableFromNode(parameterNode, enclosingElement).getType
Variable(); |
| 353 typeVariables[i++] = typeVariable; | 353 typeVariables[i++] = typeVariable; |
| 354 parameterNode.getName().setElement(typeVariable.getElement()); | 354 parameterNode.getName().setElement(typeVariable.getElement()); |
| 355 } | 355 } |
| 356 return Arrays.asList(typeVariables); | 356 return Arrays.asList(typeVariables); |
| 357 } | 357 } |
| 358 | 358 |
| 359 public static Element voidElement() { | 359 public static Element voidElement() { |
| 360 return VoidElement.getInstance(); | 360 return VoidElement.getInstance(); |
| 361 } | 361 } |
| 362 | 362 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 DartSource dartSource = (DartSource) source; | 572 DartSource dartSource = (DartSource) source; |
| 573 LibrarySource library = dartSource.getLibrary(); | 573 LibrarySource library = dartSource.getLibrary(); |
| 574 if (library != null) { | 574 if (library != null) { |
| 575 String libraryName = library.getName(); | 575 String libraryName = library.getName(); |
| 576 return libraryName.startsWith("dart://") && libraryName.endsWith("/" + n
ame); | 576 return libraryName.startsWith("dart://") && libraryName.endsWith("/" + n
ame); |
| 577 } | 577 } |
| 578 } | 578 } |
| 579 return false; | 579 return false; |
| 580 } | 580 } |
| 581 } | 581 } |
| OLD | NEW |