• Daniel Clifford's avatar
    [torque]: Implement Generics for Builtins and Macros · 3d2cb0b4
    Daniel Clifford authored
    Including specialization, e.g.:
    
      // Declare parameterized generic
      macro GenericMacroTest<T: type>(param: T): Object {
        return Undefined;
      }
    
      // Declare specialization of generic
      GenericMacroTest<Object>(param: Object): Object {
        return param;
      }
    
      ...
      assert(GenericMacroTest<Smi>(0) == Undefined);
      assert(GenericMacroTest<Smi>(1) == Undefined);
      assert(GenericMacroTest<Object>(Null) == Null);
      assert(GenericMacroTest<Object>(False) == False);
      ...
    
    Known issue: specialization doesn't rigorously checked to verify
    that specialization signature precisely matches generic declaration.
    
    Change-Id: I9d9d96da4c5c8c9a76550844680e9e133a5edaed
    Reviewed-on: https://chromium-review.googlesource.com/1043986
    Commit-Queue: Daniel Clifford <danno@chromium.org>
    Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#53203}
    3d2cb0b4
Name
Last commit
Last update
..
Torque.g4 Loading commit data...
TorqueBaseListener.cpp Loading commit data...
TorqueBaseListener.h Loading commit data...
TorqueBaseVisitor.cpp Loading commit data...
TorqueBaseVisitor.h Loading commit data...
TorqueLexer.cpp Loading commit data...
TorqueLexer.h Loading commit data...
TorqueListener.cpp Loading commit data...
TorqueListener.h Loading commit data...
TorqueParser.cpp Loading commit data...
TorqueParser.h Loading commit data...
TorqueVisitor.cpp Loading commit data...
TorqueVisitor.h Loading commit data...
ast-generator.cc Loading commit data...
ast-generator.h Loading commit data...
ast.h Loading commit data...
declarable.cc Loading commit data...
declarable.h Loading commit data...
declaration-visitor.cc Loading commit data...
declaration-visitor.h Loading commit data...
declarations.cc Loading commit data...
declarations.h Loading commit data...
file-visitor.cc Loading commit data...
file-visitor.h Loading commit data...
global-context.h Loading commit data...
implementation-visitor.cc Loading commit data...
implementation-visitor.h Loading commit data...
scope.cc Loading commit data...
scope.h Loading commit data...
torque.cc Loading commit data...
type-oracle.h Loading commit data...
types.cc Loading commit data...
types.h Loading commit data...
utils.cc Loading commit data...
utils.h Loading commit data...