Java Code Examples for com.google.javascript.rhino.jstype.FunctionType#defineDeclaredProperty()
The following examples show how to use
com.google.javascript.rhino.jstype.FunctionType#defineDeclaredProperty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClosureCodingConvention.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Closure's goog.inherits adds a {@code superClass_} property to the * subclass, and a {@code constructor} property. */ @Override public void applySubclassRelationship(FunctionType parentCtor, FunctionType childCtor, SubclassType type) { super.applySubclassRelationship(parentCtor, childCtor, type); if (type == SubclassType.INHERITS) { childCtor.defineDeclaredProperty("superClass_", parentCtor.getPrototype(), childCtor.getSource()); childCtor.getPrototype().defineDeclaredProperty("constructor", // Notice that constructor functions do not need to be covariant // on the superclass. // So if G extends F, new G() and new F() can accept completely // different argument types, but G.prototype.constructor needs // to be covariant on F.prototype.constructor. // To get around this, we just turn off type-checking on arguments // and return types of G.prototype.constructor. childCtor.cloneWithoutArrowType(), childCtor.getSource()); } }
Example 2
Source File: 1_ClosureCodingConvention.java From SimFix with GNU General Public License v2.0 | 5 votes |
/** * Closure's goog.inherits adds a {@code superClass_} property to the * subclass, and a {@code constructor} property. */ @Override public void applySubclassRelationship(FunctionType parentCtor, FunctionType childCtor, SubclassType type) { if (type == SubclassType.INHERITS) { childCtor.defineDeclaredProperty("superClass_", parentCtor.getPrototype(), parentCtor.getSource()); childCtor.getPrototype().defineDeclaredProperty("constructor", childCtor, parentCtor.getSource()); } }
Example 3
Source File: 1_ClosureCodingConvention.java From SimFix with GNU General Public License v2.0 | 5 votes |
@Override public void applySingletonGetter(FunctionType functionType, FunctionType getterType, ObjectType objectType) { functionType.defineDeclaredProperty("getInstance", getterType, functionType.getSource()); functionType.defineDeclaredProperty("instance_", objectType, functionType.getSource()); }
Example 4
Source File: 1_ClosureCodingConvention.java From SimFix with GNU General Public License v2.0 | 5 votes |
/** * Closure's goog.inherits adds a {@code superClass_} property to the * subclass, and a {@code constructor} property. */ @Override public void applySubclassRelationship(FunctionType parentCtor, FunctionType childCtor, SubclassType type) { if (type == SubclassType.INHERITS) { childCtor.defineDeclaredProperty("superClass_", parentCtor.getPrototype(), parentCtor.getSource()); childCtor.getPrototype().defineDeclaredProperty("constructor", childCtor, parentCtor.getSource()); } }
Example 5
Source File: 1_ClosureCodingConvention.java From SimFix with GNU General Public License v2.0 | 5 votes |
@Override public void applySingletonGetter(FunctionType functionType, FunctionType getterType, ObjectType objectType) { functionType.defineDeclaredProperty("getInstance", getterType, functionType.getSource()); functionType.defineDeclaredProperty("instance_", objectType, functionType.getSource()); }
Example 6
Source File: 1_ClosureCodingConvention.java From SimFix with GNU General Public License v2.0 | 5 votes |
/** * Closure's goog.inherits adds a {@code superClass_} property to the * subclass, and a {@code constructor} property. */ @Override public void applySubclassRelationship(FunctionType parentCtor, FunctionType childCtor, SubclassType type) { if (type == SubclassType.INHERITS) { childCtor.defineDeclaredProperty("superClass_", parentCtor.getPrototype(), parentCtor.getSource()); childCtor.getPrototype().defineDeclaredProperty("constructor", childCtor, parentCtor.getSource()); } }
Example 7
Source File: 1_ClosureCodingConvention.java From SimFix with GNU General Public License v2.0 | 5 votes |
@Override public void applySingletonGetter(FunctionType functionType, FunctionType getterType, ObjectType objectType) { functionType.defineDeclaredProperty("getInstance", getterType, functionType.getSource()); functionType.defineDeclaredProperty("instance_", objectType, functionType.getSource()); }
Example 8
Source File: Closure_57_ClosureCodingConvention_t.java From coming with MIT License | 5 votes |
/** * Closure's goog.inherits adds a {@code superClass_} property to the * subclass, and a {@code constructor} property. */ @Override public void applySubclassRelationship(FunctionType parentCtor, FunctionType childCtor, SubclassType type) { if (type == SubclassType.INHERITS) { childCtor.defineDeclaredProperty("superClass_", parentCtor.getPrototype(), parentCtor.getSource()); childCtor.getPrototype().defineDeclaredProperty("constructor", childCtor, parentCtor.getSource()); } }
Example 9
Source File: Closure_57_ClosureCodingConvention_t.java From coming with MIT License | 5 votes |
@Override public void applySingletonGetter(FunctionType functionType, FunctionType getterType, ObjectType objectType) { functionType.defineDeclaredProperty("getInstance", getterType, functionType.getSource()); functionType.defineDeclaredProperty("instance_", objectType, functionType.getSource()); }
Example 10
Source File: Closure_57_ClosureCodingConvention_s.java From coming with MIT License | 5 votes |
/** * Closure's goog.inherits adds a {@code superClass_} property to the * subclass, and a {@code constructor} property. */ @Override public void applySubclassRelationship(FunctionType parentCtor, FunctionType childCtor, SubclassType type) { if (type == SubclassType.INHERITS) { childCtor.defineDeclaredProperty("superClass_", parentCtor.getPrototype(), parentCtor.getSource()); childCtor.getPrototype().defineDeclaredProperty("constructor", childCtor, parentCtor.getSource()); } }
Example 11
Source File: Closure_57_ClosureCodingConvention_s.java From coming with MIT License | 5 votes |
@Override public void applySingletonGetter(FunctionType functionType, FunctionType getterType, ObjectType objectType) { functionType.defineDeclaredProperty("getInstance", getterType, functionType.getSource()); functionType.defineDeclaredProperty("instance_", objectType, functionType.getSource()); }
Example 12
Source File: ClosureCodingConvention.java From astor with GNU General Public License v2.0 | 5 votes |
@Override public void applySingletonGetter(FunctionType functionType, FunctionType getterType, ObjectType objectType) { super.applySingletonGetter(functionType, getterType, objectType); functionType.defineDeclaredProperty("getInstance", getterType, functionType.getSource()); functionType.defineDeclaredProperty("instance_", objectType, functionType.getSource()); }