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

Unified Diff: compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java

Issue 9225024: Issue 962. Fix for crash in nested function parameters list code generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/backend/js/RttTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java
diff --git a/compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java b/compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java
index 179767e1308e806d71e0e56676d380fea26091c4..3f3cafb7207353e386f2956ccd03355475744efa 100644
--- a/compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java
+++ b/compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java
@@ -500,9 +500,10 @@ public class RuntimeTypeInjector {
* No lookup method exists for the type "int bar(double x)", hence the in-line creation of:
* RTT.createFunction([RTT Parameter Types],RTT ReturnType))
*/
- private JsInvocation generateRTTCreate(VariableElement element, ClassElement classElement) {
+ private JsInvocation generateRTTCreate(Element element,
+ FunctionType elementType,
+ ClassElement classElement) {
boolean hasTypes = false;
- FunctionType type = (FunctionType) element.getType();
if (ElementKind.of(element).equals(ElementKind.CONSTRUCTOR)
|| element.getModifiers().isNative()) {
@@ -516,14 +517,14 @@ public class RuntimeTypeInjector {
JsInvocation callLookup;
callLookup = newInvocation(newQualifiedNameRef("RTT.createFunction"));
- JsArrayLiteral arr = generateTypeArrayFromTypes(type.getParameterTypes(), classElement,
+ JsArrayLiteral arr = generateTypeArrayFromTypes(elementType.getParameterTypes(), classElement,
typeArgContextExpr);
if (arr == null) {
return newInvocation(newQualifiedNameRef(RTT_DYNAMIC_LOOKUP));
}
- JsExpression returnExpr = generateRTTLookupForType(element, type.getReturnType(), classElement,
- typeArgContextExpr);
+ JsExpression returnExpr = generateRTTLookupForType(element, elementType.getReturnType(),
+ classElement, typeArgContextExpr);
callLookup.getArguments().add(arr.getExpressions().isEmpty() ? program.getNullLiteral() : arr);
callLookup.getArguments().add(returnExpr);
@@ -584,7 +585,7 @@ public class RuntimeTypeInjector {
(InterfaceType) elementType, classElement);
break;
case FUNCTION:
- elementInvoke = generateRTTCreate((VariableElement) element, classElement);
+ elementInvoke = generateRTTCreate(element, (FunctionType) elementType, classElement);
break;
case FUNCTION_ALIAS:
elementInvoke = buildTypeLookupExpression(elementType,
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/backend/js/RttTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698